sub main()
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = [0]
videoclip.StreamUrls = ["http://myserver.com/mylivestream.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
"videodev" wrote:"TheEndless" wrote:
Make sure you are setting the SwitchingStrategy value. A bug was introduced a few firmwares ago that would prevent HLS from switching to a higher bitrate if the SwitchingStrategy wasn't set. I don't know if that bug was ever fixed, but it's best to always set that value.
Thank you. It worked. I am using SwitchingStrategy as "full-adaptation".
Another question - As I mentioned above, I am using HLS streams from Wowza server, which has 6 variants from 150k to 3600k. I read in the documentation that, the dots/HD symbol is not displayed, if the stream is HLS. Is there any way to display HD if any of the variant is of HD quality?
I am using "0" as StreamBitrates in XML.
Any other suggestions for quick switching/buffering/scrubbling?
Thank you!
<SwitchingStrategy>full-adaption</SwitchingStrategy> in between the <media></media> tag?
If item.StreamFormat="" 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat="mp4"
End If
If item.StreamFormat="hls"
item.SwitchingStrategy="full-adaptation"
End If
<SwitchingStrategh>full-adaptation</SwitchingStrategy>
item.SwitchingStrategy=validstr(curshow.switchingStrategy.gettext())
"RokuJoel" wrote:Do watch out for typos though! 🙂<SwitchingStrategh>full-adaptation</SwitchingStrategy>
^
"RokuJoel" wrote:
if you add a tag to your XML:<SwitchingStrategh>full-adaptation</SwitchingStrategy>
and a line to your xml parser in ShowFeed.brs (assuming your channel is based on videoplayer example):item.SwitchingStrategy=validstr(curshow.switchingStrategy.gettext())
probably should put that after the item.StreamFormat= line
<XYZ>whatever</XYZ>
to my XML file
and the code
[code]item.XYZ=validstr(curshow.XYZ.gettext())