unify usage of autoplaying video
This commit is contained in:
parent
e467f74631
commit
7342ff1bf2
|
@ -0,0 +1,14 @@
|
||||||
|
<video
|
||||||
|
class="{{className || ''}}"
|
||||||
|
aria-label="{{ariaLabel || ''}}"
|
||||||
|
style="background: url({{poster}});"
|
||||||
|
:poster
|
||||||
|
:width
|
||||||
|
:height
|
||||||
|
:src
|
||||||
|
autoplay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
webkit-playsinline
|
||||||
|
playsinline
|
||||||
|
/>
|
|
@ -3,18 +3,13 @@
|
||||||
ref:node
|
ref:node
|
||||||
>
|
>
|
||||||
{{#if playing}}
|
{{#if playing}}
|
||||||
<video
|
<AutoplayVideo
|
||||||
style="background: url({{staticSrc}});"
|
className="{{class}}"
|
||||||
class="{{class}}"
|
ariaLabel="{{label}}"
|
||||||
aria-label="{{label}}"
|
:poster
|
||||||
poster="{{poster}}"
|
:src
|
||||||
src="{{src}}"
|
:width
|
||||||
width="{{width}}"
|
:height
|
||||||
height="{{height}}"
|
|
||||||
autoplay
|
|
||||||
muted
|
|
||||||
loop
|
|
||||||
playsinline
|
|
||||||
/>
|
/>
|
||||||
{{else}}
|
{{else}}
|
||||||
<LazyImage
|
<LazyImage
|
||||||
|
@ -43,6 +38,7 @@
|
||||||
import PlayVideoIcon from './PlayVideoIcon.html'
|
import PlayVideoIcon from './PlayVideoIcon.html'
|
||||||
import { ONE_TRANSPARENT_PIXEL } from '../_static/media'
|
import { ONE_TRANSPARENT_PIXEL } from '../_static/media'
|
||||||
import LazyImage from './LazyImage.html'
|
import LazyImage from './LazyImage.html'
|
||||||
|
import AutoplayVideo from './AutoplayVideo.html'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -58,7 +54,8 @@
|
||||||
}),
|
}),
|
||||||
components: {
|
components: {
|
||||||
PlayVideoIcon,
|
PlayVideoIcon,
|
||||||
LazyImage
|
LazyImage,
|
||||||
|
AutoplayVideo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -1,15 +1,11 @@
|
||||||
<ModalDialog :label :shown background="var(--muted-modal-bg)" muted="true">
|
<ModalDialog :label :shown background="var(--muted-modal-bg)" muted="true">
|
||||||
{{#if type === 'gifv'}}
|
{{#if type === 'gifv'}}
|
||||||
<video
|
<AutoplayVideo
|
||||||
aria-label="Animated GIF: {{description || ''}}"
|
ariaLabel="Animated GIF: {{description || ''}}"
|
||||||
poster="{{poster}}"
|
:poster
|
||||||
src="{{src}}"
|
:src
|
||||||
width="{{width}}"
|
:width
|
||||||
height="{{height}}"
|
:height
|
||||||
autoplay
|
|
||||||
muted
|
|
||||||
loop
|
|
||||||
playsinline
|
|
||||||
/>
|
/>
|
||||||
{{else}}
|
{{else}}
|
||||||
<img
|
<img
|
||||||
|
@ -30,10 +26,12 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import ModalDialog from './ModalDialog.html'
|
import ModalDialog from './ModalDialog.html'
|
||||||
|
import AutoplayVideo from '../AutoplayVideo.html'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ModalDialog
|
ModalDialog,
|
||||||
|
AutoplayVideo
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async show() {
|
async show() {
|
||||||
|
|
|
@ -25,17 +25,13 @@
|
||||||
style="width: {{inlineWidth}}px; height: {{inlineHeight}}px;"
|
style="width: {{inlineWidth}}px; height: {{inlineHeight}}px;"
|
||||||
>
|
>
|
||||||
{{#if media.type === 'gifv' && $autoplayGifs}}
|
{{#if media.type === 'gifv' && $autoplayGifs}}
|
||||||
<video
|
<AutoplayVideo
|
||||||
class="{{noNativeWidthHeight ? 'no-native-width-height' : ''}}"
|
className="{{noNativeWidthHeight ? 'no-native-width-height' : ''}}"
|
||||||
aria-label="Animated GIF: {{media.description || ''}}"
|
ariaLabel="Animated GIF: {{media.description || ''}}"
|
||||||
poster="{{media.preview_url}}"
|
poster="{{media.preview_url}}"
|
||||||
src="{{media.url}}"
|
src="{{media.url}}"
|
||||||
width="{{inlineWidth}}"
|
width="{{inlineWidth}}"
|
||||||
height="{{inlineHeight}}"
|
height="{{inlineHeight}}"
|
||||||
autoplay
|
|
||||||
muted
|
|
||||||
loop
|
|
||||||
playsinline
|
|
||||||
/>
|
/>
|
||||||
{{elseif media.type === 'gifv' && !$autoplayGifs}}
|
{{elseif media.type === 'gifv' && !$autoplayGifs}}
|
||||||
<NonAutoplayGifv
|
<NonAutoplayGifv
|
||||||
|
@ -107,6 +103,7 @@
|
||||||
import { ONE_TRANSPARENT_PIXEL } from '../../_static/media'
|
import { ONE_TRANSPARENT_PIXEL } from '../../_static/media'
|
||||||
import { store } from '../../_store/store'
|
import { store } from '../../_store/store'
|
||||||
import LazyImage from '../LazyImage.html'
|
import LazyImage from '../LazyImage.html'
|
||||||
|
import AutoplayVideo from '../AutoplayVideo.html'
|
||||||
import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate'
|
import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -165,7 +162,8 @@
|
||||||
components: {
|
components: {
|
||||||
NonAutoplayGifv,
|
NonAutoplayGifv,
|
||||||
PlayVideoIcon,
|
PlayVideoIcon,
|
||||||
LazyImage
|
LazyImage,
|
||||||
|
AutoplayVideo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue