Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
october8th
Level 7

I'm trying to play 3 files off of a USB stick in a row

Can I get some help figuring out why this example from the manual won't compile? thanks!!

Function showVideoScreen(episode As Object)
if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif
port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
' Note: HDBranded controls whether the "HD" logo is displayed for a
' title. This is separate from IsHD because its possible to
' have an HD title where you don't want to show the HD logo
' branding for the title. Set these two as appropriate for
' your content
episode.HDBranded = false
episode.IsHD = false
' Note: The preferred way to specify stream info in v2.6 is to use
' the Stream roAssociativeArray content meta data parameter.
episode.Stream = { url:"http://myserver.mydomain.com/mycontent.mp4",
bitrate:2000
quality:false
contentid:"mycontent-2000"
}
episode.StreamFormat: "mp4"
' now just tell the screen about the title to be played, set the
' message port for where you will receive events and call show to
' begin playback. You should see a buffering screen and then
' playback will start immediately when we have enough data buffered.
screen.SetContent(episode)
screen.SetMessagePort(port)
screen.Show()
' Wait in a loop on the message port for events to be received.
' We will just quit the loop and return to the calling function
' when the users terminates playback, but there are other things
' you could do here like monitor playback position and see events
' from the streaming player. Look for status messages from the
video
' player for status and failure events that occur during playback
while true
msg = wait(0, port)

if type(msg) = "roVideoScreenEvent" then
print "showVideoScreen | msg = "; msg.GetMessage() " | index
= "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isStatusMessage()
print "status message: "; msg.GetMessage()
else if msg.isPlaybackPosition()
print "playback position: "; msg.GetIndex()
else if msg.isFullResult()
print "playback completed"
exit while
else if msg.isPartialResult()
print "playback interrupted"
exit while
else if msg.isRequestFailed()
print "request failed – error: "; msg.GetIndex();" –
"; msg.GetMessage()
exit while
end if
end if
end while
End Function

Sub Main()
m.verbose = false
m.port = CreateObject("roMessagePort")
m.filesystem = CreateObject("roFilesystem")
m.filesystem.SetMessagePort(m.port)
anepisode = CreateObject("roAssociativeArray")
showVideoScreen(anepisode)
End Sub
0 Kudos