Hoping this post saves somebody the time and frustration I wasted:
When requesting a secure, live HLS stream from Akamai (master.m3u8?[token]), Akamai will return two cookies ("_alid_, "hdntl") that must included in the subsequent requests for a particular stream's manifest (m3u8). There appears to be a bug in the Roku's roVideoScreen in that even if you use "EnableCookies", only ONE of the two cookies is returned with subsequent requests.
My workaround is to grab the other cookie with an initial roUrlTransfer request, and then manually add it to the header. This method, however could fail if whatever configuration makes Roku ignore the "hdntl" cookie begins ignoring the "_alid_" cookies instead (eg: order in the header perhaps). Ignoring of the "_alid_" would be even more problematic as the cookie will eventually change with subsequent segment requests.
This is just my dev code (not cleaned up), but hopefully it will help:
req = CreateObject("roUrlTransfer")
req.SetPort(CreateObject("roMessagePort"))
req.SetUrl(radioFeed)
req.EnableCookies()
req.EnableFreshConnection(true)
if (req.AsyncGetToString())
event = wait(30000, req.GetPort())
if type(event) = "roUrlEvent"
if (event.GetResponseCode() <> 200)
DisplayDialog("No Live Feed", "Please check back later.")
return
endif
headers = event.GetResponseHeadersArray()
elseif event = invalid
print "AsyncGetToString timeout"
req.AsyncCancel()
return
else
print "AsyncGetToString unknown event"
return
endif
endif
for each header in headers
val = header.LookupCI("Set-Cookie")
if (val <> invalid)
if (val.Left(5) = "hdntl")
hdntl = val.Left(Instr(1,val,";")-1)
endif
endif
end for
port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.EnableCookies()
screen.AddHeader("Cookie",hdntl)
stream = {
HDBranded: true
IsHD: true
StreamBitrates: [0]
StreamUrls: [radioFeed]
StreamQualities: [0]
StreamFormat: "hls"
Live: true
}
screen.SetContent(stream)
screen.Show()
Another issue I have is that I cannot get the Roku player to adjust to a higher bitrate stream (it only takes the first), despite ample bandwidth (confirmed with roSystemLog bandwidth). The only way I can force it to the higher is with MinBandwidth, in which case, it plays without buffering (but obviously I'm hurting potential viewers with lower bandwidth). Here is the manifest returned by Akamai:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=698000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2"
http://REMOVED-lh.akamaihd.net/i/REMOVED@51143/index_650_av-p.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=698000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2"
http://texaggies-lh.akamaihd.net/i/REMOVED@51143/index_650_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1548000,RESOLUTION=1280x720,CODECS="avc1.77.30, mp4a.40.2"
http://REMOVED-lh.akamaihd.net/i/REMOVED@51143/index_1500_av-p.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1548000,RESOLUTION=1280x720,CODECS="avc1.77.30, mp4a.40.2"
http://REMOVED-lh.akamaihd.net/i/REMOVED@51143/index_1500_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=48000,CODECS="mp4a.40.2"
http://REMOVED-lh.akamaihd.net/i/REMOVED@51143/index_650_a-p.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=48000,CODECS="mp4a.40.2"
http://REMOVED-lh.akamaihd.net/i/REMOVED@51143/index_650_a-b.m3u8?sd=10&rebase=on
Anybody have any ideas?