mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
clean up
This commit is contained in:
parent
c4b548111f
commit
af4bc9b466
@ -308,26 +308,6 @@ function MSEPlayer({
|
|||||||
return video.buffered.end(video.buffered.length - 1) - video.currentTime;
|
return video.buffered.end(video.buffered.length - 1) - video.currentTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
const jumpToLive = () => {
|
|
||||||
if (!videoRef.current) return;
|
|
||||||
|
|
||||||
const now = Date.now();
|
|
||||||
|
|
||||||
// we either recently just started streaming or recently
|
|
||||||
// jumped to live, so don't jump to live again right away
|
|
||||||
if (now - lastJumpTimeRef.current < BUFFERING_COOLDOWN_TIMEOUT) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const buffered = videoRef.current.buffered;
|
|
||||||
if (buffered.length > 0) {
|
|
||||||
const liveEdge = buffered.end(buffered.length - 1);
|
|
||||||
// Jump to the live edge
|
|
||||||
videoRef.current.currentTime = liveEdge;
|
|
||||||
lastJumpTimeRef.current = now;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const calculateAdaptiveBufferThreshold = () => {
|
const calculateAdaptiveBufferThreshold = () => {
|
||||||
const filledEntries = bufferTimes.current.length;
|
const filledEntries = bufferTimes.current.length;
|
||||||
const sum = bufferTimes.current.reduce((a, b) => a + b, 0);
|
const sum = bufferTimes.current.reduce((a, b) => a + b, 0);
|
||||||
@ -457,7 +437,6 @@ function MSEPlayer({
|
|||||||
(bufferTime > bufferThreshold || bufferTime > 3) &&
|
(bufferTime > bufferThreshold || bufferTime > 3) &&
|
||||||
Date.now() - lastJumpTimeRef.current > BUFFERING_COOLDOWN_TIMEOUT
|
Date.now() - lastJumpTimeRef.current > BUFFERING_COOLDOWN_TIMEOUT
|
||||||
) {
|
) {
|
||||||
// jumpToLive();
|
|
||||||
videoRef.current.playbackRate = 1.1;
|
videoRef.current.playbackRate = 1.1;
|
||||||
console.log(
|
console.log(
|
||||||
camera,
|
camera,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user