Introduction
Video.js is a free, open-source web video player for live and on-demand streaming. It comes with ready-to-use controls, so you can get started with a short HTML snippet. You can also customize the player’s look and controls to match your website without changing how your stream is delivered.
Play a CDN HLS stream with Video.js
Find your HLS playlist URL on the Services/How-to page. The example below uses our Big Buck Bunny test stream.
Copy the code into the HTML of your page where you want the player to appear. Replace the src value on <hlsjs-video> with your own .m3u8 playlist URL. Leave the two module URLs unchanged.
<script type="module" src="https://play.cdnsun.com/assets/videojs/10/6/0/video.js"></script>
<script type="module" src="https://play.cdnsun.com/assets/videojs/10/6/0/media/hlsjs-video.js"></script>
<media-i18n lang="en">
<video-player poster="">
<video-skin style="display: block; width: 480px; height: 320px; --media-border-radius: 0;">
<hlsjs-video src="https://stream-test.cdnsun.com/blenders-big-buck-bunny/playlist.m3u8" playsinline></hlsjs-video>
</video-skin>
</video-player>
</media-i18n>
Generate your own embed code
In Services/How-to, open Player, select Video.js, and enter the path to your playlist. If you prefer a hosted player, see Publishing Media.
What next?
Read about the following topics.