Artplayer弹幕事件监听:
- var art = new Artplayer({
- container: '.artplayer-app',
- url: '/assets/sample/video.mp4',
- setting: true,
- plugins: [
- artplayerPluginDanmuku({
- danmuku: '/assets/sample/danmuku.xml',
- }),
- ],
- });
- art.on('artplayerPluginDanmuku:emit', (danmu) => {
- console.info('新增弹幕', danmu);
- });
- art.on('artplayerPluginDanmuku:loaded', (danmus) => {
- console.info('加载弹幕', danmus.length);
- });
- art.on('artplayerPluginDanmuku:error', (error) => {
- console.info('加载错误', error);
- });
- art.on('artplayerPluginDanmuku:config', (option) => {
- console.info('配置变化', option);
- });
- art.on('artplayerPluginDanmuku:stop', () => {
- console.info('弹幕停止');
- });
- art.on('artplayerPluginDanmuku:start', () => {
- console.info('弹幕开始');
- });
- art.on('artplayerPluginDanmuku:hide', () => {
- console.info('弹幕隐藏');
- });
- art.on('artplayerPluginDanmuku:show', () => {
- console.info('弹幕显示');
- });
- art.on('artplayerPluginDanmuku:destroy', () => {
- console.info('弹幕销毁');
- });
复制代码
|