视频流适配内外网
This commit is contained in:
@@ -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(() => {
|
||||
|
Reference in New Issue
Block a user