How to play video files in LWC using content asset file

In this post we will see how to play a video using content asset file in LWC.

I have added one video to content asset file.In lwc by importing the contentAssetUrl , we can access the content asset file.



<video width="60%" height="50%" controls="controls">
<source src={waterfallVideoUrl} type="video/mp4" />


import { LightningElement } from 'lwc';
import waterFallContentAsset from '@salesforce/contentAssetUrl/waterfall';

export default class VideoPlayer extends LightningElement {

waterfallVideoUrl = waterFallContentAsset;



<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="">

GitHub :

Result :

1 comment: