Awesome Open Source
Awesome Open Source

English | 简体中文


xgplayer is a web video and audio player library, designed with separate, detachable UI components. Since everything is componentized. the UI layer is very flexable.
xgplayer is bold in its functionality: it gets rid of video loading, buffering, and format support for video dependence. For mp4 that does not support streaming, you can use staged loading. This means load control, seamless switching without artifacts, and video bandwidth savings. It also integrates on-demand and live support for FLV, HLS, and dash.

For more details, please read the Documentation.


  1. Install

    $ npm install xgplayer
  2. Usage

    Step 1:

    <div id="vs"></div>

    Step 2:

    import Player from 'xgplayer';
    const player = new Player({
        id: 'vs',
        url: ''

    This is the easiest way to configure the video player. For more advanced content, see the plug-in section or documentation. more config


xgplayer provides more plugins. Plugins are divided into two categories: one is self-starting, and another inherits the player's core class named xgplayer. In principle, the officially provided plug-ins are self-starting and the packaged third-party libraries are inherited. Some feature plug-ins themselves can provide a downgrade scenario that suggests a self-start approach, or an inheritance approach if not. The player supports custom plugins for more content viewing plugins

The following is how to use a self-starting plug-in:

import Player from 'xgplayer';
import 'xgplayer-mp4';

const player = new Player({
    id: 'video',
    url: '//'

xgplayer-mp4plugin is self-starting, It loads mp4 video itself, parses mp4 format, implements custom loading, buffering, seamless switching, and so on. it will automatically downgrade devices that do not support MSE. details


For debugging, we provide example video files in github. You can clone the whole git repository, which includes both code and example videos with 'git clone --recurse-submodules -j8'. With 'git clone' you will pull only xgplayer code and its plugins.

$ git clone --recurse-submodules -j8 [email protected]:bytedance/xgplayer.git # OR git clone [email protected]:bytedance/xgplayer.git
$ cd xgplayer
$ npm install
$ npm run dev

Then visit http://localhost:9090/examples/index.html


Welcome to use xgplayer! Please read the following terms carefully. Using xgplayer means that you accept and agree to the terms.

  1. Xgplayer is licensed under the MIT License. You comply with its obligations by default.
  2. By default, you authorize us to place your logo in xgplayer website, which using xgplayer. If you have any problem, please let us know.

Join Us

We welcome anyone with an interest in web media technology to join! Please contact us at [email protected]

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (68,065
video (807
player (234
video-player (124
hls (117
dash (95
mp4 (72
html5-video (26
flv (25
videoplayer (16

Find Open Source By Browsing 7,000 Topics Across 59 Categories