Skip to content

Commit 88ea339

Browse files
committed
extract internal audio engine boundary
1 parent 10a892a commit 88ea339

7 files changed

Lines changed: 264 additions & 93 deletions

File tree

docs/API_CONTRACT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,10 @@ Explicitly not required for `Issue 001`:
232232
- persistence implementation
233233
- React adapter implementation
234234
- React Native engine abstraction
235+
236+
## Internal Engine Note
237+
238+
- The public contract remains `AudioPlayer`, not an exported engine interface
239+
- The current implementation isolates browser audio behavior behind an internal engine boundary
240+
- That boundary exists to keep future non-DOM exploration, such as React Native, from changing the public player API too early
241+
- `beta.1` still ships only the browser engine

docs/BETA_1_ISSUES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ Priority is based on one question only: does this unblock replacing the current
158158

159159
- Goal: explore whether the same high-level API can sit above a non-DOM engine.
160160
- Done when:
161-
- an engine interface is extracted
162-
- feasibility is documented
163-
- browser core remains the default path
161+
- a minimal internal audio engine interface is extracted from direct `HTMLAudioElement` usage
162+
- browser playback remains the default shipped engine
163+
- feasibility is documented without promising React Native support in `beta.1`
164164

165165
### Issue 015: Nice-to-have playback features
166166

docs/ROADMAP.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ Ship `1.0.0-beta.1` only when the library can replace the current `podcast-app`
3838
- Angular and Web Components should consume the same core instance
3939
- React Native is a stretch goal and likely needs a custom engine contract
4040

41+
### Internal Engine Boundary
42+
43+
- the public `AudioPlayer` API stays browser-first for `beta.1`
44+
- browser playback now sits behind a small internal audio engine boundary
45+
- the browser engine remains the only shipped runtime engine today
46+
- any future React Native work should implement the same internal engine contract instead of forking the public API
47+
4148
## Beta Definition
4249

4350
`1.0.0-beta.1` should include:

src/index.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,15 @@ describe("createAudioPlayer", () => {
172172
expect(player.getState().currentSourceId).toBe("episode-1");
173173
expect(player.getState().status).not.toBe("ended");
174174
});
175+
176+
it("surfaces unsupported environments through the typed error state", async () => {
177+
vi.stubGlobal("Audio", undefined);
178+
179+
const player = createAudioPlayer();
180+
181+
await player.load(episodeOne);
182+
183+
expect(player.getState().status).toBe("error");
184+
expect(player.getState().error?.code).toBe("UNSUPPORTED_ENVIRONMENT");
185+
});
175186
});

0 commit comments

Comments
 (0)