Skip to content

Commit

Permalink
feat: override blob MIME type (#3995)
Browse files Browse the repository at this point in the history
* feat: blob mime type

* docs: update variable name
  • Loading branch information
wfk007 authored Jan 13, 2025
1 parent e519c20 commit 5655929
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export type WaveSurferOptions = {
backend?: 'WebAudio' | 'MediaElement'
/** Nonce for CSP if necessary */
cspNonce?: string
/** Override the Blob MIME type */
blobMimeType?: string
}

const defaultOptions = {
Expand Down Expand Up @@ -435,6 +437,10 @@ class WaveSurfer extends Player<WaveSurferEvents> {
}
const onProgress = (percentage: number) => this.emit('loading', percentage)
blob = await Fetcher.fetchBlob(url, onProgress, fetchParams)
const overridenMimeType = this.options.blobMimeType
if (overridenMimeType) {
blob = new Blob([blob], { type: overridenMimeType })
}
}

// Set the mediaelement source
Expand Down

0 comments on commit 5655929

Please sign in to comment.