Commit 33882f8f authored by spc's avatar spc

video fixed

parent 79902e53
......@@ -409,6 +409,9 @@ export default {
this.initBrandInfo();
// 初始化视频上下文
this.initVideoContexts();
// 初始化曝光检测工具
this.exposureTracker = new ExposureTracker(this);
this.exposureTracker.addExposureElements(EXPOSURE_CONFIGS);
......@@ -815,6 +818,25 @@ export default {
if (this.currentPlayingVideo === 'brandVideo1') {
this.currentPlayingVideo = null;
}
// 重置视频src来进行初始化
const videoId = 'brandVideo1';
if (this.videoContexts[videoId]) {
try {
// 保存原始URL
const originalUrl = this.video1Channel.videoUrl;
// 先设置为空字符串来重置
this.videoContexts[videoId].src = '';
// 延迟一小段时间后恢复原始URL,以确保重置生效
setTimeout(() => {
if (this.videoContexts[videoId]) {
this.videoContexts[videoId].src = originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl;
}
}, 100);
console.log('视频1已重置初始化');
} catch (error) {
console.error('重置视频1失败:', error);
}
}
},
// 视频2播放结束事件
......@@ -825,6 +847,26 @@ export default {
if (this.currentPlayingVideo === 'brandVideo2') {
this.currentPlayingVideo = null;
}
// 重置视频src来进行初始化
const videoId = 'brandVideo2';
if (this.videoContexts[videoId]) {
console.warn('视频上下文已存在:', videoId);
try {
// 保存原始URL
const originalUrl = this.video2Channel.videoUrl;
// 先设置为空字符串来重置
this.videoContexts[videoId].src = '';
// 延迟一小段时间后恢复原始URL,以确保重置生效
// setTimeout(() => {
// if (this.videoContexts[videoId]) {
// this.videoContexts[videoId].src = originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl;
// }
// }, 100);
console.log('视频2已重置初始化');
} catch (error) {
console.error('重置视频2失败:', error);
}
}
},
// 处理视频播放(互斥逻辑)
......
......@@ -1749,7 +1749,7 @@ onMounted(async () => {
});
});
goodsDataArr.value = integralData?.value?.goodsListData;
goodsDataArr.value = integralData?.value?.goodsList;
swiperData.value = integralData.value?.swiper;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment