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

banner ads - mediafly

unless i missed it somewhere in the SDK

who would we go ahead and set up these type of banner ads on the bottom of the screen and click? will they only open to a video?

can they open to a with roVideoPlayer and roImageCanvas, so we can combine video, images and text on this screen?
0 Kudos
15 REPLIES 15
nowhereman
Visitor

Re: banner ads - mediafly

"FML2010" wrote:
unless i missed it somewhere in the SDK

who would we go ahead and set up these type of banner ads on the bottom of the screen and click? will they only open to a video?

can they open to a with roVideoPlayer and roImageCanvas, so we can combine video, images and text on this screen?


I think you can do pretty much anything you want when an ad is clicked. See the documentation for roPosterScreen.SetAdSelectable() on page 30 of the Component Reference.
twitter:nowhereman
http://www.thenowhereman.com/roku
http://www.thenowhereman.com/netflix
0 Kudos
FML2010
Visitor

Re: banner ads - mediafly

Thank you I will look more into that....

Ok after looking through all the .pdf files and searching the forum, I can not find a reference to how this actually coded.

I found it where you said it, but there is no actual example of it that i can find.

also are these static banners? i mane can we give a web address or does it need to be a "pkg" address.

I know php pretty good but so far this code is a bit confusing so please forgive me
0 Kudos
RokuKevin
Visitor

Re: banner ads - mediafly

You can do anything you want in response to an ad click event.... Below is a sample code snippet that will play a video:

--Kevin


Sub PlayAdVideo()
videoScreen = CreateObject("roVideoScreen")
port = CreateObject("roMessagePort")
videoScreen.SetMessagePort(port)

videoScreen.SetContent( { url: "http://myvideo.com/myAdVideo.mp4",
StreamFormat: "mp4"
} )
while true
msg = wait(0, screen.GetMessagePort())
if msg.isScreenClosed() then
return
endif
end while
End Sub

'***********************************************************************************************************
' On a poster screen already setup, you can add an ad and set the display mode via:
screen.SetAdURL(sdAdUrl, hdAdURL)
screen.SetAdDisplayMode("scale-to-fit")

while true
msg = wait(0, screen.GetMessagePort())

' handle other events as normal

if msg.isAdSelected() then
' play ad video
PlayAdVideo()
endif
end while

0 Kudos
FML2010
Visitor

Re: banner ads - mediafly

Thanks Kevin!

I am still getting no where with coding 😞

When i add what you put here it wont even load.

If i am using the video player example, where would i put this? i think part has to do with i am still trying to get the video player and register example to work and these 3 things are not playing well together!
0 Kudos
RokuKevin
Visitor

Re: banner ads - mediafly

You need to merge the code below '***************' into your poster screen.

You obviously need to change the url to a valid video on your site.

--Kevin
0 Kudos
FML2010
Visitor

Re: banner ads - mediafly

Kevin i have tried this and its not working here is the code i tried using


Function preShowPosterScreen(breadA=invalid, breadB=invalid) As Object

if validateParam(breadA, "roString", "preShowPosterScreen", true) = false return -1
if validateParam(breadB, "roString", "preShowPosterScreen", true) = false return -1

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("flat-category")
screen.SetAdURL("http://www.puresilvabannermaker.com/bannermaker/backgroundthumbs/scale_summersun5.jpg","http://www.puresilvabannermaker.com/bannermaker/backgroundthumbs/scale_summersun5.jpg")
screen.SetAdDisplayMode("scale-to-fit")
while true
msg = wait(0, screen.GetMessagePort())

' handle other events as normal

if msg.isAdSelected() then
' play ad video
PlayAdVideo()
endif
end while

return screen

End Function


And it wont even load the poster screen... i just set the banners as something i found off the web for now....

and can i put the "SUB PLAY VIDEO" In my appMain.brs ?

Thanks and im happy to get back working on my project again
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: banner ads - mediafly

"FML2010" wrote:
And it wont even load the poster screen...


You aren't telling it to display the poster screen. There's no screen.Show() command.
0 Kudos
FML2010
Visitor

Re: banner ads - mediafly

 end while

return screen

End Function


so should i replace the "Return screen" with " screen.Show() " ??

so why does it work like this?

Function preShowPosterScreen(breadA=invalid, breadB=invalid) As Object

if validateParam(breadA, "roString", "preShowPosterScreen", true) = false return -1
if validateParam(breadB, "roString", "preShowPosterScreen", true) = false return -1

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("flat-category")
screen.SetAdURL("http://www.puresilvabannermaker.com/bannermaker/backgroundthumbs/scale_summersun5.jpg","http://www.puresilvabannermaker.com/bannermaker/backgroundthumbs/scale_summersun5.jpg")
return screen

End Function


also Chris can i play the Sub play video on the appmain.brs ?? or its own like this -- adDisplay.brs ??
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: banner ads - mediafly

Based on your code snippet, it looks like you are working from the videoplayer example, in which case, the preShowPosterScreen function does not display a screen, it builds a screen and returns it. There is then another function called showPosterScreen that takes that screen as an argument, displays it, and handles any events it generates. You have introduced an event loop into preShowPosterScreen. This loop will never catch any events and your code will never reach showPosterScreen.

And you can organize your code into whatever file structure makes the most sense to you.
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.