File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ class Player<T extends GeneralEventTypes> extends EventEmitter<T> {
7575
7676 // Reset the media element, otherwise it keeps the previous source
7777 if ( src ) {
78- this . media . src = ''
78+ this . media . removeAttribute ( ' src' )
7979 }
8080
8181 try {
@@ -90,7 +90,7 @@ class Player<T extends GeneralEventTypes> extends EventEmitter<T> {
9090 this . media . pause ( )
9191 this . media . remove ( )
9292 this . revokeSrc ( )
93- this . media . src = ''
93+ this . media . removeAttribute ( ' src' )
9494 // Load resets the media element to its initial state
9595 this . media . load ( )
9696 }
Original file line number Diff line number Diff line change @@ -451,8 +451,13 @@ class WaveSurfer extends Player<WaveSurferEvents> {
451451 }
452452 }
453453
454- // Set the mediaelement source
455- this . setSrc ( url , blob )
454+ if ( url == '' ) {
455+ // If no URL is provided, clear the mediaelement source
456+ this . getMediaElement ( ) . removeAttribute ( 'src' )
457+ } else {
458+ // Set the mediaelement source
459+ this . setSrc ( url , blob )
460+ }
456461
457462 // Wait for the audio duration
458463 const audioDuration = await new Promise < number > ( ( resolve ) => {
You can’t perform that action at this time.
0 commit comments