You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After talking with @lucasrodcosta he asked me to post a PR here.
I worked a bit to ouput "latency" and "current buffer"
I'm not a dev so I do my best but I'm sure there are better ways to do it
current buffer
hls.on(Hls.Events.LEVEL_LOADED,function(event,data) {
var pos = video.currentTime;
var bufferLen = video.buffered.end(0) - pos;
console.log('CURRENT BUFFER : ' + bufferLen.toFixed(2) + ' seconds');
});
=> I detected an issue about current buffer in my code but I don't know yet how to fix it : when encoder is started if I stop it then restart it, value begins to be negative because of video.buffered.end(0) which is frozen to a very small value (0.0x)
latency (it needs EXT-X-PROGRAM-DATE-TIME header)
hls.on(Hls.Events.LEVEL_LOADED,function(event,data) {
var current = video.currentTime;
var frag = data.details.fragments[0].start;
var tps = current - frag;
var now = new Date();
var unixnow = Date.parse(now)/1000;
var tunix = Date.parse(data.details.fragments[0].rawProgramDateTime)/1000;
var latence = unixnow - tunix - tps;
console.log('LATENCY : ' + latence.toFixed(2) + ' seconds');
});
I made some tests and It works rather well.
Nico
The text was updated successfully, but these errors were encountered:
After talking with @lucasrodcosta he asked me to post a PR here.
I worked a bit to ouput "latency" and "current buffer"
I'm not a dev so I do my best but I'm sure there are better ways to do it
current buffer
hls.on(Hls.Events.LEVEL_LOADED,function(event,data) {
var pos = video.currentTime;
var bufferLen = video.buffered.end(0) - pos;
console.log('CURRENT BUFFER : ' + bufferLen.toFixed(2) + ' seconds');
});
=> I detected an issue about current buffer in my code but I don't know yet how to fix it : when encoder is started if I stop it then restart it, value begins to be negative because of video.buffered.end(0) which is frozen to a very small value (0.0x)
latency (it needs EXT-X-PROGRAM-DATE-TIME header)
hls.on(Hls.Events.LEVEL_LOADED,function(event,data) {
var current = video.currentTime;
var frag = data.details.fragments[0].start;
var tps = current - frag;
var now = new Date();
var unixnow = Date.parse(now)/1000;
var tunix = Date.parse(data.details.fragments[0].rawProgramDateTime)/1000;
var latence = unixnow - tunix - tps;
console.log('LATENCY : ' + latence.toFixed(2) + ' seconds');
});
I made some tests and It works rather well.
Nico
The text was updated successfully, but these errors were encountered: