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

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 3,925 times, 1 visits today)


Leave a Reply