mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
add mask
This commit is contained in:
1 parent
32478ecb14
commit
ca0c67499b
12 files changed
+219
-15
No files matched your search
@@ -22,10 +22,49 @@ export default class Player {
|
||||
const { proxy } = this.art.events;
|
||||
const { $video } = this.art.refs;
|
||||
const { events } = config.video;
|
||||
|
||||
events.forEach(eventName => {
|
||||
proxy($video, eventName, event => {
|
||||
this.art.emit(`video:${event.type}`, event);
|
||||
});
|
||||
});
|
||||
|
||||
this.art.on('video:loadstart', () => {
|
||||
this.art.loading.show();
|
||||
});
|
||||
|
||||
this.art.on('video:loadeddata', () => {
|
||||
this.art.loading.hide();
|
||||
});
|
||||
|
||||
this.art.on('video:canplay', () => {
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
if (this.art.option.autoplay) {
|
||||
const promise = $video.play();
|
||||
|
||||
// TODO: chrome autoplay policy changes
|
||||
if (promise !== undefined) {
|
||||
promise.then().catch(err => {
|
||||
console.warn(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.art.on('video:playing', () => {
|
||||
this.art.controls.hide();
|
||||
this.art.mask.hide();
|
||||
});
|
||||
|
||||
this.art.on('video:pause', () => {
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
|
||||
this.art.on('video:ended', () => {
|
||||
this.art.controls.show();
|
||||
this.art.mask.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user