mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 12:11:20 -08:00
add play state
This commit is contained in:
1 parent
5205847e1f
commit
e2f3ba9a6a
4 files changed
+11
-11
No files matched your search
@@ -77,6 +77,7 @@ class Artplayer extends Emitter {
|
||||
|
||||
init() {
|
||||
this.focus = false;
|
||||
this.playing = false;
|
||||
this.refs = {
|
||||
$container: this.option.container
|
||||
};
|
||||
|
||||
+4
-5
@@ -6,7 +6,6 @@ export default class Player {
|
||||
this.art = art;
|
||||
this.init();
|
||||
this.eventBind();
|
||||
this.playing = false;
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -50,19 +49,19 @@ export default class Player {
|
||||
});
|
||||
|
||||
this.art.on('video:playing', () => {
|
||||
this.playing = true;
|
||||
this.art.playing = true;
|
||||
this.art.controls.hide();
|
||||
this.art.mask.hide();
|
||||
});
|
||||
|
||||
this.art.on('video:pause', () => {
|
||||
this.playing = false;
|
||||
this.art.playing = false;
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
|
||||
this.art.on('video:ended', () => {
|
||||
this.playing = false;
|
||||
this.art.playing = false;
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
@@ -77,7 +76,7 @@ export default class Player {
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if (this.playing) {
|
||||
if (this.art.playing) {
|
||||
this.pause();
|
||||
} else {
|
||||
this.play();
|
||||
|
||||
Reference in new issue
Block a user