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

Pre/Post Roll Ads?

hi guys,

I'm new to the roku SDK and I've built a app/channel based on the videoplayer example in the SDK. I also built a db/php backend for the XML.

Anyways I'd like to implement pre roll and post roll clips for the movies, and I was wondering if anyone had done that or if anyone had some examples????

thanks!
0 Kudos
27 REPLIES 27
kbenson
Visitor

Re: Pre/Post Roll Ads?

Not that I have a lot of experience with it yet, but if you use HLS, you could just tack on the videos to the beginning and end of the playlist. From my understanding, you could even put them in the middle, if you computed the timestamps all correctly.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Anonymous
Visitor

Re: Pre/Post Roll Ads?

"olav" wrote:
hi guys,

I'm new to the roku SDK and I've built a app/channel based on the videoplayer example in the SDK. I also built a db/php backend for the XML.

Anyways I'd like to implement pre roll and post roll clips for the movies, and I was wondering if anyone had done that or if anyone had some examples????

thanks!


You can do it with the roVideoPlayer, but you'll need to wire up all the transport controls yourself and will get rebuffers between videos, if that's acceptable.
0 Kudos
FML2010
Visitor

Re: Pre/Post Roll Ads?

Patrick how would we do this?

would you add this in the showfeed section ?
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Pre/Post Roll Ads?

Given 2 video URLs, one to an ad and one to your content, you can just make 2 serial calls to showVideoScreen() in appDetailScreen.brs. The downside of that approach is that users will easily be able to skip the ads. That's where roVideoPlayer comes in handy as Patrick mentioned. It gives you the ability to customize interaction with the remote control, disable FF, etc. To see how it works, take a look at section 5.8 of the Component Reference and the "Custom Video Player" sample included with the 2.6 SDK
0 Kudos
FML2010
Visitor

Re: Pre/Post Roll Ads?

chris i have been trying by doing this and similar, and no go


if msg.GetIndex() = 2
showVideoScreen([Stream: url: "http://ia301529.us.archive.org/0/items/wonder_bread/wonder_bread_512kb.mp4" StreamFormat: "mp4"])
showList[showIndex].PlayStart = 0
showVideoScreen(showList[showIndex])
endif


and boy does it not like that!!

i have read over all the examples even the simple video, can you share how to do this correctly
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Pre/Post Roll Ads?

The problem is syntactical. In BrightScript, brackets [] designate a roArray while braces {} designate a roAssociativeArray. ShowVideoScreen() expects a roAssociatveArray as an argument, but you're trying to give it a roArray. It's also important to note that when you define multiple key/value pairs on the same line of a roAssociativeArray definition, they must be separated by commas. This is not the case if they are on separate lines.

Incorrect:
[Stream: url: "http://ia301529.us.archive.org/0/items/wonder_bread/wonder_bread_512kb.mp4" StreamFormat: "mp4"]


Correct (multiple attributes on one line with commas):
{Stream: {url: "http://ia301529.us.archive.org/0/items/wonder_bread/wonder_bread_512kb.mp4"}, StreamFormat: "mp4"}


Also correct (attributes on individual lines without commas):
{Stream: {url: "http://ia301529.us.archive.org/0/items/wonder_bread/wonder_bread_512kb.mp4"}
StreamFormat: "mp4"}
0 Kudos
FML2010
Visitor

Re: Pre/Post Roll Ads?

ok with that said i did this


preRoll = {Stream: {url: "http://ia301529.us.archive.org/0/items/wonder_bread/wonder_bread_512kb.mp4"}, StreamFormat: "mp4"}
showVideoScreen(preRoll)
showList[showIndex].PlayStart = 0
showVideoScreen(showList[showIndex])



and about 250 other combinations and nothing is working!! this is the only that will semi work and not throw a bunch of errors.

what is wrong with this? what do i need to do to get to work together, please while i still have a hair on my head!!
0 Kudos
kbenson
Visitor

Re: Pre/Post Roll Ads?

If you haven't already (and in a recent post to a separate thread you indicated you haven't), you should read through both the BrightScript Reference Manual and the Roku Component Reference in their entirety. I would easily equate an extra 15 minutes reading the reference docs to saving 3-5 hours debugging later on.

I suggest paying particular attention to any code examples in the docs, and trying to make sure you understand everything they are doing. If you don't understand an example, spending the time to figure it out, or asking why it's explained to do something different than you would expect is a great way to really get to know what's going on. It's also easier for anyone you ask to reply authoritatively, since they will have the example in it's entirety.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
FML2010
Visitor

Re: Pre/Post Roll Ads?

@ kbenson I have read them over and over and you show me one place there is a reference to my question of playing a preroll with the video player example!!
0 Kudos