Skip to content

Commit

Permalink
[optimize] switch logic on its Tencent video
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Dec 15, 2024
1 parent 0b3fdda commit cf7b2a4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/renderer/src/pages/play/componets/AsideFilm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const props = defineProps({
}
});
const emits = defineEmits(['update', 'play', 'barrage']);
const emits = defineEmits(['update', 'play', 'barrage', 'pause']);
const infoConf = ref(props.info);
const extConf = ref(props.ext);
const processConf = ref(props.process)
Expand Down Expand Up @@ -735,7 +735,23 @@ const timerUpdatePlayProcess = async(currentTime: number, duration: number) => {
if (watchTime >= duration) videoData.value.playEnd = true;
throttlePutHistory();
// 4.播放下集 不是最后一集 & 开启续集 & 观看时间+尾部跳过时间 >= 总时长
// 5.播放下集 观看时间+尾部跳过时间 >= 总时长
// 5.1 开启续集 & 不是最后一集 -> 播放下集
// 5.2 未触发下集 -> 暂停播放
if (watchTime >= duration && duration !== 0) {
if (!isLast() && playConf.playNextEnabled && !tmp.value.end) {
tmp.value.end = true; // 标识是否触发下集
const nextIndex = active.value.reverseOrder ? index + 1 : index - 1;
const nextInfo = seasonData.value[active.value.flimSource][nextIndex];
await switchSeasonEvent(nextInfo);
return;
} else {
emits('pause');
}
}
// 6.播放下集 不是最后一集 & 开启续集 & 观看时间+尾部跳过时间 >= 总时长
if (!isLast() && playConf.playNextEnabled && watchTime >= duration && duration !== 0 && !tmp.value.end) {
tmp.value.end = true; // 标识是否触发下集
Expand Down
11 changes: 9 additions & 2 deletions src/renderer/src/pages/play/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@update="updateConf"
@play="updatePlay"
@barrage="updateBarrage"
@pause="updatePause"
/>
<aside-iptv-view class="container-aside"
v-if="storeConf.type === 'iptv'"
Expand Down Expand Up @@ -132,12 +133,18 @@ const updatePlay = async (item) => {
const updateBarrage = async (item) => {
if (playerRef.value) {
setTimeout(() => {
playerRef.value?.barrage(item.comments, item.url, item.id);
setTimeout(async () => {
await playerRef.value?.barrage(item.comments, item.url, item.id);
}, 0);
}
};
const updatePause = async () => {
if (playerRef.value) {
playerRef.value?.pause();
}
};
const handleTimeUpdate = (time) => {
processFormData.value = time;
};
Expand Down

0 comments on commit cf7b2a4

Please sign in to comment.