bilibili / flv.js

HTML5 FLV Player
Apache License 2.0
22.94k stars 3.38k forks source link

Over time the live playout keeps getting more and more delayed #577

Open puscas opened 4 years ago

puscas commented 4 years ago

Hi,

First of all, thanks for this unique piece of software!

I'm doing some tests with flv.js and something I didn't understand well is why over time the playout keeps getting more and more delayed. For example, I start a live stream pointing to a clock. At the beginning, I've some a normal delay between the reality (what my eyes see on the clock) and what I see in the flv.js player, but after a few minutes is noticeable this delay is increasing during time.

I'm using a stream with H.264 1280x720 at fixed 30fps and 2 audio channels coded in AAC (128kbps). In the configuration I set the flag enableStashBuffer to false.

corsdeveloper commented 4 years ago

Same Issue. No matter what resolution, fps, settings we use, whenever video is stuck for a while it resums from same point which is not good live stream, delay keep increasing because of this. it should start from last received IDR, if not immediately this can be checked and resolved in some interval

Can anyone help on this please.

thegobot commented 4 years ago

Same Issue. You need to analyze yourself and adjust currentTime

video.addEventListener('progress', ()=>{
    var end = video.buffered.end(0);
    var delta = end - video.currentTime;
    if(delta > 1){
        video.currentTime = (end - 0.5) 
    }
});
jordancaudill commented 3 years ago

@thegobot 's solution worked for me to keep my livestream from pausing when the window loses focus.