Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

[SOLVED] Roku requests 40 segments on playback?

Hi all,

I've run into an issue that appears sporadically. Sometimes when the app starts playback it can take a very long time to actually begin playing. I've looked at the logs on the server side, and it appears when this happens the Roku is requesting many HLS segments, and sometimes it doesn't start until up to 40 segments have been received.

Any thoughts on what may be causing this behaviour?
0 Kudos
4 Replies
Highlighted
Level 7

Re: Roku requests 40 segments on playback?

I've just made some log files that may help... at least they show how the segments are coming in...

I started a video stream, waited until it had actually started playing video, then cancelled playback. I then immediately started the same video again.

This is the first time:

16:32:31 VideoPlayer:Smiley Frustratedhow(): Showing VideoPlayer screen.
16:32:34 VideoPlayer::EventHandler(): Stream started.
16:32:40 VideoPlayer::EventHandler(): Download segment info
16:32:43 VideoPlayer::EventHandler(): Download segment info
16:32:47 VideoPlayer::EventHandler(): Download segment info
16:32:52 VideoPlayer::EventHandler(): Download segment info
16:32:56 VideoPlayer::EventHandler(): Download segment info
16:33:01 VideoPlayer::EventHandler(): Download segment info
16:33:03 VideoPlayer::EventHandler(): Download segment info
16:33:07 VideoPlayer::EventHandler(): Download segment info
16:33:12 VideoPlayer::EventHandler(): Download segment info
16:33:16 VideoPlayer::EventHandler(): Download segment info
16:33:21 VideoPlayer::EventHandler(): Download segment info
16:33:22 VideoPlayer::EventHandler(): HLS segment info
16:33:25 VideoPlayer::EventHandler(): Download segment info
16:33:26 VideoPlayer::EventHandler(): HLS segment info
16:33:28 VideoPlayer::EventHandler(): Playback interrupted by user.


And this is the same video, started immediately after stopping:

16:33:40 VideoPlayer:Smiley Frustratedhow(): Showing VideoPlayer screen.
16:33:41 VideoPlayer::EventHandler(): Stream started.
16:33:51 VideoPlayer::EventHandler(): Download segment info
16:33:52 VideoPlayer::EventHandler(): Download segment info
16:33:57 VideoPlayer::EventHandler(): Download segment info
16:34:01 VideoPlayer::EventHandler(): Download segment info
16:34:06 VideoPlayer::EventHandler(): Download segment info
16:34:09 VideoPlayer::EventHandler(): Download segment info
16:34:12 VideoPlayer::EventHandler(): Download segment info
16:34:16 VideoPlayer::EventHandler(): Download segment info
16:34:21 VideoPlayer::EventHandler(): Download segment info
16:34:26 VideoPlayer::EventHandler(): Download segment info
16:34:31 VideoPlayer::EventHandler(): Download segment info
16:34:34 VideoPlayer::EventHandler(): Download segment info
16:34:39 VideoPlayer::EventHandler(): Download segment info
16:34:44 VideoPlayer::EventHandler(): Download segment info
16:34:47 VideoPlayer::EventHandler(): Download segment info
16:34:51 VideoPlayer::EventHandler(): Download segment info
16:34:56 VideoPlayer::EventHandler(): Download segment info
16:35:01 VideoPlayer::EventHandler(): Download segment info
16:35:05 VideoPlayer::EventHandler(): Download segment info
16:35:11 VideoPlayer::EventHandler(): Download segment info
16:35:15 VideoPlayer::EventHandler(): Download segment info
16:35:21 VideoPlayer::EventHandler(): Download segment info
16:35:24 VideoPlayer::EventHandler(): Download segment info
16:35:29 VideoPlayer::EventHandler(): Download segment info
16:35:36 VideoPlayer::EventHandler(): Download segment info
16:35:41 VideoPlayer::EventHandler(): Download segment info
16:35:45 VideoPlayer::EventHandler(): Download segment info
16:35:50 VideoPlayer::EventHandler(): Download segment info
16:35:55 VideoPlayer::EventHandler(): Download segment info
16:36:00 VideoPlayer::EventHandler(): Download segment info
16:36:05 VideoPlayer::EventHandler(): Download segment info
16:36:09 VideoPlayer::EventHandler(): Download segment info
16:36:13 VideoPlayer::EventHandler(): Download segment info
16:36:18 VideoPlayer::EventHandler(): Download segment info
16:36:21 VideoPlayer::EventHandler(): Download segment info
16:36:26 VideoPlayer::EventHandler(): Download segment info
16:36:31 VideoPlayer::EventHandler(): Download segment info
16:36:36 VideoPlayer::EventHandler(): Download segment info
16:36:41 VideoPlayer::EventHandler(): Download segment info
16:36:45 VideoPlayer::EventHandler(): Download segment info
16:36:50 VideoPlayer::EventHandler(): Download segment info
16:36:54 VideoPlayer::EventHandler(): Download segment info
16:37:00 VideoPlayer::EventHandler(): Download segment info
16:37:05 VideoPlayer::EventHandler(): Download segment info
16:37:11 VideoPlayer::EventHandler(): HLS segment info
16:37:14 VideoPlayer::EventHandler(): HLS segment info
16:37:17 VideoPlayer::EventHandler(): HLS segment info
16:37:22 VideoPlayer::EventHandler(): HLS segment info
16:37:27 VideoPlayer::EventHandler(): HLS segment info
16:37:32 VideoPlayer::EventHandler(): HLS segment info
16:37:37 VideoPlayer::EventHandler(): HLS segment info
16:37:42 VideoPlayer::EventHandler(): HLS segment info
16:37:43 VideoPlayer::EventHandler(): Playback interrupted by user.


In both cases, playback doesn't begin until the first "HLS segment info" message -- however, it's quite clear that the second time took MUCH longer. In fact, the second stream took 4 minutes to start!

I have tested my server against other HLS players, and this appears to be a Roku-specific issue. Why is it requesting so many segments before starting? Does anyone have any thoughts?
0 Kudos
Highlighted
Roku Employee
Roku Employee

Re: Roku requests 40 segments on playback?

What bitrate are you setting for the HLS stream? If you play the stream in VLC, do you see any errors in the log?

- Joel
0 Kudos
Highlighted
Level 8

Re: Roku requests 40 segments on playback?

Probably also worth mentioning you segment lengths. Roku recommends segment lengths of ~10 seconds. If you're using something lower (like 2 seconds), that could result in significantly more requests to fill the buffer.
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
Highlighted
Level 7

Re: Roku requests 40 segments on playback?

Update: The issue has been resolved. Our server performs live transcoding, and as a result it often delivers a playlist before the first segment is actually available. It seems the Roku was using the delay between receiving the playlist and receiving the first segment to determine how many segments to retrieve; which is why the behaviour was not consistent -- it depended on the speed of the transcode. The solution was to modify the server to not deliver the playlist until the first segment was actually available.
0 Kudos