6年构建视频播放器。90亿请求。重新开始。
6 Years Building Video Players. 9B Requests. Starting Over

原始链接: https://www.mux.com/blog/6-years-building-video-players-9-billion-requests-starting-over

## 从 Vime 到 Video.js v10:视频播放器开发的历程 本文详细介绍了作者构建视频播放器库的历程,从 2020 年的 Vime 开始,最终在 Mux 贡献 Video.js v10。作者对现有播放器感觉像僵化的“黑盒子”感到不满,最初寻求一种更基于组件的方法,使用 Svelte,从而创建了 Vime。 虽然 Vime 获得了发展,但也暴露了一些挑战——特别是围绕事件驱动的状态管理和现代视频功能的复杂性。这促成了 Reddit 的 Vidstack,它利用 Web 组件和完善的状态管理系统。尽管 Vidstack 取得了成功,但 Web 组件与 React、Vue 和 Svelte 等框架未能完全集成的问题依然存在。 核心经验教训是需要构建*与*框架一起的播放器,而不是*为*它们构建的播放器。加入 Mux 并与 Media Chrome 团队合作后,作者现在专注于 Video.js v10。这个新版本利用了 Vidstack 的最佳方面——可组合的组件、可访问性和强大的功能集——同时通过新的架构、用于框架/样式变体的编译器以及真正可定制的皮肤来解决其局限性。Video.js v10 旨在成为一个模块化、可扩展的播放器,为开发者提供完全控制权,并在他们选择的框架内提供原生体验。

相关文章

原文

How Vidstack's Journey is Shaping Video.js v10

This is part of a series on the making of Video.js v10. See also: Wesley on how Media Chrome's HTML-first architecture is evolving and Sam on how Plyr's design polish is shaping the UI.


Between Vime and Vidstack: 9 billion CDN requests. 7 million NPM downloads. 6,200 GitHub stars. Over 200 releases. Now I'm building something better.

My journey started in 2020 with a library called Vime. At the time, video players like Video.js and Plyr felt like black boxes. You dropped a script on your page and hoped for the best. Customization meant fighting against the library rather than working with it.

Example script


<video class="video-js" controls data-setup="{}"></video>
<script src="<https://vjs.zencdn.net/8.23.4/video.min.js>"></script>

Meanwhile, frameworks like Svelte were showing us what compiled components could be. Small, composable pieces. State that flowed predictably. A JS compiler target. I remember thinking: this is how we should build players. Why isn't anyone doing this?

So I built one.

I posted Vime on Reddit and it took off. People were actually using it. My first real open source project, and developers were building video players with it. That feeling never gets old.

In retrospect, a lot of the excitement was probably just that I was using Svelte — the exciting new kid on the block.

But honestly, I'd created something awkward. A bespoke plugin system that didn't feel natural to anyone. I hadn't really solved the problem. I'd just moved it around.

Creating a player in Vime 1.x (built on Svelte)

const player = new Player({
 target,
 props: {
   plugins: [ActionDisplay, Keyboard, Tooltips], 
 },
});

Here's what I learned about why video breaks people's expectations.

Events ≠ state. The video element fires events, but they're inconsistent across browsers. They might fire, they might not, they might fire in rapid succession. Wiring up UI to these events is fragile. Tracking whether they came from a user or the media itself is even more challenging.

And that's before you get to the features people actually need: captions in multiple formats, streaming protocols, adaptive bitrate, ads, DRM, analytics, and so on. It spirals quickly.

The old players solved this by hiding everything. You got a widget. It worked (mostly). But if you wanted something different, you were on your own.