Hi. I’ve been poking around on these forums trying to find clues to get some things done to the Videoplayer example in the SDK. Two things, mainly.
-
I’ve managed to merge the “register” and the “videoplayer” examples. It launches, my categories come up, I pick one, the registration screen works, logs in my database just fine. I can go to my content catigory, but when I want to pick another catigory, it makes me register again. Same if I exit and restart the channel.
-
My ratings buttons that I’ve managed to add don’t work. What I want is when a rating is elected, I want to post it to a database thru a HTTP GET with values in parameters, just like my registration is done. When I try to acomplish this, here is the result
(Don’t laugh at my coding)
Unexpected event type: 15
showHomeScreen | msg = | index = 0
Screen closed
Button pressed: 2 0
ButtonPressed
ButtonPressed
m.ratingpost =http://www.site.net/roku/xml/ratepost.asp
ratingpost =devid=16C1AV051975&rating=80
Current Function:
026: Function showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer
027:
028: if validateParam(screen, "roSpringboardScreen", "showDetailScreen") = false return -1
029: if validateParam(showList, "roArray", "showDetailScreen") = false return -1
030:
031: refreshShowDetail(screen, showList, showIndex)
032:
033: 'remote key id's for left/right navigation
034: remoteKeyLeft = 4
035: remoteKeyRight = 5
036:
037: while true
038: msg = wait(0, screen.GetMessagePort())
039:
040: if type(msg) = "roSpringboardScreenEvent" then
041: if msg.isScreenClosed()
042: print "Screen closed"
043: exit while
044: else if msg.isRemoteKeyPressed()
045: print "Remote key pressed"
046: if msg.GetIndex() = remoteKeyLeft then
047: showIndex = getPrevShow(showList, showIndex)
048: if showIndex <> -1
049: refreshShowDetail(screen, showList, showIndex)
050: end if
051: else if msg.GetIndex() = remoteKeyRight
052: showIndex = getNextShow(showList, showIndex)
053: if showIndex <> -1
054: refreshShowDetail(screen, showList, showIndex)
055: end if
056: endif
057: else if msg.isButtonPressed()
058: print "ButtonPressed"
059: print "ButtonPressed"
060: if msg.GetIndex() = 1
061: PlayStart = RegRead(showList[showIndex].ContentId)
062: if PlayStart <> invalid then
063: showList[showIndex].PlayStart = PlayStart.ToInt()
064: endif
065: showVideoScreen(showList[showIndex])
066: refreshShowDetail(screen,showList,showIndex)
067: endif
068: if msg.GetIndex() = 2
069: showList[showIndex].PlayStart = 0
070: showVideoScreen(showList[showIndex])
071: refreshShowDetail(screen,showList,showIndex)
072: endif
073: if msg.GetIndex() = 3
074: m.rating = msg.GetData()
075: sn = GetDeviceESN()
076: rating = msg.GetData().ToStr()
077: m.ratingpost = "http://www.360tv.net/roku/xml/ratepost.asp"
078: ratingpost = "devid=" + sn + "&rating=" + rating
079: http = NewHttp(m.ratingpost)
080: http.AddParam("partner", "roku")
081: http.AddParam("deviceID", sn)
082:
083:
084: print "m.ratingpost =" m.ratingpost
085: print "ratingpost =" ratingpost
086: m.ratingpost.PostFromString(ratingpost)
087: endif
088: print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
089: end if
090: else
091: print "Unexpected message class: "; type(msg)
092: end if
093: end while
094:
095: return showIndex
096:
097: End Function
Member function not found in BrightScript Component or interface. (runtime error &hf4) in ...g:/source/appDetailScreen.brs(86)
086: m.ratingpost.PostFromString(ratingpost)
Backtrace:
Function showdetailscreen(screen As <uninitialized>, showlist As <uninitialized>, showindex As Integer) As Integer
file/line: /tmp/plugin/MFAAAAf7jGw7...g:/source/appDetailScreen.brs(86)
Function displayshowdetailscreen(category As <uninitialized>, showindex As Integer) As Integer
file/line: /tmp/plugin/MFAAAAf7jGw7/pkg:/source/appPosterScreen.brs(93)
Function showposterscreen(screen As <uninitialized>, category As <uninitialized>) As Integer
file/line: /tmp/plugin/MFAAAAf7jGw7/pkg:/source/appPosterScreen.brs(69)
Function displaycategoryposterscreen(category As <uninitialized>) As
file/line: /tmp/plugin/MFAAAAf7jGw7/pkg:/source/appHomeScreen.brs(83)
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/MFAAAAf7jGw7/pkg:/source/appHomeScreen.brs(59)
Function main() As
file/line: /tmp/plugin/MFAAAAf7jGw7/pkg:/source/appMain.brs(20)
Local Variables:
screen &h0010 bsc:roSpringboardScreen, refcnt=2
showlist &h0010 bsc:roArray, refcnt=2
showindex &h0002 Integer val:0
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=7
remotekeyleft &h0002 Integer val:4
remotekeyright &h0002 Integer val:5
msg &h0010 bsc:roSpringboardScreenEvent, refcnt=1
playstart &h0000 <uninitialized> val:Uninitialized
sn &h8010 bsc:roString (2.1 was String), refcnt=1
rating &h8010 bsc:roString (2.1 was String), refcnt=1
ratingpost &h8010 bsc:roString (2.1 was String), refcnt=1
http &h0010 bsc:roAssociativeArray, refcnt=1
BrightScript Debugger> Note: GC - Found 75 orphaned objects (objects in a circular ref loop).
The code in my appDetainScreen.brs is as follows
'**********************************************************
'** Video Player Example Application - Detail Screen
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'**********************************************************
Function preShowDetailScreen(breadA=invalid, breadB=invalid) As Object
port=CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
screen.SetDescriptionStyle("episode")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if
return screen
End Function
'***************************************************************
'** The show detail screen (springboard) is where the user sees
'** the details for a show and is allowed to select a show to
'** begin playback. This is the main event loop for that screen
'** and where we spend our time waiting until the user presses a
'** button and then we decide how best to handle the event.
'***************************************************************
Function showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer
if validateParam(screen, "roSpringboardScreen", "showDetailScreen") = false return -1
if validateParam(showList, "roArray", "showDetailScreen") = false return -1
refreshShowDetail(screen, showList, showIndex)
'remote key id's for left/right navigation
remoteKeyLeft = 4
remoteKeyRight = 5
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent" then
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isRemoteKeyPressed()
print "Remote key pressed"
if msg.GetIndex() = remoteKeyLeft then
showIndex = getPrevShow(showList, showIndex)
if showIndex <> -1
refreshShowDetail(screen, showList, showIndex)
end if
else if msg.GetIndex() = remoteKeyRight
showIndex = getNextShow(showList, showIndex)
if showIndex <> -1
refreshShowDetail(screen, showList, showIndex)
end if
endif
else if msg.isButtonPressed()
print "ButtonPressed"
print "ButtonPressed"
if msg.GetIndex() = 1
PlayStart = RegRead(showList[showIndex].ContentId)
if PlayStart <> invalid then
showList[showIndex].PlayStart = PlayStart.ToInt()
endif
showVideoScreen(showList[showIndex])
refreshShowDetail(screen,showList,showIndex)
endif
if msg.GetIndex() = 2
showList[showIndex].PlayStart = 0
showVideoScreen(showList[showIndex])
refreshShowDetail(screen,showList,showIndex)
endif
if msg.GetIndex() = 3
m.rating = msg.GetData()
sn = GetDeviceESN()
rating = msg.GetData().ToStr()
m.ratingpost = "http://www.360tv.net/roku/xml/ratepost.asp"
ratingpost = "devid=" + sn + "&rating=" + rating
http = NewHttp(m.ratingpost)
http.AddParam("partner", "roku")
http.AddParam("deviceID", sn)
print "m.ratingpost =" m.ratingpost
print "ratingpost =" ratingpost
m.ratingpost.PostFromString(ratingpost)
endif
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while
return showIndex
End Function
'**************************************************************
'** Refresh the contents of the show detail screen. This may be
'** required on initial entry to the screen or as the user moves
'** left/right on the springboard. When the user is on the
'** springboard, we generally let them press left/right arrow keys
'** to navigate to the previous/next show in a circular manner.
'** When leaving the screen, the should be positioned on the
'** corresponding item in the poster screen matching the current show
'**************************************************************
Function refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer
if validateParam(screen, "roSpringboardScreen", "refreshShowDetail") = false return -1
if validateParam(showList, "roArray", "refreshShowDetail") = false return -1
show = showList[showIndex]
'Uncomment this statement to dump the details for each show
'PrintAA(show)
screen.ClearButtons()
if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then
screen.AddButton(1, "Resume playing")
screen.AddButton(2, "Play from beginning")
screen.AddRatingButton(3, 50, 75 )
screen.SetStaticRatingEnabled(false)
else
screen.addbutton(2,"Play")
screen.AddRatingButton(3, 50, 75 )
end if
screen.SetContent(show)
screen.Show()
End Function
'********************************************************
'** Get the next item in the list and handle the wrap
'** around case to implement a circular list for left/right
'** navigation on the springboard screen
'********************************************************
Function getNextShow(showList As Object, showIndex As Integer) As Integer
if validateParam(showList, "roArray", "getNextShow") = false return -1
nextIndex = showIndex + 1
if nextIndex >= showList.Count() or nextIndex < 0 then
nextIndex = 0
end if
show = showList[nextIndex]
if validateParam(show, "roAssociativeArray", "getNextShow") = false return -1
return nextIndex
End Function
'********************************************************
'** Get the previous item in the list and handle the wrap
'** around case to implement a circular list for left/right
'** navigation on the springboard screen
'********************************************************
Function getPrevShow(showList As Object, showIndex As Integer) As Integer
if validateParam(showList, "roArray", "getPrevShow") = false return -1
prevIndex = showIndex - 1
if prevIndex < 0 or prevIndex >= showList.Count() then
if showList.Count() > 0 then
prevIndex = showList.Count() - 1
else
return -1
end if
end if
show = showList[prevIndex]
if validateParam(show, "roAssociativeArray", "getPrevShow") = false return -1
return prevIndex
End Function
Any advice other than “read the documentation” (because I’ve tried) would be appreciated.
