raja632
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2012
06:44 AM
Live Streaming Issue
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
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
1 REPLY 1
RokuChris
Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2012
11:01 AM
Re: Live Streaming Issue
Your URL points to an HTML page...
Live streaming on Roku only works with HLS or SmoothStreaming, so you need to use the URL of a stream in one of those formats and set your streamFormat attribute to "hls" or "ism" depending on which format your stream is in.
See the Encoding Guide (http://sdkdocs.roku.com/display/RokuSDK ... ding+Guide) or this thread (viewtopic.php?f=34&t=49540&p=338299#p338267) for details.
$ curl --head "http://cdn.livestream.com/embed/dagrid"
HTTP/1.1 200 OK
Server: Apache
ETag: "4085edd50c92d6d1550db489bf3a2bcb:1331115171"
Last-Modified: Wed, 07 Mar 2012 10:12:51 GMT
Content-Type: text/html
Cache-Control: max-age=86400
Date: Sun, 05 Aug 2012 17:53:33 GMT
Connection: keep-alive
Live streaming on Roku only works with HLS or SmoothStreaming, so you need to use the URL of a stream in one of those formats and set your streamFormat attribute to "hls" or "ism" depending on which format your stream is in.
See the Encoding Guide (http://sdkdocs.roku.com/display/RokuSDK ... ding+Guide) or this thread (viewtopic.php?f=34&t=49540&p=338299#p338267) for details.