Installation
Get started quickly with Video.js by building your first embed code
Video.js is audio and video player components — intentionally built to achieve minimal bundle sizes while providing framework-specific customization and a great viewer experience. Answer the questions below to get started quickly with your first embed code.
Choose your JS framework
Video.js aims to provide idiomatic development experiences in your favorite JS and CSS frameworks. More to come ( vote )[todo].
Choose your use case
The defaults work well for general website playback. More use case player presets to come.
Choose your source type
Video.js supports your favorite file types and hosting services. Whichever you choose can be easily changed later. ( missing something? )
Select your source
Or upload your media for free to Mux
Install your player
npm install @videojs/htmlpnpm add @videojs/htmlyarn add @videojs/htmlbun add @videojs/html<script>
// don't need this, will be included in frosted
// import 'https://cdn.jsdelivr.net/npm/videojs/html/presets/website.js';
import 'https://cdn.jsdelivr.net/npm/videojs/html/presets/website/skins/frosted.js';
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/videojs/html/presets/website/skins/frosted.css" />npm install @videojs/reactpnpm add @videojs/reactyarn add @videojs/reactbun add @videojs/reactUse your player
<!--
The PlayerProvider passes state between the UI components
and Media, and makes fully custom UIs possible.
It does not have layout by default (display:contents)
-->
<undefined>
<!--
Skins contain the entire player UI and are easily swappable.
They can each be "ejected" for full control and customization
of UI components.
-->
<frosted-video-skin>
<!--
Media are players without UIs, handling networking
and display of the media. They are easily swappable
to handle different sources.
-->
<video src="..."></video>
</frosted-video-skin>
</undefined>import '@videojs/html/skins/frosted';Create your player
// [your project] ./components/player/index.tsx
import { createPlayer, presets, Video } from '@videojs/react';
import { FrostedVideoSkin } from '@videojs/react/presets/default-video';
import '@videojs/react/presets/default-video/skins/frosted.css';
interface MyPlayerProps {
src: string;
}
// Set up the player state features
const { PlayerProvider } = createPlayer(presets['default-video']);
export const MyPlayer = ({ src }: MyPlayerProps) => {
return (
{/* The Provider passes state between the UI components
and the Media, and makes fully custom UIs possible.
Does not render its own HTML element. */}
<PlayerProvider>
{/* Skins contain the entire player UI and are easily swappable.
They can each be "ejected" for full control and customization
of UI components. */}
<FrostedVideoSkin>
{/* Media are players without UIs, handling networking
and display of the media.
They are easily swappable to handle different sources. */}
<Video src={src} />
</FrostedVideoSkin>
</PlayerProvider>
);
};Use your player
// HomePage.tsx
import { MyPlayer } from '../components/player';
export const HomePage = () => {
return (
<div>
<h1>Welcome to My App</h1>
<MyPlayer src="https://example.com/video.mp4" />
</div>
);
};That’s it! You now have a fully functional Video.js player. Go forth and play.