Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duration Infinity on live streams #67

Closed
aronallen opened this issue Nov 16, 2015 · 8 comments
Closed

duration Infinity on live streams #67

aronallen opened this issue Nov 16, 2015 · 8 comments
Labels

Comments

@aronallen
Copy link

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?

@aronallen
Copy link
Author

you can see my code here: /aronallen/video.js

@mangui
Copy link
Member

mangui commented Nov 16, 2015

first, congrats for the videojs adaptation 👍
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)

@kanongil
Copy link
Contributor

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();
}

@kfeinUI
Copy link

kfeinUI commented Dec 3, 2015

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.

@mangui
Copy link
Member

mangui commented Jan 6, 2016

yes, this is a MSE limitation

@mangui mangui closed this as completed Jan 6, 2016
@yonimor
Copy link

yonimor commented Mar 19, 2017

+1

@johnBartos
Copy link
Collaborator

@yonimor The level object emitted from LEVEL_LOADED has a property called live, which tells you whether the stream is live or not.

johnBartos added a commit that referenced this issue Jun 27, 2018
@difosfor
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants