Skip to content

Commit

Permalink
Fix: reset media element on load (#4010)
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh authored Jan 24, 2025
1 parent f56ea15 commit ef522ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ class Player<T extends GeneralEventTypes> extends EventEmitter<T> {
if (url && src === url) return
this.revokeSrc()
const newSrc = blob instanceof Blob && (this.canPlayType(blob.type) || !url) ? URL.createObjectURL(blob) : url

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

try {
this.media.src = newSrc
} catch (e) {
Expand Down

0 comments on commit ef522ee

Please sign in to comment.