Usage
$ npm install xgplayer@next
$ npm install xgplayer-music@next
Step 1:
<div id="vs"></div>
Step 2:
import Player from 'xgplayer'
import 'xgplayer/dist/index.min.css'
import MusicPreset from 'xgplayer-music'
import 'xgplayer-music/dist/index.min.css'
const player = new Player({
id: 'vs',
url: 'http://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4',
poster: 'xxxx',
title: '这是音乐标题',
controls: {
mode: 'flex',
initShow: true
},
marginControls: true
mediaType: 'audio',
preset: ['default', MusicPreset],
music: {
list: [{
url: 'xx',
vid: '123',
poster: 'ccc',
title: 'ccc'
}]
},
width: "100%",
height: 70
})
This is the easiest way to configure the player,then it runs with video. For more advanced content, see the plug-in section or documentation. more config