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="//unpkg.byted-static.com/xgplayer@2.31.2/browser/index.js" type="text/javascript"></script>
Note
Please use stable version in CDN url, 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.