Hi,
I have successfully bridged hls.js with video.js, and I found an issue.
Video.js expects duration === Infinity in order to render the propper controls for live streams.
Is there some way to detect wether hls.js has identified a live stream?
you can see my code here: /aronallen/video.js
first, congrats for the videojs adaptation :+1:
please note that another port has been done , as a standard videojs plugin, see https://github.com/benjipott/videojs-hlsjs
you can detect whether streams are live or VoD thanks to the following event :
Hls.Events.LEVEL_LOADED , then data.details.live (true/false)
FYI, the videojs-hlsjs integration is somewhat lacking and I consider it mostly a proof of concept at this point.
Regarding live stream, you can detect it as @mangui points out, and forward it to video.js by overriding the duration method. Eg. something like:
duration() {
if (this.isLive) {
return Infinity;
}
return super();
}
Was just noticing this myself in playing around with my own integration using a live stream. Is this a technical limitation with MSE which prevents you from reporting the duration as Infinity? Appears to be the same situation with dash.js.
yes, this is a MSE limitation
+1
@yonimor The level object emitted from LEVEL_LOADED has a property called live, which tells you whether the stream is live or not.
Ran into this and noticed that dash.js uses duration: Number.MAX_SAFE_INTEGER for a live stream. Perhaps it would be nice to also implement that in hls.js? It's not Infinity, but close to it.