Your Digital Media Has Never Looked So Good

 
rlutz
Topic Author
Posts: 6
Joined: Tue Feb 15, 2011 11:09 am

Simple HLS Question

Thu Feb 24, 2011 5:38 pm

If I've got an HLS stream that's live (the m3u8 is being updated on the fly), how can I get my app to start "live" instead of at the start of the playlist. I gave a cursory glance through the developer's guide, and saw StartTime and StreamStartTimeOffset, but that didn't seem to do the trick.

Anyway, if someone could just give me a quick reply I'd appreciate it.
 
rlutz
Topic Author
Posts: 6
Joined: Tue Feb 15, 2011 11:09 am

Re: Simple HLS Question

Thu Feb 24, 2011 5:46 pm

I think I figured it out for myself, I thought, what would larry wall do, and put StreamStartTimeOffset:-1 and that seems to have done the trick :)
 
User avatar
RokuKevin
Roku Engineering
Posts: 796
Joined: Tue Sep 22, 2009 2:29 pm

Re: Simple HLS Question

Fri Feb 25, 2011 10:37 am

I think setting StreamStartTimeOffset=-1 is a red herring.... We don't really even use that parameter any more.

The way to track the live point is to either create a "Live Windowed" HLS stream or use the "PlayStart" content meta-data parameter to specify the live point in an HLS stream that includes all the segments. Using the "PlayStart" parameter is much more complicated but allows the user to seek in the live stream.

When using the "Sliding Window Live Playlist" approach, the .m3u8 specifies the "Live" point with the #EXT-X-MEDIA-SEQUENCE:Number tag that specifies the sequence number of the first segment in the current playlist. We recommend including 8 segments in your windowed live stream. An example is shown in section 8.3 of the HLS spec:

8.3. Sliding Window Playlist, using HTTPS

#EXTM3U
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:2680

#EXTINF:8,
https://priv.example.com/fileSequence2680.ts
#EXTINF:8,
https://priv.example.com/fileSequence2681.ts
#EXTINF:8,
https://priv.example.com/fileSequence2682.ts

If you are going to include all the segments in your playlist, you need to track the live point externally to the stream. You can then use the "PlayStart" content meta-data parameter to provide the offset in seconds from which the video is to be played. When using this method, be sure NOT to include the EXT-X-PROGRAM-DATE-TIME tag in the .m3u8 stream, as that tag changes the way the PlayStart parameter is interpreted.

If you know the time your live stream starts in seconds since epoch (include it in your xml feed), brightscript can always get the current time and you can calculate the live point and "PlayStart" parameter as follows:
    liveTimeSinceEpoch = CreateObject("roDateTime").asSeconds()
    PlayStart = liveTimeSinceEpoch - streamStartTimeSinceEpoch


--Kevin
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9231
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Simple HLS Question

Fri Feb 25, 2011 11:06 am

Probably not appropriate, but I've found that setting the PlayStart to some absurdly high number also works, without the time calculation.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
aljachimiak
Posts: 3
Joined: Fri Sep 22, 2017 4:52 am

Re: Simple HLS Question

Fri Sep 22, 2017 5:56 am

Probably not appropriate, but I've found that setting the PlayStart to some absurdly high number also works, without the time calculation.

I agree with this... Both that it works and that it does not seem like the best way to approach the problem.


If you have a livestream that is infinite, and you don't control the encoding for it, How can you reliably and safely move to the "most live" point in the hls stream?

Here is an example:

Using the RokuStream/RAF Tester with this appleHLS tester stream: https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8
Scenario one:
- Click the "Live" checkbox so it is checked
- Click "Go"
Observed result - Video plays at 29min 57sec.

Scenario two:
- Make the "Live" checkbox unchecked
- Click "Go"
Observed result - Video Plays at beginning (0 sec)

What is the "Roku Stream Tester" app doing to push the playhead to 29min 57 sec when "Live" is clicked?

Thanks!

Who is online

Users browsing this forum: No registered users and 5 guests