Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
derekctv
Level 7

HTTPS Issue

I am loading a hls manifest from a https source. I can confirm using roUrlTransfer that the source does exists and is accessible. Further down the script, I attempt to load the same url but using an actual roVideoScreen object (in order to play the video). But the debug output keeps stating: "handshakefailed". This is my code can anyone spot the problem? I have redacted the urls

sub Main()
?"Starting Application"

streamUrl = "https://hls-encodes.[redacted URL].mp4/hls.m3u8"

port = CreateObject("roMessagePort")
screen=CreateObject("roScreen", true)
screen.SetAlphaEnable(true)
screen.SetMessagePort(port)

ut = CreateObject("roUrlTransfer")
'ut.SetCertificatesFile("pkg:/certs/AddTrustExternalCARoot.crt")
ut.SetCertificatesFile("common:/certs/ca-bundle.crt")
ut.setUrl(streamUrl)
?ut.getToString()

player = CreateObject("roVideoPlayer")
player.SetCertificatesFile("common:/certs/ca-bundle.crt")
player.AddHeader("X-Roku-Reserved-Dev-Id", "")
player.SetMessagePort(port)
player.SetLoop(false)

player.SetContentList([{
StreamFormat: "hls"
Streams: [{url: streamUrl}]
}])

' debugging
syslog = CreateObject("roSystemLog")
syslog.SetMessagePort(port)
syslog.EnableType("http.error")
syslog.EnableType("http.connect")

?"Start Play"
screen.clear(&h00000000)
screen.swapBuffers()
player.Play()

while true
?"Looping ..."
msg = wait(0, port)

if type(msg) = "roVideoPlayerEvent" then
print "msg = "; msg.getMessage() " | index = "; msg.GetIndex()
elseif type(msg) = "roSystemLogEvent" then
?"System Log Event"
info = msg.getInfo()
?info
else
print "Unexpected message class: "; type(msg)
end if
end while


end sub
0 Kudos
1 Reply
Roku Employee
Roku Employee

Re: HTTPS Issue

It looks like you are missing the InitClientCertificates() method for both roUrlTransfer and roVideoPlayer.

- Joel
0 Kudos