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

Brightcove App

Hi everyone. Sorry but I am very much a newbie at this but hoping that someone could please answer my query (speak to me like I am a child please 😉 )

I have video assets uploaded to a brightcove account and I have followed the instructions to edit the required docs within the brightcove/roku app as outlined in their 'readme' doc (http://opensource.brightcove.com/projec ... sample-app) - but upon installing to my Roku 2 box I get the following code error:

ERROR compiling /pkg:/source/appHomeScreen.brs:
SUB or FUNCTION defined twice. (compile error &had) in ...pkg:source/appHomeScreen.brs (35)

Line 35 in the appHomeScreen.brs file reads as:

Function showHomeScreen(screen) As Integer


How do I resolve this problem? I am sure there is a 'common sense' answer but thats the problem (common sense!!). All of the code is pasted below. Please advise/help. Thanks for reading this.
Regards
Mediaman

'*****************************************************************
'** Video Player Example Application -- Home Screen
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'*****************************************************************

'******************************************************
'** 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

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 Integer

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

initCategoryList()
screen.SetListNames(m.CategoryNames)

m.curCategory = 0
screen.SetContentList(getContentForCategory(m.curCategory))

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
print "list focused | index = "; msg.GetIndex()
m.curCategory = msg.GetIndex()
screen.SetContentList(getContentForCategory(m.curCategory))
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()
showVideoScreen(getContentForCategory(m.curCategory)[msg.GetIndex()])
else if msg.isScreenClosed() then
return -1
end if
end If
end while

return 0

End Function




'************************************************************
'** initialize the category list. We fetch a category list
'** from the server, and parse it into a list of filter
'** categories
'************************************************************
Function initCategoryList() As Void

conn = InitCategoryFeedConnection()

m.JSONObj = conn.LoadCategoryFeed(conn)
m.CategoryNames = conn.GetCategoryNames(m.JSONObj)
m.ContentList = conn.GetContentList(m.JSONObj)

End Function



'********************************************************************
'** Return the list of content corresponding the currently selected
'** category in the filter banner. As the user highlights a
'** category on the top of the poster screen, the list of posters
'** displayed should be refreshed to correspond to the highlighted
'** item. This function returns the list of content for that category
'********************************************************************
Function getContentForCategory(index As Integer) As Object
list = []
For each item in m.ContentList
if item.Category = index
list.push(item)
end if
end for
return list
End Function
0 Kudos
6 REPLIES 6
MSGreg
Visitor

Re: Brightcove App

Look for a showhomescreen function or sub in any of the .brs files within the package. I don't think there is any scoping between files. Rename one of them uniquely (as well as any calls to the one you renamed).
0 Kudos
mediaman
Visitor

Re: Brightcove App

Hi, Thanks for your reply but unfortunately I am none the wiser. Any other advise apart from coding for dummies??? Damn, never realized this was going to be so difficult. Damn. Damn. Damn.
Mediaman
0 Kudos
MSGreg
Visitor

Re: Brightcove App

Search the folder containing the manifest file and all folders underneath that one for all .brs files. Within each file, search for "showhomescreen". You should find at least two that also begin with the word "sub" or "function". One of those you already know about.

My guess is that you've combined two examples.

You have two instances of showhomescreen within your code. You can only have one. You'll have to determine if the second one is redundant or complimentary based on the desired functionality of the channel.
0 Kudos
mediaman
Visitor

Re: Brightcove App

Thank you for your help/reply. I will speak with a coding friend to seek assistance. But just to let you know, I have not edited any of the coding at any stage apart from adding my unique Brightcove player & ID number as requested and therefore I still am confused why no one before me would have received these errors outlined above. Strange!! If anyone else has any ideas then please throw them at me. I will off course come back and keep you posted. Thank you kindly for giving me help.
Regards
Mediaman
0 Kudos
belltown
Roku Guru

Re: Brightcove App

Try contacting the developers of the Brightcove Roku app through their web site or at opensource@brightcove.com. You didn't do anything wrong. Their channel code contains several functions defined twice. At least the following files contain duplicate functions: Main.brs and appMain.brs; HomeScreen.brs and appHomeScreen.brs; and VideoScreen.brs and appVideoScreen.brs.

It looks like when they created the .zip file containing the source code they included a set of files that should not have been included.
0 Kudos
mediaman
Visitor

Re: Brightcove App

Hi everyone.

This issue has now been resolved - and I have managed to get a .zip file onto my Roku and a great channel up and running - from my Brightcove account.

Thanks for your help in nudging me in the right direction (which was the problem).

Personally, I am not a coder naturally and have to work damn hard at it - therefore the problem with the Brightcove Roku app is actually down to the fact that you do need a competent level of coding or access to the resources.

There are a lot of files with the source directory which do have duplicated function codes within them but this is not an error but rather down to what and how you want to develop between brightcove / roku UI for additional user functionality.

The brightcove / roku app and references to it is on Github found here https://github.com/BrightcoveOS/Roku-Sample-App

The files with the 'app' prefix are duplicates and I also found another duplicated on the HttpUtils file (I removed these files with the 'app' extention and the httpUtils file - and then created my .zip once more to upload it to the Roku box (just to get me started) and it worked really well. Really well.

Opensource at Brightcove have been helpful in resolving this 'human error not technical'. Hehe.

Thanks again guys for your correct observations and suggestions.
Mediaman.
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.