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

Fix: DOMException in destroy #3641

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class WaveSurfer extends Player<WaveSurferEvents> {
playbackRate: options.audioRate,
})

this.abortController = new AbortController()
this.options = Object.assign({}, defaultOptions, options)
this.timer = new Timer()

Expand Down Expand Up @@ -403,8 +402,12 @@ class WaveSurfer extends Player<WaveSurferEvents> {

// Fetch the entire audio as a blob if pre-decoded data is not provided
if (!blob && !channelData) {
const fetchParams = this.options.fetchParams || {}
if (window.AbortController && !fetchParams.signal) {
this.abortController = new AbortController()
fetchParams.signal = this.abortController?.signal;
}
const onProgress = (percentage: number) => this.emit('loading', percentage)
const fetchParams = { signal: this.abortController?.signal, ...(this.options.fetchParams || {}) }
blob = await Fetcher.fetchBlob(url, onProgress, fetchParams)
}

Expand Down
Loading