episode={shortdescriptionline2: ""
shortdescriptionline1: "test 123"
contentid: "10014"
sdposterurl: "http://test.com/testSD.jpg"
description: "this is a test"
ishd: true
streamformat: "mp4"
contentquality: "HD"
length: 0
streamurls: ["http://test.com/test.mp4"
"http://test.com/test-3000kb.mp4"
"http://test.com/test-1500kb.mp4"
"http://test.com/test-800kb.mp4"]
streamqualities: ["HD"
"HD"
"HD"
"HD"]
streambitrates:[9000
3000
1500
800]
hdposterurl: "http://test.com/testHD.jpg"
title: "a test a test a test"
contenttype: "episode"
hdbranded: true}
episode={shortdescriptionline2: ""
shortdescriptionline1: "test 123"
contentid: "10014"
sdposterurl: "http://test.com/testSD.jpg"
description: "this is a test"
ishd: true
streamformat: "hls"
contentquality: "HD"
length: 0
streamurls: ["http://myserver.com/playlists/multibitrate.m3u8"]
streamqualities: ["HD"]
streambitrates:[0]
hdposterurl: "http://test.com/testHD.jpg"
title: "a test a test a test"
contenttype: "episode"
switchingStrategy="full-adaptation"
hdbranded: true}
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")
screen.SetMessagePort(port)
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()
'Uncomment his line to dump the contents of the episode to be played
'PrintAA(episode)
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
End Function
item.StreamFormat="mp4"
End If
If item.StreamFormat="hls"
item.SwitchingStrategy="full-adaptation"
End If
sub main()
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = [0]
videoclip.StreamUrls = ["http://wowzastreamingserver.com:1935/vod/smil:yoursmilfile.smil/playlist.m3u8"]
di = CreateObject("roDeviceInfo")
if di.GetDisplayType() = "HDTV" then
videoclip.streamqualities=["HD"]
else
videoclip.streamqualities=["SD"]
end if
videoclip.StreamFormat = "hls"
videoclip.Title = "my awesome live stream"
videoclip.SubtitleUrl = ""
videoclip.switchingstrategy="full-adaptation"
video.SetContent(videoclip)
video.show()
lastSavedPos = 0
statusInterval = 10
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event
print "Closing video screen"
return
exit while
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()
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
end if
end while
end sub