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
package/README.md
CHANGED
|
@@ -9,7 +9,9 @@ Built by former [react-native-track-player](https://github.com/doublesymmetry/re
|
|
|
9
9
|
|
|
10
10
|
> **Coming from react-native-track-player?** The playback and queue API is intentionally familiar, so most code ports over with small changes — see the [migration guide](https://audiobrowser.dev/guide/migrating-from-track-player).
|
|
11
11
|
|
|
12
|
-
In the car, audio apps are organized as a browse tree: tabs, nested lists, and playable items, often loaded on demand from your backend.
|
|
12
|
+
In the car, audio apps are organized as a browse tree: tabs, nested lists, and playable items, often loaded on demand from your backend.
|
|
13
|
+
|
|
14
|
+
Define the tree in JS, fetch it from your API, or resolve it lazily with callbacks. Audio Browser renders it as native CarPlay and Android Auto UI, with playback wired into the lock screen and system controls.
|
|
13
15
|
|
|
14
16
|
Use the same tree in your app UI, or keep it focused on CarPlay and Android Auto. Either way, [hooks](#hooks) expose playback, queue, and browse state for your own screens.
|
|
15
17
|
|
|
@@ -17,25 +19,23 @@ Use the same tree in your app UI, or keep it focused on CarPlay and Android Auto
|
|
|
17
19
|
|
|
18
20
|
- **[Browse-first architecture](https://audiobrowser.dev/guide/browser)** — tabs, nested lists, routes, and playable items resolved from static data, JS callbacks, or your JSON API, then rendered natively on CarPlay and Android Auto.
|
|
19
21
|
- **Car cold start** — launch directly from CarPlay or Android Auto with the phone app closed. The browse tree and playback come up on the head unit without opening the app first.
|
|
20
|
-
- **Production [playback](https://audiobrowser.dev/guide/playback)** — [queue](https://audiobrowser.dev/guide/queue), background audio,
|
|
22
|
+
- **Production [playback](https://audiobrowser.dev/guide/playback)** — [queue](https://audiobrowser.dev/guide/queue), [background audio, interruptions, and audio focus](https://audiobrowser.dev/guide/playback#background-audio-interruptions-and-audio-focus), playback rate, and [lock screen, notification, and headset controls](https://audiobrowser.dev/guide/remote-controls).
|
|
21
23
|
- **Built on Nitro** — React Native's New Architecture, synchronous native calls, and no bridge overhead.
|
|
22
24
|
- **Real native-to-JS callbacks** — route resolvers, request transforms, gates, search, and track-load interception call into your JS and use what you return, instead of going through fire-and-forget bridge events.
|
|
23
25
|
- **Playback resumption** — persist the last session and resume after the app is killed, including the Android system play button and “play «App»” via Siri.
|
|
24
26
|
- **[Live-stream ready](#streaming)** — HLS, ICY/Icecast, and progressive streams, with stall recovery, reconnects, fresh URL resolution, and live-edge seeking.
|
|
25
27
|
- **[React hooks](#hooks)** — reactive playback, queue, browse, progress, sleep timer, and car-connection state for your app UI.
|
|
26
28
|
- **[Now Playing](https://audiobrowser.dev/guide/now-playing)** — metadata, artwork, [timed metadata, chapter metadata](https://audiobrowser.dev/guide/metadata), lock screen updates, and media-session integration.
|
|
27
|
-
- **[Favorites](https://audiobrowser.dev/guide/favorites)** — favorite the current track from the Now Playing heart button or by voice, ask Siri to “play my favorites” or search within them
|
|
29
|
+
- **[Favorites](https://audiobrowser.dev/guide/favorites)** — favorite the current track from the Now Playing heart button or by voice, and ask Siri to “play my favorites” or search within them. Favorited state stays in sync across surfaces, even when your app stores favorites by ID instead of stream URL.
|
|
28
30
|
- **[Voice search](https://audiobrowser.dev/guide/search)** — Siri and Google Assistant route into one structured `search` source, so “play some jazz” can arrive as a genre filter instead of a raw query string.
|
|
29
|
-
- **[
|
|
31
|
+
- **[Browse gates](https://audiobrowser.dev/guide/gate)** — put browse on CarPlay, Android Auto, and Android Automotive, and voice search anywhere, behind a paywall, login, or region wall, decided per request by a resolver.
|
|
30
32
|
- **Request and [artwork](https://audiobrowser.dev/guide/artwork) control** — rewrite outbound requests, add auth headers, shape URLs, and customize artwork loading.
|
|
31
|
-
- **Web support** — the same `AudioBrowser` API works with `react-native-web` for playback, browse, search, and sleep timer.
|
|
32
|
-
- **Platform extras** — [
|
|
33
|
+
- **[Web support](https://audiobrowser.dev/guide/getting-started#web)** — the same `AudioBrowser` API works with `react-native-web` for playback, browse, search, and sleep timer.
|
|
34
|
+
- **Platform extras** — [audio output routing](https://audiobrowser.dev/guide/audio-output) (AirPlay on iOS; the system Output Switcher, Google Cast and Sonos on Android), [Android battery-resume handling](https://audiobrowser.dev/guide/battery), [sleep timer](https://audiobrowser.dev/guide/sleep-timer), and [Android equalizer support](https://audiobrowser.dev/guide/equalizer).
|
|
33
35
|
|
|
34
36
|
## Requirements
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
- iOS **16+** · Android **API 24+**
|
|
38
|
-
- [`react-native-nitro-modules`](https://nitro.margelo.com) (peer dependency)
|
|
38
|
+
React Native with the **New Architecture** (Fabric + TurboModules), [`react-native-nitro-modules`](https://nitro.margelo.com) as a peer dependency, and on web [`shaka-player`](https://github.com/shaka-project/shaka-player) as an optional peer dependency. The minimum React Native, React, iOS, Android, nitro and shaka-player versions are listed in [Getting Started](https://audiobrowser.dev/guide/getting-started#installation).
|
|
39
39
|
|
|
40
40
|
## Installation
|
|
41
41
|
|
|
@@ -49,8 +49,16 @@ iOS:
|
|
|
49
49
|
cd ios && pod install
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
Then add the `audio` background mode (`UIBackgroundModes` → `audio`) to your app's `Info.plist`, or playback stops when the app goes to the background.
|
|
53
|
+
|
|
52
54
|
Android links automatically.
|
|
53
55
|
|
|
56
|
+
Web (`react-native-web`):
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npm install shaka-player
|
|
60
|
+
```
|
|
61
|
+
|
|
54
62
|
CarPlay and Android Auto need extra native setup (entitlements, manifest entries) — see the [CarPlay](https://audiobrowser.dev/guide/carplay) and [Android Auto](https://audiobrowser.dev/guide/android-auto) guides.
|
|
55
63
|
|
|
56
64
|
## Quick Start
|
|
@@ -79,8 +87,13 @@ Each route returns a page of children — a child with a `path` is browsable (op
|
|
|
79
87
|
"path": "/browse/jazz",
|
|
80
88
|
"title": "Jazz",
|
|
81
89
|
"children": [
|
|
82
|
-
|
|
83
|
-
{ "title": "
|
|
90
|
+
// path → open for children
|
|
91
|
+
{ "title": "Smooth Floret FM", "path": "/browse/jazz/floret-fm" },
|
|
92
|
+
// src → play this stream
|
|
93
|
+
{
|
|
94
|
+
"title": "The Stalk 88.5",
|
|
95
|
+
"src": "https://stream.example.com/stalk.mp3"
|
|
96
|
+
}
|
|
84
97
|
]
|
|
85
98
|
}
|
|
86
99
|
```
|
|
@@ -145,16 +158,16 @@ function PlayerBar() {
|
|
|
145
158
|
|
|
146
159
|
## Streaming
|
|
147
160
|
|
|
148
|
-
Optimizations for live radio and long-running streams:
|
|
161
|
+
Optimizations for live radio and long-running streams (see the [Live Streams guide](https://audiobrowser.dev/guide/live-streams)):
|
|
149
162
|
|
|
150
|
-
- **Auto-reconnect** — opt in with `setupPlayer({ retry: true })`. On a network error the player
|
|
151
|
-
- **Fresh URLs on reconnect** —
|
|
152
|
-
- **Live edge** — `seekToLiveEdge()` jumps back to live: the DVR-window end for seekable HLS, a clean reconnect for non-seekable ICY/Icecast.
|
|
153
|
-
- **ICY & chapter metadata** — Shoutcast `StreamTitle` and chapter markers surface via `onTimedMetadata` / `onChapterMetadata`, and
|
|
163
|
+
- **Auto-reconnect** — opt in with `setupPlayer({ retry: true })`. On a network error the player backs off and reconnects when the network returns, within a short budget before a stream first plays and a longer one once it has played or while offline ([budgets](https://audiobrowser.dev/guide/errors#two-duration-budgets)). Not on web.
|
|
164
|
+
- **Fresh URLs on reconnect** — build signed or token-authenticated URLs in a `media.resolve` callback and a reconnect can re-sign them ([details](https://audiobrowser.dev/guide/live-streams#fresh-urls-on-reconnect)).
|
|
165
|
+
- **Live edge** — `seekToLiveEdge()` jumps back to live on a track marked `live: true`: the DVR-window end for seekable HLS, a clean reconnect for non-seekable ICY/Icecast.
|
|
166
|
+
- **ICY & chapter metadata** — Shoutcast `StreamTitle` and chapter markers surface via `onTimedMetadata` / `onChapterMetadata`, and your [`nowPlaying` formatter](https://audiobrowser.dev/guide/now-playing#the-formatter-derived-continuous) can put them on the lock screen.
|
|
154
167
|
- **Plays nicely** — pauses cleanly on calls, audio-focus loss, and headphone/Bluetooth disconnect, and resumes when it should.
|
|
155
168
|
- **HLS, ICY/Icecast, and progressive** everywhere; DASH on Android and web.
|
|
156
169
|
|
|
157
|
-
Plus deeper per-platform hardening — Android stuck-stream recovery, optional disk caching,
|
|
170
|
+
Plus deeper per-platform hardening — Android stuck-stream recovery, optional disk caching, an [AIA-chasing TLS toolkit](https://audiobrowser.dev/guide/android-certificates) for the app's own `HttpURLConnection` traffic (the player's media requests do not use it); iOS media-services-reset and AirPlay stall recovery.
|
|
158
171
|
|
|
159
172
|
## Documentation
|
|
160
173
|
|
|
@@ -162,7 +175,7 @@ Full guides and the complete [API Reference](https://audiobrowser.dev/api/) live
|
|
|
162
175
|
|
|
163
176
|
**Start here** — [Getting Started](https://audiobrowser.dev/guide/getting-started) · [Basic Usage](https://audiobrowser.dev/guide/basic-usage) · [Configuration](https://audiobrowser.dev/guide/configuration) · [Track](https://audiobrowser.dev/guide/track) · [Hooks](https://audiobrowser.dev/guide/hooks) · [Migrating from react-native-track-player](https://audiobrowser.dev/guide/migrating-from-track-player)
|
|
164
177
|
|
|
165
|
-
**Player** — [Playback](https://audiobrowser.dev/guide/playback) · [Queue](https://audiobrowser.dev/guide/queue) · [Now Playing](https://audiobrowser.dev/guide/now-playing) · [Metadata](https://audiobrowser.dev/guide/metadata) · [Remote Controls](https://audiobrowser.dev/guide/remote-controls) · [Errors](https://audiobrowser.dev/guide/errors) · [Artwork](https://audiobrowser.dev/guide/artwork)
|
|
178
|
+
**Player** — [Playback](https://audiobrowser.dev/guide/playback) · [Queue](https://audiobrowser.dev/guide/queue) · [Now Playing](https://audiobrowser.dev/guide/now-playing) · [Live Streams](https://audiobrowser.dev/guide/live-streams) · [Metadata](https://audiobrowser.dev/guide/metadata) · [Remote Controls](https://audiobrowser.dev/guide/remote-controls) · [Errors](https://audiobrowser.dev/guide/errors) · [Artwork](https://audiobrowser.dev/guide/artwork)
|
|
166
179
|
|
|
167
180
|
**Browse** — [Browser](https://audiobrowser.dev/guide/browser) · [Search](https://audiobrowser.dev/guide/search) · [Favorites](https://audiobrowser.dev/guide/favorites) · [Gate](https://audiobrowser.dev/guide/gate)
|
|
168
181
|
|
|
@@ -172,7 +185,7 @@ Full guides and the complete [API Reference](https://audiobrowser.dev/api/) live
|
|
|
172
185
|
|
|
173
186
|
**Troubleshooting** — [Networking in native callbacks](https://audiobrowser.dev/guide/native-callback-fetch) · [Android SSL / trust anchors](https://audiobrowser.dev/guide/android-certificates)
|
|
174
187
|
|
|
175
|
-
The example app in [`apps/example-native`](https://github.com/radio-garden/react-native-audio-browser/tree/
|
|
188
|
+
The example app in [`apps/example-native`](https://github.com/radio-garden/react-native-audio-browser/tree/next/apps/example-native) browses archive.org's audio collection — in-app, on CarPlay, and on Android Auto — with search, favorites, and the gate. Its **Style Lab** tab renders every CarPlay `style` declaration, each shelf titled with the block it draws ([Presentation](https://audiobrowser.dev/guide/browser#presentation)).
|
|
176
189
|
|
|
177
190
|
### For coding agents
|
|
178
191
|
|
package/lib/commonjs/CLAUDE.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# TypeScript API
|
|
2
2
|
|
|
3
|
-
The rules here are about the shape of the package's public surface.
|
|
4
|
-
enforced by
|
|
3
|
+
The rules here are about the shape of the package's public surface. The first
|
|
4
|
+
is enforced by `public-surface.test.ts`, which only tells you _after_ you've
|
|
5
|
+
written it; the second is a convention no test checks.
|
|
5
6
|
|
|
6
7
|
## Everything you export is public
|
|
7
8
|
|
|
@@ -47,6 +48,10 @@ Two emitter classes, picked by what the event _is_:
|
|
|
47
48
|
Both are created via `emitterize(cb => (nativeBrowser.onThing = cb))` and both
|
|
48
49
|
return the instance. Neither class is exported from the package.
|
|
49
50
|
|
|
51
|
+
No test checks this rule: `features/hook-wiring.test.ts` only records which
|
|
52
|
+
native slot each emitter claims, so a bare `export function onThing(cb)` would
|
|
53
|
+
pass the suite. Review is what catches it.
|
|
54
|
+
|
|
50
55
|
`on*` observes; `handle*` overrides. `handleRemoteNext(cb)` is a plain setter
|
|
51
56
|
that replaces the default behaviour and takes `undefined` to clear it, while
|
|
52
57
|
`onRemoteNext` fires on every press regardless of who handled it.
|
|
@@ -14,14 +14,6 @@ exports.useBatteryWarningPending = useBatteryWarningPending;
|
|
|
14
14
|
var _native = require("../native");
|
|
15
15
|
var _NativeUpdatedValue = require("../utils/NativeUpdatedValue");
|
|
16
16
|
var _useNativeUpdatedValue = require("../utils/useNativeUpdatedValue");
|
|
17
|
-
/**
|
|
18
|
-
* Battery optimization status and warning handling for Android 12+ foreground service restrictions.
|
|
19
|
-
*
|
|
20
|
-
* When an external controller (Bluetooth, car head unit) tries to resume playback while the app
|
|
21
|
-
* is killed and battery restrictions are in place, Android 12+ blocks the foreground service start.
|
|
22
|
-
* This module exposes APIs to detect this condition and guide users to fix their settings.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
17
|
// MARK: - Types
|
|
26
18
|
|
|
27
19
|
/**
|
|
@@ -44,7 +36,10 @@ var _useNativeUpdatedValue = require("../utils/useNativeUpdatedValue");
|
|
|
44
36
|
|
|
45
37
|
/**
|
|
46
38
|
* Check if a battery warning is pending (Android only).
|
|
47
|
-
*
|
|
39
|
+
* On Android 12+, when a Bluetooth or car controller resumes playback while the
|
|
40
|
+
* app is killed and battery restrictions apply, the system blocks the foreground
|
|
41
|
+
* service start.
|
|
42
|
+
* Returns true if such a start was blocked and the user hasn't dismissed
|
|
48
43
|
* the warning or fixed their battery settings.
|
|
49
44
|
* Auto-clears when battery status becomes unrestricted.
|
|
50
45
|
* @returns true if warning is pending, always false on iOS
|
|
@@ -55,7 +50,6 @@ function getBatteryWarningPending() {
|
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
52
|
* Get the current battery optimization status (Android only).
|
|
58
|
-
* Also fires onBatteryOptimizationStatusChanged if status changed since last call.
|
|
59
53
|
* @returns Current status, always 'unrestricted' on iOS
|
|
60
54
|
*/
|
|
61
55
|
function getBatteryOptimizationStatus() {
|
|
@@ -74,7 +68,12 @@ function dismissBatteryWarning() {
|
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
/**
|
|
77
|
-
*
|
|
71
|
+
* Prompt the user to lift this app's battery restriction (Android only).
|
|
72
|
+
* With status `'optimized'` it starts the system's one-tap "ignore battery
|
|
73
|
+
* optimizations" dialog. Android shows that dialog only if the app's manifest
|
|
74
|
+
* declares `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS`, which the
|
|
75
|
+
* library does not declare; without it nothing appears. With any other status it
|
|
76
|
+
* opens the app's App info page.
|
|
78
77
|
* No-op on iOS.
|
|
79
78
|
*/
|
|
80
79
|
function openBatterySettings() {
|
|
@@ -93,7 +92,8 @@ const onBatteryWarningPendingChanged = exports.onBatteryWarningPendingChanged =
|
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
94
|
* Subscribes to battery optimization status changes (Android only).
|
|
96
|
-
* Fires when
|
|
95
|
+
* Fires when the app comes to the foreground with a different status from the
|
|
96
|
+
* one it had at the previous foreground, typically on return from settings.
|
|
97
97
|
* Never fires on iOS.
|
|
98
98
|
*/
|
|
99
99
|
const onBatteryOptimizationStatusChanged = exports.onBatteryOptimizationStatusChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onBatteryOptimizationStatusChanged = cb);
|
|
@@ -124,6 +124,10 @@ function useBatteryOptimizationStatus() {
|
|
|
124
124
|
* Meta hook that bundles all battery warning state and actions (Android only).
|
|
125
125
|
* Use this for a complete battery warning UI implementation.
|
|
126
126
|
*
|
|
127
|
+
* On Android 12+, when a Bluetooth or car controller resumes playback while the
|
|
128
|
+
* app is killed and battery restrictions apply, the system blocks the foreground
|
|
129
|
+
* service start. See the [Battery guide](https://audiobrowser.dev/guide/battery).
|
|
130
|
+
*
|
|
127
131
|
* @example
|
|
128
132
|
* ```tsx
|
|
129
133
|
* function BatteryWarningBanner() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","getBatteryWarningPending","nativeBrowser","getBatteryOptimizationStatus","dismissBatteryWarning","openBatterySettings","onBatteryWarningPendingChanged","exports","NativeUpdatedValue","emitterize","cb","onBatteryOptimizationStatusChanged","useBatteryWarningPending","useNativeUpdatedValue","useBatteryOptimizationStatus","useBatteryWarning","pending","status","dismiss","openSettings"],"sourceRoot":"../../../src","sources":["features/battery.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","getBatteryWarningPending","nativeBrowser","getBatteryOptimizationStatus","dismissBatteryWarning","openBatterySettings","onBatteryWarningPendingChanged","exports","NativeUpdatedValue","emitterize","cb","onBatteryOptimizationStatusChanged","useBatteryWarningPending","useNativeUpdatedValue","useBatteryOptimizationStatus","useBatteryWarning","pending","status","dismiss","openSettings"],"sourceRoot":"../../../src","sources":["features/battery.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,wBAAwBA,CAAA,EAAY;EAClD,OAAOC,qBAAa,CAACD,wBAAwB,CAAC,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACO,SAASE,4BAA4BA,CAAA,EAA8B;EACxE,OAAOD,qBAAa,CAACC,4BAA4B,CAAC,CAAC;AACrD;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAA,EAAS;EAC5CF,qBAAa,CAACE,qBAAqB,CAAC,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAS;EAC1CH,qBAAa,CAACG,mBAAmB,CAAC,CAAC;AACrC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GACzCE,sCAAkB,CAACC,UAAU,CAC1BC,EAAE,IAAMR,qBAAa,CAACI,8BAA8B,GAAGI,EAC1D,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kCAAkC,GAAAJ,OAAA,CAAAI,kCAAA,GAC7CH,sCAAkB,CAACC,UAAU,CAC1BC,EAAE,IAAMR,qBAAa,CAACS,kCAAkC,GAAGD,EAC9D,CAAC;;AAEH;;AAEA;AACA;AACA;AACA;AACO,SAASE,wBAAwBA,CAAA,EAAY;EAClD,OAAO,IAAAC,4CAAqB,EAC1BZ,wBAAwB,EACxBK,8BAA8B,EAC9B,SACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASQ,4BAA4BA,CAAA,EAA8B;EACxE,OAAO,IAAAD,4CAAqB,EAC1BV,4BAA4B,EAC5BQ,kCAAkC,EAClC,QACF,CAAC;AACH;;AAEA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAAA,EAAmB;EAClD,MAAMC,OAAO,GAAGJ,wBAAwB,CAAC,CAAC;EAC1C,MAAMK,MAAM,GAAGH,4BAA4B,CAAC,CAAC;EAE7C,OAAO;IACLE,OAAO;IACPC,MAAM;IACNC,OAAO,EAAEd,qBAAqB;IAC9Be,YAAY,EAAEd;EAChB,CAAC;AACH","ignoreList":[]}
|
|
@@ -176,7 +176,7 @@ function flattenRoutes(routes, tabs, search) {
|
|
|
176
176
|
return entries.length > 0 ? entries : undefined;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/** Android Auto
|
|
179
|
+
/** Android Auto displays at most this many tabs; CarPlay reads CPTabBarTemplate.maximumTabCount. */
|
|
180
180
|
const MAX_TABS = 4;
|
|
181
181
|
|
|
182
182
|
/**
|
|
@@ -27,24 +27,25 @@ let currentConfiguration;
|
|
|
27
27
|
* Also registers the browser with the player to enable:
|
|
28
28
|
* - Media URL transformation for authenticated playback
|
|
29
29
|
* - Android Auto / CarPlay browsing integration
|
|
30
|
-
* -
|
|
30
|
+
* - Playing a Playable track selected with navigate()
|
|
31
31
|
*
|
|
32
32
|
* Calling this again REPLACES the entire configuration (no merging) and
|
|
33
|
-
* re-runs initial navigation
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param configuration - Browser configuration including routes, tabs, media config, etc.
|
|
33
|
+
* re-runs initial navigation: the in-app browser returns to `path` or the
|
|
34
|
+
* first tab (on web, the first tab only when `tabs` is an array; otherwise
|
|
35
|
+
* '/'). CarPlay and Android Auto keep their place. For values that change at
|
|
36
|
+
* runtime (base URL, locale, auth token), don't reconfigure: read them
|
|
37
|
+
* inside a `request`/`browse` resolver or a `transform`, and call
|
|
38
|
+
* {@link invalidateAllContent} so every surface re-fetches in place.
|
|
40
39
|
*
|
|
41
40
|
* @example
|
|
42
41
|
* ```ts
|
|
43
42
|
* configureBrowser({
|
|
44
43
|
* request: { baseUrl: 'https://api.example.com' },
|
|
45
44
|
* routes: {
|
|
46
|
-
* // `{id}` is a route parameter — see the `routes` docs for matching
|
|
47
|
-
*
|
|
45
|
+
* // `{id}` is a route parameter — see the `routes` docs for matching
|
|
46
|
+
* // rules.
|
|
47
|
+
* '/albums/{id}': async ({ routeParams }) =>
|
|
48
|
+
* fetchAlbumPage(routeParams?.id),
|
|
48
49
|
* // Remapping a browse path to a different API path requires a transform;
|
|
49
50
|
* // a static `path` on a request config does NOT rewrite the path.
|
|
50
51
|
* '/artists/{id}': {
|
|
@@ -81,6 +82,16 @@ function configureBrowser(configuration) {
|
|
|
81
82
|
function getBrowserConfiguration() {
|
|
82
83
|
return currentConfiguration;
|
|
83
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Opens a Path in the in-app browser, or selects a Track.
|
|
88
|
+
*
|
|
89
|
+
* A string opens that Path; {@link getPath} and {@link getContent} and their
|
|
90
|
+
* events update. A Track is a selection: a Playable track plays, by default
|
|
91
|
+
* with its page as the queue (see `singleTrack` and `handleTrackLoad` on
|
|
92
|
+
* {@link BrowserConfiguration}); a Browsable track opens its path; a disabled
|
|
93
|
+
* track is ignored.
|
|
94
|
+
*/
|
|
84
95
|
function navigate(pathOrTrack) {
|
|
85
96
|
if (typeof pathOrTrack === 'string') {
|
|
86
97
|
return _native.nativeBrowser.navigatePath(pathOrTrack);
|
|
@@ -88,33 +99,62 @@ function navigate(pathOrTrack) {
|
|
|
88
99
|
return _native.nativeBrowser.navigateTrack(pathOrTrack);
|
|
89
100
|
}
|
|
90
101
|
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The Path the in-app browser shows. Before the first navigation it is '/' on
|
|
105
|
+
* iOS and Android and `undefined` on web.
|
|
106
|
+
*/
|
|
91
107
|
function getPath() {
|
|
92
108
|
return _native.nativeBrowser.path;
|
|
93
109
|
}
|
|
110
|
+
|
|
111
|
+
/** Emits the new Path when the in-app browser navigates. */
|
|
94
112
|
const onPathChanged = exports.onPathChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onPathChanged = cb);
|
|
113
|
+
|
|
114
|
+
/** Hook that returns {@link getPath} and updates on {@link onPathChanged}. */
|
|
95
115
|
function usePath() {
|
|
96
116
|
return (0, _useNativeUpdatedValue.useNativeUpdatedValue)(getPath, onPathChanged);
|
|
97
117
|
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The resolved page the in-app browser shows; `undefined` until the first
|
|
121
|
+
* navigation resolves.
|
|
122
|
+
*/
|
|
98
123
|
function getContent() {
|
|
99
124
|
return _native.nativeBrowser.getContent();
|
|
100
125
|
}
|
|
126
|
+
|
|
127
|
+
/** Emits the new page when the in-app browser's content changes. */
|
|
101
128
|
const onContentChanged = exports.onContentChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onContentChanged = cb);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Hook that returns {@link getContent} and updates on {@link onContentChanged}.
|
|
132
|
+
*/
|
|
102
133
|
function useContent() {
|
|
103
134
|
return (0, _useNativeUpdatedValue.useNativeUpdatedValue)(getContent, onContentChanged);
|
|
104
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The configured tabs, resolved; `undefined` until {@link configureBrowser}
|
|
139
|
+
* has run and the tabs have resolved.
|
|
140
|
+
*/
|
|
105
141
|
function getTabs() {
|
|
106
142
|
return _native.nativeBrowser.tabs;
|
|
107
143
|
}
|
|
144
|
+
|
|
145
|
+
/** Emits the new tabs when they resolve or change. */
|
|
108
146
|
const onTabsChanged = exports.onTabsChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onTabsChanged = cb);
|
|
147
|
+
|
|
148
|
+
/** Hook that returns {@link getTabs} and updates on {@link onTabsChanged}. */
|
|
109
149
|
function useTabs() {
|
|
110
150
|
return (0, _useNativeUpdatedValue.useNativeUpdatedValue)(getTabs, onTabsChanged);
|
|
111
151
|
}
|
|
112
152
|
|
|
113
153
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
154
|
+
* Re-fetches the content at `path` on every surface showing it (the in-app
|
|
155
|
+
* browser, Android Auto, CarPlay); other paths stay as they are. On iOS and
|
|
156
|
+
* Android it also drops the path's cached page. Pass a container path such as
|
|
157
|
+
* '/favorites', not a track's Contextual Path, which iOS and Android reject.
|
|
118
158
|
*
|
|
119
159
|
* @example
|
|
120
160
|
* ```ts
|
|
@@ -144,7 +184,8 @@ const invalidateAllContent = () => {
|
|
|
144
184
|
};
|
|
145
185
|
|
|
146
186
|
/**
|
|
147
|
-
* Returns whether search functionality is configured via
|
|
187
|
+
* Returns whether search functionality is configured via
|
|
188
|
+
* `configureBrowser({ search: ... })`.
|
|
148
189
|
*/
|
|
149
190
|
exports.invalidateAllContent = invalidateAllContent;
|
|
150
191
|
function hasSearch() {
|
|
@@ -156,16 +197,25 @@ function hasSearch() {
|
|
|
156
197
|
/**
|
|
157
198
|
* Searches for tracks using the configured search source.
|
|
158
199
|
*
|
|
159
|
-
*
|
|
160
|
-
* so a caller can tell "no results" from
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
200
|
+
* When a search source is configured, resolves `[]` only when it found
|
|
201
|
+
* nothing; a failed search rejects, so a caller can tell "no results" from
|
|
202
|
+
* "the request failed". Exception: on Android an HTTP search source
|
|
203
|
+
* (`TransformableRequestConfig`) resolves `[]` on any failure (non-2xx,
|
|
204
|
+
* network or decode error); a callback source still rejects there. With no
|
|
205
|
+
* search source configured, Android and web resolve `[]` and iOS rejects;
|
|
206
|
+
* call {@link hasSearch} first.
|
|
207
|
+
*
|
|
208
|
+
* The rejection's message describes the failure; on native platforms JS sees
|
|
209
|
+
* only that message. On web, a failed search request's `Error` also carries a
|
|
210
|
+
* `code`, the
|
|
211
|
+
* {@link features/errors!NavigationErrorType | NavigationErrorType} the
|
|
212
|
+
* browse path reports as a
|
|
213
|
+
* {@link features/errors!NavigationError | NavigationError}
|
|
214
|
+
* (`'http-error'`, `'network-error'`); a search callback's rejection passes
|
|
215
|
+
* through unchanged.
|
|
165
216
|
*
|
|
166
|
-
* @
|
|
167
|
-
*
|
|
168
|
-
* @throws When the search source or its request fails
|
|
217
|
+
* @throws When the search source or its request fails, or on iOS when no
|
|
218
|
+
* search source is configured
|
|
169
219
|
*
|
|
170
220
|
* @see {@link configureBrowser}
|
|
171
221
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","_browserConfig","currentConfiguration","configureBrowser","configuration","__DEV__","validateBrowserConfiguration","nativeBrowser","toNativeConfig","getBrowserConfiguration","navigate","pathOrTrack","navigatePath","navigateTrack","getPath","path","onPathChanged","exports","NativeUpdatedValue","emitterize","cb","usePath","useNativeUpdatedValue","getContent","onContentChanged","useContent","getTabs","tabs","onTabsChanged","useTabs","notifyContentChanged","invalidateAllContent","hasSearch","config","searchRoute","routes","find","r","SEARCH_ROUTE_PATH","searchCallback","searchConfig","search","query"],"sourceRoot":"../../../src","sources":["features/browser.ts"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAMA,IAAII,oBAAsD;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACC,aAAmC,EAAQ;EAC1E;EACA,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,EAAE;IAC7C,IAAAC,2CAA4B,EAACF,aAAa,CAAC;EAC7C;EACAF,oBAAoB,GAAGE,aAAa;EACpCG,qBAAa,CAACH,aAAa,GAAG,IAAAI,6BAAc,EAACJ,aAAa,CAAC;AAC7D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,uBAAuBA,CAAA,EAAqC;EAC1E,OAAOP,oBAAoB;AAC7B;
|
|
1
|
+
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","_browserConfig","currentConfiguration","configureBrowser","configuration","__DEV__","validateBrowserConfiguration","nativeBrowser","toNativeConfig","getBrowserConfiguration","navigate","pathOrTrack","navigatePath","navigateTrack","getPath","path","onPathChanged","exports","NativeUpdatedValue","emitterize","cb","usePath","useNativeUpdatedValue","getContent","onContentChanged","useContent","getTabs","tabs","onTabsChanged","useTabs","notifyContentChanged","invalidateAllContent","hasSearch","config","searchRoute","routes","find","r","SEARCH_ROUTE_PATH","searchCallback","searchConfig","search","query"],"sourceRoot":"../../../src","sources":["features/browser.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -23,10 +23,9 @@ function isCarConnected() {
|
|
|
23
23
|
// MARK: - Event Callbacks
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Android Automotive on Android)
|
|
28
|
-
*
|
|
29
|
-
* @returns An emitter — subscribe with `addListener(callback)`, which returns a cleanup function
|
|
26
|
+
* Emits when a car connects or disconnects (CarPlay on iOS, Android Auto /
|
|
27
|
+
* Android Automotive on Android), with the new state. Subscribe with
|
|
28
|
+
* `addListener`, which returns the unsubscribe function. Never emits on web.
|
|
30
29
|
*/
|
|
31
30
|
const onCarConnectedChanged = exports.onCarConnectedChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onCarConnectedChanged = cb);
|
|
32
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","isCarConnected","nativeBrowser","onCarConnectedChanged","exports","NativeUpdatedValue","emitterize","cb","useCarConnected","useNativeUpdatedValue"],"sourceRoot":"../../../src","sources":["features/carConnection.ts"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAAA,EAAY;EACxC,OAAOC,qBAAa,CAACD,cAAc,CAAC,CAAC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","isCarConnected","nativeBrowser","onCarConnectedChanged","exports","NativeUpdatedValue","emitterize","cb","useCarConnected","useNativeUpdatedValue"],"sourceRoot":"../../../src","sources":["features/carConnection.ts"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAAA,EAAY;EACxC,OAAOC,qBAAa,CAACD,cAAc,CAAC,CAAC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAME,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAGE,sCAAkB,CAACC,UAAU,CAC/DC,EAAE,IAAML,qBAAa,CAACC,qBAAqB,GAAGI,EACjD,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAAA,EAAY;EACzC,OAAO,IAAAC,4CAAqB,EAACR,cAAc,EAAEE,qBAAqB,CAAC;AACrE","ignoreList":[]}
|
|
@@ -16,7 +16,8 @@ var _useNativeUpdatedValue = require("../utils/useNativeUpdatedValue");
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Gets the current equalizer settings (Android only).
|
|
19
|
-
* @returns Equalizer settings,
|
|
19
|
+
* @returns Equalizer settings; undefined on iOS and web, and on Android before
|
|
20
|
+
* `setupPlayer` and until the player's audio session arrives
|
|
20
21
|
*/
|
|
21
22
|
function getEqualizerSettings() {
|
|
22
23
|
return _native.nativeBrowser.getEqualizerSettings();
|
|
@@ -34,7 +35,8 @@ function setEqualizerEnabled(enabled) {
|
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Sets the equalizer to a preset (Android only).
|
|
37
|
-
* @param preset -
|
|
38
|
+
* @param preset - A name from `settings.presets`; matched case-insensitively,
|
|
39
|
+
* an unknown name is ignored
|
|
38
40
|
*/
|
|
39
41
|
function setEqualizerPreset(preset) {
|
|
40
42
|
_native.nativeBrowser.setEqualizerPreset(preset);
|
|
@@ -42,7 +44,9 @@ function setEqualizerPreset(preset) {
|
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* Sets custom equalizer band levels (Android only).
|
|
45
|
-
* @param levels -
|
|
47
|
+
* @param levels - One level per band, in millibels, within
|
|
48
|
+
* `lowerBandLevelLimit`…`upperBandLevelLimit`. The length must equal
|
|
49
|
+
* `bandCount`, or the call is ignored
|
|
46
50
|
*/
|
|
47
51
|
function setEqualizerLevels(levels) {
|
|
48
52
|
_native.nativeBrowser.setEqualizerLevels(levels);
|
|
@@ -52,7 +56,6 @@ function setEqualizerLevels(levels) {
|
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* Subscribes to equalizer settings changes (Android only).
|
|
55
|
-
* @param callback - Called when equalizer settings change
|
|
56
59
|
* @returns An emitter — subscribe with `addListener(callback)`, which returns a cleanup function
|
|
57
60
|
*/
|
|
58
61
|
const onEqualizerChanged = exports.onEqualizerChanged = _NativeUpdatedValue.NativeUpdatedValue.emitterize(cb => _native.nativeBrowser.onEqualizerChanged = cb);
|
|
@@ -61,7 +64,8 @@ const onEqualizerChanged = exports.onEqualizerChanged = _NativeUpdatedValue.Nati
|
|
|
61
64
|
|
|
62
65
|
/**
|
|
63
66
|
* Hook that returns the current equalizer settings and updates when they change (Android only).
|
|
64
|
-
* @returns Current equalizer settings
|
|
67
|
+
* @returns Current equalizer settings; undefined on iOS and web, and on
|
|
68
|
+
* Android before `setupPlayer` and until the player's audio session arrives
|
|
65
69
|
*/
|
|
66
70
|
function useEqualizerSettings() {
|
|
67
71
|
return (0, _useNativeUpdatedValue.useNativeUpdatedValue)(getEqualizerSettings, onEqualizerChanged);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","getEqualizerSettings","nativeBrowser","setEqualizerEnabled","enabled","setEqualizerPreset","preset","setEqualizerLevels","levels","onEqualizerChanged","exports","NativeUpdatedValue","emitterize","cb","useEqualizerSettings","useNativeUpdatedValue"],"sourceRoot":"../../../src","sources":["features/equalizer.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAIA;;AAEA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,CAAA,EAAkC;EACpE,OAAOC,qBAAa,CAACD,oBAAoB,CAAC,CAAC;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAACC,OAAgB,EAAQ;EAC1DF,qBAAa,CAACC,mBAAmB,CAACC,OAAO,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,MAAc,EAAQ;EACvDJ,qBAAa,CAACG,kBAAkB,CAACC,MAAM,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,MAAgB,EAAQ;EACzDN,qBAAa,CAACK,kBAAkB,CAACC,MAAM,CAAC;AAC1C;;AAEA;;AAEA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_native","require","_NativeUpdatedValue","_useNativeUpdatedValue","getEqualizerSettings","nativeBrowser","setEqualizerEnabled","enabled","setEqualizerPreset","preset","setEqualizerLevels","levels","onEqualizerChanged","exports","NativeUpdatedValue","emitterize","cb","useEqualizerSettings","useNativeUpdatedValue"],"sourceRoot":"../../../src","sources":["features/equalizer.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,CAAA,EAAkC;EACpE,OAAOC,qBAAa,CAACD,oBAAoB,CAAC,CAAC;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAACC,OAAgB,EAAQ;EAC1DF,qBAAa,CAACC,mBAAmB,CAACC,OAAO,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,MAAc,EAAQ;EACvDJ,qBAAa,CAACG,kBAAkB,CAACC,MAAM,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,MAAgB,EAAQ;EACzDN,qBAAa,CAACK,kBAAkB,CAACC,MAAM,CAAC;AAC1C;;AAEA;;AAEA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7BE,sCAAkB,CAACC,UAAU,CAC1BC,EAAE,IAAMX,qBAAa,CAACO,kBAAkB,GAAGI,EAC9C,CAAC;;AAEH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAA,EAAkC;EACpE,OAAO,IAAAC,4CAAqB,EAACd,oBAAoB,EAAEQ,kBAAkB,CAAC;AACxE","ignoreList":[]}
|