fix: initialized the button text at creation
This commit is contained in:
@@ -56,6 +56,11 @@ export class BaseUI {
|
|||||||
private createPlayButton(): void {
|
private createPlayButton(): void {
|
||||||
const playButton = document.createElement("button");
|
const playButton = document.createElement("button");
|
||||||
playButton.className = this.prefixClass + "-playButton";
|
playButton.className = this.prefixClass + "-playButton";
|
||||||
|
if (this.video.paused) {
|
||||||
|
playButton.innerText = "play";
|
||||||
|
} else {
|
||||||
|
playButton.innerText = "pause";
|
||||||
|
}
|
||||||
|
|
||||||
this.video.addEventListener("play", function (): void {
|
this.video.addEventListener("play", function (): void {
|
||||||
playButton.innerText = "pause";
|
playButton.innerText = "pause";
|
||||||
|
|||||||
Reference in New Issue
Block a user