fix(player): return from background audio onto the episode it advanced to

An episode that ends while backgrounded in audio-only mode advances in the
backend, but player_exit_background_audio returned only a position, so the
video page reloaded the episode it was mounted with -- the previous one, at
the new episode's timestamp.

The command now returns BackgroundAudioResume { itemId, positionSeconds }.
planHandoffReturn yields "other-item" when the id differs from the mounted
one, and the player page navigates to that episode with resumeAt=<seconds>,
marking the outgoing episode watched and suppressing its stale stop report.

TRACES: UR-040, UR-023 | DR-296 | UT-265, UT-266
This commit is contained in:
2026-09-24 03:45:59 +02:00
parent f6efa7208a
commit 1fb5f070c8
9 changed files with 240 additions and 24 deletions
@@ -32,12 +32,12 @@ describe("background-audio player commands (param naming)", () => {
});
});
it("player_exit_background_audio takes no params and returns a position", async () => {
(invoke as any).mockResolvedValueOnce(193.5);
it("player_exit_background_audio takes no params and returns the resume point", async () => {
(invoke as any).mockResolvedValueOnce({ itemId: "ep2", positionSeconds: 193.5 });
const pos = await commands.playerExitBackgroundAudio();
const resume = await commands.playerExitBackgroundAudio();
expect(pos).toBe(193.5);
expect(resume).toEqual({ itemId: "ep2", positionSeconds: 193.5 });
expect(invoke).toHaveBeenCalledWith("player_exit_background_audio");
});
});