Commit 650d8ce0 by haojie

video偶尔会闪屏的问题

parent 28a22dd5
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
class="video-default" class="video-default"
:src="video2" :src="video2"
@ended="secondVideoEnded" @ended="secondVideoEnded"
@canplay="canplay2" @canplaythrough="canplay2"
></video> ></video>
<!-- 动作 --> <!-- 动作 -->
<video <video
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
class="video-default" class="video-default"
:src="actionVideo" :src="actionVideo"
@ended="actionVideoEnded" @ended="actionVideoEnded"
@canplay="actionCanplay" @canplaythrough="actionCanplay"
></video> ></video>
<!-- 结束动作 --> <!-- 结束动作 -->
<video <video
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
ref="videoEndAction" ref="videoEndAction"
class="video-default" class="video-default"
:src="actionEndVideo" :src="actionEndVideo"
@canplaythrough="actionEndCanplay"
@ended="actionEndVideoEnded" @ended="actionEndVideoEnded"
></video> ></video>
<ConfirmDialog <ConfirmDialog
...@@ -227,7 +228,7 @@ const confirm = () => { ...@@ -227,7 +228,7 @@ const confirm = () => {
findLastAction(); findLastAction();
if (isDev()) { if (isDev()) {
// 测试将视频进度改为160 // 测试将视频进度改为160
// videoFirst.value[currentPlayMainIndex.value].currentTime = 170; videoFirst.value[currentPlayMainIndex.value].currentTime = 170;
} }
}; };
...@@ -273,7 +274,6 @@ const findLastAction = () => { ...@@ -273,7 +274,6 @@ const findLastAction = () => {
if (!endVideoIsMain && typeof currentPlayMainIndex.value === 'number') { if (!endVideoIsMain && typeof currentPlayMainIndex.value === 'number') {
const actionUrl = realVideoList[mainVideoList[currentPlayMainIndex.value].videoIndex].actionUrl; const actionUrl = realVideoList[mainVideoList[currentPlayMainIndex.value].videoIndex].actionUrl;
actionEndVideo.value = actionUrl[actionUrl.length - 1].url; actionEndVideo.value = actionUrl[actionUrl.length - 1].url;
console.log(actionEndVideo.value, '找到结束动作视频了');
} }
}; };
...@@ -435,6 +435,10 @@ const actionCanplay = () => { ...@@ -435,6 +435,10 @@ const actionCanplay = () => {
} }
}; };
const actionEndCanplay = () => {
console.log('结束动作可以播放');
};
const secondPlay = () => { const secondPlay = () => {
mainVideoPlayChange(false); mainVideoPlayChange(false);
videoSecond.value?.play(); videoSecond.value?.play();
...@@ -534,15 +538,20 @@ watch( ...@@ -534,15 +538,20 @@ watch(
); );
const updateTime = () => { const updateTime = () => {
let row = videoFirst.value[currentPlayMainIndex.value]; try {
// 获取当前下标的total let row = videoFirst.value[currentPlayMainIndex.value];
const { mainVideoList } = props; // 获取当前下标的total
let total = mainVideoList[currentPlayMainIndex.value].total; const { mainVideoList } = props;
if (total) { let total = mainVideoList[currentPlayMainIndex.value].total;
// 计算百分比 if (total) {
emit('update:progress', Math.floor((row.currentTime / total) * 100)); // 计算百分比
// 提交当前进度 emit('update:progress', Math.floor((row.currentTime / total) * 100));
emit('currentTime', currentPlayMainIndex.value, row.currentTime); // 提交当前进度
emit('currentTime', currentPlayMainIndex.value, row.currentTime);
}
} catch (e) {
console.log('updateTime');
console.log(e);
} }
}; };
// 减小正在播放的视频音量 // 减小正在播放的视频音量
......
...@@ -278,34 +278,39 @@ export default function () { ...@@ -278,34 +278,39 @@ export default function () {
// 当前播放进度变化 // 当前播放进度变化
const currentTimeChange = (index: number, value: number) => { const currentTimeChange = (index: number, value: number) => {
// console.log(value, '当前主视频进度'); try {
let row = mainVideoList.value[index]; // console.log(value, '当前主视频进度');
// 剩余多少没有播放 let row = mainVideoList.value[index];
let currentEsidueTime = row.total - value; // 剩余多少没有播放
let currentVideoRow = realVideoList.value[row.videoIndex]; let currentEsidueTime = row.total - value;
// 更新当前进度 let currentVideoRow = realVideoList.value[row.videoIndex];
currentVideoRow.current = value; // 更新当前进度
// 低于设置的值、没有开始洗稿、有文本内容 、必须是文本脚本 currentVideoRow.current = value;
if ( // 低于设置的值、没有开始洗稿、有文本内容 、必须是文本脚本
currentEsidueTime < esidueTime && if (
currentVideoRow.confuse === CONFUSE_STATUS.CONFUSE_STATUS_WAIT && currentEsidueTime < esidueTime &&
liveDetail.value.type_content.length && currentVideoRow.confuse === CONFUSE_STATUS.CONFUSE_STATUS_WAIT &&
typeof liveDetail.value.phonetic_timbres_id === 'number' && liveDetail.value.type_content &&
typeof liveDetail.value.tone_id === 'number' && liveDetail.value.type_content.length &&
liveDetail.value.is_disorganize && typeof liveDetail.value.phonetic_timbres_id === 'number' &&
liveDetail.value.type == scriptTypeText && typeof liveDetail.value.tone_id === 'number' &&
!stopConfuse.value liveDetail.value.is_disorganize &&
) { liveDetail.value.type == scriptTypeText &&
console.log(row.videoIndex, '当前videoIndex'); !stopConfuse.value
currentVideoRow.confuse = CONFUSE_STATUS.CONFUSE_STATUS_PROGRESS; ) {
console.log('直播开始洗稿'); console.log(row.videoIndex, '当前videoIndex');
// 开始洗稿 currentVideoRow.confuse = CONFUSE_STATUS.CONFUSE_STATUS_PROGRESS;
submitConfuse(); console.log('直播开始洗稿');
} // 开始洗稿
submitConfuse();
}
// 判断是否需要取之前的主视频 // 判断是否需要取之前的主视频
if (currentEsidueTime < 20 && typeof currentPlayMainIndex.value === 'number') { if (currentEsidueTime < 20 && typeof currentPlayMainIndex.value === 'number') {
findOneVideoInit(); findOneVideoInit();
}
} catch (e) {
console.log(e);
} }
}; };
...@@ -580,13 +585,18 @@ export default function () { ...@@ -580,13 +585,18 @@ export default function () {
// { // {
// url: 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/2/2023-08-217a51d89c-1a9f-476b-950c-f81d0423b816.mp4', // url: 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/2/2023-08-217a51d89c-1a9f-476b-950c-f81d0423b816.mp4',
// type: 3, // type: 3,
// play_time: 15, // play_time: 10,
// }, // },
// 动作视频 // 动作视频
// {
// url: 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/2/2023-08-2192d4a904-c78a-4a87-9728-d93bb40cad77.mp4',
// type: 3,
// play_time: 172,
// },
{ {
url: 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/2/2023-08-2192d4a904-c78a-4a87-9728-d93bb40cad77.mp4', url: 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/2/2023-08-217a51d89c-1a9f-476b-950c-f81d0423b816.mp4',
type: 3, type: 3,
play_time: 30, play_time: 172,
}, },
{ {
url: url, url: url,
...@@ -803,6 +813,10 @@ export default function () { ...@@ -803,6 +813,10 @@ export default function () {
StartIntervalMainVideo(); StartIntervalMainVideo();
} }
} else { } else {
writeLog({
name: 'mergeCallback 回调格式错误',
value: params,
});
console.log('回调格式错误'); console.log('回调格式错误');
console.log(params); console.log(params);
} }
......
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