Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions apps/radio/src/lib/audio/manager/audio-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
31 changes: 31 additions & 0 deletions apps/radio/src/lib/node-playback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down
Loading