Videos have become an essential part of modern websites, serving as a powerful way to showcase products and engage audiences. To effectively embed videos in web pages or web applications, you need a perfect and user-friendly video player. Today, HTML5 video players have become the industry standard for web video playback, offering a seamless and versatile solution for embedding videos on your website.
In this article, we’ll explore the best HTML5 video player options available, helping you choose the one that perfectly aligns with your specific needs. We’ll also dive into both basic setups using the native <video>
tag and advanced players like VideoJS with customizable features, considering factors like ease of use, customization options, and cross-browser compatibility.
In this article:
- How Videos Impact Your Website
- Five Video Players to Choose From
- Setting Up Your Own Website Video Player
How Videos Impact Your Website
With the increasing demand for online content, adding videos to your website is a smart way to attract visitors, keep them engaged, and enhance their overall experience. Today, videos are not just entertaining, they’re also powerful tools for communication and branding. Let’s look at some ways videos can make your site more interactive and boost your online reputation.
Keep Users Engaged Longer
Studies show that about 73% of people prefer to watch a short-form video to learn more about a product or service. Video content (especially short-form videos) capture attention quickly, making them more engaging than other digital contents like long blocks of texts or static images. By adding videos to your content strategy, you can engage your audience in a fun and enjoyable way.
Highlight Your Products and Show Off Your Brand
If you’re selling a product online today, videos are a great way to highlight your products or services. Whether it’s through product demos, promotional content, customer testimonials, or ads, videos can effectively showcase what makes your offerings unique. They also help reinforce your brand identity, making your website more recognizable and appealing to visitors.
Build Stronger Connections With Your Users
Videos help you communicate on a personal level, creating a deeper connection with your audience. Whether it’s through behind-the-scenes content, team introductions, or storytelling, videos make your brand feel more relatable and trustworthy. They allow you to convey emotions, tell your story, and leave a lasting impression.
Improve SEO and Boost Conversions
Search engines prioritize websites with engaging video content, which can help improve your ranking and attract more traffic. Videos also increase the likelihood of conversions, as they provide clear and compelling information that encourages users to take action, whether it’s making a purchase, signing up, or sharing your content.
Five Video Players to Choose From
Selecting the right video player can be a daunting task, as there are many options to choose from, each with its own set of advantages and disadvantages. From the native HTML5 <video>
element to custom solutions like Video.js, the choice depends heavily on your own specific requirements and resources.
1. Cloudinary Video Player
The Cloudinary Video Player is a JavaScript-based HTML5 video player bundled with many valuable customization and integration capabilities, as well as monetization and analytics features.
Cloudinary Video Player has several useful features that are standard for a modern video player. Some of these include:
- Player controls: The video player has built-in support for player controls, such as, play, pause, mute/unmute, volume control, loop, jump, maximize/exit maximize, with the option for full customization.
- Video transformations: With the video player, you can apply Cloudinary video transformations at the player level that will apply to all videos delivered in that player.
- Extensive support for file formats: The player supports popular video formats and codecs, such as
mp4
,webm
,mov
,av1
,vp9
,h265
. The Cloudinary video player enables automatic format selection by default, or you can manually specify multiple source types. - Adaptive bitrate streaming: The Cloudinary video player has full support for adaptive bitrate streaming and MPEG-DASH including automatic generation of all required streaming representations and supporting files.
- Robust customization options and advanced features: There are also several parameters and features to customize the behaviour and appearance of the video player. Some features include options to add playlists, recommendations, subtitles, monetization, analytics, etc.
You can play around with the Cloudinary Video Player Studio to customize the look and feel of the video player. You can also check out this examples page to explore various implementations of the video player.
2. The Built-In HTML5 <video>
Element
The HTML5 video tag is a simple, universal option that’s supported by all modern browsers. It’s easy to use and doesn’t require additional libraries. However, it’s best for basic needs since it lacks advanced features like analytics or adaptive streaming.
Because of its simplicity and ease of use, the HTML video element is primarily used to embed video content directly within a web page, allowing users to play videos like product demonstrations, explainer videos, tutorials, promotional clips, news footage, or any other visual content directly on the website without needing to navigate to a separate platform.
Here’s a simple example of how to use the HTML5 <video>
player element:
<video controls width="640" height="360" poster="poster-image.jpg"> <source src="video.mp4" type="video/mp4"> <source src="video.webm" type="video/webm"> </video>
The controls
attribute adds play, pause, volume, and fullscreen controls. The poster
attribute adds a placeholder image displayed before the video plays, while the <source>
tags are used to provide different formats of the video to ensure it plays across various browsers.
3. YouTube
YouTube is a widely used online video-sharing platform that enables users to upload, share, and access video content. Its popularity stems from features such as being free to use, offering a simple and intuitive interface, providing monetization opportunities, and allowing extensive customization.
One notable feature of YouTube is its ability to embed videos on external websites using the IFrame Player API. This API empowers developers to control the embedded player via JavaScript, enabling functionality such as play, pause, and customization of playback options.
Embedding YouTube videos offers several advantages. It eliminates the need for hosting video files on your own servers, reducing storage costs and enhancing website performance. Additionally, embedding videos from a trusted platform like YouTube can boost your site’s SEO by leveraging YouTube’s high domain authority, making it a smart choice for improving search engine rankings.
To embed a YouTube video on your website, here’s the steps you need to take:
- Go to the desired video you want to embed on YouTube and click on the share button below the video player.
- In the share options that appear, click the “Embed” button and copy the code that appears on the screen.
- On your website or blog, paste the embed code into the HTML where you want the video to appear.
4. Video.js
Video.js is an open-source web video player built on top of HTML5. Video.js provides a consistent and customizable video playback experience across diverse web browsers and devices. It offers a comprehensive set of features, including customizable UI, cross-browser compatibility, an extensive plugin ecosystem, live streaming capabilities, and more.
One powerful feature of Video.js is its extendability. It allows anyone to share their video player customizations. This includes everything from the simplest UI tweaks to new playback technologies and source handlers. Another core strength of Video.js is that it decorates a standard <video>
element and emulates its associated events and APIs, while providing a customizable DOM-based UI.
Embedding Video.js in a web page is straightforward. One way to embed it is through a <video>
tag embed, which can then be initialized via a data-setup
attribute or via the videojs
method in JavaScript:
<!-- via data-setup --> <video id="vid1" class="video-js" data-setup='{}'> <source src="//vjs.zencdn.net/v/oceans.mp4"> </video> <!-- via code --> <video id="vid1" class="video-js"> <source src="//vjs.zencdn.net/v/oceans.mp4"> </video>
const player = videojs('vid1', {});
Plyr
Plyr is another lightweight and flexible HTML5 video and audio player. It’s easy to use and offers a clean and modern design. One major strength of Plyr is its simplicity and yet powerful feature set. It contains several advanced features including, a standardized API for controlling the video player, monetization, multiple audio or subtitle tracks support, streaming and i18n support, and many more.
Plyr also allows you to add YouTube and Vimeo video URLs as sources, which means you can have a customized look for Vimeo and YouTube videos on your website. Apart from videos, you can also use Plyr to embed audio on your websites.
Setting Up Your Own Website Video Player
Out of all the video players mentioned above, Cloudinary stands out as a modern option for delivering a smooth and consistent video experience. In this section, we’ll show you how to embed the Cloudinary video player on your own website.
The simplest way to add the video player to your website is to include the video player directly from a CDN provider. To do so, follow these steps:
1. Include the Required Styles and Scripts
Add the Cloudinary Video Player CSS and JavaScript files to the <head>
section of your HTML. We recommend the standard package, since it is lightweight and contains advanced features like adaptive bitrate streaming, video ads, or shoppable videos.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cloudinary Video Player</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-video-player/2.2.0/cld-video-player.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-video-player/2.2.0/cld-video-player.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script> </head> <body> </body> </html>
2. Add a Video Player Element
In the body of your HTML, add a <video>
element with an id
that will be used to initialize the player.
<video id="my-video-player" controls></video>
3. Initialize the Cloudinary Video Player
Next, in your JavaScript, use the cloudinary.videoPlayer
method to initialize the player. You’ll also need to provide your Cloudinary cloudName
and additional configuration options.
// ... <script> // Initialize the Cloudinary Video Player const player = cloudinary.videoPlayer('my-video-player', { cloudName: 'YOUR_CLOUD_NAME', }); player.source('example_video_public_id'); // Replace with your video public ID </script>
4. Customize the Video Player
Finally, you can customize the player further by adding options like autoplay, loop, or custom controls. Here’s an example:
const player = cloudinary.videoPlayer('my-video-player', { cloudName: 'YOUR_CLOUD_NAME', controls: true, autoplay: true, muted: true, loop: true, }); player.source('example_video_public_id');
You can also explore other options for embedding the video player including embedding a cloud hosted player using an iframe or installing the cloudinary-video-player
package and importing it as a module.