Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dglar
Reel Rookie

Determining if hls/dash stream is live

I need to be able to play streams (hls and dash) without knowing if they are live or vod, and set the start time accordingly. So far, I've tried just setting `playStart=-1` but the results are all over the place. Most live streams do start at the edge, but some fail with `buffer:search:demux.dash:Cannot seek to video at <timestamp>/<framerate>: error -36`. For vod, most play the last segment and stop as expected, although some do actually still start from the beginning despite the -1.

I see from the query/media-player ECP endpoint that there is indeed an `is_live` attribute that's exactly what I need, but I can't find this in any of the Video node fields. Loopback ECP access is not allowed so I can't simply use this.

Or a way to peek at the hls variant manifest to check for `#EXT-X-ENDLIST`. I do see that `manifestData` is available for dash, but of course manual parsing seems heavy handed.

The current goal is to load the video in a prebuffered state to be able to determine liveness, and then seek accordingly and start playback, similar to the solution discussed here: https://community.roku.com/t5/Roku-Developer-Program/Start-live-channel-with-timeshift-at-live-posit...

I am hoping that seeking to `duration` will resolve issues with that particular live dash stream and perhaps others.

 

Thanks

 

ETA: I did see in the documentation that the `pauseBuffer*` fields are only valid for live video, but it looks like they're set for vods as well.

0 Kudos
6 REPLIES 6
renojim
Community Streaming Expert

Re: Determining if hls/dash stream is live

I'd have to test it to be sure, but I'd be willing to be ECP just returns whether the Live attribute of the Content metadata has been set to true, which is something you'd have to do yourself.  I don't think the device has any way to determine whether a stream is live, but maybe someone has some ideas.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
dglar
Reel Rookie

Re: Determining if hls/dash stream is live

Thanks but content metadata `Live` is only responsible for displaying "Live" in the progress bar. Meanwhile, ECP's `is_live` is indeed whether the stream is live or vod.

0 Kudos
renojim
Community Streaming Expert

Re: Determining if hls/dash stream is live

Interesting.  Well I did say I'd have to test, and now that I have, it does look like you can get it from ECP.  As you noted for HLS, it's probably simply that live streams don't have an ending #EXT-X-ENDLIST, but if is_live is exposed through through the Video Node, I don't see it in the documentation.  Removing #EXT-X-ENDLIST from an m3u8 file sure enough gets ECP to return true for is_live.  Personally (after years of trying to fight Roku limitations and oddities), I'd take the "heavy handed" approach, but perhaps someone like @RokuBen might know something.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
RokuBen
Community Moderator
Community Moderator

Re: Determining if hls/dash stream is live

Alas, I'm not on the media player team, I spend most of my time in UI code, so I don't know the answer here.

0 Kudos
renojim
Community Streaming Expert

Re: Determining if hls/dash stream is live

@RokuBen, we appreciate that you do what you can!  I wish more of your cohorts showed up here.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
dglar
Reel Rookie

Re: Determining if hls/dash stream is live

Any other ideas? I see that signal beacons are sent (e.g. LiveStartInitiate / VODStartInitiate). Is there any way to access this within the channel? Looks like system logs are just for http statuses?

 

edit: beacons can be inaccurate. Seeing VODStart* frequently for live streams.

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.