feat: used new event manager for play button
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
*/
|
||||
|
||||
import { VP } from "../core";
|
||||
import { EventManager } from "../events";
|
||||
|
||||
export class BaseUI {
|
||||
private player: VP;
|
||||
private video: HTMLVideoElement;
|
||||
private prefixClass: string;
|
||||
private events: EventManager;
|
||||
private wrapper!: HTMLElement;
|
||||
private controlsWrap!: HTMLElement;
|
||||
private originalParent!: Node;
|
||||
@@ -20,6 +22,7 @@ export class BaseUI {
|
||||
this.player = player;
|
||||
this.video = video;
|
||||
this.prefixClass = prefixClass;
|
||||
this.events = new EventManager();
|
||||
this.build();
|
||||
this.createPlayButton();
|
||||
}
|
||||
@@ -51,6 +54,7 @@ export class BaseUI {
|
||||
destroy(): void {
|
||||
this.originalParent.insertBefore(this.video, this.nextSibling);
|
||||
this.wrapper.remove();
|
||||
this.events.removeAll();
|
||||
}
|
||||
|
||||
private createPlayButton(): void {
|
||||
@@ -62,10 +66,10 @@ export class BaseUI {
|
||||
playButton.innerText = "pause";
|
||||
}
|
||||
|
||||
this.video.addEventListener("play", function (): void {
|
||||
this.events.add(this.video, "play", function (): void {
|
||||
playButton.innerText = "pause";
|
||||
});
|
||||
this.video.addEventListener("pause", function (): void {
|
||||
this.events.add(this.video, "pause", function (): void {
|
||||
playButton.innerText = "play";
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user