Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
krazy
Visitor

How to play list of files in order

Hello everybody, we need some help in playing a playlist.

It is possible to play single mp4 file through http:// web server where the file is presented as an <item> in xml

Now say we have file1.mp4 , file2.mp4 , we need to play them all with single click when user selects that item to play in a sequence ,
can someone guide us how to do this. may be through a m3u8 playlist ? if yes how to format the playlist,

being VOD , does roku also support any other url other than web server http url to publish VOD ?

Thank you
Rama
0 Kudos
5 REPLIES 5
RokuKevin
Visitor

Re: How to play list of files in order

HLS enables playlist support in the sense that you can mix segments from different sources. For example, you could have your main content intermixed with ads. The Roku will take care of the different pts values from the different encoding sources.

However, there is no way to do playlists of .mp4 files without buffering. If you can live with buffering between each stream in your playlist, the following solution would work:


Function displayVideo()
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)

video2 = CreateObject("roVideoScreen")
p2 = CreateObject("roMessagePort")
video2.setMessagePort(p2)

videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = [0]
videoclip.StreamQualities = ["HD"]
videoclip.StreamUrls = ["yourFirstStreamURL"]
videoclip.StreamFormat="mp4"

videoclip2 = CreateObject("roAssociativeArray")
videoclip2.StreamBitrates = [0]
videoclip2.StreamUrls = ["yourSecondStreamURL"]
videoclip2.StreamQualities = ["HD"]
videoclip2.StreamFormat = "mp4"

lastSavedPos = 0
statusInterval = 10 'position must change by more than this number of seconds before saving

video.SetContent(videoclip)
video.SetPositionNotificationPeriod( 1 )
video.show()
pos1 = videoEventLoop(video, videoclip)

video2.SetContent(videoclip2)
video2.show()
pos2 = videoEventLoop(video2, videoclip2)

End Function

'*************************************************************
'** videoEventLoop()
'*************************************************************
Function videoEventLoop(video As Object, videoclip As Object, nowpos=0 As Integer) As Integer
validateParam(video, "roVideoScreen", "videoEventLoop")
validateParam(videoclip, "roAssociativeArray", "videoEventLoop")
lastSavedPos = 0
statusInterval = 10 'position must change by more than this number of seconds before saving
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event
print "Closing video screen"
return nowpos
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
if nowpos > 10000

end if
if nowpos > 0
if abs(nowpos - lastSavedPos) > statusInterval
lastSavedPos = nowpos
end if
end if
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
return -1
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
end if
end while
return nowpos
End Function


--Kevin
0 Kudos
destruk
Streaming Star

Re: How to play list of files in order

If you have the extra server space and time to do it, you could re-encode the mp4's into one larger file, merging them, to eliminate buffering, and have that played instead.
0 Kudos
krazy
Visitor

Re: How to play list of files in order

Hmm, not a bad idea to merge, just checking the remote and i see no button there to do a skip to next track type . thought if i could publish a set of programs in one item and user would be able to select whichever program by skipping, the other way is to present each program as an item
0 Kudos
krazy
Visitor

Re: How to play list of files in order

Kevin, you got me wrong there, to insert AD's ( it's great idea we need in later stage though)

file1.mp4
file2.mp4
etc..

all need to be presented as play list. and

in real networks there used to be ram file where the file contained rtsp links to each file one by one, when ram file was called from web server to real player, the player plays these files one by one in sequence we are looking for same thing to do here with roku but how ?
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: How to play list of files in order

This thread (viewtopic.php?f=34&t=32501) may be of help.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.