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?
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
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.
“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.
“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.
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()
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.
“pin2gtoes” wrote:
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.
IsFullResult() is an event, not a status. You should check for the IsPartialResult() event to determine if the entire video was played or not. You should also check for errors via the IsRequestFailed() event.