视频添加poster

This commit is contained in:
zyronon 2024-04-03 01:22:37 +08:00
parent 1fdb683fc7
commit 8c2bb79da2
7 changed files with 10 additions and 2 deletions

BIN
public/images/a1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
public/images/a2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
public/images/a3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
public/images/a4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/a5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -58,6 +58,7 @@
"width": 720, "width": 720,
"height": 720 "height": 720
}, },
"poster":"a1.jpg",
"height": 3840, "height": 3840,
"width": 2160, "width": 2160,
"ratio": "1080p", "ratio": "1080p",
@ -342,6 +343,7 @@
"width": 720, "width": 720,
"height": 720 "height": 720
}, },
"poster":"a2.jpg",
"height": 1920, "height": 1920,
"width": 1080, "width": 1080,
"ratio": "1080p", "ratio": "1080p",
@ -914,6 +916,7 @@
"width": 720, "width": 720,
"height": 720 "height": 720
}, },
"poster":"a3.jpg",
"height": 1920, "height": 1920,
"width": 1080, "width": 1080,
"ratio": "720p", "ratio": "720p",
@ -1163,6 +1166,7 @@
"width": 720, "width": 720,
"height": 720 "height": 720
}, },
"poster":"a4.jpg",
"height": 1080, "height": 1080,
"width": 1920, "width": 1920,
"ratio": "1080p", "ratio": "1080p",
@ -1424,6 +1428,7 @@
"width": 720, "width": 720,
"height": 720 "height": 720
}, },
"poster":"a5.jpg",
"height": 1920, "height": 1920,
"width": 1080, "width": 1080,
"ratio": "1080p", "ratio": "1080p",

View File

@ -4,7 +4,7 @@
<!-- <video :src="item.video + '?v=123'"--> <!-- <video :src="item.video + '?v=123'"-->
<video <video
:src="item.video.play_addr.url_list[0]" :src="item.video.play_addr.url_list[0]"
:poster="_checkImgUrl(item.video.cover.url_list[0])" :poster="poster"
ref="video" ref="video"
muted muted
preload preload
@ -82,7 +82,7 @@ import Loading from '../Loading'
import ItemToolbar from './ItemToolbar' import ItemToolbar from './ItemToolbar'
import ItemDesc from './ItemDesc' import ItemDesc from './ItemDesc'
import bus, { EVENT_KEY } from '../../utils/bus' import bus, { EVENT_KEY } from '../../utils/bus'
import { SlideItemPlayStatus } from '../../utils/const_var' import { SlideItemPlayStatus } from '@/utils/const_var'
import { computed } from 'vue' import { computed } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
@ -134,6 +134,9 @@ export default {
} }
}, },
computed: { computed: {
poster() {
return _checkImgUrl(this.item.video.poster ?? this.item.video.cover.url_list[0])
},
durationStyle() { durationStyle() {
return { width: this.playX + 'px' } return { width: this.playX + 'px' }
}, },