diff --git a/src/lib/mediaPlayer.ts b/src/lib/mediaPlayer.ts index d6294f2d..a2243707 100644 --- a/src/lib/mediaPlayer.ts +++ b/src/lib/mediaPlayer.ts @@ -281,6 +281,8 @@ export default class VideoPlayer { video.autoplay = true; video.play(); } + }).finally(() => { // due to autoplay, play will not call + this.wrapper.classList.toggle('is-playing', !this.video.paused); }); //(this.wrapper.querySelector('.toggle') as HTMLButtonElement).click(); } @@ -388,12 +390,10 @@ export default class VideoPlayer { this.togglePlay(); }); */ - video.addEventListener('play', () => { - this.updateButton(toggle); - }); + /* video.addEventListener('play', () => { + }); */ video.addEventListener('pause', () => { - this.updateButton(toggle); clearInterval(updateInterval); }); @@ -515,12 +515,12 @@ export default class VideoPlayer { const skin = this.skin; if(skin === 'default') { return ` - +