mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-14 08:26:16 -08:00
add danumuku lockTime
This commit is contained in:
1 parent
a989de98e5
commit
d0f6d643a4
5 files changed
+77
-2
No files matched your search
@@ -56,6 +56,7 @@ export default class Danmuku {
|
||||
antiOverlap: true,
|
||||
useWorker: true,
|
||||
synchronousPlayback: false,
|
||||
lockTime: 5,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ export default class Danmuku {
|
||||
antiOverlap: 'boolean',
|
||||
useWorker: 'boolean',
|
||||
synchronousPlayback: 'boolean',
|
||||
lockTime: 'number',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -256,6 +258,7 @@ export default class Danmuku {
|
||||
|
||||
this.option.speed = clamp(this.option.speed, 1, 10);
|
||||
this.option.opacity = clamp(this.option.opacity, 0, 1);
|
||||
this.option.lockTime = clamp(this.option.lockTime, 0, 60);
|
||||
|
||||
if (option.fontSize) {
|
||||
this.option.fontSize = this.getFontSize(this.option.fontSize);
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function setting(art, danmuku) {
|
||||
const $danmuOff = getIcon(danmuOff, 'danmu-off');
|
||||
const $danmuConfig = getIcon(danmuConfig, 'danmu-config');
|
||||
const $danmuStyle = getIcon(danmuStyle, 'danmu-config');
|
||||
const $control = danmuku.option.mount || $controlsCenter;
|
||||
const $control = danmuku.option.mount instanceof Element ? danmuku.option.mount : $controlsCenter;
|
||||
|
||||
function addEmitter() {
|
||||
const colors = [
|
||||
@@ -113,7 +113,7 @@ export default function setting(art, danmuku) {
|
||||
$input.value = '';
|
||||
danmuku.emit(danmu);
|
||||
addClass($send, 'art-disabled');
|
||||
countdown(danmuku.option.timeout || 5);
|
||||
countdown(danmuku.option.lockTime);
|
||||
art.emit('artplayerPluginDanmuku:emit', danmu);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,12 @@ export default function setting(art, danmuku) {
|
||||
art.on('resize', () => {
|
||||
setStyle($emitter, 'display', $control.clientWidth < 150 ? 'none' : null);
|
||||
});
|
||||
|
||||
art.on('destroy', () => {
|
||||
if ($control !== $controlsCenter) {
|
||||
$control.removeChild($emitter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addControl() {
|
||||
|
||||
Reference in new issue
Block a user