mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 15:56:15 -08:00
update
This commit is contained in:
1 parent
3ed27338c5
commit
3e0c286c09
7 files changed
+43
-24
No files matched your search
+12
-4
@@ -6,6 +6,7 @@ export default class Player {
|
||||
this.art = art;
|
||||
this.init();
|
||||
this.eventBind();
|
||||
this.playing = false;
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -39,7 +40,7 @@ export default class Player {
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
if (this.art.option.autoplay) {
|
||||
const promise = $video.play();
|
||||
const promise = this.play();
|
||||
if (promise !== undefined) {
|
||||
promise.then().catch(err => {
|
||||
console.warn(err);
|
||||
@@ -49,31 +50,38 @@ export default class Player {
|
||||
});
|
||||
|
||||
this.art.on('video:playing', () => {
|
||||
this.playing = true;
|
||||
this.art.controls.hide();
|
||||
this.art.mask.hide();
|
||||
});
|
||||
|
||||
this.art.on('video:pause', () => {
|
||||
this.playing = false;
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
|
||||
this.art.on('video:ended', () => {
|
||||
this.playing = false;
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
}
|
||||
|
||||
play() {
|
||||
//
|
||||
return this.art.refs.$video.play();
|
||||
}
|
||||
|
||||
pause() {
|
||||
//
|
||||
return this.art.refs.$video.pause();
|
||||
}
|
||||
|
||||
toggle() {
|
||||
//
|
||||
if (this.playing) {
|
||||
this.pause();
|
||||
} else {
|
||||
this.play();
|
||||
}
|
||||
}
|
||||
|
||||
seek() {
|
||||
|
||||
Reference in new issue
Block a user