Skip to content

Instantly share code, notes, and snippets.

@torkale
Last active August 29, 2015 14:24
Show Gist options
  • Save torkale/e49ae4087ba8a4bcb1c9 to your computer and use it in GitHub Desktop.
Save torkale/e49ae4087ba8a4bcb1c9 to your computer and use it in GitHub Desktop.
JWPlayer, play flash HLS from signed cloudfront urls

Intro:

Playing HLS m3u8 file.

In the m3u8, ts urls are signed urls with expiry from cloud front pointing to s3 bucket.

Problem description

JWplayer does not play the m3u8 when in flash mode returning "http code 0"

Diagnose the problem (Mac)

  1. Install flash debugger for firefox
  2. go to ~/Library/Preferences/Macromedia/Flash\ Player/Logs
  3. tail -f flashlog.txt
*** Security Sandbox Violation ***
Connection to <url> halted - not permitted from http://p.jwpcdn.com/6/12/jwplayer.flash.swf
Error: Request for resource at <url> by requestor from http://p.jwpcdn.com/6/12/jwplayer.flash.swf is denied due to lack of policy file permissions.
WARNING: For content targeting Flash Player version 14 or higher, ExternalInterface escapes strings using JSON conventions. To maintain compatibility, content published to earlier Flash Player versions continues to use the legacy escaping behavior.

Solve the problem

  1. Create and upload crossdomain.xml to s3 bucket
  2. Make the file public
  3. Add behavior to cloud front with pattern crossdomain.xml with no signed url or expiry
  4. After the cdn updates you will be able to play your HLS playlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment