GuideMigrate
Migrate from Video.js 8
Move a Video.js 8 integration to v10, mapping the options object, techs, plugins, and player API onto composed components
Video.js 8 gives you one function, videojs(), and one large options object. It enhances a <video> element and returns a player with a control bar, plugin system, and component tree.
Video.js v10 is a rebuild, not a drop-in version bump. There is no videojs() call, options object, or plugin registry. You compose a player from a few named pieces instead.
Video.js 8 lives on at its repo and docs. The video.js package on npm is still Video.js 8, so npm install video.js won’t get you v10. Video.js 10 ships as scoped @videojs/* packages.
Three pieces instead of one
In v8 the player was everything: playback, UI, and the skin on top of it. Options configured all three, which is why the options object grew so large.
v10 splits those jobs up. Learning the three names first makes the rest of this guide much shorter.
The player is the outer element. It holds state and hands that state to everything inside it, and it draws nothing. This is the closest thing to a v8 player instance, but it owns state rather than DOM. Which state it holds depends on the features it’s built from.
The media is the thing that plays the video. This is where v8’s tech went. A plain <video> plays progressive files, and there’s a media component for HLS, DASH, YouTube, Vimeo, and Mux. Swapping one for another is a tag change, and the rest of your player keeps working.
The skin is the UI: the controls, the poster, the captions, the settings menu, the keyboard shortcuts. It’s the v8 control bar and skin combined, except skins are plain trees of components you can read and edit rather than a class hierarchy you subclass.
So a v8 embed becomes a player wrapped around a skin wrapped around a media:
Most of this guide is about which of those three a given v8 option now belongs to.
Your first player
Here’s a standard v8 setup: one file, captions, a poster, and the default skin.
v10 ships web components, so the migration keeps its declarative feel. One script from the CDN gives you the video preset: a player, a skin, and a media element that already fit together.
With a bundler, the same thing is two imports:
Four differences worth understanding, because each one is a pattern you’ll see again:
- No
class="video-js", nodata-setup, novideojs()call. The custom elements register themselves and wire up when the browser upgrades them. Nothing scans the page looking for players. - No
controlsattribute. The skin is the controls. Including a skin is how you ask for them, which is also how you opt out: leave it out and you get a player with no UI. - The poster is player metadata, not a media attribute. Set
posteron<video-player>, and the skin, not the browser, controls how it appears. For more advanced control (like supplying your own image element), see Add a poster and loading placeholder. - Your
<track>elements don’t change. Captions, subtitles, chapters, and thumbnails are all still tracks, and the skin shows the matching controls when it finds them.
There’s also a minimal skin, closer to v8’s control bar if the default’s frosted look is too much of a change. Swap video.js for video-minimal.js and <video-skin> for <video-minimal-skin>.
Where your options went
The v8 options object is gone, and its contents scattered in four directions. This is the biggest conceptual step, so it’s worth understanding the four buckets before you go looking for a specific option.
- Media attributes. Anything the browser itself understands stays exactly where it was, on your media element.
- Player metadata. The title and poster belong to player state, which lets the skin or your custom UI render them.
- Your CSS. Sizing, aspect ratio, and responsive behavior are layout, and layout is yours.
- Composition. Which controls exist, which shortcuts fire, which language you’re in. You express these by choosing components rather than by setting flags.
Media attributes
Port these across untouched. They’re native attributes and always were.
Player metadata
The poster belongs to player state rather than the media, which lets the skin control how it appears:
The packaged video and live-video skins already include the <media-title> element, so setting content-title on the player displays it. Audio skins do not include a title. Add <media-title> where you want it in a custom layout or skin source you added to your project. For poster rendering options — including placeholders and custom image elements — see Add a poster and loading placeholder and the <media-poster> reference.
Your CSS
v8 had a small sizing language of its own. v10 doesn’t, because CSS already has one.
Composition
These are the ones that need a decision rather than a rename, so each has a section below.
Techs become media components
v8’s tech system was one of its harder ideas: an abstraction layer with a registry, a resolution order, and source handlers on top. Getting HLS meant getting VHS, which meant reasoning about overrideNative and hoping the right thing won.
v10 replaces the whole mechanism with a choice you make in markup. You pick the media component that plays your format, and that’s the tech decision.
Each needs its own import.
Package-manager installations also need the matching media package. The lightweight HLS component shown below uses
@videojs/spf; the hls.js component uses @videojs/hlsjs-video; Mux video and audio use @videojs/mux-video and
@videojs/mux-audio; DASH uses @videojs/dash-video; Vimeo uses @videojs/vimeo-video; and Shaka and Wistia use
@videojs/shaka-video and @videojs/wistia-video.
For HLS from the CDN:
With a package manager, install SPF and import the HTML registration instead:
Then swap the tag:
The lightweight HLS component runs on SPF, Video.js’s own playback engine, and helps keep v10 small. The hls.js component is a much larger download but more compatible, supporting TS-packaged media and DRM. Choose the one whose supported feature set fits your stream.
Your VHS tuning options don’t have direct equivalents. Rendition capping, bandwidth hints, and the rest are engine-specific, so they belong to whichever engine you chose rather than to a shared options object.
Customize your player
In v8, customizing meant three different techniques depending on what you wanted: options for some things, addChild and component subclassing for others, and CSS overrides on .vjs-* selectors for the look. v10 has one path with three levels of commitment. Try them in order.
Level 1: pick a skin
The default skin is a modern, frosted look. The minimal skin is closer to v8’s control bar. Both bring controls, tooltips, captions, keyboard shortcuts, touch gestures, and a settings menu that appears when there’s something to put in it. See Skins.
Both also include AirPlay and Cast buttons, which v8 had no answer for. Follow Cast to AirPlay and Chromecast to add the Google Cast extension. Remote playback is a feature you compose in rather than a plugin you install.
Level 2: restyle it
v8 customization meant writing selectors against internal class names and hoping they survived the next release. v10 skins expose custom properties instead, which are part of the public surface:
--media-accent-color reaches the sliders, the active buttons, and the accent surfaces at once. Video.js derives a readable text color to sit on top of it; override that with --media-accent-text-color if you’d rather choose. --media-border-radius rounds the player, and --media-scale-unit scales the whole control bar, which is the closest thing to v8’s font-size trick for sizing controls. Customize skins has the full list.
Level 3: edit skin source
For changes to controls, layout, or interactions, add the skin source to your project. Its components and styles become local files. Customize skins covers the setup and available skins.
This is where v8’s controlBar config and addChild calls end up, and honestly it’s the better trade. Instead of controlBar: { pictureInPictureToggle: false }, you delete a line. Instead of subclassing a component to change its behavior, you edit the markup.
Keep the player and skin registration imports. The skin import registers the container and UI elements that the copied layout uses; you do not render the skin element itself:
Then write the layout yourself:
Those hotkey and gesture declarations are where userActions went. v8’s userActions.hotkeys was a function you wrote; here each shortcut is a component with a key and an action, and userActions.click and doubleClick become gestures with a region. The packaged skins already include a sensible set of both, which is why you don’t see them in the earlier examples.
When you add the skin source, you also take on its CSS. The packaged skins ship styles for everything above; a bare layout renders unstyled until you bring those along, so the added source includes the skin’s stylesheet next to its markup.
Plugins
v10 has no plugin system. There’s no videojs.registerPlugin, no player.myPlugin(), and no plugin lifecycle.
That’s a deliberate choice rather than a missing feature. v8 plugins existed largely because there was no other way in: to add a control, change a behavior, or support a format, you had to reach into player internals through the one door the plugin API provided. v10 gives you the front door instead: components you can add, skin source you can change, and media elements you can swap. Most of what plugins did is now ordinary composition.
Audit your plugins and sort them into four piles:
- Formats and techs (
videojs-contrib-*, YouTube, Vimeo, Mux). Replace with the matching media component. See Techs become media components. - UI additions (extra buttons, overlays, custom control bars). Rebuild them by editing the skin source in your project, or with your own component. This is usually less code than the plugin was.
- Workarounds for v8 limitations. Check whether the limitation still exists before you port anything.
- Genuinely missing features (ads, playlists). These need real work, and some have no home yet. Get them on the list early, because they’ll drive your timeline.
That last pile is the honest risk in a v8 migration. If your player depends on an ads plugin, there’s no v10 answer today.
Read player state
Events
Your media element is a real media element, so every event you already listen for still fires on it. The listeners port directly; only where you attach them changes.
One category doesn’t survive that translation, because those were never media events. v8’s UI events (useractive, userinactive, playerresize, texttrackchange) were the player’s own. Read the equivalent from player state instead.
Player state
Use PlayerController inside a custom element. Give it a selector for the feature you care about and it keeps your element in sync as that state changes:
Drive playback
v8 used accessor methods for everything: player.currentTime() to read, player.currentTime(10) to write. v10 keeps that single-object habit: control everything through the player. Its store holds the state each feature tracks and an action for each of these calls — playback, seeking, volume, rate, fullscreen, captions, and quality alike.
You can also write to the media element directly. That is safe because player state derives from the native media events: set media.currentTime and the time slider follows. There is no wrapper to fall out of sync.
Everything the table describes as “the player’s” lives on the player element’s store. Hold a reference to <video-player> the way you held a v8 player instance, and call actions on its store.state:
Swapping sources is the change most likely to surprise you. There’s no player.src(); you set src on the media element, or replace the media element entirely, and the UI follows. Changing formats is changing tags.
Languages
v8 shipped one language and asked you to register more with videojs.addLanguage. v10 ships locale packs for around 50 languages, so most apps need no setup at all. See Internationalize the player.
To override individual strings:
See Internationalize the player for scoped overrides, custom locales, and runtime switching.
Live and audio-only
v8 turned live UI on with a liveui flag, and audio-only on with audioOnlyMode. In v10 these are different players with different skins, because live and audio-only have different state and a genuinely different UI. See Presets.
For audio, use the audio player with the audio skin, or the live audio pair. There’s also a background video player for muted, chrome-free background video, which v8 had no answer for.
You get targetLiveWindow and liveEdgeStart in state, plus a live button that jumps to the live edge. The live preset does not include streamType; add the stream type feature to a custom player when you need it. v8’s liveTracker tuning has no equivalent (#1730).
The live composition is deliberately narrower than the video one. It leaves out playback rate, quality, and audio-track state, so those controls don’t appear in a live skin’s settings menu. If you need an omitted feature on a live player, build your own player from a feature list rather than taking the preset’s.
That’s what createPlayer is for. Hand it a feature list and you get back the mixins to define your own player element.
Moved utilities
v8 put a handful of utilities on the videojs global for anyone building a custom component or plugin: videojs.time.formatTime, videojs.dom, videojs.fn.throttle, and a few others. There’s no global in v10, but the same job is covered by @videojs/utils.
These are worth reaching for before writing your own when extending the player. For example, formatTime is the exact digital-clock formatting the packaged skins use for their own time displays, so a custom one will match.
The package is split into subpaths, so you can import only the module you need. Other than time, it includes array, events, i18n, jwt, predicate, string, and types subpaths for anything else a custom component or plugin replacement needs.
Import the util function directly in a module <script> tag:
Or with a bundler:
Known gaps
Ordered roughly by how likely each is to block a v8 migration.
- No ads support. v8’s IMA and ad-plugin ecosystem has no v10 equivalent. This is the most common hard blocker.
- No playlist support. No
videojs-playlistequivalent. - No plugin system, by design. Budget for rebuilding UI plugins as components. See Plugins.
- Playback rates are a fixed set —
0.2,0.5,0.7,1,1.2,1.5,1.7,2— so v8’splaybackRateshas no equivalent yet (#1404). - No text-track settings dialog. v8’s
textTrackSettingslet viewers restyle captions; v10 exposes only the positioning custom properties its skins define. - No spatial navigation. v8’s
spatialNavigationfor TV and D-pad remotes has no equivalent. - Nothing persists between sessions: volume, captions language, speed, quality. That’s out of scope for GA (#944). Default subtitle language is tracked at #1423.
- No VHS-equivalent tuning surface. Engine settings belong to the engine you chose, and the lightweight HLS component deliberately exposes few of them.
- Chapters render in the time slider from a
<track kind="chapters">, and its segments reflectdata-active. There is no player-level active chapter value or chapter menu, so v8’s chapters menu has no equivalent (#1873). Cue points aren’t implemented (#1442). - The controls auto-hide delay isn’t configurable, so arbitrary
inactivityTimeoutvalues have no equivalent (#1728). The commoninactivityTimeout: 0case is covered byvisibility="always"on the controls component in a custom layout or a skin layout in your project. - No full-window fullscreen fallback. v8 had one for browsers without the Fullscreen API; support is around 96% now.
- Multiple
<source>elements withsizemetadata don’t become a quality menu. Use HLS or DASH for adaptive quality; picking renditions by resolution won’t be added (#1415). - Two skins, and no runtime theme switch.
- Native controls are not automatically removed when custom controls load (#1160).
- Smaller conveniences without homes yet: debug mode (#1406) and autoplay with a muted fallback (#1039).
See also
- Features and Presets
- Media sources
- Skins and Customize skins