player = CreateObject("roVideoPlayer")
messagePort = CreateObject("roMessagePort")
player.SetMessagePort(messagePort)
player.SetPositionNotificationPeriod(1)
player.SetContentList(playList)
player.Play()
'// Create Metadata Hash
metaData = {
Description: decription,
videoUrl: videoUrl,
Length: duration,
pubDate: videoTime,
Title: videoTitle,
StreamUrls: videoItems,
StreamBitrates: videoBitrates,
StreamQualities: videoQualities,
StreamFormat: "mp4"
}
'// Push Metadata Into Playlist
playList.push(metaData)
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(0, {Color: "#00000000"})
canvas.Show()
player.SetDestinationRect({x: 0, y: 0, w: 1280, h: 720}) ' 720x480 for SD
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
port = CreateObject("roMessagePort")
canvas = CreateObject("roImageCanvas")
canvas.SetMessagePort(port)
canvas.SetLayer(0, { color: "#00000000", CompositionMode: "Source" })
canvas.Show()
player = CreateObject("roVideoPlayer")
player.SetMessagePort(port)
player.SetDestinationRect(canvas.GetCanvasRect())
player.SetContentList([{
streamFormat: "mp4"
stream: { url: "http://video.ted.com/talks/podcast/DavidBrooks_2011.mp4" }
}])
player.Play()
while true
msg = Wait(0, port)
print type(msg)
end while