mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
优化ready事件
This commit is contained in:
1 parent
7b3913e318
commit
4cbefa172d
11 files changed
+21
-37
No files matched your search
@@ -21,7 +21,7 @@ export default class Contextmenu extends Component {
|
||||
|
||||
this.$parent = $contextmenu;
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
this.add(
|
||||
playbackRate({
|
||||
disable: !option.playbackRate,
|
||||
|
||||
@@ -35,7 +35,7 @@ export default class Control extends Component {
|
||||
|
||||
this.cancelDelayHide = this.delayHide.clearTimeout;
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
this.add(
|
||||
progress({
|
||||
name: 'progress',
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class Events {
|
||||
this.loadImg = this.loadImg.bind(this);
|
||||
|
||||
if (art.whitelist.state) {
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
clickInit(art, this);
|
||||
hoverInit(art, this);
|
||||
mousemoveInit(art, this);
|
||||
|
||||
@@ -9,7 +9,7 @@ export default class Hotkey {
|
||||
} = art;
|
||||
|
||||
if (option.hotkey) {
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
this.add(27, () => {
|
||||
if (player.fullscreenWeb) {
|
||||
player.fullscreenWeb = false;
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class Layer extends Component {
|
||||
super(art);
|
||||
this.name = 'layer';
|
||||
this.$parent = art.template.$layer;
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
art.option.layers.forEach(item => {
|
||||
this.add(item);
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ export default function eventInit(art, player) {
|
||||
notice,
|
||||
} = art;
|
||||
|
||||
let isReady = false;
|
||||
let reconnectTime = 0;
|
||||
const maxReconnectTime = 5;
|
||||
|
||||
@@ -37,10 +36,7 @@ export default function eventInit(art, player) {
|
||||
art.loading.show = false;
|
||||
art.controls.show = true;
|
||||
art.mask.show = true;
|
||||
if (!isReady) {
|
||||
art.emit('ready');
|
||||
isReady = true;
|
||||
}
|
||||
art.emit('ready');
|
||||
});
|
||||
|
||||
// art.on('video:canplaythrough', () => {
|
||||
@@ -97,10 +93,7 @@ export default function eventInit(art, player) {
|
||||
art.loading.show = false;
|
||||
art.controls.show = true;
|
||||
art.mask.show = true;
|
||||
if (!isReady) {
|
||||
art.emit('ready');
|
||||
isReady = true;
|
||||
}
|
||||
art.emit('ready');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function localSubtitle(art) {
|
||||
});
|
||||
}
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
setting.add({
|
||||
title: 'Local Subtitle',
|
||||
name: 'localSubtitle',
|
||||
|
||||
@@ -51,7 +51,7 @@ export default function localVideo(art) {
|
||||
});
|
||||
}
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
setting.add({
|
||||
title: 'Local Video',
|
||||
name: 'localVideo',
|
||||
|
||||
@@ -18,7 +18,7 @@ export default class Setting extends Component {
|
||||
this.$parent = $settingBody;
|
||||
|
||||
if (option.setting) {
|
||||
art.on('ready', () => {
|
||||
art.once('ready', () => {
|
||||
proxy($setting, 'click', e => {
|
||||
if (e.target === $setting) {
|
||||
this.show = false;
|
||||
|
||||
Reference in new issue
Block a user