Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Failed to execute 'start' on 'AudioBufferSourceNode' #3920

Open
1ndoryu opened this issue Oct 25, 2024 · 1 comment
Open

RangeError: Failed to execute 'start' on 'AudioBufferSourceNode' #3920

1ndoryu opened this issue Oct 25, 2024 · 1 comment
Labels

Comments

@1ndoryu
Copy link

1ndoryu commented Oct 25, 2024

Bug description

With version 7.7.8 of wavesurfer.js, I’m experiencing a recurring issue with playback. When clicking near the start of the waveform, an intermittent error appears about 2 out of 10 times:

Uncaught (in promise) RangeError: Failed to execute 'start' on 'AudioBufferSourceNode': The offset provided (-0.0444035) is less than the minimum bound (0).

Additionally, after this error occurs, the following error sometimes appears when trying to stop the audio:

Uncaught InvalidStateError: Failed to execute 'stop' on 'AudioScheduledSourceNode': cannot call stop without calling start first.

The only way to resolve the issue is by refreshing the page and trying again. This seems to happen more frequently when clicking near the beginning of the waveform.

Environment

  • Browser: Chrome
  • wavesurfer.js version: 7.7.8

Minimal code snippet

The issue occurs in the _play() and _pause() methods in wavesurfer.js:

// In _play():
let e = this.playedDuration * this._playbackRate;
e >= this.duration && (e = 0, this.playedDuration = 0),
this.bufferNode.start(this.audioContext.currentTime, e);

// In _pause():
null === (t = this.bufferNode) || void 0 === t || t.stop();

Expected result

Audio playback should start and stop without errors or negative offsets, even when clicking near the start of the waveform.

Obtained result

Intermittent RangeError due to a negative offset and occasional InvalidStateError from stop being called without start. The error can only be resolved by reloading the page.

@1ndoryu 1ndoryu added the bug label Oct 25, 2024
@1ndoryu
Copy link
Author

1ndoryu commented Oct 25, 2024

"It's not complicated to replicate the error; sometimes it happens, sometimes it doesn't. You just need to click at the beginning of the waveform within the first six lines, and that will be enough for it to fail."

https://2upra.com/sample/classic-soul-sample/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant