mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
优化demo
This commit is contained in:
1 parent
a836852e48
commit
06fc487482
14 files changed
+75
-56
No files matched your search
@@ -3,8 +3,19 @@ var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: url + '/video/your-name.mp4',
|
||||
autoSize: true,
|
||||
localVideo: true,
|
||||
moreVideoAttr: {
|
||||
crossOrigin: 'anonymous',
|
||||
},
|
||||
controls: [
|
||||
{
|
||||
name: 'open',
|
||||
position: 'right',
|
||||
html: 'Local Video',
|
||||
mounted: $open => {
|
||||
art.plugins.localVideo.attach($open);
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: [artplayerPluginBacklight],
|
||||
});
|
||||
@@ -4,7 +4,7 @@ var art = new Artplayer({
|
||||
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||
title: '【新海诚动画】『秒速5センチメートル』',
|
||||
autoSize: true,
|
||||
localPreview: true,
|
||||
localVideo: true,
|
||||
moreVideoAttr: {
|
||||
crossOrigin: 'anonymous',
|
||||
},
|
||||
@@ -16,16 +16,13 @@ var art = new Artplayer({
|
||||
mounted: $gif => {
|
||||
art.plugins.artplayerPluginGif.attach($gif);
|
||||
},
|
||||
style: {
|
||||
marginRight: '15px'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'open',
|
||||
position: 'right',
|
||||
html: 'Local video',
|
||||
html: 'Local Video',
|
||||
mounted: $open => {
|
||||
art.plugins.localPreview.attach($open);
|
||||
art.plugins.localVideo.attach($open);
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -40,4 +37,4 @@ art.on('artplayerPluginGif', image => {
|
||||
animatedImage.src = image;
|
||||
$popinner.innerHTML = '';
|
||||
$popinner.appendChild(animatedImage);
|
||||
});
|
||||
});
|
||||
@@ -18,21 +18,21 @@ var art = new Artplayer({
|
||||
html: '发送弹幕',
|
||||
click: () => {
|
||||
if (window.location.href.includes('code=')) {
|
||||
art.notice.show('正在登陆中,请稍等!!!');
|
||||
art.notice.show = '正在登陆中,请稍等!!!';
|
||||
} else if (!danmuku.isLogin) {
|
||||
danmuku.login();
|
||||
} else {
|
||||
var text = prompt('请输入:', '弹幕内容');
|
||||
if (!text || !text.trim()) return;
|
||||
if (text.length >= 20) {
|
||||
art.notice.show('弹幕字数不能大于20字!!!');
|
||||
return;
|
||||
}
|
||||
if (danmuku.remaining <= 10) {
|
||||
art.notice.show('接口请求到达上限,请稍后再试!!!');
|
||||
art.notice.show = '弹幕字数不能大于20字!!!';
|
||||
return;
|
||||
}
|
||||
art.notice.show('弹幕发送中...');
|
||||
if (danmuku.remaining <= 10) {
|
||||
art.notice.show = '接口请求到达上限,请稍后再试!!!';
|
||||
return;
|
||||
}
|
||||
art.notice.show = '弹幕发送中...';
|
||||
danmuku
|
||||
.send({
|
||||
text: text,
|
||||
@@ -40,15 +40,16 @@ var art = new Artplayer({
|
||||
color: '#' + Math.floor(Math.random() * 0xffffff).toString(16),
|
||||
})
|
||||
.then(data => {
|
||||
art.notice.show(`发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`);
|
||||
art.notice.show = `发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`;
|
||||
art.plugins.artplayerPluginDanmuku.emit({
|
||||
...data,
|
||||
mode: 'scroll',
|
||||
time: art.player.currentTime + 0.2,
|
||||
border: data.color,
|
||||
});
|
||||
}).catch(() => {
|
||||
art.notice.show(`发送弹幕失败: ${danmuku.remaining} / ${danmuku.limit}`);
|
||||
})
|
||||
.catch(() => {
|
||||
art.notice.show = `发送弹幕失败: ${danmuku.remaining} / ${danmuku.limit}`;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -12,9 +12,6 @@ var art = new Artplayer({
|
||||
click: () => {
|
||||
art.plugins.artplayerPluginPlaylist.show();
|
||||
},
|
||||
style: {
|
||||
marginRight: '15px',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'prev',
|
||||
@@ -23,9 +20,6 @@ var art = new Artplayer({
|
||||
click: () => {
|
||||
art.plugins.artplayerPluginPlaylist.prev();
|
||||
},
|
||||
style: {
|
||||
marginRight: '15px',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'next',
|
||||
|
||||
Reference in new issue
Block a user