Hi,
I am new roku development and forgive me for basic questions.
I am trying to develope a roku channel for live streaming a video. The URL is
http://cdn.livestream.com/embed/dagrid and it works great in a browser. I tried the below code for having embedded into a roku app and it is not loading anything. any help is appreciated.
Function displayVideo()
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
bitrates = [0]
urls = ["http://cdn.livestream.com/embed/dagrid"]
qualities = ["HD"]
StreamFormat = "m4v"
title = "Raj Sample Video"
srt = ""
videoclip = CreateObject("roAssociativeArray")
videoclip.Title = title
videoclip.Live=true
print "srt = ";srt
if srt <> invalid and srt <> "" then
videoclip.SubtitleUrl = srt
end if
video.SetContent(videoclip)
video.show()
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"
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 Function
Thanks,
Raj