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: 
belltown
Roku Guru

roAudioPlayerEvent undocumented event type 10

I'm using roAudioPlayer to play an MP3 stream. If the audio stream is interrupted, an event of type 10 is raised. There is no documentation under roAudioPlayer in the 2.9 or 3.0 SDKs for this event type. There is, however, an event type of isRequestInterrupted (type 10), but that is only documented for the roSlideShowObject.

Is it safe to assume that this is a valid event for roAudioPlayer, just an omission from the documentation? I plan to use this event to detected an interrupted audio stream and restart the stream automatically. My code for this seems to work okay. I just want to make sure I'm not using an undocumented feature that may be removed in a future release.
0 Kudos
6 REPLIES 6
RokuMarkn
Visitor

Re: roAudioPlayerEvent undocumented event type 10

Yes, a buffer underrun in the media player will generate a RequestInterrupted event.

--Mark
0 Kudos
belltown
Roku Guru

Re: roAudioPlayerEvent undocumented event type 10

Could you please give me some insight into what exactly a buffer underrun is, and what would cause it. I'm streaming MP3 audio data to my Roku and every 20 minutes or so I get the RequestInterrupted roAudioEvent.

Right before it happens I see the following:

Several packets of MP3 TCP data are sent from my server's port to the Roku's with [PSH,ACK] flags.
The Roku sends back an [ACK] to the first of those packets.
0.001629 secs later the Roku sends a [FIN,ACK] with the same acknowledgement number as in the previous packet.
The server sends an [ACK] acknowledging the previous [FIN,ACK] packet from the Roku.
The Roku then sends a series of [RST] packets.

I can't see that my server is doing anything wrong. It's just sending out a continuous stream of MP3 data. The [FIN,ACK] that the Roku sends seems to indicate that the Roku wishes to terminate the connection. Can you give me any idea why that would happen?
0 Kudos
jbrave
Channel Surfer

Re: roAudioPlayerEvent undocumented event type 10

Typically, a buffer underrun might indicate your server isn't serving data fast enough. There might be other considerations, such as how your server is responding to http range requests, and if the server is providing accurate range header information.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
belltown
Roku Guru

Re: roAudioPlayerEvent undocumented event type 10

"jbrave" wrote:
Typically, a buffer underrun might indicate your server isn't serving data fast enough. There might be other considerations, such as how your server is responding to http range requests, and if the server is providing accurate range header information.

- Joel


That might explain what's happening. The server is continuously streaming song tracks played as MP3. However, there is a (small, generally not more than a couple of seconds) timeframe in between each song when no audio is being streamed. I assume that the roAudioPlayer sees that no audio is coming through and assumes that playback has ended and terminates the connection.

I don't think range requests have anything to do with it. I haven't seen the audio player send out any and in case my server doesn't handle them. Am I correct in assuming that for simple MP3 audio streaming the Roku does not send out range requests?

Any idea how other streaming services (e.g. Pandora) that play a series of individual song tracks handle the gaps in between songs that in my case are leading to a roRequestInterrupted event? Are they continuously streaming "something" even if just silence?
0 Kudos
jbrave
Channel Surfer

Re: roAudioPlayerEvent undocumented event type 10

Hmm. Well, if you are streaming a set of songs, you would generally use a playlist file, like a .m3u file. The roku would get the playlist file, and extract the paths to each url in the file and then create an array of songs. Then you add this to the audioplayer using audioplayer.setcontentlist

Then issue an audioplayer.play() and it will roll through all songs in the list sequentially.

If you are trying to stream live broadcasts, that is a different story, you would typically use Shoutcast, Icecast or other similar server, or I think you can do it with Wowza as well.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
belltown
Roku Guru

Re: roAudioPlayerEvent undocumented event type 10

"jbrave" wrote:
Hmm. Well, if you are streaming a set of songs, you would generally use a playlist file, like a .m3u file. The roku would get the playlist file, and extract the paths to each url in the file and then create an array of songs. Then you add this to the audioplayer using audioplayer.setcontentlist

Then issue an audioplayer.play() and it will roll through all songs in the list sequentially.

If you are trying to stream live broadcasts, that is a different story, you would typically use Shoutcast, Icecast or other similar server, or I think you can do it with Wowza as well.

- Joel


Thanks for your insight. The songs I'm streaming come from another streaming source, so the playlist file wouldn't work. Rather than stream through another server, I decided to modify my server to output a stream of silence in between songs so it now looks to the Roku like a continuous uninterrupted audio stream. That seems to have fixed the problem.
0 Kudos