Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Player<T extends GeneralEventTypes> extends EventEmitter<T> {

// Reset the media element, otherwise it keeps the previous source
if (src) {
this.media.src = ''
this.media.removeAttribute('src')
}

try {
Expand All @@ -90,7 +90,7 @@ class Player<T extends GeneralEventTypes> extends EventEmitter<T> {
this.media.pause()
this.media.remove()
this.revokeSrc()
this.media.src = ''
this.media.removeAttribute('src')
// Load resets the media element to its initial state
this.media.load()
}
Expand Down
9 changes: 7 additions & 2 deletions src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,13 @@ class WaveSurfer extends Player<WaveSurferEvents> {
}
}

// Set the mediaelement source
this.setSrc(url, blob)
if (url == '') {
// If no URL is provided, clear the mediaelement source
this.getMediaElement().removeAttribute('src')
} else {
// Set the mediaelement source
this.setSrc(url, blob)
}

// Wait for the audio duration
const audioDuration = await new Promise<number>((resolve) => {
Expand Down
Loading