salesforce lightning

How to Play Video file in Lightning Component

Lightning Component
Prerequisites : basic understanding of Lightning Component

In this post we can see how to  play video file in lightning component by using  HTML5. there are 3 supported video formats: MP4, WebM, and Ogg.

The browser support for the different formats is:salesforce lightning supported video format

How to Play YouTube Video In Salesforce Lightning Component

step 1 : Add Video file in static resources.

Keep in mind that we can upload video file up to 5MB in static resource.

  • From Setup, enter static recourse in the Quick Find box, then select Static Resources.
  • Click New.
  • In the Name text box, enter the text that should be used to identify the resource in lightning component.
  • Next to the File text box, click Browse to navigate to a local copy of the video file that you want to upload.
  • Set the Cache Control : public
  • Click Save.
step 2 : Create salesforce lightning component

Component code [sample.cmp] .

  • Source tag Defines media resources for video element .
  • Controls attribute : it specifies that video controls should be displayed. like Play,Pause,Seeking,Volume and more…

Cheers!  Like our facebook page for new post updates.?

(Visited 4,372 times, 1 visits today)


    • I really really want to solve this issue!!! The size limit of Static Resources is only 5mb!!! My videos are way larger! My Videos are already uploaded in a Salesforce Content Document Library & I wish that someone could help me, please guys – I’ve been battling with this for 2 weeks already!

      I’m making a Video Carousel and I want to be able to use HTML5 video tag as that works really good for me. Using the old-school iframe I cant get the resizing going well nor loading the video in the actual carousel.

      please help me load/display my Video in my Lightning Component, any advice would help me lots, thanks in advance.


Leave a Reply