mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:46:16 -08:00
build all packages
This commit is contained in:
1 parent
7c72e3ecd8
commit
429330a7e2
10 files changed
+3215
No files matched your search
@@ -0,0 +1,60 @@
|
||||
// 接口每小时限制 5000 次请求,勿滥用
|
||||
var github = new ArtplayerToolGithub({
|
||||
api: 'zhw2590582/github-issues-api-as-danmuku/issues/1',
|
||||
clientID: '749a95aad589f8849abe',
|
||||
clientSecret: '7bb6fa67ef6e525e5bd5fda46cd3925ecc4a3760',
|
||||
});
|
||||
|
||||
var url = 'https://zhw2590582.github.io/assets-cdn';
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: url + '/video/you-name.mp4',
|
||||
autoSize: true,
|
||||
controls: [
|
||||
{
|
||||
name: 'danmuku',
|
||||
position: 'right',
|
||||
html: '发送弹幕',
|
||||
click: () => {
|
||||
if (!github.isLogin) {
|
||||
github.login();
|
||||
} else {
|
||||
var text = prompt('请输入:', '弹幕内容');
|
||||
if (!text || !text.trim()) return;
|
||||
if (github.remaining <= 10) {
|
||||
art.notice.show('接口请求到达上限,请稍后再试!!!');
|
||||
return;
|
||||
}
|
||||
art.notice.show('弹幕发送中...');
|
||||
github
|
||||
.send({
|
||||
text: text,
|
||||
time: art.player.currentTime,
|
||||
color: '#' + Math.floor(Math.random() * 0xffffff).toString(16),
|
||||
})
|
||||
.then(data => {
|
||||
art.notice.show(`发送弹幕成功: ${github.remaining} / ${github.limit}`);
|
||||
art.plugins.artplayerPluginDanmu.emit({
|
||||
...data,
|
||||
time: art.player.currentTime,
|
||||
border: data.color,
|
||||
});
|
||||
}).catch(() => {
|
||||
art.notice.show(`发送弹幕失败: ${github.remaining} / ${github.limit}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
artplayerPluginDanmu({
|
||||
danmus: () => github.cache(),
|
||||
speed: 5,
|
||||
opacity: 1,
|
||||
color: '#fff',
|
||||
size: 25,
|
||||
maxlength: 50,
|
||||
margin: [10, 100],
|
||||
}),
|
||||
],
|
||||
});
|
||||
Reference in new issue
Block a user