Skip to content

Commit 9238622

Browse files
author
Datanoise
committed
fix: ensure reconnect URL preserves path correctly
1 parent 61f40a2 commit 9238622

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

server/templates/embed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@
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
});

server/templates/player.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
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);

0 commit comments

Comments
 (0)