refs #2954 Support sound file as media attachment
This commit is contained in:
parent
dcb70bd8b9
commit
8a1980a088
|
@ -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')
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue