perf: 视频文件封面显示

This commit is contained in:
jmal 2023-05-12 18:47:55 +08:00
parent 24ac3c1bfd
commit 6c8f53396b
3 changed files with 8 additions and 6 deletions

View File

@ -32,12 +32,15 @@
</div> </div>
<svg-icon v-if="item.isFolder" icon-class="folder"/> <svg-icon v-if="item.isFolder" icon-class="folder"/>
<div v-else-if="item.contentType.indexOf('video') > -1"> <div v-else-if="item.contentType.indexOf('video') > -1">
<div v-if="item.mediaCover !== undefined"> <div v-if="item.mediaCover === undefined || item.mediaCover === 'true'">
<div v-if="grid && pc" class="grid-play-icon"> <div v-if="grid && pc" class="grid-play-icon">
<svg-icon icon-class="play1"/> <svg-icon icon-class="play1"/>
</div> </div>
<el-image lazy v-if="grid" :style="{'height':details?'110px':(gridWidth-35) + 'px'}" fit="contain" <el-image lazy v-if="grid" :style="{'height':details?'110px':(gridWidth-35) + 'px'}" fit="contain"
:src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)"> :src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">
<div slot="error" class="image-slot">
<svg-icon icon-class="video"/>
</div>
</el-image> </el-image>
<el-avatar v-if="!grid" shape="square" fit="contain" <el-avatar v-if="!grid" shape="square" fit="contain"
:src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)"> :src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">

View File

@ -1007,6 +1007,9 @@ export default {
let index = this.fileList.findIndex(file => file.id === fileDoc.id) let index = this.fileList.findIndex(file => file.id === fileDoc.id)
if ('updateFile' === url) { if ('updateFile' === url) {
if (index > -1) { if (index > -1) {
if (fileDoc.m3u8) {
this.fileList[index].m3u8 = fileDoc.m3u8
}
this.fileList[index].size = fileDoc.size this.fileList[index].size = fileDoc.size
this.fileList[index].agoTime = 1 this.fileList[index].agoTime = 1
this.fileList[index].updateDate = fileDoc.updateDate this.fileList[index].updateDate = fileDoc.updateDate

View File

@ -136,7 +136,6 @@ export default {
} }
} }
this.option.url = videoUrl this.option.url = videoUrl
console.log('this.option.url', this.option.url)
if (this.file.m3u8) { if (this.file.m3u8) {
this.option.customType = { this.option.customType = {
m3u8: this.playM3u8 m3u8: this.playM3u8
@ -186,10 +185,9 @@ export default {
// iina // iina
const iina = doc.querySelector('[data-index="1"]').querySelector('a'); const iina = doc.querySelector('[data-index="1"]').querySelector('a');
iina.href = `iina://weblink?url=${this.videoLink}` iina.href = `iina://weblink?url=${this.videoLink}`
console.log('iina.href', iina.href)
// nplayer // nplayer
const nplayer = doc.querySelector('[data-index="2"]').querySelector('a'); const nplayer = doc.querySelector('[data-index="2"]').querySelector('a');
let link = `nplayer-${this.videoLink}` const link = `nplayer-${this.videoLink}`
nplayer.href = link nplayer.href = link
// infuse // infuse
const infuse = doc.querySelector('[data-index="3"]').querySelector('a'); const infuse = doc.querySelector('[data-index="3"]').querySelector('a');
@ -202,11 +200,9 @@ export default {
hls.loadSource(url); hls.loadSource(url);
hls.attachMedia(video); hls.attachMedia(video);
art.hls = hls; art.hls = hls;
console.log('Hls')
art.on('destroy', () => hls.destroy()); art.on('destroy', () => hls.destroy());
} else if (video.canPlayType('application/vnd.apple.mpegurl')) { } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url; video.src = url;
console.log('Hls1')
} else { } else {
art.notice.show = 'Unsupported playback format: m3u8'; art.notice.show = 'Unsupported playback format: m3u8';
} }