gitmyhub

xgplayer

JavaScript ★ 9.2k updated 9d ago

A HTML5 video player with a parser that saves traffic

A browser video player from ByteDance that streams MP4 files in segments to reduce buffering, and supports HLS, DASH, and FLV formats through a fully plugin-based architecture.

JavaScriptnpmHLSDASHFLVsetup: moderatecomplexity 3/5

xgplayer is a web video player built by ByteDance, the company behind TikTok. It is designed to be embedded into websites and web applications to play video content in a browser. Developers add it to a webpage with a few lines of code, point it at a video file, and it handles the rest.

The player is notable for how it handles MP4 video files. Standard browser video players download the entire file or rely on the server to support streaming. xgplayer can load an MP4 file in segments, which reduces how much data is transferred, allows switching between quality levels without interruption, and gives developers more control over buffering behavior. The README describes this as the key feature that sets it apart from typical web players.

Beyond MP4, the player supports HLS and DASH, which are the two most common streaming formats used for live video and on-demand content at scale. There is also support for FLV, a format still used in some live streaming contexts. Each format is handled through a plugin, and the player's architecture is built around the idea that every feature, including UI controls, is a self-contained component that can be added, removed, or replaced.

Installation uses npm, the standard package manager for JavaScript projects. The documentation site covers configuration options and the plugin system in more detail. The project is open source under the MIT license.

Where it fits