-
Notifications
You must be signed in to change notification settings - Fork 6k
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
How to detect live streaming vs VOD in ExoPlayer #2668
Comments
As described in the issue you reference, you can use isCurrentWindowDynamic for this. |
@ojw28 Presently I check the result of isCurrentWindowDynamic && isCurrentWindowSeekable to distinguish between live streaming and VOD. I wonder is there a better way to do that too. |
Yes, that's a good point. The method described will only work for DASH, HLS and SmoothStreaming. You can get on-demand (i.e. non-live) content that's not seekable. You're probably better off looking at the duration (ExoPlayer.getDuration). If it's unknown, that's a pretty good sign that you're dealing with a live stream. So you could try OR'ing this approach with the one based on the window being dynamic. By the way, did you mean || instead of && in your comment? I don't think && is what you'd want? |
Oh yes, sorry for that, I made two mistakes. I was intent to say isCurrentWindowDynamic || !isCurrentWindowSeekable. So the recommended way is to use isCurrentWindowDynamic || getDuration == C.TIME_UNSET to solve the problem. Thanks you for that. |
That approach seems like it would get it right in the vast majority of cases, yes. Give it a try and let us know. It's actually quite difficult to determine whether a stream is live in the completely general case. If you compared an on-demand stream that doesn't define its duration or seek information and is served from a server that doesn't tell you the content length, that would be impossible to distinguish from a genuine live stream. Admittedly that combination is quite far fetched. On-demand media isn't seekable in the case that it doesn't define any seek information (e.g. in the media container) to enable the player to perform an efficient seek. Raw MPEG-TS streams are a good example of this (HLS is seekable because the media playlist effectively provides seek information at a higher level). |
Given there are lots of properties you could look at to try and determine whether a stream is live, we should probably add an isLive method and implement our best-attempt logic there (which can be updated over time, if needed). Marking as an enhancement. |
@tonihei - Reassigning because this touches on It might be nice to fix this so that we can remove this not exactly accurate troubleshooting entry, if it's relatively straightforward. Although perhaps it fits better into the bigger playlist simplification work. |
Issue:#2668 PiperOrigin-RevId: 274793644
Is there is any method available right now for distinguish between live streaming and VOD?
I have already seen track #2099 that is posted on dated Nov 23, 2016. On that time there is no such method available for distinguish between live streaming and VOD.
Since the above post is almost 5 months old. Now I want to conform that Is there is any method available right now for distinguish between live streaming and VOD?
I have also try by get duration of video but unable to find distinguish between Live Streaming and VOD?
The text was updated successfully, but these errors were encountered: