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: 
AFactsBrad
Visitor

Live streaming example

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
0 Kudos
15 REPLIES 15
RokuChris
Roku Employee
Roku Employee

Re: Live streaming example

"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.
0 Kudos
AFactsBrad
Visitor

Re: Live streaming example

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!
0 Kudos
craigvansant
Visitor

Re: Live streaming example

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 ~
0 Kudos
stratcat96
Visitor

Re: Live streaming example

"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.
0 Kudos
RokuKevin
Visitor

Re: Live streaming example

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
0 Kudos
AFactsBrad
Visitor

Re: Live streaming example

Hi Friends,
*BUMP* I think my thread got hijacked over the weekend.
The stream I'm trying to play is:
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
0 Kudos
stratcat96
Visitor

Re: Live streaming example

@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...


'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"
0 Kudos
AFactsBrad
Visitor

Re: Live streaming example

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.
0 Kudos
scyber
Visitor

Re: Live streaming example

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:

#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:

#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.
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.