Merge pull request #1008 from h3poteto/iss-800

closes #800 Set autoplay for movie attachments
This commit is contained in:
AkiraFukushima 2019-08-18 16:35:09 +09:00 committed by GitHub
commit 7ecfcd479a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -1,12 +1,8 @@
<template> <template>
<div <div id="current-media" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.8)">
id="current-media" <video :src="src" v-if="isMovieFile()" autoplay loop controls v-on:loadstart="loaded()"></video>
v-loading="loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<video :src="src" v-if="isMovieFile()" controls v-on:loadstart="loaded()"></video>
<video :src="src" v-else-if="isGIF()" autoplay loop v-on:loadstart="loaded()"></video> <video :src="src" v-else-if="isGIF()" autoplay loop v-on:loadstart="loaded()"></video>
<img :src="src" v-else v-on:load="loaded()"> <img :src="src" v-else v-on:load="loaded()" />
</div> </div>
</template> </template>
@ -30,13 +26,13 @@ export default {
}) })
}, },
methods: { methods: {
isMovieFile () { isMovieFile() {
return ['video'].includes(this.type) return ['video'].includes(this.type)
}, },
isGIF () { isGIF() {
return ['gifv'].includes(this.type) return ['gifv'].includes(this.type)
}, },
async loaded () { async loaded() {
this.$store.dispatch('TimelineSpace/Modals/ImageViewer/loaded') this.$store.dispatch('TimelineSpace/Modals/ImageViewer/loaded')
} }
} }