Force fresh radio stream start to avoid stale buffered audio
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.21 R103";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.21 R104";
|
||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||
|
||||
@@ -107,6 +107,11 @@ function connectRadioChannelSource(
|
||||
};
|
||||
}
|
||||
|
||||
function freshStreamUrl(streamUrl: string): string {
|
||||
const separator = streamUrl.includes('?') ? '&' : '?';
|
||||
return `${streamUrl}${separator}chgrid_start=${Date.now()}`;
|
||||
}
|
||||
|
||||
export class RadioStationRuntime {
|
||||
private readonly sharedRadioSources = new Map<string, SharedRadioSource>();
|
||||
private readonly itemRadioOutputs = new Map<string, ItemRadioOutput>();
|
||||
@@ -251,7 +256,7 @@ export class RadioStationRuntime {
|
||||
}
|
||||
const audioCtx = this.audio.context;
|
||||
if (!audioCtx) return null;
|
||||
const element = new Audio(streamUrl);
|
||||
const element = new Audio(freshStreamUrl(streamUrl));
|
||||
element.crossOrigin = 'anonymous';
|
||||
element.loop = true;
|
||||
element.preload = 'none';
|
||||
|
||||
Reference in New Issue
Block a user