ai视频一期功能提交

This commit is contained in:
sunli_tydic
2025-12-09 11:21:27 +08:00
parent 3ee4afb229
commit fa1bcaf1c7
2 changed files with 32 additions and 2 deletions

View File

@@ -456,6 +456,7 @@ export default {
...mapMutations({ ...mapMutations({
SET_currentLang: 'video/SET_currentLang', SET_currentLang: 'video/SET_currentLang',
SET_currentTime: 'video/SET_currentTime', SET_currentTime: 'video/SET_currentTime',
SET_selectableLang: 'video/SET_selectableLang',
}), }),
//当视频由于需要缓冲下一帧而停止,解决一直计时的问题 //当视频由于需要缓冲下一帧而停止,解决一直计时的问题
onWaiting(){ onWaiting(){
@@ -784,9 +785,37 @@ export default {
// } // }
// }, // },
src: function () { src: function () {
// 当视频地址变更时,重载视频 // 当视频地址变更时,先重置字幕再重载视频
this.isPlaying = false;
// 重置字幕相关状态
this.SET_currentLang('');
this.currentLangLabel = '';
// 移除所有现有字幕轨道元素
Array.from(this.videoDom.querySelectorAll('track')).forEach(t => t.remove());
// 更彻底地清除字幕重置所有textTracks
Array.from(this.videoDom.textTracks).forEach(track => {
track.mode = 'hidden';
// 尝试移除所有cues浏览器支持的话
if (track.cues) {
while (track.cues.length > 0) {
track.cues.remove(0);
}
}
});
// 重载视频
this.videoDom.load(); this.videoDom.load();
this.isPlaying = false
// 如果有默认语言且支持AI翻译重新设置字幕
if (this.isAiTranslate && this.selectableLang && this.selectableLang.length > 0) {
// 找到默认语言或第一个可用语言
const defaultLang = this.selectableLang.find(lang => lang.srclang === 'zh-CN') || this.selectableLang[0];
if (defaultLang) {
this.changeLang(defaultLang);
}
}
}, },
}, },
}; };

View File

@@ -1388,6 +1388,7 @@ export default {
}, },
// ai播放器相关 - 视频处理 // ai播放器相关 - 视频处理
handleAIVideo(list = [], r) { handleAIVideo(list = [], r) {
console.log('触发了-----------list', list);
this.SET_selectableLang(list); this.SET_selectableLang(list);
this.SET_courseInfo(this.courseInfo); this.SET_courseInfo(this.courseInfo);
if (this.courseInfo.aiSet && this.courseInfo.aiAbstract == 1 && this.courseInfo.summaryContent) { if (this.courseInfo.aiSet && this.courseInfo.aiAbstract == 1 && this.courseInfo.summaryContent) {