Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scottselby
Visitor

Play video from url with redirect

In our channel we have a url to play videos that does a last check for authentication then redirects to the CDN url and that plays a video. This was all done over http in all of our test channels and works great.

The problem is when we deployed to our live website hosting the API the server is set up to redirect all requests to HTTPS. I figured out how to get HTTPS calls to work for all my api calls just fine. The last problem I am having is that the HTTPS call is made to our server then redirects to HTTP CDN server and not working every time I try. The error messages that brightscript returns aren't very helpful I jst get the generic error code 11 with message "Unspecified or invalid track path/url."

Anyone have any experience with this ? or any idea what to do? so far I have tried setting up the roVideoScreen to have all the settings to allow an HTTPS call , I think it is getting stuck when it catches a redirect to HTTP.

ex.
...
video = CreateObject("roVideoScreen")
....
video.SetContent(videoclip)
video.AddHeader("Accept", "*/*")
video.SetCertificatesFile("common:/certs/ca-bundle.crt")
video.SetCertificatesDepth(3)
video.InitClientCertificates()
video.EnableCookies()
video.show()
0 Kudos
7 REPLIES 7
TheEndless
Channel Surfer

Re: Play video from url with redirect

A couple questions...

  • Why are you setting the cookie depth to 3?

  • You're calling EnableCookies(). Is that because you require cookie support? If so, that may be the problem. The roVideoScreen cookie implementation doesn't work, so you need to retrieve the cookies first, then explicitly add the cookie headers.
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)
0 Kudos
scottselby
Visitor

Re: Play video from url with redirect

I do not need cookies, and setting the depth to 3 was just a last attempt to get it to work. I got that line from an open source project on github. Neither have any any effect, I have tried with and without those lines.
0 Kudos
TheEndless
Channel Surfer

Re: Play video from url with redirect

"scottselby" wrote:
I do not need cookies, and setting the depth to 3 was just a last attempt to get it to work. I got that line from an open source project on github. Neither have any any effect, I have tried with and without those lines.

Have you tried retrieving the URL with roUrlTransfer, then getting the landing URL from the "Location" header?
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)
0 Kudos
scottselby
Visitor

Re: Play video from url with redirect

I'll try that and let you know.
0 Kudos
scottselby
Visitor

Re: Play video from url with redirect

Could you post an example of how to read the headers of a response? I'm clear on how to set them but not as clear on reading them
0 Kudos
TheEndless
Channel Surfer

Re: Play video from url with redirect

"scottselby" wrote:
Could you post an example of how to read the headers of a response? I'm clear on how to set them but not as clear on reading them

Something along these lines should work:
http = CreateObject("roUrlTransfer")
http.SetUrl("http://url.to.stream")
response = http.Head()
redirectUrl = response.GetResponseHeaders()["Location"]
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)
0 Kudos
scottselby
Visitor

Re: Play video from url with redirect

I can't believe that actually worked. Thanks a lot.
0 Kudos