Skip to content

Commit

Permalink
Fix: reset media element on load
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Jan 24, 2025
1 parent f56ea15 commit 93972b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ 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 = ''
this.media.load()
}

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

0 comments on commit 93972b4

Please sign in to comment.