refs #2954 Support sound file as media attachment

This commit is contained in:
AkiraFukushima 2022-02-12 16:04:30 +09:00
parent dcb70bd8b9
commit 8a1980a088
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
<div id="current-media" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.8)">
<video :src="src" v-if="isMovieFile()" autoplay loop 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="isAudio()" autoplay loop controls v-on:loadstart="loaded()"></video>
<img :src="imageSrc" v-else v-on:load="loaded()" />
</div>
</template>
@ -27,7 +28,7 @@ export default {
}
},
watch: {
src: async function(newSrc, _oldSrc) {
src: async function (newSrc, _oldSrc) {
this.imageSrc = newSrc
if (newSrc && !this.isMovieFile() && !this.isGIF()) {
try {
@ -51,6 +52,9 @@ export default {
isGIF() {
return ['gifv'].includes(this.type)
},
isAudio() {
return ['audio'].includes(this.type)
},
async loaded() {
this.$store.dispatch('TimelineSpace/Modals/ImageViewer/loaded')
}

View File

@ -95,13 +95,14 @@
</el-button>
<div class="media" v-bind:key="media.preview_url" v-for="media in mediaAttachments">
<FailoverImg
:src="media.preview_url"
:src="media.preview_url ? media.preview_url : originalMessage.account.avatar"
@click="openImage(media.url, mediaAttachments)"
:title="media.description"
:readExif="true"
/>
<el-tag class="media-label" size="mini" v-if="media.type == 'gifv'">GIF</el-tag>
<el-tag class="media-label" size="mini" v-else-if="media.type == 'video'">VIDEO</el-tag>
<el-tag class="media-label" size="mini" v-if="media.type === 'gifv'">GIF</el-tag>
<el-tag class="media-label" size="mini" v-else-if="media.type === 'video'">VIDEO</el-tag>
<el-tag class="media-label" size="mini" v-else-if="media.type === 'audio'">AUDIO</el-tag>
</div>
</div>
<div class="clearfix"></div>