@yetric/audioplayer 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yetric AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ # `@yetric/audioplayer`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Headless TypeScript audio player for modern browsers.
4
+
5
+ [GitHub](https://github.com/yetric/audioplayer)
6
+
7
+ ## Status
8
+
9
+ `1.0.0` is the current stable release line.
10
+
11
+ Recommended current focus:
12
+
13
+ - use the browser package
14
+ - validate it in `podcast-app`
15
+ - treat React Native support as later work
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install @yetric/audioplayer
21
+ ```
22
+
23
+ React usage:
24
+
25
+ ```bash
26
+ npm install @yetric/audioplayer react
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```ts
32
+ import { createAudioPlayer } from "@yetric/audioplayer";
33
+
34
+ const player = createAudioPlayer();
35
+
36
+ await player.play({
37
+ id: "episode-42",
38
+ src: "https://cdn.example.com/episode-42.mp3",
39
+ title: "Episode 42",
40
+ artist: "Podcast Name",
41
+ });
42
+
43
+ player.subscribe((state) => {
44
+ console.log(state.status, state.progress.playedFraction);
45
+ });
46
+ ```
47
+
48
+ The first milestone is not "generic media player." It is "good enough to replace the current `podcast-app` audio layer with a simpler, testable, framework-agnostic library."
49
+
50
+ ## Product Direction
51
+
52
+ - Browser-first, using `HTMLAudioElement` as the primary engine
53
+ - Headless core API, so React/Angular/Web Components/vanilla JS can all use the same package
54
+ - Imperative instance API first: `const player = createAudioPlayer()`
55
+ - Queue management lives inside the player instance for `1.0`
56
+ - Persistence is opt-in, with `localStorage` as the first storage adapter
57
+ - `load()` accepts one flat audio source object in `1.0`
58
+ - `subscribe(state)` is the primary UI model, with typed events for side effects
59
+ - Every source / queue item must have a stable caller-provided `id`
60
+ - `play(...)` may auto-load the requested item instead of requiring a separate `load()`
61
+ - `1.0` is optimized for one active player instance per app/page
62
+ - When playback finishes without auto-advancing, the current item remains loaded with `status: "ended"`
63
+ - Strong TypeScript types without making vanilla JS usage awkward
64
+ - React Native compatibility treated as a later adapter problem, not a 1.0 blocker
65
+
66
+ ## 1.0 Goal
67
+
68
+ `1.0.0` is ready when `podcast-app` can use this package for:
69
+
70
+ - load / replace a source
71
+ - play / pause
72
+ - seek
73
+ - playback rate changes
74
+ - progress reporting
75
+ - queue navigation
76
+ - persisted resume state
77
+ - Media Session integration
78
+
79
+ ## Early API Shape
80
+
81
+ ```ts
82
+ import { createAudioPlayer } from "@yetric/audioplayer";
83
+
84
+ const player = createAudioPlayer();
85
+
86
+ await player.load({
87
+ id: "episode-42",
88
+ src: "https://cdn.example.com/episode-42.mp3",
89
+ title: "Episode 42",
90
+ artist: "My Podcast",
91
+ artwork: "https://cdn.example.com/episode-42.jpg",
92
+ });
93
+
94
+ await player.play();
95
+ player.seek(120);
96
+ player.setRate(1.25);
97
+
98
+ const unsubscribe = player.subscribe((state) => {
99
+ console.log(state.status, state.currentTime);
100
+ });
101
+ ```
102
+
103
+ The public API should stay small. Extra behavior like persistence, progress pings, analytics, and Media Session should be opt-in modules or config hooks around the same core. The first persistence target is `localStorage`, but the design should leave room for custom storage backends later. UI consumers should mostly read state through `subscribe(...)`, while integrations can rely on typed events instead of diffing state manually.
104
+
105
+ ## Planned Package Surface
106
+
107
+ - `@yetric/audioplayer`
108
+ - headless browser player core
109
+ - queue support
110
+ - persistence hooks
111
+ - Media Session integration
112
+ - later:
113
+ - `@yetric/audioplayer-react`
114
+ - provider-owned singleton player for app-level usage
115
+ - hook-based consumption on top of the provider
116
+ - `@yetric/audioplayer-rn`
117
+
118
+ ## Repo Docs
119
+
120
+ - [`docs/ROADMAP.md`](./docs/ROADMAP.md)
121
+ - [`docs/V1_ISSUES.md`](./docs/V1_ISSUES.md)
122
+ - [`docs/API_CONTRACT.md`](./docs/API_CONTRACT.md)
123
+ - [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
124
+ - [`docs/CORE_GUIDE.md`](./docs/CORE_GUIDE.md)
125
+ - [`docs/REACT_GUIDE.md`](./docs/REACT_GUIDE.md)
126
+ - [`docs/INTEGRATIONS.md`](./docs/INTEGRATIONS.md)
127
+ - [`docs/RECIPES.md`](./docs/RECIPES.md)
128
+ - [`docs/MIGRATION_PODCAST_APP.md`](./docs/MIGRATION_PODCAST_APP.md)
129
+ - [`docs/ANGULAR_EXAMPLE.md`](./docs/ANGULAR_EXAMPLE.md)
130
+ - [`docs/WEB_COMPONENT_EXAMPLE.md`](./docs/WEB_COMPONENT_EXAMPLE.md)
131
+
132
+ ## External Docs
133
+
134
+ - Docusaurus site source: [`website/`](./website/)
135
+ - Local dev: `npm run docs:start`
136
+ - Production build: `npm run docs:build`
137
+
138
+ ## Local Demo
139
+
140
+ - Start demo: `npm run demo:start`
141
+ - Build demo: `npm run demo:build`
142
+ - Preview demo build: `npm run demo:preview`
143
+
144
+ ## Examples
145
+
146
+ - [`examples/vanilla/index.html`](./examples/vanilla/index.html)
147
+ - [`examples/vanilla/playlist-demo.js`](./examples/vanilla/playlist-demo.js)
148
+ - [`examples/react/App.tsx`](./examples/react/App.tsx)
149
+ - [`examples/react/PodcastPlayerDemo.tsx`](./examples/react/PodcastPlayerDemo.tsx)