mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 18:51:55 -08:00
add vue
This commit is contained in:
1 parent
26fba8e2a6
commit
0ed7f87794
11 files changed
+9364
-82
No files matched your search
@@ -1,50 +1,27 @@
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
autoSize: true,
|
||||
fullscreen: true,
|
||||
fullscreenWeb: true,
|
||||
plugins: [
|
||||
artplayerPluginDanmuku({
|
||||
danmuku: '/assets/sample/danmuku-v2.xml',
|
||||
speed: 5,
|
||||
opacity: 1,
|
||||
fontSize: 20,
|
||||
maxlength: 100,
|
||||
margin: ['10%', 60],
|
||||
antiOverlap: true,
|
||||
useWorker: true,
|
||||
synchronousPlayback: false,
|
||||
filter: (danmu) => danmu.text.length < 50,
|
||||
}),
|
||||
],
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '隐藏',
|
||||
click: function (_, event) {
|
||||
if (art.plugins.artplayerPluginDanmuku.isHide) {
|
||||
art.plugins.artplayerPluginDanmuku.show();
|
||||
event.target.innerText = '隐藏';
|
||||
} else {
|
||||
art.plugins.artplayerPluginDanmuku.hide();
|
||||
event.target.innerText = '显示';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
position: 'right',
|
||||
html: '发送',
|
||||
click: function () {
|
||||
var text = prompt('请输入弹幕文本', '弹幕测试文本');
|
||||
if (!text || !text.trim()) return;
|
||||
var color = '#' + Math.floor(Math.random() * 0xffffff).toString(16);
|
||||
art.plugins.artplayerPluginDanmuku.emit({
|
||||
text: text,
|
||||
color: color,
|
||||
border: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
var art = new Artplayer(
|
||||
{
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
autoSize: true,
|
||||
fullscreen: true,
|
||||
fullscreenWeb: true,
|
||||
plugins: [
|
||||
artplayerPluginDanmuku({
|
||||
danmuku: '/assets/sample/danmuku-v2.xml',
|
||||
speed: 5,
|
||||
opacity: 1,
|
||||
fontSize: 20,
|
||||
maxlength: 100,
|
||||
margin: ['10%', 60],
|
||||
antiOverlap: true,
|
||||
useWorker: true,
|
||||
synchronousPlayback: false,
|
||||
filter: (danmu) => danmu.text.length < 50,
|
||||
}),
|
||||
],
|
||||
},
|
||||
function () {
|
||||
const danmuku = document.querySelector('.danmuku');
|
||||
art.plugins.artplayerPluginDanmuku.mount(danmuku);
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user