There are a few ways to get started using Video.js (currently v7.10.2), but you should select the one that best fits your particular use case.
Our friends at Fastly are nice enough to provide hosting for all the necessary files for Video.js on their content delivery network. Using these hosted files is probably the easiest way to get started using Video.js, you simply need to include the following links in your page.
For more advanced workflows, installing via npm is recommended
$ npm install --save-dev video.js
Beginning with v7, we will no longer support Microsoft Internet Explorer versions prior to IE 11, including IE 8, 9, and 10. Microsoft dropped support for these versions over two years ago, they are widely considered out of compliance with modern security standards, and they comprise less than 0.1% of Video.js browser usage.
<head> of the document.
We include a stripped down Google Analytics pixel that tracks a random percentage (currently 1%) of players loaded from the CDN. This allows us to see (roughly) what browsers are in use in the wild, along with other useful metrics such as OS and device. If you'd like to disable analytics, you can simply include the following global before including Video.js via the free CDN:
Note: v7 will not send any data, and v6.8 and up respect the browser's do not track flag.
window.HELP_IMPROVE_VIDEOJS = false;
If you've downloaded one of the releases or installed via a package manager, you've probably noticed that the contents are slightly different from the source code available on Github. The former includes just the compiled files necessary to use Video.js, and the latter includes the source used to create those files.
A Video.js distribution is what you'll find if you've downloaded a release or installed via a package manager.
Video.js/ ├── alt │ ├── video.core.js │ ├── video.core.min.js │ ├── video.core.novtt.js │ ├── video.core.novtt.min.js │ ├── video.novtt.js │ └── video.novtt.min.js ├── examples/ ├── font │ ├── VideoJS.svg │ ├── VideoJS.ttf │ └── VideoJS.woff ├── lang/ ├── video-js-<span class="vjs-version">$LATEST_VERSION$</span>.zip ├── video-js.css ├── video-js.min.css ├── video.cjs.js ├── Video.es.js ├── Video.js └── video.min.js
This package includes everything you'll need to use Video.js on a production site. By default, we bundle Video.js with Mozilla's excellent VTT.js. If you don't need VTT.js functionality for whatever reason, you can use one of the Video.js copies that don't include VTT.js. These have
novtt in the name and can be found in the
font/ includes all the generated icon font files from the Videojs Font project.
lang/ contains all the generated translation files.
The source code is everything you'll find when checking out the Video.js git repository. This includes all the source files and any tooling necessary to build a production ready version of Video.js, as well as useful development tools such as sandboxed examples.
A lot of the root source directory is JSON configs for various package managers because, Internet. Most likely the important things you're looking for will be in
src/ contains all of the source files for both the player JS and the base skin, while the
build/ directory contains various grunt tasks as well as the primary build file,
Using Video.js straight out of the box is fine, but we think it's better if you make it your own. Plugins and skins make it possible to completely customize your player.
The player skin is completely built from HTML and CSS, including when Flash and other players like YouTube are used.
Skin changes can be as simple as centering the play button (you can just add the 'vjs-big-play-centered' class to your video tag), or as complex as creating entirely new layouts. We've built a codepen project where you can explore different changes.
The themes in the home page come from the Videojs Themes library. To use them in your player, import the CSS, then add the relevant class to your video tag. For example, if you want to use the City theme, you could set up your HTML like so:
<!-- In the head of your document with your other CSS includes... --> <!-- Video.js base CSS --> <link href="https://unpkg.com/video.js@7/dist/video-js.min.css" rel="stylesheet" /> <!-- City --> <link href="https://unpkg.com/@videojs/themes@1/dist/city/index.css" rel="stylesheet" /> <!-- Then, in the player --> <video class="video-js vjs-theme-city" ...></video>
A great place to start is the Video.js Skin Designer, but at the end of the day we suggest using the cascading aspect of CSS to simply override the parts of the design you want to customize.
Video.js by itself is purposefully very simple. It supports the basic video and audio playback features and ensures they work the same across different playback technologies ("techs"). Any more advanced features are built as plugins, including playlists, analytics, advertising, and support for advanced formats like HLS and DASH. Check out the plugins page to see what's available.