yanabi
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2011
08:05 AM
roVideoPlayer stuck at buffering stage
Can anyone help me out with this code please? I am using the hls format to stream channel into Roku. The hls url works in IOS system, but not in roku. I have added the roSystemLog object in the code and can see that the roVideoPlayer first gets the .m3u8 file and then follows it to get the .ts files. I can see these files being downloaded properly (roSystemLog gives the http response of 200). however the player is stuck in a never ending loop of just buffer and never showing any actual video content.
here is the link to my m3u8 file: http://<server>:1935/<app>/<channel>/playlist.m3u8
(link has been removed)
and here is my test code:
' ********************************************************************
' ** Sample PlayVideo App
' ** Copyright (c) 2009 Roku Inc. All Rights Reserved.
' ********************************************************************
Sub Main(args As Dynamic)
'initialize theme attributes like titles, logos and overhang color
initTheme()
if type(args) = "roAssociativeArray" and type(args.url) = "roString" then
displayVideo(args)
end if
print "Type args = "; type(args)
print "Type args.url = "; type(args.url)
'has to live for the duration of the whole app to prevent flashing
'back to the roku home screen.
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()
itemMpeg4 = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
HDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
IsHD:False
HDBranded:False
ShortDescriptionLine1:"Dan Gilbert asks, Why are we happy?"
ShortDescriptionLine2:""
Description:"Harvard psychologist Dan Gilbert says our beliefs about what will make us happy are often wrong -- a premise he supports with intriguing research, and explains in his accessible and unexpectedly funny book, Stumbling on Happiness."
Rating:"NR"
StarRating:"80"
Length:1280
Categories:["Technology","Talk"]
Title:"Dan Gilbert asks, Why are we happy?"
}
itemVenter = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/CraigVenter-2008.jpg"
HDPosterUrl:"file://pkg:/images/CraigVenter-2008.jpg"
IsHD:False
HDBranded:False
ShortDescriptionLine1:"Can we create new life out of our digital universe?"
ShortDescriptionLine2:""
Description:"He walks the TED2008 audience through his latest research into fourth-generation fuels -- biologically created fuels with CO2 as their feedstock. His talk covers the details of creating brand-new chromosomes using digital technology, the reasons why we would want to do this, and the bioethics of synthetic life. A fascinating Q&A with TED's Chris Anderson follows."
Rating:"NR"
StarRating:"80"
Length:1972
Categories:["Technology","Talk"]
Title:"Craig Venter asks, Can we create new life out of our digital universe?"
}
item = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/BigBuckBunny.jpg"
HDPosterUrl:"file://pkg:/images/BigBuckBunny.jpg"
IsHD:true
HDBranded:true
ShortDescriptionLine1:"Big Buck Bunny"
ShortDescriptionLine2:""
Description:"Big Buck Bunny is being served using a Wowza server running on Amazon EC2 cloud services. The video is transported via HLS HTTP Live Streaming. A team of small artists from the Blender community produced this open source content..."
Rating:"NR"
StarRating:"80"
Length:600
Categories:["Technology","Cartoon"]
Title:"Big Buck Bunny"
}
showSpringboardScreen(itemVenter)
'showSpringboardScreen(itemMpeg4) 'uncomment this line and comment out the next to see the old mpeg4 example
'showSpringboardScreen(item) 'uncomment this line to see the BigBuckBunny example
'exit the app gently so that the screen doesn't flash to black
screenFacade.showMessage("")
sleep(25)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangPrimaryLogoOffsetSD_X = "72"
theme.OverhangPrimaryLogoOffsetSD_Y = "15"
theme.OverhangSliceSD = "pkg:/images/Overhang_BackgroundSlice_SD43.png"
theme.OverhangPrimaryLogoSD = "pkg:/images/Logo_Overhang_SD43.png"
theme.OverhangPrimaryLogoOffsetHD_X = "123"
theme.OverhangPrimaryLogoOffsetHD_Y = "20"
theme.OverhangSliceHD = "pkg:/images/Overhang_BackgroundSlice_HD.png"
theme.OverhangPrimaryLogoHD = "pkg:/images/Logo_Overhang_HD.png"
app.SetTheme(theme)
End Sub
'*************************************************************
'** showSpringboardScreen()
'*************************************************************
Function showSpringboardScreen(item as object) As Boolean
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
print "showSpringboardScreen"
screen.SetMessagePort(port)
screen.AllowUpdates(false)
if item <> invalid and type(item) = "roAssociativeArray"
screen.SetContent(item)
endif
screen.SetDescriptionStyle("generic") 'audio, movie, video, generic
' generic+episode=4x3,
screen.ClearButtons()
screen.AddButton(1,"Play")
screen.AddButton(2,"Go Back")
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.Show()
' no need to wait for user, play video directly
displayVideo("")
downKey=3
selectKey=6
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
if msg.GetIndex() = 1
displayVideo("")
else if msg.GetIndex() = 2
return true
endif
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
else
print "wrong type.... type=";msg.GetType(); " msg: "; msg.GetMessage()
endif
end while
return true
End Function
'*************************************************************
'** displayVideo()
'*************************************************************
Function displayVideo(args As Dynamic)
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
'video = CreateObject("roVideoPlayer")
video.setMessagePort(p)
syslog = CreateObject("roSystemLog")
syslog.setMessagePort(p)
syslog.EnableType("bandwidth.minute")
syslog.EnableType("http.error")
syslog.EnableType("http.connect")
'bitrates = [0] ' 0 = no dots, adaptive bitrate
'bitrates = [348] ' <500 Kbps = 1 dot
'bitrates = [664] ' <800 Kbps = 2 dots
'bitrates = [996] ' <1.1Mbps = 3 dots
'bitrates = [2048] ' >=1.1Mbps = 4 dots
bitrates = [0]
urls = ["http://<server>:1935/<app>/<channel>/playlist.m3u8"]
' (link has been removed)
StreamFormat = "hls"
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = bitrates
videoclip.StreamUrls = urls
videoclip.StreamQualities = qualities
videoclip.StreamFormat = StreamFormat
videoclip.Title = title
print "srt = ";srt
if srt <> invalid and srt <> "" then
videoclip.SubtitleUrl = srt
end if
' min bandwidth scenario
videoclip.minBandwidth = 10
videoclip.live = true
video.SetContent(videoclip)
video.SetPositionNotificationPeriod(10)
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.isStatusMessage()
print "status message: "; msg.GetMessage()
else if msg.isPlaybackPosition() then
print "playback position: "; msg.GetIndex()
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else if msg.isStreamStarted()
print "stream started:- msg: "; msg.GetMessage(); " index: "; msg.GetIndex(); " info: "; msg.GetInfo().url; " measuredbitrate: "; msg.GetInfo().MeasuredBitrate; " isunderrun: "; msg.GetInfo().isUnderrun
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
elseif type(msg) = "roSystemLogEvent" then
' Handle the roSystemLogEvents:
i = msg.GetInfo()
if i.LogType = "http.error" or i.LogType = "http.connect"
if i.LogType = "http.error"
print "http error: "; i.HttpCode; "URL: ";i.Url
else
print "http connect: "; i.url
print "http method: "; i.method; " status: "; i.status
print "http code: "; i.httpcode
end if
else if i.LogType = "bandwidth.minute"
'if i.LogType = "bandwidth.minute"
print "Bandwidth is "; i.Bandwidth
end if
end if
end while
End Function
here is the link to my m3u8 file: http://<server>:1935/<app>/<channel>/playlist.m3u8
(link has been removed)
and here is my test code:
' ********************************************************************
' ** Sample PlayVideo App
' ** Copyright (c) 2009 Roku Inc. All Rights Reserved.
' ********************************************************************
Sub Main(args As Dynamic)
'initialize theme attributes like titles, logos and overhang color
initTheme()
if type(args) = "roAssociativeArray" and type(args.url) = "roString" then
displayVideo(args)
end if
print "Type args = "; type(args)
print "Type args.url = "; type(args.url)
'has to live for the duration of the whole app to prevent flashing
'back to the roku home screen.
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()
itemMpeg4 = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
HDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
IsHD:False
HDBranded:False
ShortDescriptionLine1:"Dan Gilbert asks, Why are we happy?"
ShortDescriptionLine2:""
Description:"Harvard psychologist Dan Gilbert says our beliefs about what will make us happy are often wrong -- a premise he supports with intriguing research, and explains in his accessible and unexpectedly funny book, Stumbling on Happiness."
Rating:"NR"
StarRating:"80"
Length:1280
Categories:["Technology","Talk"]
Title:"Dan Gilbert asks, Why are we happy?"
}
itemVenter = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/CraigVenter-2008.jpg"
HDPosterUrl:"file://pkg:/images/CraigVenter-2008.jpg"
IsHD:False
HDBranded:False
ShortDescriptionLine1:"Can we create new life out of our digital universe?"
ShortDescriptionLine2:""
Description:"He walks the TED2008 audience through his latest research into fourth-generation fuels -- biologically created fuels with CO2 as their feedstock. His talk covers the details of creating brand-new chromosomes using digital technology, the reasons why we would want to do this, and the bioethics of synthetic life. A fascinating Q&A with TED's Chris Anderson follows."
Rating:"NR"
StarRating:"80"
Length:1972
Categories:["Technology","Talk"]
Title:"Craig Venter asks, Can we create new life out of our digital universe?"
}
item = { ContentType:"episode"
SDPosterUrl:"file://pkg:/images/BigBuckBunny.jpg"
HDPosterUrl:"file://pkg:/images/BigBuckBunny.jpg"
IsHD:true
HDBranded:true
ShortDescriptionLine1:"Big Buck Bunny"
ShortDescriptionLine2:""
Description:"Big Buck Bunny is being served using a Wowza server running on Amazon EC2 cloud services. The video is transported via HLS HTTP Live Streaming. A team of small artists from the Blender community produced this open source content..."
Rating:"NR"
StarRating:"80"
Length:600
Categories:["Technology","Cartoon"]
Title:"Big Buck Bunny"
}
showSpringboardScreen(itemVenter)
'showSpringboardScreen(itemMpeg4) 'uncomment this line and comment out the next to see the old mpeg4 example
'showSpringboardScreen(item) 'uncomment this line to see the BigBuckBunny example
'exit the app gently so that the screen doesn't flash to black
screenFacade.showMessage("")
sleep(25)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangPrimaryLogoOffsetSD_X = "72"
theme.OverhangPrimaryLogoOffsetSD_Y = "15"
theme.OverhangSliceSD = "pkg:/images/Overhang_BackgroundSlice_SD43.png"
theme.OverhangPrimaryLogoSD = "pkg:/images/Logo_Overhang_SD43.png"
theme.OverhangPrimaryLogoOffsetHD_X = "123"
theme.OverhangPrimaryLogoOffsetHD_Y = "20"
theme.OverhangSliceHD = "pkg:/images/Overhang_BackgroundSlice_HD.png"
theme.OverhangPrimaryLogoHD = "pkg:/images/Logo_Overhang_HD.png"
app.SetTheme(theme)
End Sub
'*************************************************************
'** showSpringboardScreen()
'*************************************************************
Function showSpringboardScreen(item as object) As Boolean
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
print "showSpringboardScreen"
screen.SetMessagePort(port)
screen.AllowUpdates(false)
if item <> invalid and type(item) = "roAssociativeArray"
screen.SetContent(item)
endif
screen.SetDescriptionStyle("generic") 'audio, movie, video, generic
' generic+episode=4x3,
screen.ClearButtons()
screen.AddButton(1,"Play")
screen.AddButton(2,"Go Back")
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.Show()
' no need to wait for user, play video directly
displayVideo("")
downKey=3
selectKey=6
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
if msg.GetIndex() = 1
displayVideo("")
else if msg.GetIndex() = 2
return true
endif
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
else
print "wrong type.... type=";msg.GetType(); " msg: "; msg.GetMessage()
endif
end while
return true
End Function
'*************************************************************
'** displayVideo()
'*************************************************************
Function displayVideo(args As Dynamic)
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
'video = CreateObject("roVideoPlayer")
video.setMessagePort(p)
syslog = CreateObject("roSystemLog")
syslog.setMessagePort(p)
syslog.EnableType("bandwidth.minute")
syslog.EnableType("http.error")
syslog.EnableType("http.connect")
'bitrates = [0] ' 0 = no dots, adaptive bitrate
'bitrates = [348] ' <500 Kbps = 1 dot
'bitrates = [664] ' <800 Kbps = 2 dots
'bitrates = [996] ' <1.1Mbps = 3 dots
'bitrates = [2048] ' >=1.1Mbps = 4 dots
bitrates = [0]
urls = ["http://<server>:1935/<app>/<channel>/playlist.m3u8"]
' (link has been removed)
StreamFormat = "hls"
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = bitrates
videoclip.StreamUrls = urls
videoclip.StreamQualities = qualities
videoclip.StreamFormat = StreamFormat
videoclip.Title = title
print "srt = ";srt
if srt <> invalid and srt <> "" then
videoclip.SubtitleUrl = srt
end if
' min bandwidth scenario
videoclip.minBandwidth = 10
videoclip.live = true
video.SetContent(videoclip)
video.SetPositionNotificationPeriod(10)
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.isStatusMessage()
print "status message: "; msg.GetMessage()
else if msg.isPlaybackPosition() then
print "playback position: "; msg.GetIndex()
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else if msg.isStreamStarted()
print "stream started:- msg: "; msg.GetMessage(); " index: "; msg.GetIndex(); " info: "; msg.GetInfo().url; " measuredbitrate: "; msg.GetInfo().MeasuredBitrate; " isunderrun: "; msg.GetInfo().isUnderrun
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
elseif type(msg) = "roSystemLogEvent" then
' Handle the roSystemLogEvents:
i = msg.GetInfo()
if i.LogType = "http.error" or i.LogType = "http.connect"
if i.LogType = "http.error"
print "http error: "; i.HttpCode; "URL: ";i.Url
else
print "http connect: "; i.url
print "http method: "; i.method; " status: "; i.status
print "http code: "; i.httpcode
end if
else if i.LogType = "bandwidth.minute"
'if i.LogType = "bandwidth.minute"
print "Bandwidth is "; i.Bandwidth
end if
end if
end while
End Function
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2011
08:22 AM
Re: roVideoPlayer stuck at buffering stage
There doesn't appear to be any audio codec information in the actual video files associated with this stream. The Roku doesn't like that, hence the endless buffer, as it attempts to find valid audio info.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
yanabi
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2011
08:33 AM
Re: roVideoPlayer stuck at buffering stage
Thanks for a quick response theendless.
I had removed the audio in that stream to see if that was causing it. Here is another m3u8 url that has audio but still has the same buffering issue.
http://<server>:1935/<app>/<channel>/playlist.m3u8
(link has been removed)
I had removed the audio in that stream to see if that was causing it. Here is another m3u8 url that has audio but still has the same buffering issue.
http://<server>:1935/<app>/<channel>/playlist.m3u8
(link has been removed)

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2011
09:20 AM
Re: roVideoPlayer stuck at buffering stage
"yanabi" wrote:
Thanks for a quick response theendless.
I had removed the audio in that stream to see if that was causing it. Here is another m3u8 url that has audio but still has the same buffering issue.
http://204.93.159.230:1935/himalayatv/h ... 041905fded
Ok.. in this case, the audio is MP3, which the Roku doesn't currently support for HLS. Hopefully the Roku will eventually support MP3 audio in HLS streams, but for now the audio needs to be AAC.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2011
09:59 AM
Re: roVideoPlayer stuck at buffering stage
Your .m3u8 starts out with only one segment in the sliding window:
This is an illegal HLS stream. Per the spec, you need a minimum of 3 segments. We recommend 8 x 10 second segments in your sliding live segment window.
--Kevin
#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:11,
media_1.ts?wowzasessionid=647705532&token=ff65c0d8b28fb2b841933a041905fded
This is an illegal HLS stream. Per the spec, you need a minimum of 3 segments. We recommend 8 x 10 second segments in your sliding live segment window.
--Kevin
yanabi
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2011
12:02 PM
Re: roVideoPlayer stuck at buffering stage
Thanks Endless and Kevin.
That was it. Once the audio encoding was changed from mp3 to aac, it worked. I appreciate you guys testing this out and responding so quickly
That was it. Once the audio encoding was changed from mp3 to aac, it worked. I appreciate you guys testing this out and responding so quickly