|
@ -46,6 +46,7 @@ let dataLiveWs; |
|
|
let lidarLiveWs; |
|
|
let lidarLiveWs; |
|
|
let dataLiveWsInterval; |
|
|
let dataLiveWsInterval; |
|
|
let lidarLiveWsInterval; |
|
|
let lidarLiveWsInterval; |
|
|
|
|
|
let flvPlayerInterval; |
|
|
function Index (props) { |
|
|
function Index (props) { |
|
|
const { dispatch, craneData } = props |
|
|
const { dispatch, craneData } = props |
|
|
const xyCvs = useRef() |
|
|
const xyCvs = useRef() |
|
@ -609,17 +610,22 @@ function Index (props) { |
|
|
hasAudio: false, |
|
|
hasAudio: false, |
|
|
hasVideo: true, |
|
|
hasVideo: true, |
|
|
}, { |
|
|
}, { |
|
|
enableWorker: false, |
|
|
enableWorker: false,//分离线程
|
|
|
enalleStashBuffer: true, |
|
|
enalleStashBuffer: false, //IO隐藏缓冲区
|
|
|
stashInitialSize: 128, |
|
|
stashInitialSize: 128, |
|
|
lazyLoadMaxDuration: 3 * 60, |
|
|
isLive: true, |
|
|
|
|
|
lazyLoad: false, |
|
|
|
|
|
// lazyLoadMaxDuration: 3 * 60,
|
|
|
|
|
|
lazyLoadMaxDuration: 1, |
|
|
seekType: 'range', |
|
|
seekType: 'range', |
|
|
autoCleanupSourceBuffer: true, |
|
|
autoCleanupSourceBuffer: true, |
|
|
cors: true, |
|
|
// cors: true,
|
|
|
|
|
|
// stashInitialSize: 1024
|
|
|
}); |
|
|
}); |
|
|
flv.attachMediaElement(container); |
|
|
flv.attachMediaElement(container); |
|
|
flv.load(); |
|
|
flv.load(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
// 初始化 _remuxer
|
|
|
// 初始化 _remuxer
|
|
|
let controller = flv?._transmuxer?._controller |
|
|
let controller = flv?._transmuxer?._controller |
|
|
controller._remuxer = { |
|
|
controller._remuxer = { |
|
@ -627,11 +633,29 @@ function Index (props) { |
|
|
console.log("flushStashedSamples") |
|
|
console.log("flushStashedSamples") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error(error); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
flv.play(); |
|
|
flv.play(); |
|
|
flvPlayer.current = flv |
|
|
flvPlayer.current = flv |
|
|
|
|
|
|
|
|
|
|
|
if (flvPlayerInterval) { |
|
|
|
|
|
clearInterval(flvPlayerInterval) |
|
|
|
|
|
} |
|
|
|
|
|
// flvPlayerInterval = setInterval(() => {
|
|
|
|
|
|
// console.log(flv.buffered);
|
|
|
|
|
|
// if (flv.buffered.length) {
|
|
|
|
|
|
// let end = flv.buffered.end(0);//获取当前buffered值
|
|
|
|
|
|
// let diff = end - flv.currentTime;//获取buffered与currentTime的差值
|
|
|
|
|
|
// if (diff >= 3) {//如果差值大于等于0.5 手动跳帧 这里可根据自身需求来定
|
|
|
|
|
|
// console.log(222222222);
|
|
|
|
|
|
// flv.currentTime = flv.buffered.end(0);//手动跳帧
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }, 1000 * 10);
|
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error(error); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|