I am transcoding some of my videos to mpeg-dash so I can use html5 players. But I am not able to play them on any player. It might be something wrong with my files.

These is a sample

https://d19cwas8lp55sz.cloudfront.net/archivos/1048/mpegDash/playlist.mpd

I tried playing it on this test player https://bitmovin.com/demos/stream-test?format=dash&manifest=https://d19cwas8lp55sz.cloudfront.net/archivos/1048/mpegDash/playlist.mpd

I can see that the duration of the video is displayed correctly but I cannot play the video. I was using amazon elastic transcoder to transcode this files

  • 1
    @Rob it should be an Avengers2 trailer – Juan Diego Nov 9 at 16:29

This is not an issue of the player, but it appears to be related to your Cloudfront setup and/or your S3 bucket, as it doesn't provide the required CORS configuration, therefore the player can't download your video/audio content.

You can check that yourself by opening the debug console of your browser (F12 on Windows, or CMD SHIFT I on Mac). In the console tab you will find error messages like that:

Access to XMLHttpRequest at 'https://d19cwas8lp55sz.cloudfront.net/archivos/1048/mpegDash/mpegDash4800k/3d3b437408996f42ed668f17cbe10408e0059e8914fcb12c775ad92d002cc88f' from origin 'https://bitmovin.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

CORS is a security policy enforced by the browser in order to allow/deny XHR requests to resources which are hosted on a different domain than the site the request is coming from. XHR requests are commonly used by javascript applications web apps as well as HTML5 players to request your video content.

The decision of the browser, if it blocks this request or not, depends on additional headers which are returned by the server the XHR request is sent to (Cloudfront and/or your S3 bucket in this case). If the CORS configuration whitelists the domain the request is coming from, the browser will allow this request.


In your case this CORS configuration seems to be missing. Therefore, please see your S3 CORS settings:

S3 Bucket CORS configuration: https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-cors-configuration.html

This CORS configuration allows every origin to access your content

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>1800</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

This CORS configuration only allows bitmovin.com to access your content

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>https://bitmovin.com</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>1800</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

How to configure Cloudfront to respect CORS: https://medium.com/@dmitter/amazon-cloudfront-and-cors-57dd43cdfd30 OR https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-cors

As soon as this is done, the playback at this demo page should work just fine. https://bitmovin.com/demos/stream-test?format=dash&manifest=https%3A%2F%2Fbitmovin-a.akamaihd.net%2Fcontent%2FMI201109210084_1%2Fmpds%2Ff08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd

I hope this is helpful and understandable :)

  • I checked that and I still had trouble with cors, I fixed my cors issue with <AllowedHeader>range</AllowedHeader> thanks to amazon support. But I still cannot play my videos o videogular – Juan Diego Nov 9 at 16:31

Apparently I needed

<AllowedHeader>range</AllowedHeader> 

For my cors problem to go away

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.