There are few videos in files (Lightning files) of my slesforce org. Is there a way i can play/preview them in an iframe inside a lightning component?


I normally use this approach for expose video files in my lightning components:

<video width="100%">
    <source src="{!'../sfc/servlet.shepherd/document/download/' + file.Id}" type="video/mp4" />
Your browser dont support video tag

You need acces to the file in order to see the file.

  • exposing video via file does not work anymore, getting error : Refused to load media from 'https://urldomain.my.salesforce.com/sfc/servlet.shepherd/document/download/xxx' because it violates the following Content Security Policy directive: "media-src 'self' * any idea how to fix this ? – Shamina Dec 10 '19 at 12:37

This approach work for me.

<video autoplay="true" muted="true" loop="true" id="myVideo">
        <source src="{!$Resource.VideoStaticResource}" type="video/mp4"/>

Can you please check, this works for you?


In order to play/preview them in an iframe. First get your video files URL in your salesforce org. then paste it inside the src in iframe.

  <iframe width="500" height="300" 
   src="Paste URL here">
  • Salesforce file url is in this format svje-dev-ed.my.salesforce.com/sfc/p/6F000001cNSs/a/6F000000Lmrn/… There is no embed tag in this url, so to play a video in iframe it needs embed keyword. – Vivian Oct 17 '18 at 7:38
  • @Vivian Where did you store your video files? Is it in static resources or in the document? – Clark Siruno Oct 17 '18 at 7:44
  • Try to store it in Public Folder in the Document. – Clark Siruno Oct 17 '18 at 8:00
  • I am saying about lighting files not classic documents – Vivian Oct 17 '18 at 8:12

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.