Forum Discussion

jules27's avatar
jules27
Visitor
15 years ago

Problem with HTTP redirect 302 and HLS

I am testing out Roku2's capability to play HLS streams served by Wowza. I have found no problems playing static content and live streams. However, I did run into a problem with an in-house feature involving HTTP redirects that I'm hoping someone from Roku can give some pointers.

We have a feature that has user-agent detection and redirects from a generic URL to a protocol-specific URL depending on the user-agent. For example, given a generic URL "http://<domain>.com/path/to/file.mp4", and a user-agent "roku", we will perform an HTTP redirect to "http://<domain>.com/path/to/file.mp4/playlist.m3u8".

This is the sequence of events I got from tcpdump on the Roku2.

1. Roku2 does a GET on the generic URL. It receives a "HTTP/1.1 302 Found" for the correct URL that points to playlist.m3u8.

2. Roku2 does a GET on the URL "http://<domain>.com/path/to/file.mp4/playlist.m3u8". It receives a "HTTP/1.1 200 OK" and the following playlist.m3u8 file from Wowza:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=672450
playlist.m3u8?wowzasessionid=12345678
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000
playlist.m3u8?wowzaaudioonly&wowzasession


3. This is where things go wrong. Roku2 does a GET on the generic URL again and somehow strips out the filename: "http://<domain>.com/path/to/playlist.m3u8?wowzasessionid=12345678" and receives a "HTTP/1.1 302 Found" for the incorrect URL, also without a filename, and with a duplicate playlist.m3u8: "http://<domain>.com/path/to/playlist.m3u8/playlist.meu8?wowzasessionid=12345678".

4. Roku2 does a GET on the incorrect URL and receives a "HTTP/1.1 403 Forbidden", and the session ends.

For this test, I took the example "simplevideoplayer" from the SDK and hardcoded URL's in. My Roku2 is running 4.1 build 1275.

Is Roku's behavior in step 3 expected?

12 Replies

  • I wonder if ifURLTransfer.retainBodyOnError would help, and also, have you tried the GetResponseHeadersArray method of roUrlEvent?

    - Joel
  • -3 is not an http status code of course, since all status codes are positive 3-digit integers. If you're getting this -3 value from roUrlEvent.GetResponseCode, the doc (http://sdkdocs.roku.com/display/sdkdoc/roUrlEvent) says that that value means CURLE_URL_MALFORMAT. So it sounds like your URL is invalid.

    Also, this doesn't have anything to do with the original topic (redirects and HLS), does it? And Roku does support redirects internally. I'm not sure if it did at the time the original post was posted, over 3 years ago, which demonstrates the reason it's not a good idea to post to very old threads.

    --Mark