I want to play .mov video from amazon in lightning.

Here is amazon presigned url:


Clicking the url will download the video which I want to play.

Here is how I am trying to play it:

    <video class="videoElement" controls="" src="https://s3.us-east-1.amazonaws.com/zed-content/Activity%20Contents/test%20act%20Content/testVid47.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAJ7V4MJWO3GNAM6WA%2F20180829%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20180829T082051Z&amp;X-Amz-Expires=604800&amp;X-Amz-Signature=7ec66a41cc4c536ccc4abd42e5fea3621438563b114f72dd26f71c14eb4c4edd&amp;X-Amz-SignedHeaders=host" id="videoSrc" data-aura-rendered-by="116:560;a">
         Your browser does not support the video tag.

Here is what I see: enter image description here

Here is the error I am getting in console:

Refused to load media from 'https://s3.us-east-1.amazonaws.com/zed-content/Activity%20Contents/test%20act%20Content/testVid47.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ7V4MJWO3GNAM6WA%2F20180829%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180829T082051Z&X-Amz-Expires=604800&X-Amz-Signature=7ec66a41cc4c536ccc4abd42e5fea3621438563b114f72dd26f71c14eb4c4edd&X-Amz-SignedHeaders=host' because it violates the following Content Security Policy directive: "media-src 'self' *.visualforce.com https://zeddev-dev-ed--c.documentforce.com blob:".

It is clear that I am violating Content Security Policy, but I can not infer how to stop violating them from the error.

  • have you tried adding that URL on Content Security Policy Settings Aug 29 '18 at 9:33
  • @PranayJaiswal, what does that mean? Could you elaborate, please?
    – iloveseven
    Aug 29 '18 at 9:42
  • Am sorry I forgot to mention link and how to. ... help.salesforce.com/… Aug 29 '18 at 9:55
  • @PranayJaiswal, oh. Looks like you have a point here. I will try it and be back with the outcome. Thank you.
    – iloveseven
    Aug 29 '18 at 10:01
  • 1
    I will post it as an answer... It will help others with similar queries reach a solution faster. Aug 29 '18 at 10:28

You have put that URL in Content Security Policy settings in Salesforce. CSP setting determines which content from 3rd party sites can be played/viewed in Salesforce.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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