diff --git a/apps/radio/src/lib/audio/manager/audio-manager.test.ts b/apps/radio/src/lib/audio/manager/audio-manager.test.ts index cc94bf80..d1ca7d36 100644 --- a/apps/radio/src/lib/audio/manager/audio-manager.test.ts +++ b/apps/radio/src/lib/audio/manager/audio-manager.test.ts @@ -421,6 +421,35 @@ describe("AudioManager", () => { } }); + // RADIO-1Z: Node mode loads through AudioManager.playSound → toPlaybackInput. + // Persisted RadioJar Alhara URLs must remount before readiness, or Chrome + // reports MEDIA_ERR_SRC_NOT_SUPPORTED and the lane maps it to PLAY_ERROR. + test("Node playSound remounts a persisted Radio Alhara RadioJar URL", async () => { + const harness = createMediaPlaybackHarness(); + try { + const { manager, browser, effects } = harness; + effects.connectGraph = mock(async () => true); + const soundId = manager.createSound( + { + name: "Radio Alhara", + streamUrl: "https://n03.radiojar.com/78cxy6wkxtzuv", + }, + "node:n:alhara", + "native", + "station" + ); + const starting = manager.playSound(soundId); + await flushMicrotasks(); + expect(browser.audio().loadSources).toEqual([ + "https://stream.radioalhara.net/ra", + ]); + browser.audio().emit("canplay"); + await starting; + } finally { + harness.restore(); + } + }); + test("unsupported Safari live radio leaves the Node sound stopped", async () => { const harness = createMediaPlaybackHarness(); try { diff --git a/apps/radio/src/lib/node-playback.test.ts b/apps/radio/src/lib/node-playback.test.ts index 6912e017..ae775600 100644 --- a/apps/radio/src/lib/node-playback.test.ts +++ b/apps/radio/src/lib/node-playback.test.ts @@ -1574,6 +1574,37 @@ describe("Node Playback starts", () => { ); }); + // RADIO-1Z: a real unsupported-stream failure must stay visible on the lane + // and still report as PLAY_ERROR. Remapping dead hosts is separate; do not + // swallow format failures in Node lifecycle ownership. + test("reports an unsupported stream format as a Node PLAY_ERROR", async () => { + insertNodeSession(patch([station("alhara")])); + const harness = createHarness(); + harness.context.audio.playSound = mock(() => + Promise.reject(new Error("Audio stream format is not supported")) + ); + await harness.playback.activate(); + + await harness.playback.setPlaying("alhara", true); + await harness.playback.whenSettled(); + + expect(getPlaybackChannelRuntime(channelOf("alhara")).error).toMatchObject({ + code: "PLAY_ERROR", + message: + "This audio format is not supported. Check the station stream or try another source.", + }); + expect(harness.context.reportError).toHaveBeenCalledWith( + expect.objectContaining({ + cause: expect.objectContaining({ + message: "Audio stream format is not supported", + }), + channelId: channelOf("alhara"), + code: "PLAY_ERROR", + mode: "node", + }) + ); + }); + test("reconciles main output settings when playback starts a lane", async () => { insertNodeSession(patch([station("a")])); const patches: unknown[] = [];