西瓜播放器 HTML5 video video.js 播放器 HTML5播放器 mp4 hls hls.js flv flv.js dash dash.js 无缝切换

Getting Started

Only three steps: With installation、DOM placeholder and instantiation you can finish using the player.

Installation

# The last stable version
$ npm install xgplayer

For the existed project the player can be introduced with CDN. The code appears as follows.

<script src="//cdn.jsdelivr.net/npm/xgplayer@1.1.3/browser/index.js" type="text/javascript"></script>

Note

you will use latest without given version,but we recomment use it by giving version,more see jsdelivr.

Use Player

1. Setting the player container on the page.

<div id="mse"></div>

2. Instantiation

let player = new Player({
  id: 'mse',
  url: '//abc.com/**/*.mp4'
});

With two steps you can finish the simplest video play(VOD in MP4). The player provides the rich configuration options, such as autoplay, mapping, volume control, turning off built-in controls and so on. Check Configuration for more information.

If you need some functions about LIVE,the player can automatically identify the LIVE or playback, Check Examples for more information.

Note

The core packages and plugins are compiled with babel to ES5.

DEMO

Compatibility

  • VOD needs IE10+.
  • LIVE needs the browser with supporting Media Source Extensions
  • The requirements for the compatibility are reduced in different business needs. Check Plugins for more information.