视频流适配内外网

This commit is contained in:
lxj
2025-08-29 11:34:13 +08:00
parent b309eba099
commit d6c3048a9f
3 changed files with 12 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
<template>
<Page :auto-content-height="true">
<div class="flex h-full gap-[8px]">
<div class="h-full tree-box">
<div class="tree-box h-full">
<DpTree class="h-full w-[300px]" @checked="onNodeChecked" />
</div>
<div class="bg-background flex-1">
@@ -254,7 +254,7 @@ let isSupportH265 = false;
onMounted(() => {
// 检测浏览器是否支持h265
isSupportH265 = checkHEVCSupport();
setInterval(catchUp, 10000);
setInterval(catchUp, 120000);
});
onUnmounted(() => {

View File

@@ -337,7 +337,6 @@ function doPlayer(nodeData: any, index: number = 0) {
player,
key: nodeData.id,
data: nodeData,
el: videoElement,
};
} else {
console.log('视频播放元素获取异常');
@@ -381,13 +380,10 @@ function catchUp() {
if (playerData) {
const { player, el } = playerData;
const end = player.buffered.end(player.buffered.length - 1);
const { currentTime } = el;
if (end && currentTime) {
const diff = end - el.currentTime;
if (diff > 2) {
// 如果延迟超过2秒
el.currentTime = end - 0.5; // 跳转到接近直播点
}
const diff = end - el.currentTime;
if (diff > 2) {
// 如果延迟超过2秒
el.currentTime = end - 0.5; // 跳转到接近直播点
}
}
});
@@ -397,7 +393,7 @@ let isSupportH265 = false;
onMounted(() => {
// 检测浏览器是否支持h265
isSupportH265 = checkHEVCSupport();
setInterval(catchUp, 10000);
setInterval(catchUp, 120000);
});
onUnmounted(() => {