Live streaming example

Roku's free SDK allows developers to build channels and applications and publish them to the Roku Channel Store. Register for the Developer Program at http://www.roku.com/developer

Moderators: RokuDouglas, RokuRyan, RokuJamesL, RokuKen, RokuChris, RokuJoel

Live streaming example

Postby AFactsBrad » Wed Aug 10, 2011 12:35 pm

Hi friends,
My name is Brad, I work for a TV and radio station in California called Amazing Facts. We would like to create a channel on ROKU.

I have created an account, downloaded the SDK, read most of the documentation, searched the forum, and looked at the example code. The videoplayer example is a huge help. Big thanks.

We are currently using BitGravity as our CDN streaming from FMLE. Bitgravity will be providing HLS for us soon.

My questions is, Is there a piece of example code for creating a live video player application? I'm not sure where to put my CDN's parameters.
Also, do I need to own a ROKU box to put up a channel?

Thanks in advance,
Brad
Last edited by AFactsBrad on Thu Aug 18, 2011 5:28 pm, edited 2 times in total.
AFactsBrad
 
Posts: 8
Joined: Wed Aug 10, 2011 12:10 pm

Re: Live streaming example

Postby RokuChris » Wed Aug 10, 2011 1:40 pm

AFactsBrad wrote:My questions is, Is there a piece of example code for creating a *live* video player application? I'm not sure where to put my CDN's parameters.
Also, do I need to own a ROKU box to put up a channel?


The simplevideoplayer example in the SDK has some code in it for playing HLS. It's very similar to playing other video formats.

And yes, you'll need a Roku. Channels have to be encrypted and signed before publishing and the only way to do that is with a box. You'll also need a box to test your channel during development.
User avatar
RokuChris
 
Posts: 1088
Joined: Mon Aug 30, 2010 1:45 pm

Re: Live streaming example

Postby AFactsBrad » Thu Aug 18, 2011 5:19 pm

Thanks for your help. I purchased a ROKU and am using it for development.

I downloaded v29 and v30 of the SDK and example code. Without editing the example code, most of the streaming examples do not work when I upload them to the device. The only HLS live streaming example I have gotten to work is the CustomVideoPlayer example. The SimpleVideoPlayer example has several different commented ways to stream but only the un-commented one works, and that's not HLS. I would like to use the SimpleVideoPlayer example but I am not sure what to do?

The roku player I am using was purchased brand-new from ROKU.com it is the ROKU2 XS

Any ideas?
Thanks in advance!
AFactsBrad
 
Posts: 8
Joined: Wed Aug 10, 2011 12:10 pm

Re: Live streaming example

Postby craigvansant » Thu Aug 18, 2011 7:01 pm

I am very interested to follow this post as I am looking to also broadcast live. I currently use a CDN which allows me to upload in an RTMP format from FMLE or another H.264 encoding appliance. Normally the player would be an Adobe Flash player in a web browser. Is there a way to play this RTMP stream on the Roku?

Also, I am trying to obtain the least amount of latency in the live broadcast to get as close to "real-time" as possible. Is there a way to control the amount of buffer on the player or box?

Thanks ~
craigvansant
 
Posts: 1
Joined: Thu Aug 18, 2011 6:54 pm

Re: Live streaming example

Postby stratcat96 » Thu Aug 18, 2011 7:30 pm

AFactsBrad wrote:Thanks for your help. I purchased a ROKU and am using it for development.

I downloaded v29 and v30 of the SDK and example code. Without editing the example code, most of the streaming examples do not work when I upload them to the device. The only HLS live streaming example I have gotten to work is the CustomVideoPlayer example. The SimpleVideoPlayer example has several different commented ways to stream but only the un-commented one works, and that's not HLS. I would like to use the SimpleVideoPlayer example but I am not sure what to do?

The roku player I am using was purchased brand-new from ROKU.com it is the ROKU2 XS

Any ideas?
Thanks in advance!



just insert your .m3u8 playlist file's path into the uncommented stream so instead of it looking for that mp4, it retrieves your playlist. Make sure you change the stream attribute to "HLS" rather than "Mp4". You can then look at editing out the references to other selections so as soon as the channel is entered you either arrive at a springboard including the details of your programming with a play button, or you can have the stream begins to load at channel entry. The simpleplayer example really is the most basic example to do exactly what you want.
stratcat96
** Valued Community Member **
 
