feat: 更新视频播放器组件,添加章节视频功能并优化返回逻辑

This commit is contained in:
2026-04-09 16:48:57 +08:00
parent 943cc862fc
commit 17022d498a
19 changed files with 1192 additions and 1599 deletions

View File

@@ -105,6 +105,16 @@
type: Number,
default: 1
},
//倍速列表配置
playbackRates: {
type: Array,
default: () => []
},
//是否显示倍速提示
showRateTips: {
type: Boolean,
default: false
},
//循环播放
loop: {
type: Boolean,
@@ -219,8 +229,13 @@
return 'web'
}
}
}
},
// #endif
//是否一直显示控件
alwaysShowControls: {
type: Boolean,
default: false
}
},
computed: {
boxStyle () {
@@ -513,36 +528,38 @@
//重加载视频
async reloadVideo () {
const arg = {
src: this.parseSrc(this.src),
segments: this.parseSegments(this.segments),
title: this.title,
poster: this.poster,
type: this.type,
three: this.three,
initialTime: this.initialTime,
duration: this.duration,
autoplay: this.autoplay,
preload: this.preload,
muted: this.muted,
loop: this.loop,
playbackRate: this.playbackRate,
isLive: this.isLive,
header: this.header,
controls: this.controls,
objectFit: this.objectFit,
crossOrigin: this.crossOrigin,
openDirection: this.openDirection,
exitDirection: this.exitDirection,
quality: this.parseList(this.quality),
works: this.works,
workIndex: this.workIndex,
subtitles: this.parseList(this.subtitles),
subtitleIndex: this.subtitleIndex,
custom: await this.parseCustom(),
flvConfig: this.flvConfig,
hlsConfig: this.hlsConfig,
jsmpegConfig: this.jsmpegConfig
}
src: this.parseSrc(this.src),
segments: this.parseSegments(this.segments),
title: this.title,
poster: this.poster,
type: this.type,
three: this.three,
initialTime: this.initialTime,
duration: this.duration,
autoplay: this.autoplay,
preload: this.preload,
muted: this.muted,
loop: this.loop,
playbackRate: this.playbackRate,
playbackRates: this.playbackRates,
isLive: this.isLive,
header: this.header,
controls: this.controls,
alwaysShowControls: this.alwaysShowControls,
objectFit: this.objectFit,
crossOrigin: this.crossOrigin,
openDirection: this.openDirection,
exitDirection: this.exitDirection,
quality: this.parseList(this.quality),
works: this.works,
workIndex: this.workIndex,
subtitles: this.parseList(this.subtitles),
subtitleIndex: this.subtitleIndex,
custom: await this.parseCustom(),
flvConfig: this.flvConfig,
hlsConfig: this.hlsConfig,
jsmpegConfig: this.jsmpegConfig
}
this.evalJS('reloadVideo', arg)
},
//卸载视频
@@ -608,7 +625,8 @@
this.updateTimer = setTimeout(() => {
const arg = {
header: this.header,
controls: this.controls
controls: this.controls,
alwaysShowControls: this.alwaysShowControls
}
this.evalJS('updateConfig', arg)
}, 200)
@@ -778,6 +796,12 @@
playbackRate (newVal) {
this.setVideo('playbackRate', newVal)
},
//监听倍速列表
playbackRates (newVal) {
if (newVal && newVal.length > 0) {
this.reloadVideo()
}
},
//监听循环属性
loop (newVal) {
this.setVideo('loop', newVal)
@@ -791,9 +815,13 @@
this.updateConfig()
},
//监听controls
controls () {
this.updateConfig()
},
controls () {
this.updateConfig()
},
//监听alwaysShowControls
alwaysShowControls () {
this.updateConfig()
},
//深度监听custom
custom: {
handler(newVal, oldVal) {