File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 127127 function reconnect ( ) {
128128 if ( isPlaying ) {
129129 console . log ( "Stream interrupted, attempting reconnect..." ) ;
130- const currentSrc = audio . src . split ( '?' ) [ 0 ] ;
131- audio . src = currentSrc + '?t=' + new Date ( ) . getTime ( ) ;
130+ const url = new URL ( audio . src , window . location . origin ) ;
131+ audio . src = url . pathname + '?t=' + new Date ( ) . getTime ( ) ;
132132 audio . play ( ) . catch ( e => {
133133 setTimeout ( reconnect , 2000 ) ;
134134 } ) ;
Original file line number Diff line number Diff line change 211211 function reconnect ( ) {
212212 if ( isPlaying ) {
213213 console . log ( "Stream interrupted, attempting reconnect..." ) ;
214- const currentSrc = audio . src . split ( '?' ) [ 0 ] ;
215- audio . src = currentSrc + '?t=' + new Date ( ) . getTime ( ) ; // Prevent cache
214+ const url = new URL ( audio . src , window . location . origin ) ;
215+ audio . src = url . pathname + '?t=' + new Date ( ) . getTime ( ) ; // Prevent cache
216216 audio . play ( ) . catch ( e => {
217217 console . log ( "Reconnect failed, retrying in 2s..." ) ;
218218 setTimeout ( reconnect , 2000 ) ;
You can’t perform that action at this time.
0 commit comments