Posts: 3427
Joined: Sat Nov 06, 2010 7:22 pm
Location: Ice Planet Hoth

Re: Live streaming example

Postby RokuKevin » Sat Aug 20, 2011 2:35 pm

craigvansant-

The Roku does not support RTMP. It also does not support control of the buffering on the box. The amount of required buffering is calculated automatically by the Roku.

The only way to do live streaming on the Roku is with HLS.

--Kevin
User avatar
RokuKevin
Roku Engineering
 
Posts: 789
Joined: Tue Sep 22, 2009 2:29 pm

Re: Live streaming example

Postby AFactsBrad » Mon Aug 22, 2011 9:15 am

Hi Friends,
*BUMP* I think my thread got hijacked over the weekend.
The stream I'm trying to play is:
Code: Select all
http://bgmp-w.bitgravity.com/cdn-live-s1/_definst_/amazingfacts/live/feed01/playlist.m3u8


Any help is appreciated.

AFactsBrad wrote:Thanks for your help. I purchased a ROKU and am using it for development.

I downloaded v29 and v30 of the SDK and example code. Without editing the example code, most of the streaming examples do not work when I upload them to the device. The only HLS live streaming example I have gotten to work is the CustomVideoPlayer example. The SimpleVideoPlayer example has several different commented ways to stream but only the un-commented one works, and that's not HLS. I would like to use the SimpleVideoPlayer example but I am not sure what to do?

The roku player I am using was purchased brand-new from ROKU.com it is the ROKU2 XS

Any ideas?
Thanks in advance!


edit: Thanks stratcat96, I've already tried that. (see quoted) If you can get my stream to stream in your example. I'd be ecstatic
AFactsBrad
 
Posts: 8
Joined: Wed Aug 10, 2011 12:10 pm

Re: Live streaming example

Postby stratcat96 » Mon Aug 22, 2011 12:48 pm

@AFactsBrad

just like this, all you are doing is replacing the stream url, changing HD to SD (although I don't know if you need to) and changing MP4 to HLS. I left everything else unchanged so you could see where the relevant "paragraph" is. You can edit out the other junk if you want to clean it up, and change the artwork/information to info about the stream.The stream plays fine for me, it a sermon playing right now...

Code: Select all
 'Swap the commented values below to play different video clips...
 urls = ["http://bgmp-w.bitgravity.com/cdn-live-s1/_definst_/amazingfacts/live/feed01/playlist.m3u8"]
 qualities = ["SD"]
 StreamFormat = "HLS"
 title = "Craig Venter Synthetic Life"
 srt = "file://pkg:/source/craigventer.srt"
stratcat96
** Valued Community Member **
 
Posts: 3427
Joined: Sat Nov 06, 2010 7:22 pm
Location: Ice Planet Hoth

Re: Live streaming example

Postby AFactsBrad » Mon Aug 22, 2011 4:57 pm

Thanks for sticking with me.
I've tried this, but let me be do it again just be sure. Do you own a ROKU 2? What is your firmware version? It may make a difference

-=-
Edit: Just tried again. I commented out the other paragraphs and added your code that you provided me. Thanks for your help, but it is still not working. After I hit "PLAY" it goes to a black screen and say "receiving" at the bottom. Then, It bounces right back out and back to the screen with the play button on it. This all happens in about half a second.

I've been coding in multiple languages for over 15 years... This baffles me. Maybe I have a defective device? Can someone from ROKU verify this somehow?

Thanks in advance.
AFactsBrad
 
Posts: 8
Joined: Wed Aug 10, 2011 12:10 pm

Re: Live streaming example

Postby scyber » Mon Aug 22, 2011 6:09 pm

There is (was?) a bug in the Roku2 HLS implementation that prevents it from playing m3u8 files with relative references to other m3u8 files. See the thread here:

viewtopic.php?f=34&t=41670

Roku has not given an ETA on when it will be fixed. I believe that build 1265 was supposed to address some of the wowza issues. Not sure if this was one of them. What build is running on your R2?

However, if you can edit the m3u8 file, you should be able to manually fix it. Change this:

Code: Select all
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=471583
playlist.m3u8?wowzasessionid=243206755
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=54385
playlist.m3u8?wowzaaudioonly&wowzasessionid=243206755


to this:

Code: Select all
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=471583
http://bgmp-w.bitgravity.com/cdn-live-s1/_definst_/amazingfacts/live/feed01/playlist.m3u8?wowzasessionid=243206755
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=54385
http://bgmp-w.bitgravity.com/cdn-live-s1/_definst_/amazingfacts/live/feed01/playlist.m3u8?wowzaaudioonly&wowzasessionid=243206755


and it should work.
scyber
 
Posts: 1290
Joined: Mon Dec 29, 2008 8:51 am

Re: Live streaming example

Postby RokuChris » Mon Aug 22, 2011 7:11 pm

AFactsBrad wrote:
Code: Select all
http://bgmp-w.bitgravity.com/cdn-live-s1/_definst_/amazingfacts/live/feed01/playlist.m3u8


Plays fine for me in 2.9
In 4.1/Roku2 I had to set switchingStrategy = "minimum-adaptation" to get it working
User avatar
RokuChris
 
Posts: 1088
Joined: Mon Aug 30, 2010 1:45 pm

Re: Live streaming example

Postby stratcat96 » Mon Aug 22, 2011 9:15 pm

AFactsBrad wrote:Thanks for sticking with me.
I've tried this, but let me be do it again just be sure. Do you own a ROKU 2? What is your firmware version? It may make a difference

-=-
Edit: Just tried again. I commented out the other paragraphs and added your code that you provided me. Thanks for your help, but it is still not working. After I hit "PLAY" it goes to a black screen and say "receiving" at the bottom. Then, It bounces right back out and back to the screen with the play button on it. This all happens in about half a second.

I've been coding in multiple languages for over 15 years... This baffles me. Maybe I have a defective device? Can someone from ROKU verify this somehow?

Thanks in advance.


sorry, I use a Roku XDS (Roku 1) in developer mode as it's the one on a TV near my computer, I didn't try it on my R2 XS.
stratcat96
** Valued Community Member **
 
Posts: 3427
Joined: Sat Nov 06, 2010 7:22 pm
Location: Ice Planet Hoth

Re: Live streaming example

Postby AFactsBrad » Tue Aug 23, 2011 8:29 am

Hi friends,
Thanks for your replies. Let me answer some of your questions :)

