Regarding PreRoll I added the function for showPreroll into its own appPreRoll.brs file and in appVideoScreen.brs I have added this section, but always errors out on the line preroll = { line 142 in my script
Any idea why?
Debug shows this only but the
Syntax I cant find an error:
*** ERROR compiling /pkg:/source/appVideoScreen.brs:
Syntax Error. (compile error &h02) in ...kg:/source/appVideoScreen.brs(142)
.
.
.
preroll = {
streamFormat: "mp4"
stream: {
url: "
http://www.archive.org/download/kelloggs_variety_pak/kelloggs_variety_pak_512kb.mp4"
}
}
ShowVideoScreen(preroll)
port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.SetContent(preroll)
screen.Show()
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed()
exit while
end if
end if
end while
screen.Close()
end sub
' Create and display a blank roImageCanvas to prevent the
' underlying UI from flickering between videos after Pre-Roll
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(0, "#000000")
canvas.Show()
' Play the preroll video with trick play disabled
if ShowPreroll(preroll)
Function showVideoScreen(episode As Object)
'*Start to Check if Billing was a successful*************************
' if (not BillReminder()) then return invalid
'*End Check if Billing was successful********************************
if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif
'* Start optional Tracking of video content played****************
' Track(episode["contentId"])
'* End optional Tracking of video content played****************
port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()
'Uncomment his line to dump the contents of the episode to be played
PrintAA(episode)
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent" then
print "showHomeScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
RegWrite(episode.ContentId, nowpos.toStr())
else
print "Unexpected event type: "; msg.GetType()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while
End Function
' End Pre-Roll
End if
' close the blank canvas and return the user to the previous UI screen
canvas.Close()