{"id":3001,"date":"2013-09-26T04:00:00","date_gmt":"2013-09-26T04:00:00","guid":{"rendered":"http:\/\/jwplayer.com\/delivering-hls-with-amazon-cloudfront\/"},"modified":"2024-10-10T06:38:26","modified_gmt":"2024-10-10T10:38:26","slug":"delivering-hls-with-amazon-cloudfront","status":"publish","type":"post","link":"https:\/\/jwplayer.com\/blog\/delivering-hls-with-amazon-cloudfront\/","title":{"rendered":"Delivering HLS with Amazon CloudFront"},"content":{"rendered":"
In this blog post, we will setup Amazon Cloudfront to swiftly and reliably deliver an HLS stream around the globe. We’ll use JW Player to embed these streams, so they work on both iOS and desktop browsers.<\/p>\n
This post is a follow-up to the one on Encoding HLS with Amazon Elastic transcoder<\/a>. That post discussed setting up storage buckets and creating Pipelines, Presets and Jobs to encode HLS.<\/p>\n By the end of the previous post<\/a>, we ended up with an HLS stream and a thumbnail in separate Amazon S3 buckets. In order to improve delivery performance, we’ll now setup CloudFront to deliver these files over HTTP.<\/p>\n This tutorial assumes that you have already signed up<\/a> for Amazon CloudFront and can access these services from your AWS console<\/a>. In the console, open the CloudFront section.<\/p>\n Inside the CloudFront console, create a new distribution. Set the Delivery Method<\/strong> to Download<\/em>. In step 2, set the Origin Domain Name to the S3 bucket that contains your HLS stream. Leave everything else default and create the distribution:<\/p>\n Repeat these steps to create a second distribution for your thumbnail image S3 bucket.<\/p>\n At this point, your HLS stream and JPG thumbnail are available through the two new CloudFront domains.<\/p>\n In theory, all is set for delivering this stream across the world. Before we can load this stream into JW Player though, one more item needs to be taken care off: Flash cross-domain loading.<\/p>\n In short, the problem is that a Flash player from domain A<\/strong> can only load an HLS stream (or smooth an image) from domain B<\/strong> if that domain has an XML access file in its root. This XML access file looks like the following:<\/p>\n <\/p>\n <\/p>\n <\/p>\n <\/p>\n <\/p>\n You must create and upload this crossdomain.xml<\/em> file to your HLS stream and JPG thumbnail buckets. This can be done in the S3 console.<\/p>\nCreating CloudFront distributions<\/h2>\n
<\/p>\n
Uploading crossdomain XML files<\/h2>\n
Setting up JW Player with HLS<\/h2>\n