@Cyber:
I am running build 1265.
Doesn't my CDN control the m3u8 file? I dont think I can edit this myself since the file is generated by Bitgravity.
The ROKU device i purchased from ROKU.com is the...
Roku 2 XS
4.1 build 1265
Model 3100X

@RokuChris: I'm not sure what 2.9 is... but I'll try switchingStrategy = "minimum-adaptation" and let you know how it goes.
Edit: That didnt work. Maybe im unsure where to put this variable? I added it at the beginning of the paragraph for the path to the playlist m3u8 file. I have searched the forum for more information about SwitchingStrategy with little success, also I cannot find it in the simplevideoplayer source code, i had to add it myself. Any further ideas?

@stratcat96: :)

Edit: added updated progress
Last edited by AFactsBrad on Tue Aug 23, 2011 8:47 am, edited 2 times in total.
AFactsBrad
 
Posts: 8
Joined: Wed Aug 10, 2011 12:10 pm

Re: Live streaming example

Postby stratcat96 » Tue Aug 23, 2011 8:33 am

2.9 is the firmware version on the Roku 1 units. I'm running 3.0 (beta) on my XDS. You are actually probably using the 3.0SDK for any coding. Since there hasn't been a release of an SDK for the 4.x firmware yet, most of us (I would think) are using our R1s still :)
stratcat96
** Valued Community Member **
 
Posts: 3427
Joined: Sat Nov 06, 2010 7:22 pm
Location: Ice Planet Hoth

Re: Live streaming example

Postby RokuChris » Tue Aug 23, 2011 9:55 am

AFactsBrad wrote:I have searched the forum for more information about SwitchingStrategy with little success, also I cannot find it in the simplevideoplayer source code, i had to add it myself. Any further ideas?


switchingStrategy is an attribute of the content-meta-data structure, documented in section 3.3 of the Component Reference.
User avatar
RokuChris
 
Posts: 1088
Joined: Mon Aug 30, 2010 1:45 pm

Next

Return to Roku Developer Program

Who is online

Users browsing this forum: No registered users and 5 guests