rsromeo
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2010
12:01 AM
SIMULATING A PLAYLIST
Trying to figure out how to play multiple mp4 files in succession. I know without using HLS, there will be rebuffering in between each clip but I can live with that. Just trying to make it work. Does anyone know if the following will work?
this.player.SetContentList([{
Stream: { url:"http://test.com/video1.mp4" }
StreamFormat: "mp4"
},
Stream: { url:"http://test.com/video2.mp4" }
StreamFormat: "mp4"
}])
this.player.SetContentList([{
Stream: { url:"http://test.com/video1.mp4" }
StreamFormat: "mp4"
},
Stream: { url:"http://test.com/video2.mp4" }
StreamFormat: "mp4"
}])
11 REPLIES 11


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2010
09:16 AM
Re: SIMULATING A PLAYLIST
My guess would be no, that won't work. roVideoScreen doesn't have a SetContentList() method. The easiest way I've found to play a series of videos is to just feed them one at a time to a roVideoScreen. Given an array of content-meta-data objects, you could do something like this:
for each video in videoArray
videoScreen = CreateObject("roVideoScreen")
videoScreen.SetMessagePort(CreateObject("roMessagePort"))
videoScreen.SetContent(video)
videoScreen.Show()
while true
msg = wait(0, videoScreen.GetMessagePort())
if msg.isScreenClosed()
exit while
end if
end while
next
rsromeo
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2010
08:54 AM
Re: SIMULATING A PLAYLIST
how do you create an array of associated arrays? I'm guessing thats what I need to pass into the for-next loop. I tried this with an roList and it didn't work. It only played first video and then jumped out of channel when done.


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2010
10:32 AM
Re: SIMULATING A PLAYLIST
"rsromeo" wrote:
how do you create an array of associated arrays? I'm guessing thats what I need to pass into the for-next loop. I tried this with an roList and it didn't work. It only played first video and then jumped out of channel when done.
Were there any other screens open under your roVideoScreen at the time? A Roku channel will exit when the bottom screen is closed, so you will need some other screen open before entering your loop to keep that from happening. A blank roImageCanvas or an empty roParagraphScreen will do the job.
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2010
01:01 PM
Re: SIMULATING A PLAYLIST
"rsromeo" wrote:
how do you create an array of associated arrays? I'm guessing thats what I need to pass into the for-next loop. I tried this with an roList and it didn't work. It only played first video and then jumped out of channel when done.
assarray=CreateObject("RoArray",1,true)
assarray=[{key1:"dog",key2:"cat"},{key1:"apple",key2:"pear",key3:"banana"},{key1:"audi",key2:"mercedes",key3:"jaguar"}]
so now assarray is an array of associative arrays where
BrightScript Debugger> ?assarray
<ROT:roAssociativeArray>
<ROT:roAssociativeArray>
<ROT:roAssociativeArray>
BrightScript Debugger> ?assarray[0]
key2: cat
key1: dog
BrightScript Debugger> ?assarray[1]
key3: banana
key2: pear
key1: apple
BrightScript Debugger> ?assarray[2]
key3: jaguar
key2: mercedes
key1: audi
BrightScript Debugger> ?assarray[2].key2
mercedes
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2010
01:03 PM
Re: SIMULATING A PLAYLIST
No need for the CreateObject line in that snippet, jbrave. The square brackets in the next line take care of that for you.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2010
01:06 PM
Re: SIMULATING A PLAYLIST
cool! I wasn't completely sure about that so I guess that is one more redunancy I can eliminate from my project!
- Joel
- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
rsromeo
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2010
10:52 PM
Re: SIMULATING A PLAYLIST
thanks for all your help guys! It worked!! 🙂
rsromeo
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2010
03:04 PM
Re: SIMULATING A PLAYLIST
ok my playlist works but I have another issue now. After each video plays, it advances to the next video in the array. that works great. My problem is the close screen event which occurs after each video is played. How can this be controlled so that when a user presses the UP key on remote, it exits the playlist? Right now, the UP key closes the current video screen and then it loops to the next video giving the user no way to exit other than using the Home key or advancing through all the videos in the array. Here's a sample snipet of code I am using:
For each clip in array
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
video.SetContent(clip)
video.show()
while true
msg = wait(0, video.GetMessagePort())
if msg.isRemoteKeyPressed()
i = msg.GetIndex()
print "Key Pressed - " ; msg.GetIndex()
if (i = 2) then
print "Up pressed"
goto closecanvas
end if
else if msg.isScreenClosed()
print "Screen closed"
exit while
end if
end while
end for
closecanvas:
canvas.close()
For each clip in array
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
video.SetContent(clip)
video.show()
while true
msg = wait(0, video.GetMessagePort())
if msg.isRemoteKeyPressed()
i = msg.GetIndex()
print "Key Pressed - " ; msg.GetIndex()
if (i = 2) then
print "Up pressed"
goto closecanvas
end if
else if msg.isScreenClosed()
print "Screen closed"
exit while
end if
end while
end for
closecanvas:
canvas.close()
pin2gtoes
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2011
07:16 AM
Re: SIMULATING A PLAYLIST
My problem is the close screen event which occurs after each video is played. How can this be controlled so that when a user presses the UP key on remote, it exits the playlist? Right now, the UP key closes the current video screen and then it loops to the next video giving the user no way to exit other than using the Home key or advancing through all the videos in the array.
In case you are still looking for an answer, here's what I have been doing.
Check msg.isFullResult() inside while loop before continuing to the next video. isFullResult() returns True if the entire video was played. When user interrupts playback, isFullResult() will return False.
Nuod Tayo - Filipino Channel for Roku - (http://blog.nuodtayo.tv)