react-native-audio-browser 0.2.0-next.54 → 0.2.0-next.56
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/README.md +32 -19
- package/lib/commonjs/CLAUDE.md +7 -2
- package/lib/commonjs/features/battery.js +16 -12
- package/lib/commonjs/features/battery.js.map +1 -1
- package/lib/commonjs/features/browser-config.js +1 -1
- package/lib/commonjs/features/browser.js +74 -24
- package/lib/commonjs/features/browser.js.map +1 -1
- package/lib/commonjs/features/carConnection.js +3 -4
- package/lib/commonjs/features/carConnection.js.map +1 -1
- package/lib/commonjs/features/equalizer.js +9 -5
- package/lib/commonjs/features/equalizer.js.map +1 -1
- package/lib/commonjs/features/errors.js +35 -21
- package/lib/commonjs/features/errors.js.map +1 -1
- package/lib/commonjs/features/favorites.js +15 -13
- package/lib/commonjs/features/favorites.js.map +1 -1
- package/lib/commonjs/features/gate.js +12 -6
- package/lib/commonjs/features/gate.js.map +1 -1
- package/lib/commonjs/features/metadata.js +16 -14
- package/lib/commonjs/features/metadata.js.map +1 -1
- package/lib/commonjs/features/network.js +5 -1
- package/lib/commonjs/features/network.js.map +1 -1
- package/lib/commonjs/features/nowPlaying.js +28 -14
- package/lib/commonjs/features/nowPlaying.js.map +1 -1
- package/lib/commonjs/features/output.js +8 -4
- package/lib/commonjs/features/output.js.map +1 -1
- package/lib/commonjs/features/playback/controls.js +10 -5
- package/lib/commonjs/features/playback/controls.js.map +1 -1
- package/lib/commonjs/features/playback/playWhenReady.js +6 -5
- package/lib/commonjs/features/playback/playWhenReady.js.map +1 -1
- package/lib/commonjs/features/playback/playing.js +5 -3
- package/lib/commonjs/features/playback/playing.js.map +1 -1
- package/lib/commonjs/features/playback/progress.js +11 -5
- package/lib/commonjs/features/playback/progress.js.map +1 -1
- package/lib/commonjs/features/playback/state.js +3 -3
- package/lib/commonjs/features/playback/state.js.map +1 -1
- package/lib/commonjs/features/playback/trackPlaybackTime.js +6 -1
- package/lib/commonjs/features/playback/trackPlaybackTime.js.map +1 -1
- package/lib/commonjs/features/playback/volume.js +6 -5
- package/lib/commonjs/features/playback/volume.js.map +1 -1
- package/lib/commonjs/features/player/options.js +20 -10
- package/lib/commonjs/features/player/options.js.map +1 -1
- package/lib/commonjs/features/player/setup.js +34 -38
- package/lib/commonjs/features/player/setup.js.map +1 -1
- package/lib/commonjs/features/queue/activeTrack.js +0 -1
- package/lib/commonjs/features/queue/activeTrack.js.map +1 -1
- package/lib/commonjs/features/queue/queue.js +48 -20
- package/lib/commonjs/features/queue/queue.js.map +1 -1
- package/lib/commonjs/features/queue/repeatMode.js +2 -1
- package/lib/commonjs/features/queue/repeatMode.js.map +1 -1
- package/lib/commonjs/features/queue/shuffle.js +0 -1
- package/lib/commonjs/features/queue/shuffle.js.map +1 -1
- package/lib/commonjs/features/remoteControls.js +59 -35
- package/lib/commonjs/features/remoteControls.js.map +1 -1
- package/lib/commonjs/features/sleepTimer.js +15 -6
- package/lib/commonjs/features/sleepTimer.js.map +1 -1
- package/lib/commonjs/utils/LazyNativeEmitter.js +6 -9
- package/lib/commonjs/utils/LazyNativeEmitter.js.map +1 -1
- package/lib/commonjs/utils/NativeUpdatedValue.js +13 -12
- package/lib/commonjs/utils/NativeUpdatedValue.js.map +1 -1
- package/lib/commonjs/utils/getTrackIdentity.js +6 -4
- package/lib/commonjs/utils/getTrackIdentity.js.map +1 -1
- package/lib/commonjs/utils/useDebug.js +16 -3
- package/lib/commonjs/utils/useDebug.js.map +1 -1
- package/lib/commonjs/web/NativeAudioBrowser.js +2 -4
- package/lib/commonjs/web/NativeAudioBrowser.js.map +1 -1
- package/lib/commonjs/web/browser/parseSearchResponse.js +3 -4
- package/lib/commonjs/web/browser/parseSearchResponse.js.map +1 -1
- package/lib/commonjs/web/browser/sections.js +1 -1
- package/lib/commonjs/web/util/BrowserPathHelper.js +1 -3
- package/lib/commonjs/web/util/BrowserPathHelper.js.map +1 -1
- package/lib/module/CLAUDE.md +7 -2
- package/lib/module/features/battery.js +16 -12
- package/lib/module/features/battery.js.map +1 -1
- package/lib/module/features/browser-config.js +1 -1
- package/lib/module/features/browser.js +74 -24
- package/lib/module/features/browser.js.map +1 -1
- package/lib/module/features/carConnection.js +3 -4
- package/lib/module/features/carConnection.js.map +1 -1
- package/lib/module/features/equalizer.js +9 -5
- package/lib/module/features/equalizer.js.map +1 -1
- package/lib/module/features/errors.js +35 -21
- package/lib/module/features/errors.js.map +1 -1
- package/lib/module/features/favorites.js +15 -13
- package/lib/module/features/favorites.js.map +1 -1
- package/lib/module/features/gate.js +12 -6
- package/lib/module/features/gate.js.map +1 -1
- package/lib/module/features/metadata.js +16 -14
- package/lib/module/features/metadata.js.map +1 -1
- package/lib/module/features/network.js +5 -1
- package/lib/module/features/network.js.map +1 -1
- package/lib/module/features/nowPlaying.js +28 -14
- package/lib/module/features/nowPlaying.js.map +1 -1
- package/lib/module/features/output.js +8 -4
- package/lib/module/features/output.js.map +1 -1
- package/lib/module/features/playback/controls.js +10 -5
- package/lib/module/features/playback/controls.js.map +1 -1
- package/lib/module/features/playback/playWhenReady.js +6 -5
- package/lib/module/features/playback/playWhenReady.js.map +1 -1
- package/lib/module/features/playback/playing.js +5 -3
- package/lib/module/features/playback/playing.js.map +1 -1
- package/lib/module/features/playback/progress.js +11 -5
- package/lib/module/features/playback/progress.js.map +1 -1
- package/lib/module/features/playback/state.js +3 -3
- package/lib/module/features/playback/state.js.map +1 -1
- package/lib/module/features/playback/trackPlaybackTime.js +6 -1
- package/lib/module/features/playback/trackPlaybackTime.js.map +1 -1
- package/lib/module/features/playback/volume.js +6 -5
- package/lib/module/features/playback/volume.js.map +1 -1
- package/lib/module/features/player/options.js +20 -10
- package/lib/module/features/player/options.js.map +1 -1
- package/lib/module/features/player/setup.js +34 -38
- package/lib/module/features/player/setup.js.map +1 -1
- package/lib/module/features/queue/activeTrack.js +0 -1
- package/lib/module/features/queue/activeTrack.js.map +1 -1
- package/lib/module/features/queue/queue.js +48 -20
- package/lib/module/features/queue/queue.js.map +1 -1
- package/lib/module/features/queue/repeatMode.js +2 -1
- package/lib/module/features/queue/repeatMode.js.map +1 -1
- package/lib/module/features/queue/shuffle.js +0 -1
- package/lib/module/features/queue/shuffle.js.map +1 -1
- package/lib/module/features/remoteControls.js +59 -35
- package/lib/module/features/remoteControls.js.map +1 -1
- package/lib/module/features/sleepTimer.js +15 -6
- package/lib/module/features/sleepTimer.js.map +1 -1
- package/lib/module/utils/LazyNativeEmitter.js +6 -9
- package/lib/module/utils/LazyNativeEmitter.js.map +1 -1
- package/lib/module/utils/NativeUpdatedValue.js +13 -12
- package/lib/module/utils/NativeUpdatedValue.js.map +1 -1
- package/lib/module/utils/getTrackIdentity.js +6 -4
- package/lib/module/utils/getTrackIdentity.js.map +1 -1
- package/lib/module/utils/useDebug.js +16 -3
- package/lib/module/utils/useDebug.js.map +1 -1
- package/lib/module/web/NativeAudioBrowser.js +2 -4
- package/lib/module/web/NativeAudioBrowser.js.map +1 -1
- package/lib/module/web/browser/parseSearchResponse.js +3 -4
- package/lib/module/web/browser/parseSearchResponse.js.map +1 -1
- package/lib/module/web/browser/sections.js +1 -1
- package/lib/module/web/util/BrowserPathHelper.js +1 -3
- package/lib/module/web/util/BrowserPathHelper.js.map +1 -1
- package/lib/typescript/src/features/battery.d.ts +17 -12
- package/lib/typescript/src/features/battery.d.ts.map +1 -1
- package/lib/typescript/src/features/browser.d.ts +64 -24
- package/lib/typescript/src/features/browser.d.ts.map +1 -1
- package/lib/typescript/src/features/carConnection.d.ts +3 -4
- package/lib/typescript/src/features/carConnection.d.ts.map +1 -1
- package/lib/typescript/src/features/equalizer.d.ts +9 -5
- package/lib/typescript/src/features/equalizer.d.ts.map +1 -1
- package/lib/typescript/src/features/errors.d.ts +37 -22
- package/lib/typescript/src/features/errors.d.ts.map +1 -1
- package/lib/typescript/src/features/favorites.d.ts +15 -13
- package/lib/typescript/src/features/favorites.d.ts.map +1 -1
- package/lib/typescript/src/features/gate.d.ts +14 -8
- package/lib/typescript/src/features/gate.d.ts.map +1 -1
- package/lib/typescript/src/features/metadata.d.ts +37 -17
- package/lib/typescript/src/features/metadata.d.ts.map +1 -1
- package/lib/typescript/src/features/network.d.ts +5 -1
- package/lib/typescript/src/features/network.d.ts.map +1 -1
- package/lib/typescript/src/features/nowPlaying.d.ts +28 -14
- package/lib/typescript/src/features/nowPlaying.d.ts.map +1 -1
- package/lib/typescript/src/features/output.d.ts +8 -4
- package/lib/typescript/src/features/output.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/controls.d.ts +10 -5
- package/lib/typescript/src/features/playback/controls.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/playWhenReady.d.ts +6 -5
- package/lib/typescript/src/features/playback/playWhenReady.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/playing.d.ts +16 -3
- package/lib/typescript/src/features/playback/playing.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/progress.d.ts +11 -5
- package/lib/typescript/src/features/playback/progress.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/state.d.ts +8 -3
- package/lib/typescript/src/features/playback/state.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/trackPlaybackTime.d.ts +9 -2
- package/lib/typescript/src/features/playback/trackPlaybackTime.d.ts.map +1 -1
- package/lib/typescript/src/features/playback/volume.d.ts +6 -5
- package/lib/typescript/src/features/playback/volume.d.ts.map +1 -1
- package/lib/typescript/src/features/player/options.d.ts +52 -37
- package/lib/typescript/src/features/player/options.d.ts.map +1 -1
- package/lib/typescript/src/features/player/setup.d.ts +65 -60
- package/lib/typescript/src/features/player/setup.d.ts.map +1 -1
- package/lib/typescript/src/features/queue/activeTrack.d.ts +0 -1
- package/lib/typescript/src/features/queue/activeTrack.d.ts.map +1 -1
- package/lib/typescript/src/features/queue/queue.d.ts +48 -20
- package/lib/typescript/src/features/queue/queue.d.ts.map +1 -1
- package/lib/typescript/src/features/queue/repeatMode.d.ts +1 -1
- package/lib/typescript/src/features/queue/repeatMode.d.ts.map +1 -1
- package/lib/typescript/src/features/queue/shuffle.d.ts +0 -1
- package/lib/typescript/src/features/queue/shuffle.d.ts.map +1 -1
- package/lib/typescript/src/features/remoteControls.d.ts +58 -25
- package/lib/typescript/src/features/remoteControls.d.ts.map +1 -1
- package/lib/typescript/src/features/sleepTimer.d.ts +15 -7
- package/lib/typescript/src/features/sleepTimer.d.ts.map +1 -1
- package/lib/typescript/src/types/browser-nodes.d.ts +54 -57
- package/lib/typescript/src/types/browser-nodes.d.ts.map +1 -1
- package/lib/typescript/src/types/browser.d.ts +181 -144
- package/lib/typescript/src/types/browser.d.ts.map +1 -1
- package/lib/typescript/src/utils/LazyNativeEmitter.d.ts +6 -9
- package/lib/typescript/src/utils/LazyNativeEmitter.d.ts.map +1 -1
- package/lib/typescript/src/utils/NativeUpdatedValue.d.ts +13 -12
- package/lib/typescript/src/utils/NativeUpdatedValue.d.ts.map +1 -1
- package/lib/typescript/src/utils/getTrackIdentity.d.ts +6 -4
- package/lib/typescript/src/utils/getTrackIdentity.d.ts.map +1 -1
- package/lib/typescript/src/utils/useDebug.d.ts +16 -3
- package/lib/typescript/src/utils/useDebug.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CLAUDE.md +7 -2
- package/src/docs-floors.test.ts +71 -0
- package/src/features/battery.ts +17 -13
- package/src/features/browser-config.ts +1 -1
- package/src/features/browser.ts +65 -24
- package/src/features/carConnection.ts +3 -4
- package/src/features/equalizer.ts +9 -5
- package/src/features/errors.ts +37 -22
- package/src/features/favorites.ts +15 -13
- package/src/features/gate.ts +14 -8
- package/src/features/metadata.ts +37 -17
- package/src/features/network.ts +5 -1
- package/src/features/nowPlaying.ts +28 -14
- package/src/features/output.ts +8 -4
- package/src/features/playback/controls.ts +10 -5
- package/src/features/playback/playWhenReady.ts +6 -5
- package/src/features/playback/playing.ts +16 -3
- package/src/features/playback/progress.ts +11 -5
- package/src/features/playback/state.ts +8 -3
- package/src/features/playback/trackPlaybackTime.ts +9 -2
- package/src/features/playback/volume.ts +6 -5
- package/src/features/player/options.ts +54 -43
- package/src/features/player/setup.ts +67 -61
- package/src/features/queue/activeTrack.ts +0 -1
- package/src/features/queue/queue.ts +48 -20
- package/src/features/queue/repeatMode.ts +1 -1
- package/src/features/queue/shuffle.ts +0 -1
- package/src/features/remoteControls.ts +59 -35
- package/src/features/sleepTimer.ts +15 -7
- package/src/types/browser-nodes.ts +54 -57
- package/src/types/browser.ts +183 -146
- package/src/utils/LazyNativeEmitter.ts +6 -9
- package/src/utils/NativeUpdatedValue.ts +13 -12
- package/src/utils/getTrackIdentity.ts +6 -4
- package/src/utils/useDebug.ts +16 -3
- package/src/web/NativeAudioBrowser.ts +2 -4
- package/src/web/browser/parseSearchResponse.ts +3 -4
- package/src/web/browser/sections.ts +1 -1
- package/src/web/util/BrowserPathHelper.ts +1 -3
- package/website/guide/android-auto.md +25 -13
- package/website/guide/android-certificates.md +199 -120
- package/website/guide/artwork.md +93 -48
- package/website/guide/audio-output.md +86 -68
- package/website/guide/automotive.md +15 -10
- package/website/guide/basic-usage.md +5 -2
- package/website/guide/battery.md +50 -23
- package/website/guide/browser.md +155 -68
- package/website/guide/carplay.md +132 -49
- package/website/guide/configuration.md +85 -49
- package/website/guide/equalizer.md +36 -32
- package/website/guide/errors.md +106 -64
- package/website/guide/favorites.md +41 -31
- package/website/guide/gate.md +24 -10
- package/website/guide/getting-started.md +55 -2
- package/website/guide/hooks.md +53 -47
- package/website/guide/live-streams.md +80 -49
- package/website/guide/metadata.md +87 -53
- package/website/guide/migrating-from-track-player.md +94 -49
- package/website/guide/native-callback-fetch.md +46 -36
- package/website/guide/network.md +36 -20
- package/website/guide/now-playing.md +72 -44
- package/website/guide/playback.md +112 -35
- package/website/guide/queue.md +77 -43
- package/website/guide/remote-controls.md +87 -29
- package/website/guide/search.md +37 -22
- package/website/guide/sleep-timer.md +35 -14
- package/website/guide/track.md +59 -35
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NavigationError } from '../features/errors';
|
|
2
2
|
import type { ResolvedTrack, Track } from './browser-nodes.ts';
|
|
3
3
|
/**
|
|
4
|
-
* Event fired when a track is about to
|
|
4
|
+
* Event fired when a playable track is about to load: a browse-row tap or a
|
|
5
|
+
* `navigate(track)` call.
|
|
5
6
|
*/
|
|
6
7
|
export interface TrackLoadEvent {
|
|
7
8
|
/** The track that will be loaded */
|
|
@@ -19,13 +20,16 @@ export interface TrackLoadEvent {
|
|
|
19
20
|
* promise before proceeding (e.g., showing Now Playing in CarPlay).
|
|
20
21
|
*/
|
|
21
22
|
export type HandleTrackLoadCallback = (event: TrackLoadEvent) => Promise<void>;
|
|
23
|
+
/** What a browse callback receives: the path, and the params its route matched. */
|
|
22
24
|
export type BrowserSourceCallbackParam = {
|
|
23
25
|
path: string;
|
|
24
26
|
routeParams?: Record<string, string>;
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* Return BrowseError from a browse callback to display an error to the user.
|
|
28
|
-
*
|
|
30
|
+
* CarPlay and Android Auto show the error in place of the list: as the CarPlay
|
|
31
|
+
* list's message, and as an error row in Android Auto. The title comes from
|
|
32
|
+
* `formatNavigationError` (default "Error"), and your string is the message.
|
|
29
33
|
*
|
|
30
34
|
* On the app side, the error is surfaced as a `NavigationError` with
|
|
31
35
|
* `code: 'callback-error'`. Use `useNavigationError()` to get the error details,
|
|
@@ -33,11 +37,13 @@ export type BrowserSourceCallbackParam = {
|
|
|
33
37
|
*
|
|
34
38
|
* @example
|
|
35
39
|
* ```ts
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
40
|
+
* routes: {
|
|
41
|
+
* '/premium': async ({ path }) => {
|
|
42
|
+
* if (!user.subscribed) {
|
|
43
|
+
* return { error: 'Please subscribe to access this content' }
|
|
44
|
+
* }
|
|
45
|
+
* return fetchContent(path)
|
|
39
46
|
* }
|
|
40
|
-
* return fetchContent(path)
|
|
41
47
|
* }
|
|
42
48
|
* ```
|
|
43
49
|
*/
|
|
@@ -49,6 +55,7 @@ export type BrowseError = {
|
|
|
49
55
|
* Can be either a ResolvedTrack (success) or BrowseError (failure).
|
|
50
56
|
*/
|
|
51
57
|
export type BrowseResult = ResolvedTrack | BrowseError;
|
|
58
|
+
/** Browse callback: returns the page for a path, or a {@link BrowseError}. */
|
|
52
59
|
export type BrowserSourceCallback = (param: BrowserSourceCallbackParam) => BrowseResult | Promise<BrowseResult>;
|
|
53
60
|
/**
|
|
54
61
|
* Search mode — the *container vertical*: what KIND of result the user asked
|
|
@@ -135,29 +142,60 @@ export interface SearchParams {
|
|
|
135
142
|
*/
|
|
136
143
|
reference: MediaReference;
|
|
137
144
|
}
|
|
145
|
+
/** Search callback: returns the result tracks for a search. */
|
|
138
146
|
export type SearchSourceCallback = (params: SearchParams) => Promise<Track[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Async `transform`: receives the merged request and the route's params, and
|
|
149
|
+
* returns the request to send.
|
|
150
|
+
*/
|
|
139
151
|
export type RequestConfigTransformer = (request: RequestConfig, routeParams?: Record<string, string>) => Promise<RequestConfig>;
|
|
152
|
+
/** Sync `transformSync`: the {@link RequestConfigTransformer} without a Promise. */
|
|
140
153
|
export type RequestConfigTransformerSync = (request: RequestConfig, routeParams?: Record<string, string>) => RequestConfig;
|
|
154
|
+
/** HTTP method of a request. */
|
|
141
155
|
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
156
|
+
/**
|
|
157
|
+
* One HTTP request's fields. When configs layer, `headers` and `query` merge
|
|
158
|
+
* by key, and every other set field overrides the one below it, unless the
|
|
159
|
+
* layer has a transform, which replaces the config outright.
|
|
160
|
+
*/
|
|
142
161
|
export interface RequestConfig {
|
|
162
|
+
/** HTTP method. Defaults to `'GET'`. */
|
|
143
163
|
method?: HttpMethod;
|
|
144
164
|
/**
|
|
145
165
|
* The request path.
|
|
146
166
|
* - For browser requests, this is the track's `path`
|
|
147
167
|
* - For media requests, this is the track's `src` value
|
|
148
168
|
* - For artwork requests, this is the track's `artwork` URL
|
|
169
|
+
*
|
|
170
|
+
* A static value is ignored on `request`, `browse`, `media` and route
|
|
171
|
+
* layers; change it in a `transform`.
|
|
149
172
|
*/
|
|
150
173
|
path?: string;
|
|
174
|
+
/** URL that a relative `path` is appended to. */
|
|
151
175
|
baseUrl?: string;
|
|
176
|
+
/** Request headers, merged by key with the layers below. */
|
|
152
177
|
headers?: Record<string, string>;
|
|
178
|
+
/** Query parameters, merged by key with the layers below. */
|
|
153
179
|
query?: Record<string, string>;
|
|
180
|
+
/**
|
|
181
|
+
* Request body, sent for POST, PUT and PATCH (and DELETE when set) on iOS
|
|
182
|
+
* and Android; not sent on web.
|
|
183
|
+
*/
|
|
154
184
|
body?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Content type of the body on iOS and Android. Defaults to
|
|
187
|
+
* `'application/json'`; not sent on web.
|
|
188
|
+
*/
|
|
155
189
|
contentType?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Sent as `User-Agent` on iOS and Android (a `User-Agent` in `headers` wins
|
|
192
|
+
* on iOS); ignored on web.
|
|
193
|
+
*/
|
|
156
194
|
userAgent?: string;
|
|
157
195
|
}
|
|
158
196
|
/**
|
|
159
197
|
* Context for image loading requests.
|
|
160
|
-
* Provides pixel dimensions
|
|
198
|
+
* Provides pixel dimensions from Android Auto/CarPlay.
|
|
161
199
|
*
|
|
162
200
|
* @example
|
|
163
201
|
* ```typescript
|
|
@@ -225,7 +263,9 @@ export interface MediaTransformParams {
|
|
|
225
263
|
* }
|
|
226
264
|
* ```
|
|
227
265
|
*/
|
|
266
|
+
/** Async artwork `transform`: receives `{ request, context }`. */
|
|
228
267
|
export type MediaRequestConfigTransformer = (params: MediaTransformParams) => Promise<RequestConfig>;
|
|
268
|
+
/** Sync artwork `transformSync`: the {@link MediaRequestConfigTransformer} without a Promise. */
|
|
229
269
|
export type MediaRequestConfigTransformerSync = (params: MediaTransformParams) => RequestConfig;
|
|
230
270
|
/**
|
|
231
271
|
* Request configuration that supports async transformation.
|
|
@@ -291,65 +331,6 @@ export interface TransformableRequestConfig extends RequestConfig {
|
|
|
291
331
|
* ```
|
|
292
332
|
*/
|
|
293
333
|
export type RequestConfigResolver = () => TransformableRequestConfig | Promise<TransformableRequestConfig>;
|
|
294
|
-
/**
|
|
295
|
-
* Configuration for artwork image requests
|
|
296
|
-
*
|
|
297
|
-
* ### Configuration Hierarchy
|
|
298
|
-
*
|
|
299
|
-
* When a request is made, configs are merged in this order (later overrides earlier):
|
|
300
|
-
* 1. `request` (base config) - shared settings like user agent, common headers
|
|
301
|
-
* 2. `artwork` config - resource-specific settings
|
|
302
|
-
* 3. `resolve(track)` result - per-track overrides (if provided)
|
|
303
|
-
* 4. `imageQueryParams` - automatic size query param injection (if configured)
|
|
304
|
-
* 5. `transform(request, context)` result - final modifications (if provided)
|
|
305
|
-
*
|
|
306
|
-
* ### Usage Patterns
|
|
307
|
-
*
|
|
308
|
-
* **Simple CDN configuration:**
|
|
309
|
-
* ```typescript
|
|
310
|
-
* media: {
|
|
311
|
-
* baseUrl: 'https://audio.cdn.example.com',
|
|
312
|
-
* headers: { 'X-API-Key': 'your-api-key' }
|
|
313
|
-
* }
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* **Per-track URL resolution:**
|
|
317
|
-
* ```typescript
|
|
318
|
-
* media: {
|
|
319
|
-
* resolve: async (track) => ({
|
|
320
|
-
* baseUrl: 'https://audio.cdn.example.com',
|
|
321
|
-
* path: `/streams/${track.src}`,
|
|
322
|
-
* query: { token: await getSignedToken(track.src) }
|
|
323
|
-
* })
|
|
324
|
-
* }
|
|
325
|
-
* ```
|
|
326
|
-
*
|
|
327
|
-
* **Size-aware transformation (for artwork):**
|
|
328
|
-
* ```typescript
|
|
329
|
-
* artwork: {
|
|
330
|
-
* baseUrl: 'https://images.cdn.example.com',
|
|
331
|
-
* transform: async ({ request, context }) => ({
|
|
332
|
-
* ...request,
|
|
333
|
-
* query: {
|
|
334
|
-
* ...request.query,
|
|
335
|
-
* w: context?.width ? String(context.width) : '600',
|
|
336
|
-
* sig: await signUrl(request.path)
|
|
337
|
-
* }
|
|
338
|
-
* })
|
|
339
|
-
* }
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
* **Simple size params (declarative alternative):**
|
|
343
|
-
* ```typescript
|
|
344
|
-
* artwork: {
|
|
345
|
-
* baseUrl: 'https://images.cdn.example.com',
|
|
346
|
-
* imageQueryParams: { width: 'w', height: 'h' }
|
|
347
|
-
* }
|
|
348
|
-
* ```
|
|
349
|
-
*
|
|
350
|
-
* @see BrowserConfiguration.media - Audio stream configuration
|
|
351
|
-
* @see BrowserConfiguration.artwork - Image/artwork configuration
|
|
352
|
-
*/
|
|
353
334
|
/**
|
|
354
335
|
* Query parameter names for automatic context injection from CarPlay/Android Auto.
|
|
355
336
|
* Maps ImageContext fields to query parameter names for your CDN.
|
|
@@ -361,11 +342,9 @@ export interface ImageQueryParams {
|
|
|
361
342
|
height?: string;
|
|
362
343
|
}
|
|
363
344
|
/**
|
|
364
|
-
* Configuration for
|
|
345
|
+
* Configuration for audio stream requests: `media` in BrowserConfiguration.
|
|
365
346
|
* Extends TransformableRequestConfig with per-track resolution capabilities.
|
|
366
|
-
*
|
|
367
|
-
* Used for both `media` (audio streaming) and `artwork` (image loading) configuration
|
|
368
|
-
* in BrowserConfiguration.
|
|
347
|
+
* For `artwork`, see {@link ArtworkRequestConfig}.
|
|
369
348
|
*
|
|
370
349
|
* ### Configuration Hierarchy
|
|
371
350
|
*
|
|
@@ -378,10 +357,8 @@ export interface ImageQueryParams {
|
|
|
378
357
|
* per-track resolver is the most specific layer and wins over the
|
|
379
358
|
* transform, on every platform
|
|
380
359
|
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
* means a `media.transform` cannot sign what `resolve` produced — do that work
|
|
384
|
-
* inside `resolve`, or move the signing to `transform` and drop `resolve`.
|
|
360
|
+
* So a `media.transform` cannot sign what `resolve` produced: sign inside
|
|
361
|
+
* `resolve`, or sign in `transform` and drop `resolve`.
|
|
385
362
|
*
|
|
386
363
|
* ### Usage Patterns
|
|
387
364
|
*
|
|
@@ -406,10 +383,10 @@ export interface ImageQueryParams {
|
|
|
406
383
|
*
|
|
407
384
|
* **Dynamic request signing:**
|
|
408
385
|
* ```typescript
|
|
409
|
-
*
|
|
410
|
-
* baseUrl: 'https://images.cdn.example.com',
|
|
386
|
+
* media: {
|
|
411
387
|
* transform: async (request) => ({
|
|
412
388
|
* ...request,
|
|
389
|
+
* baseUrl: 'https://audio.cdn.example.com',
|
|
413
390
|
* query: { ...request.query, sig: await signUrl(request.path) }
|
|
414
391
|
* })
|
|
415
392
|
* }
|
|
@@ -420,18 +397,18 @@ export interface ImageQueryParams {
|
|
|
420
397
|
*/
|
|
421
398
|
export interface MediaRequestConfig extends TransformableRequestConfig {
|
|
422
399
|
/**
|
|
423
|
-
*
|
|
400
|
+
* Async per-track request resolution.
|
|
424
401
|
*
|
|
425
402
|
* Called for each track to generate the final request configuration.
|
|
426
403
|
* Receives the full Track object, allowing URL generation based on
|
|
427
404
|
* track metadata (id, artist, album, src, etc.).
|
|
428
405
|
*
|
|
429
406
|
* Runs **last** for media — after `transform`, and winning over it on every
|
|
430
|
-
* field including `path
|
|
431
|
-
*
|
|
407
|
+
* field including `path`; artwork runs them the other way round (see
|
|
408
|
+
* {@link MediaRequestConfig}). When `resolveSync` is also set, both run and
|
|
409
|
+
* the `resolveSync` result merges over this one.
|
|
432
410
|
*
|
|
433
411
|
* @param track - The track being requested
|
|
434
|
-
* @returns Request configuration for this specific track (sync or async)
|
|
435
412
|
*
|
|
436
413
|
* @example
|
|
437
414
|
* ```typescript
|
|
@@ -441,20 +418,61 @@ export interface MediaRequestConfig extends TransformableRequestConfig {
|
|
|
441
418
|
* })
|
|
442
419
|
* ```
|
|
443
420
|
*/
|
|
444
|
-
/** Async per-track resolution. When both are set, runs (merged) BEFORE `resolveSync`. */
|
|
445
421
|
resolve?: (track: Track) => Promise<RequestConfig>;
|
|
446
422
|
/** Sync per-track resolution (no Promise allocation). When both are set, runs (merged) AFTER `resolve`. */
|
|
447
423
|
resolveSync?: (track: Track) => RequestConfig;
|
|
448
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Configuration for artwork image requests: `artwork` and `nowPlayingArtwork`
|
|
427
|
+
* in BrowserConfiguration.
|
|
428
|
+
*
|
|
429
|
+
* ### Configuration Hierarchy
|
|
430
|
+
*
|
|
431
|
+
* Configs merge in this order (later overrides earlier):
|
|
432
|
+
* 1. `request` (base config) - shared settings like user agent, common headers
|
|
433
|
+
* 2. `artwork` (or `nowPlayingArtwork`) config - resource-specific settings
|
|
434
|
+
* 3. `resolve(track)` result - per-track overrides (if provided)
|
|
435
|
+
* 4. `imageQueryParams` - automatic size query params (if configured)
|
|
436
|
+
* 5. `transform({ request, context })` result - final changes (if provided)
|
|
437
|
+
*
|
|
438
|
+
* ### Usage Patterns
|
|
439
|
+
*
|
|
440
|
+
* **Size-aware transformation:**
|
|
441
|
+
* ```typescript
|
|
442
|
+
* artwork: {
|
|
443
|
+
* baseUrl: 'https://images.cdn.example.com',
|
|
444
|
+
* transform: async ({ request, context }) => ({
|
|
445
|
+
* ...request,
|
|
446
|
+
* query: {
|
|
447
|
+
* ...request.query,
|
|
448
|
+
* w: context?.width ? String(context.width) : '600',
|
|
449
|
+
* sig: await signUrl(request.path)
|
|
450
|
+
* }
|
|
451
|
+
* })
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* **Simple size params (declarative alternative):**
|
|
456
|
+
* ```typescript
|
|
457
|
+
* artwork: {
|
|
458
|
+
* baseUrl: 'https://images.cdn.example.com',
|
|
459
|
+
* imageQueryParams: { width: 'w', height: 'h' }
|
|
460
|
+
* }
|
|
461
|
+
* ```
|
|
462
|
+
*
|
|
463
|
+
* @see BrowserConfiguration.artwork - Image/artwork configuration
|
|
464
|
+
* @see BrowserConfiguration.nowPlayingArtwork - Now-playing artwork
|
|
465
|
+
*/
|
|
449
466
|
export interface ArtworkRequestConfig extends RequestConfig {
|
|
450
467
|
/**
|
|
451
|
-
*
|
|
468
|
+
* Async per-track request resolution.
|
|
452
469
|
*
|
|
453
470
|
* Called for each track to generate the request configuration based on
|
|
454
471
|
* track metadata (id, artist, album, src, etc.).
|
|
455
472
|
*
|
|
456
473
|
* The returned config is merged with base configs, then passed to
|
|
457
|
-
* `transform` if provided.
|
|
474
|
+
* `transform` if provided. When `resolveSync` is also set, both run and the
|
|
475
|
+
* `resolveSync` result merges over this one.
|
|
458
476
|
*
|
|
459
477
|
* @param track - The track being requested
|
|
460
478
|
* @returns Request configuration for this specific track
|
|
@@ -469,23 +487,23 @@ export interface ArtworkRequestConfig extends RequestConfig {
|
|
|
469
487
|
* }
|
|
470
488
|
* ```
|
|
471
489
|
*/
|
|
472
|
-
/** Async per-track resolution. When both are set, runs (merged) BEFORE `resolveSync`. */
|
|
473
490
|
resolve?: (track: Track) => Promise<RequestConfig>;
|
|
474
491
|
/** Sync per-track resolution (no Promise allocation). When both are set, runs (merged) AFTER `resolve`. */
|
|
475
492
|
resolveSync?: (track: Track) => RequestConfig;
|
|
476
493
|
/**
|
|
477
|
-
*
|
|
494
|
+
* Async final transform for artwork requests.
|
|
478
495
|
*
|
|
479
496
|
* Called after `resolve` (if provided) with the merged request config.
|
|
480
497
|
* Receives optional ImageContext with size hints from Android Auto/CarPlay.
|
|
498
|
+
* When `transformSync` is also set, it runs after this one on its result.
|
|
481
499
|
*
|
|
482
500
|
* Use this for:
|
|
483
501
|
* - Adding size query params dynamically
|
|
484
502
|
* - URL signing
|
|
485
503
|
* - Adding authentication tokens
|
|
486
504
|
*
|
|
487
|
-
* @param
|
|
488
|
-
*
|
|
505
|
+
* @param params - `{ request, context }`: the merged request configuration
|
|
506
|
+
* and the optional image context with size hints
|
|
489
507
|
* @returns Modified request configuration
|
|
490
508
|
*
|
|
491
509
|
* @example
|
|
@@ -502,15 +520,15 @@ export interface ArtworkRequestConfig extends RequestConfig {
|
|
|
502
520
|
* }
|
|
503
521
|
* ```
|
|
504
522
|
*/
|
|
505
|
-
/** Async final transform. When both are set, runs BEFORE `transformSync`. */
|
|
506
523
|
transform?: MediaRequestConfigTransformer;
|
|
507
524
|
/** Sync final transform (no Promise allocation). When both are set, runs AFTER `transform`. */
|
|
508
525
|
transformSync?: MediaRequestConfigTransformerSync;
|
|
509
526
|
/**
|
|
510
527
|
* Query parameter names for automatic context injection from CarPlay/Android Auto.
|
|
511
528
|
*
|
|
512
|
-
* When configured, the image
|
|
513
|
-
*
|
|
529
|
+
* When configured, the image width and height from CarPlay/Android Auto are
|
|
530
|
+
* added as query parameters to artwork URLs, in whole pixels, when the
|
|
531
|
+
* display size is known.
|
|
514
532
|
*
|
|
515
533
|
* This is a simpler alternative to using `transform` for context-aware URLs.
|
|
516
534
|
*
|
|
@@ -541,20 +559,24 @@ export interface ArtworkRequestConfig extends RequestConfig {
|
|
|
541
559
|
* sub-container (`path`). A callback / static `ResolvedTrack` returns the same
|
|
542
560
|
* page object directly.
|
|
543
561
|
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
562
|
+
* A {@link TabsSource} HTTP endpoint returns this same page shape, with the
|
|
563
|
+
* tabs as its `children`. A {@link SearchSource} HTTP endpoint differs: it
|
|
564
|
+
* returns a bare `Track[]`.
|
|
546
565
|
*/
|
|
547
566
|
export type BrowserSource = ResolvedTrack | BrowserSourceCallback | TransformableRequestConfig;
|
|
567
|
+
/**
|
|
568
|
+
* A callback or an HTTP request config. A route's `browse` takes the wider
|
|
569
|
+
* {@link BrowserSource}, which also accepts a static {@link ResolvedTrack}.
|
|
570
|
+
*/
|
|
548
571
|
export type RouteSource = BrowserSourceCallback | TransformableRequestConfig;
|
|
549
572
|
/**
|
|
550
|
-
* Route configuration with per-route
|
|
573
|
+
* Route configuration with per-route browse and artwork overrides.
|
|
551
574
|
*
|
|
552
575
|
* @example
|
|
553
576
|
* ```typescript
|
|
554
577
|
* routes: {
|
|
555
578
|
* '/premium': {
|
|
556
579
|
* browse: async () => fetchPremiumContent(),
|
|
557
|
-
* media: { baseUrl: 'https://premium-audio.cdn.com' },
|
|
558
580
|
* artwork: { baseUrl: 'https://premium-images.cdn.com' }
|
|
559
581
|
* }
|
|
560
582
|
* }
|
|
@@ -563,17 +585,23 @@ export type RouteSource = BrowserSourceCallback | TransformableRequestConfig;
|
|
|
563
585
|
export type RouteConfig = {
|
|
564
586
|
/** Override browse config for this route. */
|
|
565
587
|
browse?: BrowserSource;
|
|
566
|
-
/**
|
|
588
|
+
/**
|
|
589
|
+
* Not applied on any platform: media always resolves from the top-level
|
|
590
|
+
* `media` config.
|
|
591
|
+
*/
|
|
567
592
|
media?: MediaRequestConfig;
|
|
568
593
|
/** Override artwork config for this route. */
|
|
569
594
|
artwork?: ArtworkRequestConfig;
|
|
570
595
|
};
|
|
596
|
+
/** Tabs callback: returns the tab tracks. */
|
|
571
597
|
export type TabsSourceCallback = () => Track[] | Promise<Track[]>;
|
|
572
598
|
/**
|
|
573
599
|
* Tab source configuration for navigation tabs.
|
|
574
600
|
*
|
|
575
|
-
* When using API configuration (TransformableRequestConfig), the
|
|
576
|
-
*
|
|
601
|
+
* When using API configuration (TransformableRequestConfig), the web requests
|
|
602
|
+
* path '/', but iOS and Android request an internal placeholder path instead.
|
|
603
|
+
* A static `path` is ignored, so set the path in a `transform` for the same
|
|
604
|
+
* request on every platform. The endpoint must return a page object
|
|
577
605
|
* `{ title?, children: Track[] }` whose `children` are the tabs — the same
|
|
578
606
|
* shape a browse endpoint returns. Callback/static sources provide `Track[]`
|
|
579
607
|
* directly.
|
|
@@ -583,14 +611,18 @@ export type TabsSource = Track[] | TabsSourceCallback | TransformableRequestConf
|
|
|
583
611
|
* Search source configuration for handling search requests.
|
|
584
612
|
*
|
|
585
613
|
* **Response shape (HTTP / `TransformableRequestConfig`):** the endpoint must
|
|
586
|
-
* return a
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
614
|
+
* return a bare `Track[]` of result rows, not the page object a browse
|
|
615
|
+
* endpoint returns. (The web implementation also accepts a page object
|
|
616
|
+
* `{ children: Track[] }`; iOS and Android do not.) Callback sources return
|
|
617
|
+
* `Track[]` directly.
|
|
590
618
|
*
|
|
591
619
|
* @see BrowserConfiguration.search
|
|
592
620
|
*/
|
|
593
621
|
export type SearchSource = SearchSourceCallback | TransformableRequestConfig;
|
|
622
|
+
/**
|
|
623
|
+
* The browser's configuration: requests, routes, tabs, search and the car
|
|
624
|
+
* surfaces. Pass it to `configureBrowser`.
|
|
625
|
+
*/
|
|
594
626
|
export type BrowserConfiguration = {
|
|
595
627
|
/**
|
|
596
628
|
* Initial navigation path. Setting this triggers initial navigation to the
|
|
@@ -682,9 +714,9 @@ export type BrowserConfiguration = {
|
|
|
682
714
|
* the result flows through the shared `request` layer (so a relative path gets `baseUrl`
|
|
683
715
|
* prepended). For logic that can't be expressed as a template, use `resolve(track)`.
|
|
684
716
|
*
|
|
685
|
-
* The `{id}` templating
|
|
686
|
-
*
|
|
687
|
-
* implementation.
|
|
717
|
+
* The same `{id}` templating applies to every artwork config (`artwork`,
|
|
718
|
+
* a route's `artwork`, `nowPlayingArtwork`) on iOS and Android. Neither
|
|
719
|
+
* `{id}` nor `nowPlayingArtwork` is implemented by the web implementation.
|
|
688
720
|
*
|
|
689
721
|
* @example
|
|
690
722
|
* // 302-redirect endpoint keyed by the track id:
|
|
@@ -724,8 +756,8 @@ export type BrowserConfiguration = {
|
|
|
724
756
|
* expects different names, rename them in `transform` — it receives the params
|
|
725
757
|
* already on `request.query`, e.g. `query: { search: request.query?.q }`.
|
|
726
758
|
*
|
|
727
|
-
* Response shape: the endpoint must return a
|
|
728
|
-
*
|
|
759
|
+
* Response shape: the endpoint must return a bare `Track[]` — see
|
|
760
|
+
* {@link SearchSource}.
|
|
729
761
|
*
|
|
730
762
|
* @example
|
|
731
763
|
* ```typescript
|
|
@@ -735,11 +767,15 @@ export type BrowserConfiguration = {
|
|
|
735
767
|
* if (params.reference === 'my') return await getFavorites();
|
|
736
768
|
* // Filters are read directly from their props (not derived from `mode`)
|
|
737
769
|
* if (params.album && params.artist) {
|
|
738
|
-
* return await db.query(
|
|
739
|
-
*
|
|
770
|
+
* return await db.query(
|
|
771
|
+
* 'SELECT * FROM tracks WHERE album = ? AND artist = ?',
|
|
772
|
+
* [params.album, params.artist]
|
|
773
|
+
* );
|
|
740
774
|
* }
|
|
741
775
|
* if (params.artist) {
|
|
742
|
-
* return await db.query('SELECT * FROM tracks WHERE artist = ?', [
|
|
776
|
+
* return await db.query('SELECT * FROM tracks WHERE artist = ?', [
|
|
777
|
+
* params.artist,
|
|
778
|
+
* ]);
|
|
743
779
|
* }
|
|
744
780
|
* // `mode` is the container vertical — narrow by it when present
|
|
745
781
|
* if (params.mode === 'podcast') return await searchPodcasts(params.query);
|
|
@@ -750,8 +786,8 @@ export type BrowserConfiguration = {
|
|
|
750
786
|
* // API configuration - parameters automatically added to query string
|
|
751
787
|
* search: {
|
|
752
788
|
* baseUrl: 'https://api.example.com/search',
|
|
753
|
-
* // GET /search?q=greens&
|
|
754
|
-
*
|
|
789
|
+
* // GET /search?q=greens&album=greens&artist=the+radishes&limit=20
|
|
790
|
+
* transformSync(request) {
|
|
755
791
|
* return {
|
|
756
792
|
* ...request,
|
|
757
793
|
* query: { ...request.query, limit: '20' }
|
|
@@ -766,7 +802,11 @@ export type BrowserConfiguration = {
|
|
|
766
802
|
* The first tab's path is automatically loaded when the browser starts.
|
|
767
803
|
*
|
|
768
804
|
* Optional - if not provided, no tab navigation will be available.
|
|
769
|
-
*
|
|
805
|
+
* Car surfaces show only the first tabs: Android Auto shows 4, CarPlay
|
|
806
|
+
* shows up to `CPTabBarTemplate.maximumTabCount`. `getTabs` and `useTabs`
|
|
807
|
+
* still return every tab, and `configureBrowser` warns in development when
|
|
808
|
+
* a static array has more than Android Auto shows. See
|
|
809
|
+
* [Tabs and the initial path](/guide/browser#tabs-and-the-initial-path).
|
|
770
810
|
*
|
|
771
811
|
* Can provide static array of Track objects with paths as tabs, API configuration, or custom callback.
|
|
772
812
|
*/
|
|
@@ -800,13 +840,14 @@ export type BrowserConfiguration = {
|
|
|
800
840
|
* which receives `routeParams` as its second argument.
|
|
801
841
|
*
|
|
802
842
|
* Values can be a `BrowserSource` (callback, request config, or static page
|
|
803
|
-
* object) or a `RouteConfig` with per-route `
|
|
843
|
+
* object) or a `RouteConfig` with per-route `browse`/`artwork` overrides.
|
|
804
844
|
*
|
|
805
845
|
* @example
|
|
806
846
|
* ```typescript
|
|
807
847
|
* routes: {
|
|
808
848
|
* '/favorites': async () => getFavoritesPage(),
|
|
809
|
-
* '/albums/{id}': async ({ routeParams }) =>
|
|
849
|
+
* '/albums/{id}': async ({ routeParams }) =>
|
|
850
|
+
* fetchAlbumPage(routeParams?.id),
|
|
810
851
|
* '/premium': {
|
|
811
852
|
* browse: { baseUrl: 'https://premium-api.example.com' },
|
|
812
853
|
* artwork: { baseUrl: 'https://premium-images.example.com' }
|
|
@@ -826,7 +867,9 @@ export type BrowserConfiguration = {
|
|
|
826
867
|
singleTrack?: boolean;
|
|
827
868
|
/**
|
|
828
869
|
* Custom handler for track load events.
|
|
829
|
-
* When set,
|
|
870
|
+
* When set, loading a playable track (a browse-row tap or a
|
|
871
|
+
* `navigate(track)` call) invokes this handler instead of auto-loading and
|
|
872
|
+
* playing the track.
|
|
830
873
|
* Pass undefined to restore default behavior.
|
|
831
874
|
*
|
|
832
875
|
* @param event - The track load event containing the track, queue, and startIndex
|
|
@@ -846,28 +889,16 @@ export type BrowserConfiguration = {
|
|
|
846
889
|
*/
|
|
847
890
|
androidControllerOfflineError?: boolean;
|
|
848
891
|
/**
|
|
849
|
-
* Titles the "view more" row
|
|
850
|
-
* `Section.path
|
|
851
|
-
* Android Auto, today the only one.
|
|
892
|
+
* Titles the "view more" row Android Auto appends to a `Section` that
|
|
893
|
+
* carries a `Section.path`, one string for every section.
|
|
852
894
|
*
|
|
853
|
-
*
|
|
854
|
-
* default, the same arrangement `formatNavigationError` has. Set this to
|
|
855
|
-
* localize it: it is re-resolved once per content generation, so
|
|
895
|
+
* It is re-resolved once per content generation, so
|
|
856
896
|
* `invalidateAllContent()` after an in-app language switch picks up the new
|
|
857
|
-
* copy without reconfiguring the browser.
|
|
858
|
-
* than a plain string — an app whose locale is its own, not the system's,
|
|
859
|
-
* cannot express that with a value frozen at configure time.
|
|
860
|
-
*
|
|
861
|
-
* One string for every section by design — the row is a fallback for a
|
|
862
|
-
* surface that cannot draw a link in its header, so per-section wording would
|
|
863
|
-
* be ceremony most consumers never see rendered.
|
|
897
|
+
* copy without reconfiguring the browser.
|
|
864
898
|
*
|
|
865
|
-
* For wording that varies by section
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
* leave `Section.path` unset so this row doesn't also appear. Since the
|
|
869
|
-
* row is Android-only, that branch is an ordinary platform check on the
|
|
870
|
-
* content you emit; CarPlay never sees the extra row.
|
|
899
|
+
* For wording that varies by section, leave `Section.path` unset and append
|
|
900
|
+
* your own browsable {@link Track} to `children`; that Track shows on every
|
|
901
|
+
* surface. See [Android Auto](https://audiobrowser.dev/guide/android-auto).
|
|
871
902
|
*
|
|
872
903
|
* @default 'View more'
|
|
873
904
|
*
|
|
@@ -897,13 +928,13 @@ export type BrowserConfiguration = {
|
|
|
897
928
|
*/
|
|
898
929
|
carPlayLoadingTitle?: string;
|
|
899
930
|
/**
|
|
900
|
-
* Called when the
|
|
901
|
-
*
|
|
902
|
-
*
|
|
903
|
-
*
|
|
931
|
+
* Called when the active track changes and it has no {@link Track.albumPath}.
|
|
932
|
+
* Return a browse path to make the album line on the CarPlay Now Playing
|
|
933
|
+
* screen tappable: a tap navigates the CarPlay browse stack there. Return
|
|
934
|
+
* `undefined` to leave the album line untappable for this track.
|
|
904
935
|
*
|
|
905
|
-
* The
|
|
906
|
-
*
|
|
936
|
+
* The library calls it ahead of any tap, so the album line is tappable only
|
|
937
|
+
* when there is somewhere to go.
|
|
907
938
|
*
|
|
908
939
|
* @example
|
|
909
940
|
* ```typescript
|
|
@@ -916,7 +947,8 @@ export type BrowserConfiguration = {
|
|
|
916
947
|
resolveAlbumPath?: ResolveAlbumPathCallback;
|
|
917
948
|
/**
|
|
918
949
|
* Callback to customize error messages for navigation errors.
|
|
919
|
-
* Used by CarPlay and
|
|
950
|
+
* Used by CarPlay and Android Auto, and available via
|
|
951
|
+
* `useFormattedNavigationError()` for app UI.
|
|
920
952
|
*
|
|
921
953
|
* If not provided or returns undefined, default English messages are used.
|
|
922
954
|
*
|
|
@@ -973,8 +1005,13 @@ export type FormattedNavigationError = {
|
|
|
973
1005
|
* Default values:
|
|
974
1006
|
* - `'content-not-found'`: "Content Not Found" (English)
|
|
975
1007
|
* - `'network-error'`: "Network Error" (English)
|
|
976
|
-
* - `'http-error'`:
|
|
1008
|
+
* - `'http-error'`: the status text, system-localized on iOS (e.g. "Not
|
|
1009
|
+
* Found", "Service Unavailable"); on Android an English name for common
|
|
1010
|
+
* codes. "Server Error" when there is no status code, for codes Android
|
|
1011
|
+
* does not name, and always on web
|
|
977
1012
|
* - `'callback-error'`: "Error" (English)
|
|
1013
|
+
* - `'empty-content'`: "Nothing here" (English)
|
|
1014
|
+
* - `'timeout'`: "Couldn't load" (English)
|
|
978
1015
|
* - `'unknown-error'`: "Error" (English)
|
|
979
1016
|
*/
|
|
980
1017
|
title: string;
|
|
@@ -1029,8 +1066,8 @@ export type FormatNavigationErrorParams = {
|
|
|
1029
1066
|
*/
|
|
1030
1067
|
export type FormatNavigationErrorCallback = (params: FormatNavigationErrorParams) => FormattedNavigationError | undefined;
|
|
1031
1068
|
/**
|
|
1032
|
-
* Maps the
|
|
1033
|
-
*
|
|
1069
|
+
* Maps the active track to a browse path for the CarPlay album line, or
|
|
1070
|
+
* `undefined` to leave the line untappable. See {@link BrowserConfiguration.resolveAlbumPath | resolveAlbumPath}.
|
|
1034
1071
|
*/
|
|
1035
1072
|
export type ResolveAlbumPathCallback = (track: Track) => string | undefined;
|
|
1036
1073
|
/** Supplies the title of the appended "view more" row. See `viewMoreTitle`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../src/types/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE9D
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../src/types/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE9D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,mCAAmC;IACnC,KAAK,EAAE,KAAK,EAAE,CAAA;IACd,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE9E,mFAAmF;AACnF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,WAAW,CAAA;AAEtD,8EAA8E;AAC9E,MAAM,MAAM,qBAAqB,GAAG,CAClC,KAAK,EAAE,0BAA0B,KAC9B,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAE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