WPlayer 是基于 DPlayer 1.27.1 开发的弹幕播放器,具体内容请参考官方文档
使用 npm:
npm install wplayer-next --save
使用 Yarn:
yarn add wplayer-next
加载播放器文件:
<div id="wplayer"></div>
<script src="WPlayer.min.js"></script>
或者使用模块管理器:
import WPlayer from 'wplayer-next';
const player = new WPlayer(options);
在 js 里初始化:
const player = new WPlayer({
container: document.getElementById('wplayer'),
video: {
url: 'demo.mp4',
},
});