Skip to content

Commit

Permalink
fix removeOnAudioProcess for Safari
Browse files Browse the repository at this point in the history
When using "WebAudio" in Safari the "audioprocess" event doesn't get fired anymore once you pause/play the current song or load a new one into your wavesurfer object preventing the following piece of code to be executed:

this.backend.on('audioprocess', time => {
    this.drawer.progress(this.backend.getPlayedPercents());
    this.fireEvent('audioprocess', time);
});

This commit fixes the bug, so it is not needed anymore to use "MediaElement" on Safari as a workaround (which has its own drawbacks).
  • Loading branch information
Farbenkollektiv authored and thijstriemstra committed Jan 14, 2019
1 parent 6ce0294 commit 799faba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default class WebAudio extends util.Observer {

/** @private */
removeOnAudioProcess() {
this.scriptNode.onaudioprocess = null;
this.scriptNode.onaudioprocess = () => {};
}

/** @private */
Expand Down

0 comments on commit 799faba

Please sign in to comment.