Skip to content

Commit

Permalink
Fix: emit time update when audio is already playing on init (katspaug…
Browse files Browse the repository at this point in the history
…h#3359)

* Fix timeupdate render to use requestAnimationFrame

* Fixed PR issue

* Reverted timeupdate event and added timer start if player is already playing

* Removed ;

* Added space

* Ran prettier

---------

Co-authored-by: Ziga Lah <ziga.lah@inova.si>
  • Loading branch information
ziga-lah-songtradr and LahZiga committed Nov 28, 2023
1 parent 1fddf1b commit 9444021
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ class WaveSurfer extends Player<WaveSurferEvents> {
}

private initPlayerEvents() {
if (this.isPlaying()) {
this.emit('play')
this.timer.start()
}

this.mediaSubscriptions.push(
this.onMediaEvent('timeupdate', () => {
const currentTime = this.getCurrentTime()
Expand Down

0 comments on commit 9444021

Please sign in to comment.