There are a number of ways to play back web media depending on the scale of your needs and whether you need ad integration and digital rights management.
For media playback on the web, a spectrum of options is available including:
- An embedded
mediaelement with default or custom user agent controls.
- Digital rights management using Encrypted Media Extensions.
- Open source or commercial players which provide ready made solutions for needs such as ads integration, and adaptive bitrate streaming.
This page defines and discusses these options, all of which must be considered when deciding how to play back media on your web page.
- A single or small number of WebM or MP4 files.
- No advertising.
- You don't need adaptive bitrate (ABR) streaming or digital rights management (DRM).
For user interface controls, you actually have a choice between custom player controls and native controls. Custom controls require more elements and custom scripts. Adding native controls is as simple as adding the
controls attribute to your
<video> element. For example:
<video src="videofile.webm" controls></video>
There are several things to consider when choosing. Native controls are optimized for the browser but are inconsistent between browsers. Custom controls allow you to build for accessibility, add your own branding, and keep the look and feel consistent between browsers.
Adaptive Streaming offers multiple resolutions and bitrates to the user by having the player choose which quality level and bitrate to play based upon the user's bandwidth and other factors. This generally results in a significantly better user experience with less buffering and smoother playback leading to longer watch times. This is accomplished by using the Media Source Extensions API to build to one of the adaptive bitrate standards, in other words, DASH or HLS. Although it's possible to build your own player using these technologies, it is not recommended.
You may be happy sharing your content with anyone who wants it. Or maybe your content is also your livelihood, in which case you'll need Encrypted Media Extensions (EME) or a player that supports digital rights management (DRM). See DRM and authentication for more details.
Your player will need to integrate with ad SDKs such as, for example, IMA SDK or Freewheel. Either work with your ad partners directly or partner with a player company or an online video provider who has already done these integrations.
There are both open source and commercial options. While open source solutions will allow you to implement media playback without a licensing fee, commercial vendors can help you with ads integration and DRM.
Open Source Players: