feat: used new event manager for play button

This commit is contained in:
2026-04-26 00:07:07 +03:30
parent 1fce8a5682
commit 5fd8f9b047

View File

@@ -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";
});