React 中直接用需注意 class 而非 className,建议用官方 React 包装组件;项目方已推荐新项目改用 Video.js,需评估维护方向
media-chrome
muxincMIT活跃维护一套基于 Web Components 的媒体播放器控件,能快速给网站或应用加上外观统一的音视频播放界面,不用自己从头写 UI。
Custom elements (web components) for making audio and video player controls that look great in your website or app.
<script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome@4/+esm"></script>README 未说明,纯前端库无特殊硬件要求
用 Web Components 搭自定义音视频播放器控件,HTML 加 CSS 就能改样式
一套基于 Web Components 的媒体播放器控件,能快速给网站或应用加上外观统一的音视频播放界面,不用自己从头写 UI。
核心能力
- 用 media-* 自定义元素拼装播放控件
- 纯 HTML 增删控件、纯 CSS 改样式
- 兼容 React、Angular、Svelte 等框架
- 可对接 video/audio 及 YouTube、HLS.js 等播放器
- 提供 React 包装组件避免 Web Components 写法别扭
容易踩的坑
- v4.19.4最新正式版2026-10-23 · 2026-10-23 13:18 UTC
Bug Fixes
- error-dialog: render error attribute values as text (#1331) (d862932)
- don't list disabled hotkeys in the keyboard shortcuts dialog (#1312) (9c819e1), closes #1305
- hide poster on seek for ON_DEMAND streams (#1322) (2e7c52e)
- i18n: accept partial dictionaries in addTranslation (#1321) (0ddb749), closes #1314
Performance Improvements
- v4.19.32026-09-28 · 2026-09-28 15:07 UTC
查看更新说明
Bug Fixes
- (docs) correct broken link to defaultstreamtype on stream-type page (#1298) (d8e337f), closes #1297
- return '0 seconds' for zero input in formatAsTimePhrase (#1300) (c624760), closes #1299
- snap media-time-range when seeking back less than 3% of duration (#1315) (803787e), closes #1306 #1307
- updates mediacurrenttime when a seek starts, before it completes (#1316) (7e8a08f)
- v4.19.22026-06-10 · 2026-06-10 19:22 UTC
- v4.19.12026-06-01 · 2026-06-01 15:22 UTC
- v4.19.02026-04-13 · 2026-04-13 18:46 UTC
查看更新说明
Bug Fixes
- Auto rendition label for vertical videos (#1274) (de23cdc)
- Replace aria-valuetext with aria-description for improved accessibility (#1286) (3b1014b)
- replace low-res 48x48 favicon with proper 1200x630 OG image (#1283) (3688052)
- update focus-visible box-shadow to use CSS variable (#1279) (4975ab8), closes #1278 /#diff-453ac22c98e6886a5fa7e178193648b57e699c7a80e7af61b07a4a92911dfaf3L35-R35
Features
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
[!IMPORTANT] Media Chrome, meet Video.js 👋
The folks behind Media Chrome, Plyr and Vidstack have joined forces to build the latest version of Video.js: one modern, accessible player with the best of all three. It keeps what made Media Chrome great, like HTML-first
media-*elements styled with plain CSS, and adds React components, polished skins, and streaming built in. Starting something new? Give Video.js a try.
Your media player's dancing suit. :man_dancing:
Fully customizable media player controls using web components (native custom elements).
- Compatible with any javascript framework (React, Angular, Svelte, etc.)
- Compatible with the
<video>and<audio>elements and a lot of players (YouTube, HLS.js, and more) - Simple HTML to add/remove controls
- Simple CSS to style the controls
From Mux, the team behind Video.js. Need video hosting? Check out Mux!
Documentation
Visit the official documentation for Media Chrome for the latest up-to-date usage instructions.
Examples
See all of the repo examples in action.
Video Example
<script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome@4/+esm"></script>
<media-controller>
<video
slot="media"
src="https://stream.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/high.mp4"
crossorigin
>
<track
label="thumbnails"
default
kind="metadata"
src="https://image.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/storyboard.vtt"
/>
</video>
<media-control-bar>
<media-play-button></media-play-button>
<media-mute-button></media-mute-button>
<media-volume-range></media-volume-range>
<media-time-range></media-time-range>
<media-pip-button></media-pip-button>
<media-fullscreen-button></media-fullscreen-button>
</media-control-bar>
</media-controller>
Results (Try the CodePen example)
Audio Example
<script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome@4/+esm"></script>
<media-controller audio>
<audio
slot="media"
src="https://stream.mux.com/O4h5z00885HEucNNa1rV02wZapcGp01FXXoJd35AHmGX7g/audio.m4a"
></audio>
<media-control-bar>
<media-play-button></media-play-button>
<media-time-display showduration></media-time-display>
<media-time-range></media-time-range>
<media-playback-rate-button></media-playback-rate-button>
<media-mute-button></media-mute-button>
<media-volume-range></media-volume-range>
</media-control-bar>
</media-controller>
Results (Try the CodePen example)
Use with React
While you technically can use Media Chrome elements directly with React, it can sometimes be a bit clunky to work with Web Components in React, and some things just don't feel idiomatic to the framework (for example: having to use class= instead of className=, see React's official docs regarding web components for more details). To help with this, we've published some React wrapper components for all of our core Elements. You can read up on using them here.
Why?
More often than not web designers and developers just use the default media player controls, even when creating a beautiful custom design theme. It's hard not to.
- Web browsers have built-in media controls that can't easily be customized and look different in every browser.
- Social sites like Youtube, Vimeo, and SoundCloud only let you customize small details of the player, like primary button color.
- Media controls are complex and hard to build from scratch. Open source players like Video.js and JW Player help, but require you to learn proprietary JS APIs, and can be difficult to use with popular Javascript frameworks.
It should be easier... <media-chrome> is an attempt at solving that.
Why now?
Web components. @heff spoke about the potential of web components for video at Demuxed 2015, and again in 2020. They allow us to extend the browser's base HTML functionality, meaning we can now build media player controls as simple HTML tags that:
- Can be used like any native HTML tag in HTML, Javascript, and CSS (unleash your designer)
- Are compatible by default with Javascript frameworks (React, Angular, Svelte)
- Can be used across players when using multiple in the same site, e.g Youtube &
<video>. (Could even be used by players as their own built-in controls)