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: 
mmcbride
Newbie

HLS streaming and rewind.

I've got an application I update about once a year that streams a live HLS stream. Previously, the rewind button worked with no issues to seek backwards in the live stream. Now using either the rewind or fast forward button causes it to start the stream over at the beginning of the segment/window (not sure about the correct terminology for HLS, something like an hour and a half in the past for this particular stream when I only rewind 1 minute, or just hit the fast forward button)

It's basically a roVideoScreen that I specify Live=true, StreamStartTimeOffset={Large number meaning end of stream so it's live}, and PlayStart={same number as StreamStartTimeOffset}. I've tried both with correct hardcoded bitrates and 0 for the bitrate.

Am I doing something totally wrong? For now I've set SetPreviewMode=true so the FF/REW buttons are disabled, but I'd like to get them working again. Any ideas?
0 Kudos
7 REPLIES 7
mmcbride
Newbie

Re: HLS streaming and rewind.

So a little more information from my testing.

Here is the code snippet of my roVideoScreen loop. I've added in the SetPositionNotificationPeriod(5) so that I can see where in the stream it's currently playing for debugging purposes.


video.SetPositionNotificationPeriod(5)
video.show()

while true
message = wait(0, port)
if m.debug=true print "DEBUG message index: "; message.GetIndex()
if type(message) = "roVideoScreenEvent"
if message.isScreenClosed() then
if m.debug=true print "Closing screen"
exit while
else if message.isPlaybackPosition() then
if m.debug=true print "Current Position: "; message.GetIndex()
else if message.isRequestFailed()
if m.debug=true print "Playback Failed: "; message.GetMessage()
else
if m.debug=true print "Unknown: "; message.GetType(); " message: "; message.GetMessage()
endif
end if
end while


Here is what I get in the debug window.

DEBUG message index: 2
Unknown: 20 message: Stream started.
DEBUG message index: 208202
Current Position: 208202
DEBUG message index: 208207
Current Position: 208207
DEBUG message index: 208212
Current Position: 208212
DEBUG message index: 0
Unknown: 12 message: Playback paused.
DEBUG message index: 26
Unknown: 20 message: Stream started.
DEBUG message index: 202910
Current Position: 202910
DEBUG message index: 202915


The stream I'm using has time stamps displayed in it. I played a stream and hit the rewind button until my Roku showed 1 minute in the past on the buffer timeline at the bottom of the screen, that is where the debug log shows the Unknown message 12 and debug message 26. The 208202 index that the stream started at then showed about 5:59 am on the stream feed. The 202910 show about 4:31 am.

I'm totally lost since this has worked in the past, but doesn't seem to work now. Any ideas?
0 Kudos
mmcbride
Newbie

Re: HLS streaming and rewind.

I've also verified rewinding on the feed works fine on an IOS device.
0 Kudos
TheEndless
Channel Surfer

Re: HLS streaming and rewind.

Have you tried not setting Live=true to see if it makes a difference? Also, I don't think you need to set the StreamStartTimeOffset, so I'd try without setting that as well.
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)
0 Kudos
mmcbride
Newbie

Re: HLS streaming and rewind.

Thanks for the reply TheEndless.

I've actually tried not setting StreamStartTimeOffset and PlayStart both together and separately. I've also tried setting live=false but still the same issue persists. I hit the rewind or fast forward button and I'm at the beginning of whatever the live stream HLS feed is.
0 Kudos
TheEndless
Channel Surfer

Re: HLS streaming and rewind.

I just tested with a live HLS stream here, and am definitely not seeing what you're describing. If it helps, this is how I define the content metadata for the stream:
content = {
Title: "Watch the live stream"
HDPosterUrl: "pkg:/images/live_hd.png"
SDPosterUrl: "pkg:/images/live_sd.png"
Stream: {
Url: "http://my.live.stream/url.m3u8"
}
StreamFormat: "hls"
SwitchingStrategy: "full-adaptation"
Live: True
}
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)
0 Kudos
mmcbride
Newbie

Re: HLS streaming and rewind.

That's pretty much the same as my feed setup. I've even tried even tried the different SwitchingStrategy settings in the documentation just to test. No luck. Rewind/FF always take me to the start of the 1:28 mark for my stream.
0 Kudos
mmcbride
Newbie

Re: HLS streaming and rewind.

I replaced the HLS stream URL with the Apple test HLS stream and the rewind works properly so I guess my code is correct. I can't release the HLS stream URL's yet, but I guess there is some issue there.
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.