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

Acudeo Ads attachment Problem

Here is my appHomescreen.brs code.On the top side another function name showHomescreen() so it 's my point there
i add playAd() function.my Acudeo ads function show at the appvideoscreen.brs but there i have problem with to handle loop my mean when i play channel my add started and then my channel start after commercial but when i press back bottom so again popup commercial. Please help


Best regrades



'******************************************************
'** Perform any startup/initialization stuff prior to
'** initially showing the screen.
'******************************************************
Function preShowHomeScreen(breadA=invalid, breadB=invalid) As Object

if validateParam(breadA, "roString", "preShowHomeScreen", true) = false return -1
if validateParam(breadA, "roString", "preShowHomeScreen", 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
hdAd="http://skylitelajna.com/roku/AdPicture/CN1/Ad_HD.png"
sdAd="http://skylitelajna.com/roku/AdPicture/CN1/Ad_SD43.png"
screen.setAdUrl(sdAd,hdAd)
screen.SetAdSelectable(false)
screen.SetListStyle("flat-category")
screen.setAdDisplayMode("scale-to-fit")
return screen

End Function


'******************************************************
'** Display the home screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the game posters
'******************************************************
Function showHomeScreen(screen as object ) As Integer

if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1

m.curCategory = 0
initCategoryList()
screen.SetContentList(m.Categories.Kids)
screen.SetFocusedListItem(0)
screen.Show()


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

if type(msg) = "roPosterScreenEvent" then
print "showHomeScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
m.curCategory = msg.GetIndex()
m.curShow = 0
screen.SetFocusedListItem(m.curShow)
screen.SetContentList(getShowsForCategoryItem(m.Categories, m.curCategory))
print "list focused | current category = "; m.curCategory
else if msg.isListItemSelected() then


playAd()

m.curShow = msg.GetIndex()
print "list item selected | current show = "; m.curShow
'm.curShow = displayShowDetailScreen(category, m.curShow)
'screen.SetFocusedListItem(m.curShow)

showList = getShowsForCategoryItem(m.Categories, m.curShow)
'print "showList: ";showList[0]
print "list item updated | new show = "; m.curShow
[color=#FF0000] showVideoScreen(showList[0])[/color]
' print "m.Categories feed: ";m.Categories.kids[m.curShow].kids[0].feed

'if kid.type = "special_category" then
'displaySpecialCategoryScreen()
'else

'displayShowDetailScreen(kid)
end if

else if msg.isScreenClosed() then
return 0
end if
'end If
end while

return 0

End Function


'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an associative array with the
'** data for the selected show. This data should be
'** sufficient for the show detail (springboard) to display
'**********************************************************
'Function displayCategoryPosterScreen(category As Object) As Dynamic

'if validateParam(category, "roAssociativeArray", "displayCategoryPosterScreen") = false return -1
'screen = preShowDetailScreen(category.Title, "")
'showDetailScreen(screen, showList, showIndex)
'return 0
'End Function
Function displayShowDetailScreen(category as Object, showIndex as Integer) As Integer

if validateParam(category, "roAssociativeArray", "displayShowDetailScreen") = false return -1

shows = getShowsForCategoryItem(category, m.curCategory)
screen = preShowDetailScreen(category.Title, category.kids[m.curCategory].Title)
showIndex = showDetailScreen(screen, shows, showIndex)

return showIndex
End Function
'**********************************************************
'** Special categories can be used to have categories that
'** don't correspond to the content hierarchy, but are
'** managed from the server by data from the feed. In these
'** cases we might show a different type of screen other
'** than a poster screen of content. For example, a special
'** category could be search, music, options or similar.
'**********************************************************
Function displaySpecialCategoryScreen() As Dynamic

' do nothing, this is intended to just show how
' you might add a special category ionto the feed

return 0
End Function

'************************************************************
'** initialize the category tree. We fetch a category list
'** from the server, parse it into a hierarchy of nodes and
'** then use this to build the home screen and pass to child
'** screen in the heirarchy. Each node terminates at a list
'** of content for the sub-category describing individual videos
'************************************************************
Function initCategoryList() As Void

conn = InitCategoryFeedConnection()

m.Categories = conn.LoadCategoryFeed(conn)
m.CategoryNames = conn.GetCategoryNames(m.Categories)

End Function
Function getShowsForCategoryItem(category As Object, item As Integer) As Object

if validateParam(category, "roAssociativeArray", "getCategoryList") = false return invalid

conn = InitShowFeedConnection(category.kids[item])
'print "Connection: ";conn
showList = conn.LoadShowFeed(conn)
return showList

End Function

'Function getShowsForCategoryItem(category As Object, item As Integer) As Object

'if validateParam(category, "roAssociativeArray", "getCategoryList") = false return invalid

'conn = InitShowFeedConnection(category.kids[item])
'showList = conn.LoadShowFeed(conn)
'return showList

'End Function
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.