fix Firefox autoplay gifv
This commit is contained in:
		
							parent
							
								
									6978d27a8c
								
							
						
					
					
						commit
						b10ecff3c0
					
				
					 3 changed files with 8 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -54,10 +54,6 @@
 | 
			
		|||
 | 
			
		||||
  export default {
 | 
			
		||||
    oncreate() {
 | 
			
		||||
      // TODO: this hack is for Edge 16, which makes the modal too wide
 | 
			
		||||
      if (typeof setImmediate === 'function' && navigator.userAgent.match(/Edge/)) {
 | 
			
		||||
        this.getDialogElement().style.width = `${this.get('width')}px`
 | 
			
		||||
      }
 | 
			
		||||
      this.getDialogElement().style.background = this.get('background') || '#000'
 | 
			
		||||
      this.observe('shown', shown => {
 | 
			
		||||
        if (shown) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
>
 | 
			
		||||
  {{#if playing}}
 | 
			
		||||
    <video
 | 
			
		||||
      style="background: url({{staticSrc}});"
 | 
			
		||||
      class="{{class}}"
 | 
			
		||||
      aria-label="{{label}}"
 | 
			
		||||
      poster="{{poster}}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,9 @@
 | 
			
		|||
      <button type="button"
 | 
			
		||||
            class="show-image-button"
 | 
			
		||||
            aria-label="Show image: {{media.description || ''}}"
 | 
			
		||||
            on:click="onClickShowImageButton(media, getOriginalWidth(media), getOriginalHeight(media))">
 | 
			
		||||
            on:click="onClickShowImageButton(media, getOriginalWidth(media), getOriginalHeight(media))"
 | 
			
		||||
            on:mouseover="set({mouseover: event})"
 | 
			
		||||
      >
 | 
			
		||||
      {{#if media.type === 'gifv' && $autoplayGifs}}
 | 
			
		||||
        <video
 | 
			
		||||
          class="{{hasNoNativeWidthHeight(media) ? 'no-native-width-height' : ''}}"
 | 
			
		||||
| 
						 | 
				
			
			@ -45,6 +47,7 @@
 | 
			
		|||
          staticSrc="{{media.preview_url}}"
 | 
			
		||||
          width="{{getSmallWidth(media)}}"
 | 
			
		||||
          height="{{getSmallHeight(media)}}"
 | 
			
		||||
          playing="{{mouseover}}"
 | 
			
		||||
        />
 | 
			
		||||
      {{else}}
 | 
			
		||||
        <img class="{{!imageLoaded ? 'image-loading' : ''}} {{imageError ? 'image-error' : ''}} {{hasNoNativeWidthHeight(media) ? 'no-native-width-height' : ''}}"
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +139,7 @@
 | 
			
		|||
  import { imgLoad, imgLoadError } from '../../_utils/events'
 | 
			
		||||
  import { showVideoDialog } from '../../_utils/showVideoDialog'
 | 
			
		||||
  import { showImageDialog } from '../../_utils/showImageDialog'
 | 
			
		||||
  import { mouseover } from '../../_utils/events'
 | 
			
		||||
  import NonAutoplayGifv from '../NonAutoplayGifv.html'
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +163,8 @@
 | 
			
		|||
    },
 | 
			
		||||
    events: {
 | 
			
		||||
      imgLoad,
 | 
			
		||||
      imgLoadError
 | 
			
		||||
      imgLoadError,
 | 
			
		||||
      mouseover
 | 
			
		||||
    },
 | 
			
		||||
    components: {
 | 
			
		||||
      NonAutoplayGifv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue