react-native-audio-browser 0.2.0-next.53 → 0.2.0-next.55
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/android/src/cast/java/com/audiobrowser/cast/CastSupport.kt +8 -10
- package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +96 -243
- package/android/src/main/java/com/audiobrowser/AudioBrowserLifecycleModule.kt +8 -12
- package/android/src/main/java/com/audiobrowser/AudioBrowserPackage.kt +1 -3
- package/android/src/main/java/com/audiobrowser/Callbacks.kt +1 -10
- package/android/src/main/java/com/audiobrowser/ForegroundStart.kt +13 -18
- package/android/src/main/java/com/audiobrowser/HeadlessTaskService.kt +3 -7
- package/android/src/main/java/com/audiobrowser/RemoteOutputs.kt +8 -10
- package/android/src/main/java/com/audiobrowser/Service.kt +20 -61
- package/android/src/main/java/com/audiobrowser/ServiceBinding.kt +9 -17
- package/android/src/main/java/com/audiobrowser/browser/ArtworkResolutionRegistry.kt +10 -9
- package/android/src/main/java/com/audiobrowser/browser/BrowseArtworkRegistry.kt +11 -8
- package/android/src/main/java/com/audiobrowser/browser/BrowserManager.kt +117 -448
- package/android/src/main/java/com/audiobrowser/browser/BrowserUrlResolution.kt +21 -60
- package/android/src/main/java/com/audiobrowser/browser/InertStyleDiagnostic.kt +20 -80
- package/android/src/main/java/com/audiobrowser/browser/JsonArtwork.kt +6 -10
- package/android/src/main/java/com/audiobrowser/browser/JsonModels.kt +7 -24
- package/android/src/main/java/com/audiobrowser/browser/RouteMatch.kt +2 -4
- package/android/src/main/java/com/audiobrowser/browser/SectionScope.kt +13 -31
- package/android/src/main/java/com/audiobrowser/browser/SimpleRouter.kt +12 -40
- package/android/src/main/java/com/audiobrowser/browser/StyleResolver.kt +15 -26
- package/android/src/main/java/com/audiobrowser/browser/TrackLoadHandler.kt +5 -15
- package/android/src/main/java/com/audiobrowser/extension/EnumExtensions.kt +1 -0
- package/android/src/main/java/com/audiobrowser/extension/NumberExt.kt +2 -0
- package/android/src/main/java/com/audiobrowser/extension/ResolvedTrackExt.kt +4 -8
- package/android/src/main/java/com/audiobrowser/extension/TappedTrack.kt +4 -6
- package/android/src/main/java/com/audiobrowser/extension/TrackIdentity.kt +3 -7
- package/android/src/main/java/com/audiobrowser/http/HttpClient.kt +13 -22
- package/android/src/main/java/com/audiobrowser/http/RequestConfigBuilder.kt +17 -38
- package/android/src/main/java/com/audiobrowser/model/IcyTitle.kt +5 -6
- package/android/src/main/java/com/audiobrowser/model/PlaybackMetadata.kt +4 -9
- package/android/src/main/java/com/audiobrowser/model/PlayerSetupOptions.kt +18 -29
- package/android/src/main/java/com/audiobrowser/model/PlayerUpdateOptions.kt +6 -16
- package/android/src/main/java/com/audiobrowser/player/AutomaticBufferManager.kt +15 -45
- package/android/src/main/java/com/audiobrowser/player/CapabilityControls.kt +23 -59
- package/android/src/main/java/com/audiobrowser/player/CrossOriginHeaderStripper.kt +14 -26
- package/android/src/main/java/com/audiobrowser/player/DynamicLoadControl.kt +15 -43
- package/android/src/main/java/com/audiobrowser/player/EnginePlayback.kt +4 -4
- package/android/src/main/java/com/audiobrowser/player/EqualizerController.kt +15 -21
- package/android/src/main/java/com/audiobrowser/player/InterceptingPlayer.kt +14 -31
- package/android/src/main/java/com/audiobrowser/player/LocalEngine.kt +8 -8
- package/android/src/main/java/com/audiobrowser/player/MediaFactory.kt +16 -27
- package/android/src/main/java/com/audiobrowser/player/MediaSessionCallback.kt +119 -237
- package/android/src/main/java/com/audiobrowser/player/MediaSessionCommandManager.kt +48 -145
- package/android/src/main/java/com/audiobrowser/player/NowPlayingUpdater.kt +39 -100
- package/android/src/main/java/com/audiobrowser/player/PlaybackErrorClassifier.kt +16 -26
- package/android/src/main/java/com/audiobrowser/player/PlaybackStateMachine.kt +22 -28
- package/android/src/main/java/com/audiobrowser/player/PlaybackStateStore.kt +28 -64
- package/android/src/main/java/com/audiobrowser/player/PlaybackTimer.kt +8 -4
- package/android/src/main/java/com/audiobrowser/player/Player.kt +117 -405
- package/android/src/main/java/com/audiobrowser/player/PlayerCapabilitiesExt.kt +1 -1
- package/android/src/main/java/com/audiobrowser/player/PlayerEngineFactory.kt +11 -19
- package/android/src/main/java/com/audiobrowser/player/PlayerListener.kt +30 -96
- package/android/src/main/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicy.kt +39 -95
- package/android/src/main/java/com/audiobrowser/player/ShuffleOrderLedBy.kt +7 -13
- package/android/src/main/java/com/audiobrowser/player/SleepTimer.kt +13 -30
- package/android/src/main/java/com/audiobrowser/player/SleepTimerManager.kt +7 -11
- package/android/src/main/java/com/audiobrowser/player/StuckRecoveryPolicy.kt +9 -22
- package/android/src/main/java/com/audiobrowser/player/TransformingDataSource.kt +22 -54
- package/android/src/main/java/com/audiobrowser/player/VolumeFader.kt +8 -15
- package/android/src/main/java/com/audiobrowser/remote/RemoteItem.kt +9 -8
- package/android/src/main/java/com/audiobrowser/remote/RemoteOutputsController.kt +13 -10
- package/android/src/main/java/com/audiobrowser/remote/RemotePlayback.kt +8 -8
- package/android/src/main/java/com/audiobrowser/remote/RemoteQueue.kt +12 -5
- package/android/src/main/java/com/audiobrowser/remote/RemoteSwitchingPlayer.kt +28 -48
- package/android/src/main/java/com/audiobrowser/sonos/DeviceDescriptionParser.kt +11 -19
- package/android/src/main/java/com/audiobrowser/sonos/DidlLite.kt +2 -2
- package/android/src/main/java/com/audiobrowser/sonos/SoapClient.kt +6 -6
- package/android/src/main/java/com/audiobrowser/sonos/SoapEnvelopes.kt +8 -9
- package/android/src/main/java/com/audiobrowser/sonos/SoapResponseParser.kt +11 -18
- package/android/src/main/java/com/audiobrowser/sonos/SonosDiscoverer.kt +10 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosOutputs.kt +10 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosPlayer.kt +21 -33
- package/android/src/main/java/com/audiobrowser/sonos/SonosRemote.kt +4 -6
- package/android/src/main/java/com/audiobrowser/sonos/SonosRouteProviderService.kt +9 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosStreamUri.kt +7 -7
- package/android/src/main/java/com/audiobrowser/sonos/SonosTransport.kt +5 -4
- package/android/src/main/java/com/audiobrowser/sonos/SsdpDiscovery.kt +8 -3
- package/android/src/main/java/com/audiobrowser/sonos/SsdpMessages.kt +4 -6
- package/android/src/main/java/com/audiobrowser/sonos/ZoneGroupState.kt +13 -11
- package/android/src/main/java/com/audiobrowser/tls/AiaCertChaser.kt +34 -71
- package/android/src/main/java/com/audiobrowser/tls/AiaChasingExtendedTrustManager.kt +20 -37
- package/android/src/main/java/com/audiobrowser/tls/AiaChasingTrustManager.kt +18 -27
- package/android/src/main/java/com/audiobrowser/tls/AiaTls.kt +14 -29
- package/android/src/main/java/com/audiobrowser/tls/CachingCertificateFetcher.kt +68 -133
- package/android/src/main/java/com/audiobrowser/util/ArtworkContentProvider.kt +10 -22
- package/android/src/main/java/com/audiobrowser/util/ArtworkRoutes.kt +6 -6
- package/android/src/main/java/com/audiobrowser/util/ArtworkUris.kt +4 -3
- package/android/src/main/java/com/audiobrowser/util/ArtworkVariant.kt +2 -13
- package/android/src/main/java/com/audiobrowser/util/Automotive.kt +2 -4
- package/android/src/main/java/com/audiobrowser/util/BatteryOptimizationHelper.kt +3 -9
- package/android/src/main/java/com/audiobrowser/util/BatteryWarningStore.kt +4 -14
- package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +21 -85
- package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoader.kt +7 -7
- package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoaderHolder.kt +5 -8
- package/android/src/main/java/com/audiobrowser/util/CoilBitmapLoader.kt +8 -24
- package/android/src/main/java/com/audiobrowser/util/EqualizerManager.kt +7 -39
- package/android/src/main/java/com/audiobrowser/util/MediaExtrasBuilder.kt +10 -14
- package/android/src/main/java/com/audiobrowser/util/MetadataAdapter.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/NetworkConnectivityMonitor.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/OutputMonitor.kt +21 -50
- package/android/src/main/java/com/audiobrowser/util/OutputSwitcher.kt +7 -20
- package/android/src/main/java/com/audiobrowser/util/PlayingStateFactory.kt +3 -5
- package/android/src/main/java/com/audiobrowser/util/RatingFavorites.kt +4 -5
- package/android/src/main/java/com/audiobrowser/util/StyleWire.kt +5 -5
- package/android/src/main/java/com/audiobrowser/util/SvgArtworkRenderer.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/SystemVolumeMonitor.kt +6 -9
- package/android/src/main/java/com/audiobrowser/util/TrackFactory.kt +25 -47
- package/android/src/nocast/java/com/audiobrowser/cast/CastSupport.kt +0 -2
- package/android/src/test/java/com/audiobrowser/ForegroundStartTest.kt +1 -2
- package/android/src/test/java/com/audiobrowser/LegacyRatingTest.kt +3 -3
- package/android/src/test/java/com/audiobrowser/ServiceBindingTest.kt +0 -13
- package/android/src/test/java/com/audiobrowser/ServiceTaskRemovedTest.kt +2 -3
- package/android/src/test/java/com/audiobrowser/TestFixtures.kt +5 -14
- package/android/src/test/java/com/audiobrowser/browser/BrowseArtworkRegistryTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerBuildApiRequestTest.kt +2 -8
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerFavoritesTest.kt +2 -12
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerLayerResolutionTest.kt +5 -28
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerTest.kt +11 -43
- package/android/src/test/java/com/audiobrowser/browser/BrowserUrlResolutionTest.kt +4 -13
- package/android/src/test/java/com/audiobrowser/browser/InertStyleDiagnosticTest.kt +2 -11
- package/android/src/test/java/com/audiobrowser/browser/JsonArtworkTest.kt +0 -2
- package/android/src/test/java/com/audiobrowser/browser/JsonStyleTest.kt +3 -8
- package/android/src/test/java/com/audiobrowser/browser/SectionScopeTest.kt +2 -14
- package/android/src/test/java/com/audiobrowser/browser/SimpleRouterTest.kt +1 -5
- package/android/src/test/java/com/audiobrowser/browser/StyleResolverTest.kt +2 -13
- package/android/src/test/java/com/audiobrowser/extension/TappedTrackTest.kt +1 -7
- package/android/src/test/java/com/audiobrowser/extension/TrackIdentityTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/http/RequestConfigBuilderTest.kt +8 -16
- package/android/src/test/java/com/audiobrowser/model/IcyTitleTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/player/BrowseTilesTest.kt +12 -29
- package/android/src/test/java/com/audiobrowser/player/CapabilityControlsTest.kt +3 -12
- package/android/src/test/java/com/audiobrowser/player/CrossOriginHeaderStripperTest.kt +0 -7
- package/android/src/test/java/com/audiobrowser/player/DynamicLoadControlTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/player/EqualizerControllerTest.kt +0 -9
- package/android/src/test/java/com/audiobrowser/player/LiveSeekCommandTest.kt +1 -2
- package/android/src/test/java/com/audiobrowser/player/MediaSessionSlotMappingTest.kt +0 -9
- package/android/src/test/java/com/audiobrowser/player/NowPlayingUpdaterTest.kt +15 -22
- package/android/src/test/java/com/audiobrowser/player/PlaybackErrorClassifierTest.kt +1 -24
- package/android/src/test/java/com/audiobrowser/player/PlaybackStateMachineTest.kt +0 -20
- package/android/src/test/java/com/audiobrowser/player/PlaybackStateStoreTrackJsonTest.kt +1 -6
- package/android/src/test/java/com/audiobrowser/player/PlaybackTimerTest.kt +2 -4
- package/android/src/test/java/com/audiobrowser/player/PlayerCastTest.kt +2 -2
- package/android/src/test/java/com/audiobrowser/player/PlayerEngineFactoryTest.kt +0 -3
- package/android/src/test/java/com/audiobrowser/player/PlayerInvalidTrackTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/player/PlayerSetupTest.kt +3 -2
- package/android/src/test/java/com/audiobrowser/player/PlayerSonosTest.kt +5 -1
- package/android/src/test/java/com/audiobrowser/player/PlayerSuppressionTest.kt +5 -7
- package/android/src/test/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicyTest.kt +4 -35
- package/android/src/test/java/com/audiobrowser/player/SessionErrorMaskTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/player/ShuffleOrderLedByTest.kt +1 -8
- package/android/src/test/java/com/audiobrowser/player/StandardSkipTest.kt +4 -6
- package/android/src/test/java/com/audiobrowser/player/StuckRecoveryPolicyTest.kt +11 -11
- package/android/src/test/java/com/audiobrowser/player/TransformingDataSourceTest.kt +2 -23
- package/android/src/test/java/com/audiobrowser/remote/FakeRemote.kt +9 -10
- package/android/src/test/java/com/audiobrowser/remote/RemoteSwitchingPlayerTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/DeviceDescriptionParserTest.kt +1 -3
- package/android/src/test/java/com/audiobrowser/sonos/DidlLiteTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SoapClientTest.kt +0 -3
- package/android/src/test/java/com/audiobrowser/sonos/SoapEnvelopesTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SoapResponseParserTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosDiscovererTest.kt +2 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosPlayerTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosRemoteTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosRoutesTest.kt +2 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosTransportTest.kt +2 -6
- package/android/src/test/java/com/audiobrowser/sonos/SsdpMessagesTest.kt +0 -2
- package/android/src/test/java/com/audiobrowser/tls/AiaCertChaserTest.kt +13 -37
- package/android/src/test/java/com/audiobrowser/tls/AiaChasingTrustManagerTest.kt +10 -24
- package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherCallSiteTest.kt +15 -39
- package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherTest.kt +4 -10
- package/android/src/test/java/com/audiobrowser/util/ArtworkContentProviderTest.kt +2 -11
- package/android/src/test/java/com/audiobrowser/util/ArtworkUrisTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/util/BrowserPathHelperTest.kt +0 -4
- package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderHolderTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/util/FakeImageLoader.kt +2 -2
- package/android/src/test/java/com/audiobrowser/util/MediaExtrasBuilderTest.kt +4 -12
- package/android/src/test/java/com/audiobrowser/util/OutputMonitorTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/PlayingStateFactoryTest.kt +0 -4
- package/android/src/test/java/com/audiobrowser/util/TrackFactoryBrowseTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/TrackFactoryMediaIdTest.kt +4 -6
- package/android/src/testCast/java/com/audiobrowser/cast/CastEndsTest.kt +1 -1
- package/android/src/testCast/java/com/audiobrowser/cast/SendingMediaItemConverterTest.kt +1 -0
- package/ios/AVPlayerEngine.swift +13 -21
- package/ios/AVPlayerEngineCallbacks.swift +2 -4
- package/ios/Browser/BrowseGate.swift +7 -8
- package/ios/Browser/BrowserConfig.swift +19 -34
- package/ios/Browser/BrowserError.swift +0 -1
- package/ios/Browser/BrowserManager.swift +29 -75
- package/ios/Browser/BrowserPathHelper.swift +13 -93
- package/ios/Browser/FavoriteSet.swift +7 -10
- package/ios/Browser/InertStyleDiagnostic.swift +17 -82
- package/ios/Browser/JsonModels.swift +11 -51
- package/ios/Browser/NavigationErrorState.swift +3 -2
- package/ios/Browser/PageResolver.swift +13 -23
- package/ios/Browser/RequestLayer.swift +16 -20
- package/ios/Browser/RequestPipeline.swift +33 -43
- package/ios/Browser/SearchDrillIn.swift +7 -13
- package/ios/Browser/SectionScope.swift +14 -26
- package/ios/Browser/SimpleRouter.swift +8 -15
- package/ios/Browser/StyleResolver.swift +12 -29
- package/ios/Browser/TabBarEntries.swift +6 -11
- package/ios/Browser/TrackIdTemplate.swift +6 -14
- package/ios/CarPlay/CPInterfaceController+Safe.swift +19 -28
- package/ios/CarPlay/CarPlayArtworkResolver.swift +5 -9
- package/ios/CarPlay/CarPlayController.swift +4 -4
- package/ios/CarPlay/CarPlayImageLoader.swift +11 -26
- package/ios/CarPlay/CarPlayListItemFactory.swift +30 -80
- package/ios/CarPlay/CarPlayNowPlayingManager.swift +19 -54
- package/ios/CarPlay/CarPlaySession+Navigator.swift +10 -10
- package/ios/CarPlay/CarPlaySession+PageLoader.swift +6 -5
- package/ios/CarPlay/CarPlaySession+Refresher.swift +2 -2
- package/ios/CarPlay/CarPlaySession+TabBar.swift +19 -26
- package/ios/CarPlay/CarPlaySession.swift +13 -17
- package/ios/CarPlay/CarPlayTemplates.swift +6 -7
- package/ios/CarPlay/IntentHandlers.swift +3 -5
- package/ios/CarPlay/MediaIntentCriteria.swift +15 -29
- package/ios/CarPlay/MediaIntentHandler.swift +4 -7
- package/ios/CarPlay/MediaIntentPlayback.swift +9 -8
- package/ios/CarPlay/NowPlayingButtonRules.swift +3 -4
- package/ios/CarPlay/SectionPresentation.swift +18 -28
- package/ios/CarPlay/TopTemplateReplacer.swift +8 -9
- package/ios/Extension/Capability+RemoteCommand.swift +3 -3
- package/ios/Extension/ChapterMetadata+AVFoundation.swift +2 -5
- package/ios/Extension/CxxVectorConformances.swift +4 -16
- package/ios/Extension/NavigationError+Conversion.swift +4 -7
- package/ios/Extension/PlayerCapabilities+Favorite.swift +0 -1
- package/ios/Extension/RequestConfig+Copying.swift +2 -6
- package/ios/Extension/ResolvedTrack+Copying.swift +2 -8
- package/ios/Extension/SearchParams+Query.swift +4 -4
- package/ios/Extension/Section+Copying.swift +3 -6
- package/ios/Extension/String+IcyCharset.swift +5 -5
- package/ios/Extension/TimedMetadata+AVFoundation.swift +6 -12
- package/ios/Extension/Track+AVPlayer.swift +1 -2
- package/ios/Extension/Track+Copying.swift +2 -8
- package/ios/Extension/Track+Identity.swift +4 -9
- package/ios/Extension/TrackMetadata+AVFoundation.swift +10 -13
- package/ios/Extension/UIApplication+ActiveScene.swift +6 -14
- package/ios/Extension/Variant+Artwork.swift +8 -22
- package/ios/Http/HttpClient.swift +3 -3
- package/ios/HybridAudioBrowser+Browser.swift +10 -16
- package/ios/HybridAudioBrowser+Options.swift +6 -9
- package/ios/HybridAudioBrowser+Player.swift +8 -16
- package/ios/HybridAudioBrowser+PlayerCallbacks.swift +4 -5
- package/ios/HybridAudioBrowser+Stubs.swift +5 -7
- package/ios/HybridAudioBrowser.swift +54 -79
- package/ios/Model/NitroTypeStubs.swift +15 -22
- package/ios/Model/PlayerUpdateOptions.swift +6 -21
- package/ios/Model/RemoteCommand.swift +2 -2
- package/ios/Model/TrackPlayerError.swift +9 -22
- package/ios/NowPlayingInfo/NowPlayingInfoController.swift +21 -40
- package/ios/NowPlayingInfo/SilentAudioPrimer.swift +10 -16
- package/ios/Observer/ItemObserver.swift +7 -5
- package/ios/Observer/PlayerObserver.swift +5 -5
- package/ios/PlaybackEvent.swift +2 -2
- package/ios/Player/AirPlayStallJudgement.swift +7 -9
- package/ios/Player/AudioSessionController.swift +14 -15
- package/ios/Player/DeferredSeek.swift +2 -2
- package/ios/Player/EndOfTrackJudgement.swift +6 -13
- package/ios/Player/ErrorStatus.swift +8 -7
- package/ios/Player/MediaLoader.swift +20 -24
- package/ios/Player/NowPlayingLines.swift +1 -4
- package/ios/Player/NowPlayingUpdater.swift +35 -61
- package/ios/Player/PersistedPlaybackState.swift +1 -2
- package/ios/Player/PlaybackFailure.swift +20 -24
- package/ios/Player/PlaybackPersistence.swift +5 -6
- package/ios/Player/PlaybackStateMachine.swift +8 -11
- package/ios/Player/PlaybackTimer.swift +8 -11
- package/ios/Player/Player.swift +6 -13
- package/ios/Player/PlayerEngine.swift +20 -20
- package/ios/Player/PlayerStatusTypes.swift +1 -2
- package/ios/Player/QueueManager.swift +23 -67
- package/ios/Player/RetryLoop.swift +39 -50
- package/ios/Player/ShuffleOrder.swift +17 -57
- package/ios/Player/SleepTimerManager.swift +13 -28
- package/ios/Player/VolumeFader.swift +16 -16
- package/ios/RemoteCommand/RemoteCommandCallbacks.swift +6 -16
- package/ios/RemoteCommand/RemoteCommandController.swift +8 -10
- package/ios/Tests/AirPlayStallJudgementTests.swift +4 -4
- package/ios/Tests/BrowserPathHelperTests.swift +3 -6
- package/ios/Tests/DeferredSeekTests.swift +1 -3
- package/ios/Tests/EmitterTests.swift +0 -1
- package/ios/Tests/EndOfTrackJudgementTests.swift +1 -6
- package/ios/Tests/FavoriteSetTests.swift +1 -0
- package/ios/Tests/GenerationMemoTests.swift +2 -2
- package/ios/Tests/InertStyleDiagnosticTests.swift +4 -10
- package/ios/Tests/JsonModelsTests.swift +5 -12
- package/ios/Tests/LRUCacheTests.swift +1 -5
- package/ios/Tests/MediaIntentCriteriaTests.swift +2 -7
- package/ios/Tests/MediaLoaderTests.swift +3 -12
- package/ios/Tests/ObserverTests.swift +3 -3
- package/ios/Tests/PlaybackErrorTests.swift +7 -9
- package/ios/Tests/PlaybackFailureTests.swift +9 -17
- package/ios/Tests/PlaybackPersistenceTests.swift +1 -0
- package/ios/Tests/PlaybackStateMachineTests.swift +1 -16
- package/ios/Tests/PlaybackTimerTests.swift +2 -3
- package/ios/Tests/PlayerPolicyTests.swift +10 -26
- package/ios/Tests/PlayerTests.swift +53 -88
- package/ios/Tests/PlayingStateTests.swift +0 -1
- package/ios/Tests/QueueManagerTests.swift +30 -80
- package/ios/Tests/RemoteCommandControllerTests.swift +5 -13
- package/ios/Tests/ResolvedTrackCopyingTests.swift +0 -2
- package/ios/Tests/RetryLoopTests.swift +12 -35
- package/ios/Tests/SearchDrillInTests.swift +4 -5
- package/ios/Tests/SectionPresentationTests.swift +3 -16
- package/ios/Tests/SectionScopeTests.swift +3 -6
- package/ios/Tests/SimpleRouterTests.swift +1 -5
- package/ios/Tests/SleepTimerManagerTests.swift +8 -11
- package/ios/Tests/StyleResolverTests.swift +4 -13
- package/ios/Tests/Support/ManualSleepTimerScheduler.swift +3 -8
- package/ios/Tests/Support/TestTypes.swift +5 -15
- package/ios/Tests/TabBarEntriesTests.swift +0 -2
- package/ios/Tests/TimedMetadataAVFoundationTests.swift +2 -3
- package/ios/Tests/TopTemplateReplacerTests.swift +1 -1
- package/ios/Tests/TrackIdTemplateTests.swift +2 -6
- package/ios/Tests/TrackMetadataAVFoundationTests.swift +1 -4
- package/ios/Tests/TrackSelectorTests.swift +3 -15
- package/ios/TrackSelector.swift +13 -25
- package/ios/Util/ArtworkFreshness.swift +6 -6
- package/ios/Util/ArtworkImageFetcher.swift +19 -20
- package/ios/Util/ConcurrentMap.swift +2 -2
- package/ios/Util/Emitter.swift +8 -13
- package/ios/Util/NetworkMonitor.swift +4 -6
- package/ios/Util/OutputPicker.swift +1 -1
- package/ios/Util/ReadyValue.swift +3 -2
- package/ios/Util/SFSymbolRenderer.swift +17 -30
- package/ios/Util/SVGProcessor.swift +5 -9
- 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,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: 'Shape playback tone with the Android system equalizer: named presets, custom band levels, and handling its absence on iOS.'
|
|
2
|
+
description: 'Shape playback tone with the Android system equalizer: named presets, custom band levels, and handling its absence on iOS and web.'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Equalizer
|
|
@@ -9,9 +9,10 @@ either by applying a named **preset** (e.g. "Rock", "Jazz") or by setting
|
|
|
9
9
|
**custom band levels** yourself. It wraps the system equalizer effect.
|
|
10
10
|
|
|
11
11
|
::: warning Android only
|
|
12
|
-
The equalizer is **Android-only**.
|
|
13
|
-
setter is a no-op
|
|
14
|
-
treat the settings as possibly-absent (see
|
|
12
|
+
The equalizer is **Android-only**. On iOS and web every getter returns
|
|
13
|
+
`undefined` and every setter is a no-op; neither platform has an equivalent
|
|
14
|
+
system equalizer. Always treat the settings as possibly-absent (see
|
|
15
|
+
[Availability](#availability)).
|
|
15
16
|
:::
|
|
16
17
|
|
|
17
18
|
The UI snippets below import `View` / `Text` / `Button` from `react-native` and
|
|
@@ -22,10 +23,14 @@ for brevity. Everything else comes from `react-native-audio-browser`.
|
|
|
22
23
|
|
|
23
24
|
[`getEqualizerSettings()`](/api/features/equalizer/#getequalizersettings)
|
|
24
25
|
returns [`EqualizerSettings | undefined`](/api/features/equalizer/#equalizersettings).
|
|
25
|
-
It's `undefined` whenever the equalizer isn't available
|
|
26
|
-
Android
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
It's `undefined` whenever the equalizer isn't available: on iOS and web, and
|
|
27
|
+
**on Android before `setupPlayer`** and for a short moment after it, until the
|
|
28
|
+
player's audio session arrives. Use the reactive hook so a settings screen fills
|
|
29
|
+
in when it does.
|
|
30
|
+
|
|
31
|
+
On Android, a setter called after `setupPlayer` but before the equalizer exists
|
|
32
|
+
is kept and applied when it appears; the result arrives through
|
|
33
|
+
`onEqualizerChanged`. A setter called before `setupPlayer` is dropped.
|
|
29
34
|
|
|
30
35
|
## Reading the settings
|
|
31
36
|
|
|
@@ -129,12 +134,11 @@ flat[0] = 600
|
|
|
129
134
|
setEqualizerLevels(flat)
|
|
130
135
|
```
|
|
131
136
|
|
|
132
|
-
Setting custom levels clears `activePreset` (it becomes `undefined`)
|
|
133
|
-
|
|
137
|
+
Setting custom levels clears `activePreset` (it becomes `undefined`), even if
|
|
138
|
+
they equal a preset's levels. To return to a preset, apply it again.
|
|
134
139
|
|
|
135
|
-
Whichever you
|
|
136
|
-
|
|
137
|
-
over.
|
|
140
|
+
Whichever you applied last, preset or custom levels, carries over to the next
|
|
141
|
+
audio session, along with the enabled state.
|
|
138
142
|
|
|
139
143
|
## A complete equalizer screen
|
|
140
144
|
|
|
@@ -183,29 +187,29 @@ function EqualizerScreen() {
|
|
|
183
187
|
/>
|
|
184
188
|
))}
|
|
185
189
|
|
|
186
|
-
{eq.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
190
|
+
{eq.centerBandFrequencies.map((mHz, index) => {
|
|
191
|
+
const level = eq.bandLevels[index] ?? 0
|
|
192
|
+
return (
|
|
193
|
+
<View key={mHz}>
|
|
194
|
+
<Text>
|
|
195
|
+
{formatHz(mHz)}: {(level / 100).toFixed(1)} dB
|
|
196
|
+
</Text>
|
|
197
|
+
<Slider
|
|
198
|
+
minimumValue={eq.lowerBandLevelLimit}
|
|
199
|
+
maximumValue={eq.upperBandLevelLimit}
|
|
200
|
+
value={level}
|
|
201
|
+
// Commit on release; onValueChange fires continuously.
|
|
202
|
+
onSlidingComplete={(millibels) => setBand(index, millibels)}
|
|
203
|
+
/>
|
|
204
|
+
</View>
|
|
205
|
+
)
|
|
206
|
+
})}
|
|
201
207
|
</View>
|
|
202
208
|
)
|
|
203
209
|
}
|
|
204
210
|
```
|
|
205
211
|
|
|
206
|
-
|
|
207
|
-
the slider keeps its own state after mounting. That's fine here, but if you want
|
|
208
|
-
the thumbs to jump when a preset is applied, give each `Slider` a
|
|
212
|
+
If the thumbs don't follow a newly applied preset, give each `Slider` a
|
|
209
213
|
`key={eq.activePreset}` so it remounts with the new levels.
|
|
210
214
|
|
|
211
215
|
## A note on units
|
|
@@ -228,4 +232,4 @@ The system equalizer works in "milli" units, so convert for display:
|
|
|
228
232
|
| `setEqualizerPreset(name)` | Apply a preset from `settings.presets`. |
|
|
229
233
|
| `setEqualizerLevels(millibels[])` | Set all bands; length must equal `bandCount`. |
|
|
230
234
|
|
|
231
|
-
All are **Android-only
|
|
235
|
+
All are **Android-only**: no-ops or `undefined` on iOS and web.
|
package/website/guide/errors.md
CHANGED
|
@@ -47,16 +47,16 @@ string is especially jarring.
|
|
|
47
47
|
|
|
48
48
|
`kind` is one of:
|
|
49
49
|
|
|
50
|
-
| `kind` | Meaning
|
|
51
|
-
| ---------------- |
|
|
52
|
-
| `'offline'` | The device had no connection at the moment of failure. The stream may be fine.
|
|
53
|
-
| `'unreachable'` | The host could not be reached: DNS failure, refused connection, timeout, or a connection dropped while loading.
|
|
54
|
-
| `'not-found'` | The server said this stream is gone (HTTP 404 / 410).
|
|
55
|
-
| `'rejected'` | The server refused the request
|
|
56
|
-
| `'server-error'` | The server responded 5xx. Usually transient.
|
|
57
|
-
| `'unplayable'` | Fetched, but not playable: unknown container, unsupported codec, decoder failure.
|
|
58
|
-
| `'stalled'` | Playback had started, then stopped, and the player exhausted its recovery budget.
|
|
59
|
-
| `'unknown'` | Could not be classified. Inspect `code`.
|
|
50
|
+
| `kind` | Meaning | Retrying help? |
|
|
51
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
|
52
|
+
| `'offline'` | The device had no connection at the moment of failure. The stream may be fine. | Once back online |
|
|
53
|
+
| `'unreachable'` | The host could not be reached: DNS failure, refused connection, timeout, or a connection dropped while loading. | Maybe |
|
|
54
|
+
| `'not-found'` | The server said this stream is gone (HTTP 404 / 410). | No |
|
|
55
|
+
| `'rejected'` | The server refused the request: any HTTP 4xx other than 404 / 410 (auth, geo-blocking, rate limiting), or a DRM, licence or region refusal (Android and web). | No (except 408 / 429) |
|
|
56
|
+
| `'server-error'` | The server responded 5xx. Usually transient. | Maybe |
|
|
57
|
+
| `'unplayable'` | Fetched, but not playable: unknown container, unsupported codec, decoder failure. | No |
|
|
58
|
+
| `'stalled'` | Playback had started, then stopped, and the player exhausted its recovery budget. | Maybe |
|
|
59
|
+
| `'unknown'` | Could not be classified. Inspect `code`. | Maybe |
|
|
60
60
|
|
|
61
61
|
Codes that name no cause stay `'unknown'` rather than being guessed into a
|
|
62
62
|
friendlier bucket — a wrong classification misleads the listener _and_ poisons
|
|
@@ -80,7 +80,8 @@ function errorLine(kind: PlaybackErrorKind): string {
|
|
|
80
80
|
case 'unreachable':
|
|
81
81
|
case 'server-error':
|
|
82
82
|
return t('…your "could not reach it" copy')
|
|
83
|
-
// Both
|
|
83
|
+
// Both refusals: a manual retry rarely helps (with automatic
|
|
84
|
+
// retry on, a 408 / 429 was already retried).
|
|
84
85
|
case 'not-found':
|
|
85
86
|
case 'rejected':
|
|
86
87
|
return t('…your "not available" copy')
|
|
@@ -115,24 +116,31 @@ so you can show it on the lock screen / car too.
|
|
|
115
116
|
|
|
116
117
|
### Manual retry
|
|
117
118
|
|
|
118
|
-
[`retry()`](/api/features/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
[`retry()`](/api/features/playback/#retry) re-attempts the current item. It's
|
|
120
|
+
the action behind a "Try again" button, and what you call after
|
|
121
|
+
[automatic retry](#automatic-retry) has given up.
|
|
122
|
+
|
|
123
|
+
From `'error'` it begins a fresh load with fresh retry budgets, exactly as if
|
|
124
|
+
the listener had re-selected the track. A plain play command from `'error'`
|
|
125
|
+
does the same.
|
|
126
|
+
|
|
127
|
+
Call it from `'error'` only, because the platforms differ outside that state.
|
|
128
|
+
On Android and web it does nothing unless the player is in `'error'` or
|
|
129
|
+
stopped, where it reloads the item. On iOS it reloads the current item from
|
|
130
|
+
any state, even while it plays.
|
|
123
131
|
|
|
124
132
|
## Automatic retry
|
|
125
133
|
|
|
126
|
-
Configure [`setupPlayer({ retry })`](/
|
|
127
|
-
transient **load** failures (network blips, timeouts, a live
|
|
128
|
-
mid-play) with exponential backoff. It's **off by default**,
|
|
129
|
-
only — the web implementation has no automatic retry, so every
|
|
130
|
-
terminal:
|
|
134
|
+
Configure [`setupPlayer({ retry })`](/api/features/player/#retryconfig) to
|
|
135
|
+
recover from transient **load** failures (network blips, timeouts, a live
|
|
136
|
+
stream dropping mid-play) with exponential backoff. It's **off by default**,
|
|
137
|
+
and it's native only — the web implementation has no automatic retry, so every
|
|
138
|
+
web error is terminal:
|
|
131
139
|
|
|
132
140
|
```ts
|
|
133
141
|
import { setupPlayer } from 'react-native-audio-browser'
|
|
134
142
|
|
|
135
|
-
// Retry with the default duration budgets (
|
|
143
|
+
// Retry with the default duration budgets (see below):
|
|
136
144
|
await setupPlayer({ retry: true })
|
|
137
145
|
|
|
138
146
|
// Or bound it yourself:
|
|
@@ -145,20 +153,26 @@ await setupPlayer({
|
|
|
145
153
|
})
|
|
146
154
|
```
|
|
147
155
|
|
|
148
|
-
Which failures qualify is nearly the same on iOS and Android
|
|
149
|
-
429,
|
|
150
|
-
|
|
156
|
+
Which failures qualify is nearly the same on iOS and Android. HTTP 408 and
|
|
157
|
+
429 qualify, and so do server errors: every 5xx on iOS, the common four (500,
|
|
158
|
+
502, 503, 504) on Android.
|
|
159
|
+
|
|
160
|
+
Transport failures qualify too (DNS, timeouts, a dropped connection), and so
|
|
161
|
+
does anything the platform couldn't classify, which is assumed transient
|
|
151
162
|
rather than fatal.
|
|
163
|
+
|
|
152
164
|
Permanent failures are never retried — 403 / 404, and media that can't be
|
|
153
165
|
parsed or decoded.
|
|
154
166
|
|
|
155
167
|
### Two duration budgets
|
|
156
168
|
|
|
157
|
-
Retry state is tracked per **load
|
|
158
|
-
when a track becomes current (selection, queue advance, skip) _or
|
|
159
|
-
from a terminal error_ (`retry()`, or any play command while in
|
|
160
|
-
and
|
|
161
|
-
|
|
169
|
+
Retry state is tracked per **load**: one track's playback session. A load is
|
|
170
|
+
created when a track becomes current (selection, queue advance, skip) _or is
|
|
171
|
+
restarted from a terminal error_ (`retry()`, or any play command while in
|
|
172
|
+
`'error'`), and it survives every automatic retry of that track.
|
|
173
|
+
|
|
174
|
+
A new load starts fresh budgets. Within a load, the recovery budget refills
|
|
175
|
+
after a stretch of uninterrupted playback (see below).
|
|
162
176
|
|
|
163
177
|
How long the player keeps trying depends on one piece of evidence: **has this
|
|
164
178
|
load ever produced audio?**
|
|
@@ -170,25 +184,38 @@ load ever produced audio?**
|
|
|
170
184
|
|
|
171
185
|
While the device is **offline**, the first-connect budget does not apply: the
|
|
172
186
|
player parks and retries the moment connectivity returns, so a stream started
|
|
173
|
-
in a tunnel still plays when the network comes back.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
in a tunnel still plays when the network comes back.
|
|
188
|
+
|
|
189
|
+
Any offline observation resets the first-connect clock entirely — after
|
|
190
|
+
restoration the load gets another full first-connect window, because the
|
|
191
|
+
clock only ever measures a contiguous online stretch.
|
|
192
|
+
|
|
193
|
+
`maxRetryDurationMs` is different: it is a wall-clock ceiling that
|
|
194
|
+
**includes** offline time. It exists so playback can't surprise the listener
|
|
195
|
+
by resuming after a long time offline.
|
|
196
|
+
|
|
197
|
+
`maxRetries` additionally caps the retry attempts, counted across both budgets
|
|
198
|
+
and across offline/online transitions.
|
|
199
|
+
|
|
200
|
+
One Android caveat: for segmented formats like HLS, ExoPlayer counts attempts
|
|
201
|
+
per internal loadable — playlist and segments separately — so an attempt cap
|
|
202
|
+
is less predictable there. Prefer the duration budgets as the bound you rely
|
|
203
|
+
on.
|
|
204
|
+
|
|
205
|
+
After 20 seconds of uninterrupted audible playback, the stream counts as
|
|
206
|
+
recovered and the recovery budget refills (on iOS, the attempt count too), so
|
|
207
|
+
each later dropout of a long-lived stream gets a full window.
|
|
208
|
+
|
|
209
|
+
The load stays the same, and so does its evidence that it has played: the
|
|
210
|
+
first-connect budget does not come back.
|
|
211
|
+
|
|
212
|
+
Backoff delays grow exponentially from 1 s, capped at 5 s. Once a budget is
|
|
187
213
|
exhausted the state lands on `'error'`, where your `PlaybackErrorView` and
|
|
188
|
-
[`retry()`](#manual-retry) take over.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
214
|
+
[`retry()`](#manual-retry) take over.
|
|
215
|
+
|
|
216
|
+
Restarting from `'error'` — via `retry()` or any play command — begins a
|
|
217
|
+
**new load** of the same track: fresh budgets, starting with the
|
|
218
|
+
first-connect one. The tap behaves exactly like re-selecting the track.
|
|
192
219
|
|
|
193
220
|
### Errors while retrying
|
|
194
221
|
|
|
@@ -197,8 +224,11 @@ classified and surfaced immediately through
|
|
|
197
224
|
[`onPlaybackChanged`](/api/features/playback/#onplaybackchanged) /
|
|
198
225
|
[`usePlayback()`](/guide/playback#playback-state), attached to the current
|
|
199
226
|
non-terminal state (`'loading'` / `'buffering'`, or `'paused'`) with
|
|
200
|
-
`retrying: true`.
|
|
201
|
-
|
|
227
|
+
`retrying: true`.
|
|
228
|
+
|
|
229
|
+
Show it as advisory — the cause over a spinner — because the next attempt may
|
|
230
|
+
still succeed. A 408 or 429 arrives here as `kind: 'rejected'` with
|
|
231
|
+
`retrying: true`; it becomes final only once retry gives up:
|
|
202
232
|
|
|
203
233
|
```tsx
|
|
204
234
|
const { state, error } = usePlayback()
|
|
@@ -213,16 +243,19 @@ if (error?.retrying) {
|
|
|
213
243
|
`onPlaybackError` and `usePlaybackError()` stay **terminal-only**: they fire on
|
|
214
244
|
_both_ edges of the `'error'` state — entering it (with the error) and leaving
|
|
215
245
|
it (with `error: undefined`; the hook returns `undefined` again). Advisory
|
|
216
|
-
errors never pass through them.
|
|
217
|
-
|
|
218
|
-
|
|
246
|
+
errors never pass through them.
|
|
247
|
+
|
|
248
|
+
The same advisory error also reaches the
|
|
249
|
+
[Now Playing formatter](/guide/now-playing#the-formatter-derived-continuous), so
|
|
250
|
+
the lock screen and the car can show it too.
|
|
219
251
|
|
|
220
252
|
Advisory emissions are deduplicated by **classification** (`kind`, plus the
|
|
221
|
-
HTTP status when there is one) — never by the raw native `message`.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
253
|
+
HTTP status when there is one) — never by the raw native `message`.
|
|
254
|
+
|
|
255
|
+
The scope is the current advisory episode. Consecutive identical failures
|
|
256
|
+
within one retry sequence produce a single event rather than one per backoff
|
|
257
|
+
tick. The dedupe resets once the advisory clears: on recovery, a track change,
|
|
258
|
+
or hardening into the terminal error.
|
|
226
259
|
|
|
227
260
|
## Navigation errors
|
|
228
261
|
|
|
@@ -241,17 +274,25 @@ with `onNavigationError` / snapshot with `getNavigationError()`.
|
|
|
241
274
|
| `'network-error'` | The request failed (connection error, timeout, no internet). |
|
|
242
275
|
| `'http-error'` | Server returned non-2xx (or 2xx but parsing failed) — see `statusCode` / `statusCodeSuccess`. |
|
|
243
276
|
| `'callback-error'` | Your browse callback returned an error (e.g. auth/subscription required). |
|
|
244
|
-
| `'empty-content'` | The
|
|
245
|
-
| `'timeout'` | Resolution didn't finish in time.
|
|
277
|
+
| `'empty-content'` | The page has no tracks (empty Favorites, no search results). CarPlay / Android Auto only. |
|
|
278
|
+
| `'timeout'` | Resolution didn't finish in time. CarPlay only. |
|
|
246
279
|
| `'unknown-error'` | An unexpected error (e.g. invalid configuration). |
|
|
247
280
|
|
|
281
|
+
`'empty-content'` and `'timeout'` never reach `useNavigationError()` or
|
|
282
|
+
`onNavigationError`: the library raises them only for the in-car screens, where
|
|
283
|
+
they pass through [`formatNavigationError`](#showing-navigation-errors). Handle
|
|
284
|
+
them there.
|
|
285
|
+
|
|
248
286
|
### Showing navigation errors
|
|
249
287
|
|
|
250
288
|
For display, prefer
|
|
251
289
|
[`useFormattedNavigationError()`](/api/features/errors/#useformattednavigationerror)
|
|
252
290
|
— it returns a ready-to-show [`FormattedNavigationError`](/api/features/errors/#formattednavigationerror)
|
|
253
|
-
(`{ title, message? }`).
|
|
254
|
-
|
|
291
|
+
(`{ title, message? }`). Outside React, read it with
|
|
292
|
+
`getFormattedNavigationError()` or subscribe with
|
|
293
|
+
[`onFormattedNavigationError`](/api/features/errors/#onformattednavigationerror).
|
|
294
|
+
The **same** formatted error drives the CarPlay and Android Auto error dialogs,
|
|
295
|
+
so your in-app and in-car messages stay consistent:
|
|
255
296
|
|
|
256
297
|
```tsx
|
|
257
298
|
import { Text } from 'react-native'
|
|
@@ -302,9 +343,10 @@ message to render.
|
|
|
302
343
|
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
303
344
|
| `usePlaybackError()` / `getPlaybackError()` | The current playback error (`{ kind, code, message, statusCode?, retrying? }`) — branch on `kind`. |
|
|
304
345
|
| `onPlaybackError` | Subscribe to terminal playback errors outside React (fires on entering/leaving `'error'`; advisory retrying errors arrive via `onPlaybackChanged`). |
|
|
305
|
-
| `retry()` | Re-attempt the current item
|
|
306
|
-
| `setupPlayer({ retry })` | Automatic retry with two duration budgets: first-connect
|
|
346
|
+
| `retry()` | Re-attempt the current item; meant for the `'error'` state (on iOS it reloads from any state). |
|
|
347
|
+
| `setupPlayer({ retry })` | Automatic retry with two [duration budgets](#two-duration-budgets): first-connect and recovery. Off by default. |
|
|
307
348
|
| `useNavigationError()` / `getNavigationError()` | The raw navigation error (`code`, `statusCode`, …). |
|
|
308
349
|
| `onNavigationError` | Subscribe to navigation errors outside React. |
|
|
309
350
|
| `useFormattedNavigationError()` / `getFormattedNavigationError()` | Display-ready `{ title, message? }`, shared with CarPlay / Android Auto. |
|
|
351
|
+
| `onFormattedNavigationError` | Subscribe to the formatted navigation error outside React. |
|
|
310
352
|
| `configureBrowser({ formatNavigationError })` | Customize / localize the formatted messages. |
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: 'Let listeners heart the active track from the
|
|
2
|
+
description: 'Let listeners heart the active track from the Android notification, Android Auto, CarPlay, and Siri, and surface a Favorites tab and voice command.'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Favorites
|
|
6
6
|
|
|
7
|
-
**Favorites** let a listener mark the active track with a heart
|
|
7
|
+
**Favorites** let a listener mark the active track with a heart: in the Android notification and system media controls, Android Auto, the CarPlay now-playing screen, and through Siri. They also let you surface a "Favorites" tab and a "play my favorites" voice command.
|
|
8
|
+
|
|
9
|
+
The library tracks favorite _state_ (which track is favorited, and keeping the heart in sync everywhere); **your app owns the collection** (where favorites are stored and how they persist).
|
|
8
10
|
|
|
9
11
|
## Enabling favorites
|
|
10
12
|
|
|
@@ -18,7 +20,7 @@ await setupPlayer({
|
|
|
18
20
|
})
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
The identifiers you pass to [`setFavorites`](#hydrating-favorite-state) are compared against each track's **identity**: its `id` when set, falling back to its `src
|
|
23
|
+
The identifiers you pass to [`setFavorites`](#hydrating-favorite-state) are compared against each track's **identity**: its `id` when set, falling back to its `src` ([`getTrackIdentity`](/api/utils/getTrackIdentity/) computes it). Store the same stable identifier you put in `Track.id` — or, for tracks without ids, the full `src`:
|
|
22
24
|
|
|
23
25
|
```ts
|
|
24
26
|
import { setFavorites } from 'react-native-audio-browser'
|
|
@@ -32,7 +34,9 @@ setFavorites(['https://stream.example.com/jazz.mp3']) // matches by src
|
|
|
32
34
|
|
|
33
35
|
## Hydrating favorite state
|
|
34
36
|
|
|
35
|
-
The library keeps a native cache of which tracks are favorited
|
|
37
|
+
The library keeps a native cache of which tracks are favorited. It paints hearts on Android Auto browse rows and the now-playing heart without a round-trip to JS, and **without your content API having to know which tracks are favorites**.
|
|
38
|
+
|
|
39
|
+
Declare your favorites once with `setFavorites`; the library stamps `favorited` on any track whose [identity](#enabling-favorites) matches, wherever that track appears. Your content endpoints stay favorites-agnostic — they return the same tracks for everyone, and favorite state lives entirely in your app/user storage.
|
|
36
40
|
|
|
37
41
|
```ts
|
|
38
42
|
import { setFavorites } from 'react-native-audio-browser'
|
|
@@ -44,29 +48,29 @@ setFavorites(favorites)
|
|
|
44
48
|
|
|
45
49
|
You only need `setFavorites` for the initial hydrate. After that, taps on the system heart and calls to [`setActiveTrackFavorited`](#favoriting-from-your-own-ui) update the cache for you.
|
|
46
50
|
|
|
47
|
-
Your API can also return `favorited: true` on a track directly. A caller-set flag always wins over hydration for display — the library never overwrites it — but it does **not** fill the favorites cache
|
|
51
|
+
Your API can also return `favorited: true` on a track directly. A caller-set flag always wins over hydration for display — the library never overwrites it — but it does **not** fill the favorites cache. It only affects the response it arrived in, so other appearances of the same track stay unhearted.
|
|
52
|
+
|
|
53
|
+
Treat `setFavorites` as the source of truth, and server-supplied `favorited` as a per-response display override.
|
|
48
54
|
|
|
49
55
|
## Favoriting from system controls
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
Where the heart shows up depends on the platform:
|
|
58
|
+
|
|
59
|
+
- **Android:** once the capability is on, the heart sits in the overflow of the notification, Android Auto and the system media controls. You need no layout for it. A [`remoteButtonLayout`](/guide/remote-controls#button-layout-android) places it, and a layout that leaves out `'favorite'` drops it.
|
|
60
|
+
- **iOS:** the only heart is a button on the CarPlay now-playing screen, and you opt into it. Control Center and the lock screen show none.
|
|
52
61
|
|
|
53
62
|
```ts
|
|
54
63
|
import { setupPlayer } from 'react-native-audio-browser'
|
|
55
64
|
|
|
56
65
|
await setupPlayer({
|
|
57
66
|
capabilities: { favorite: true },
|
|
58
|
-
android: {
|
|
59
|
-
remoteButtonLayout: {
|
|
60
|
-
back: 'skip-to-previous',
|
|
61
|
-
forward: 'skip-to-next',
|
|
62
|
-
overflow: ['favorite']
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
67
|
ios: { carPlayNowPlayingButtons: ['favorite'] }
|
|
66
68
|
})
|
|
67
69
|
```
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
On iOS, Siri can also favorite or unfavorite the playing track ("add this to my favorites", "I like this") once Siri is wired up as in [CarPlay → Siri Voice Search](/guide/carplay#siri-voice-search), with `INAddMediaIntent` and `INUpdateMediaAffinityIntent` also listed in `INIntentsSupported`. Favorites need no `search` source.
|
|
72
|
+
|
|
73
|
+
Every favorite change, from any source, updates the library's cache and the hearts, then emits `onFavoriteChanged`: a system heart tap, a Siri request, and your own calls to [`setActiveTrackFavorited`](#favoriting-from-your-own-ui) alike. Persist the change to your storage or backend here, and only here:
|
|
70
74
|
|
|
71
75
|
```ts
|
|
72
76
|
import { onFavoriteChanged } from 'react-native-audio-browser'
|
|
@@ -77,7 +81,7 @@ const unsubscribe = onFavoriteChanged.addListener(({ track, favorited }) => {
|
|
|
77
81
|
})
|
|
78
82
|
```
|
|
79
83
|
|
|
80
|
-
The native side has already updated the now-playing heart by the time this fires, so your handler
|
|
84
|
+
The native side has already updated the now-playing heart by the time this fires, so your handler persists the change, then refreshes the `/favorites` content (see [Keep it in sync](#keep-it-in-sync)).
|
|
81
85
|
|
|
82
86
|
## Favoriting from your own UI
|
|
83
87
|
|
|
@@ -93,7 +97,7 @@ setActiveTrackFavorited(true)
|
|
|
93
97
|
toggleActiveTrackFavorited()
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
Both emit `onFavoriteChanged` like a system heart tap does, so the listener above persists the change. Don't persist it again in your button handler.
|
|
97
101
|
|
|
98
102
|
## Surfacing favorites
|
|
99
103
|
|
|
@@ -122,18 +126,24 @@ Resolve it however your collection lives — from local storage, or from your AP
|
|
|
122
126
|
|
|
123
127
|
### Keep it in sync
|
|
124
128
|
|
|
125
|
-
The library caches each
|
|
129
|
+
The library caches each path's content, so `/favorites` keeps showing its old content until you tell it to re-fetch. **Whenever the favorites collection changes**, re-fetch it.
|
|
130
|
+
|
|
131
|
+
When the change came from outside the player, such as a sync from another device or an edit on your server, also refresh the hearts:
|
|
126
132
|
|
|
127
133
|
```ts
|
|
128
134
|
import { setFavorites, notifyContentChanged } from 'react-native-audio-browser'
|
|
129
135
|
|
|
130
|
-
// refresh the hearts
|
|
136
|
+
// only for changes from outside the player: refresh the hearts
|
|
131
137
|
setFavorites(updatedIds)
|
|
132
|
-
// re-fetch the /favorites content
|
|
138
|
+
// always: re-fetch the /favorites content
|
|
133
139
|
notifyContentChanged('/favorites')
|
|
134
140
|
```
|
|
135
141
|
|
|
136
|
-
These hit two different caches
|
|
142
|
+
These hit two different caches. `setFavorites` updates the `favorited` flag wherever a track appears. A heart tap, a Siri request or `setActiveTrackFavorited` already updates it, so for those the call is redundant, though harmless.
|
|
143
|
+
|
|
144
|
+
[`notifyContentChanged(path)`](/api/features/browser/#notifycontentchanged) re-runs the route handler for that one path and refreshes any surface currently showing it. Use [`invalidateAllContent()`](/api/features/browser/#invalidateallcontent) instead only when _everything_ should re-fetch, such as on a locale switch or sign-out.
|
|
145
|
+
|
|
146
|
+
You can drive both calls from one place that observes your favorites list, rather than from each source of change.
|
|
137
147
|
|
|
138
148
|
## Searching within favorites
|
|
139
149
|
|
|
@@ -141,14 +151,14 @@ Voice intents can target the favorites collection — both "play my favorites" a
|
|
|
141
151
|
|
|
142
152
|
## API summary
|
|
143
153
|
|
|
144
|
-
| API | Purpose
|
|
145
|
-
| ---------------------------------------------------------------- |
|
|
146
|
-
| `capabilities: { favorite: true }` | Enable favoriting and the system hearts.
|
|
147
|
-
| `setFavorites(ids)` | Hydrate the favorites cache; ids match each track's identity (`id`, falling back to `src`).
|
|
148
|
-
| `track.favorited` | Per-track display flag; a caller-set value wins over hydration but does not fill the cache.
|
|
149
|
-
| `setActiveTrackFavorited(bool)` / `toggleActiveTrackFavorited()` | Favorite the active track from your own UI.
|
|
150
|
-
| `onFavoriteChanged` |
|
|
151
|
-
| `notifyContentChanged('/favorites')` | Re-fetch the `/favorites` content after the collection changes.
|
|
152
|
-
| `'favorite'` in `android.remoteButtonLayout` |
|
|
153
|
-
| `ios.carPlayNowPlayingButtons: ['favorite']` |
|
|
154
|
-
| `search` source with `reference: 'my'` | Resolve "play my favorites" / favorites search.
|
|
154
|
+
| API | Purpose |
|
|
155
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
156
|
+
| `capabilities: { favorite: true }` | Enable favoriting and the system hearts. |
|
|
157
|
+
| `setFavorites(ids)` | Hydrate the favorites cache; ids match each track's identity (`id`, falling back to `src`). |
|
|
158
|
+
| `track.favorited` | Per-track display flag; a caller-set value wins over hydration but does not fill the cache. |
|
|
159
|
+
| `setActiveTrackFavorited(bool)` / `toggleActiveTrackFavorited()` | Favorite the active track from your own UI. |
|
|
160
|
+
| `onFavoriteChanged` | Fires on every favorite change (system heart, Siri, your own calls); persist the change here. |
|
|
161
|
+
| `notifyContentChanged('/favorites')` | Re-fetch the `/favorites` content after the collection changes. |
|
|
162
|
+
| `'favorite'` in `android.remoteButtonLayout` | Places the Android heart. Without a layout it sits in the overflow already. A layout replaces the defaults wholesale, so list the other buttons you still want. |
|
|
163
|
+
| `ios.carPlayNowPlayingButtons: ['favorite']` | The heart on the CarPlay now-playing screen, the only one on iOS. |
|
|
164
|
+
| `search` source with `reference: 'my'` | Resolve "play my favorites" / favorites search. |
|
package/website/guide/gate.md
CHANGED
|
@@ -4,19 +4,27 @@ description: 'Block premium, login-only, or region-locked content on CarPlay and
|
|
|
4
4
|
|
|
5
5
|
# Gate
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A **Gate** replaces the browse content on **CarPlay**, **Android Auto** and **Android Automotive** with a short message that you hand the library. It can also turn away voice searches.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use it when part of your catalog is premium, login-only or region-locked, and you want to block it in the car without building a separate UI there.
|
|
10
|
+
|
|
11
|
+
One rule worth keeping in mind: **a Gate blocks _finding_, never _hearing_.** Whatever is already playing keeps going, a voice "resume" is never gated, and the queue is left alone.
|
|
12
|
+
|
|
13
|
+
A voice request to play something new is a search. The Gate refuses it unless your resolver lets search through (see [Gating some requests, not others](#gating-some-requests-not-others)).
|
|
10
14
|
|
|
11
15
|
Two things it never touches:
|
|
12
16
|
|
|
13
17
|
- **Your own in-app browse UI.** The Gate only covers content the _library_ serves; the screens you draw in your app are yours to gate with your own paywall.
|
|
14
18
|
- **Playback.** It lives on the find/resolve path, so audio is never interrupted.
|
|
15
19
|
|
|
16
|
-
It follows that the Gate is **iOS and Android only**. On web `setGate` and `clearGate` are no-ops and `onGate` never fires
|
|
20
|
+
It follows that the Gate is **iOS and Android only**. On web `setGate` and `clearGate` are no-ops and `onGate` never fires: there's no car surface to cover.
|
|
21
|
+
|
|
22
|
+
In-app browse UI is not the Gate's job on any platform. Calling the Gate functions from shared code is safe, and on web does nothing.
|
|
17
23
|
|
|
18
24
|
::: warning Voice search isn't only a "car" thing
|
|
19
|
-
A Siri request ("Hey Siri, play jazz on App") can come from the phone or lock screen, not just
|
|
25
|
+
A Siri or Google Assistant request ("Hey Siri, play jazz on App") can come from the phone or lock screen, not just the car. It still goes through the Gate.
|
|
26
|
+
|
|
27
|
+
That's why the common setup below **gates browsing but lets search through**: voice-play keeps working everywhere, while the car's browse tabs stay walled off.
|
|
20
28
|
:::
|
|
21
29
|
|
|
22
30
|
## Setting a gate
|
|
@@ -29,19 +37,23 @@ setGate({ title: 'Premium', message: 'Subscribe to browse in the car.' })
|
|
|
29
37
|
clearGate()
|
|
30
38
|
```
|
|
31
39
|
|
|
32
|
-
[`setGate`](/api/features/gate/#setgate) raises the gate (or updates it in place); [`clearGate`](/api/features/gate/#cleargate) drops it and the real content returns
|
|
40
|
+
[`setGate`](/api/features/gate/#setgate) raises the gate (or updates it in place); [`clearGate`](/api/features/gate/#cleargate) drops it and the real content returns (on CarPlay, on the first tab; see the warning below).
|
|
41
|
+
|
|
42
|
+
Set it before the car connects and it'll be there the moment it does. A gate is global and singular — calling `setGate` again replaces the current one.
|
|
33
43
|
|
|
34
44
|
A Gate is **independent** of `setupPlayer` and `configureBrowser` — call `setGate` any time after import. The usual lifecycle is: set it once at startup, then `clearGate` (or re-`setGate`) whenever the user's entitlement changes (purchase, login, logout).
|
|
35
45
|
|
|
36
46
|
A gate is just a title and an optional message. How it renders depends on the surface:
|
|
37
47
|
|
|
38
|
-
- **CarPlay
|
|
39
|
-
- **Android Auto
|
|
48
|
+
- **CarPlay**: the tab bar stays, and each gated tab, or gated page you navigate to, shows a centered message page in place of its list (newlines in the message collapse to spaces). The Now Playing screen keeps its transport controls but hides the custom buttons from `ios.carPlayNowPlayingButtons`.
|
|
49
|
+
- **Android Auto and Android Automotive**: the tabs stay visible, and each gated tab's content becomes one non-playable list tile. The tile shows the **title** as its main line and the **message** as the subtitle (newlines collapse to spaces). Keep both short: it's a tile, not a full page.
|
|
40
50
|
|
|
41
51
|
There's no action button: Android Auto can't show one, and a car surface can't run a purchase flow anyway (see [Reacting to gate hits](#reacting-to-gate-hits) for the deferred-upsell pattern).
|
|
42
52
|
|
|
43
|
-
::: warning
|
|
44
|
-
|
|
53
|
+
::: warning Changing the gate resets CarPlay navigation
|
|
54
|
+
While CarPlay is connected, every `setGate`, and every `clearGate` that drops a gate that was up, pops any drilled-in pages back to the tab root. This includes a first `setGate` on logout and a `clearGate` after a purchase. A `clearGate` with no gate up does nothing.
|
|
55
|
+
|
|
56
|
+
A `clearGate` also rebuilds the tab bar, so CarPlay returns to the first tab; `setGate` keeps the selected tab. A gate set before the car connects does not affect navigation.
|
|
45
57
|
:::
|
|
46
58
|
|
|
47
59
|
## Gating some requests, not others
|
|
@@ -104,7 +116,9 @@ setGate({ title: 'Premium', message: 'Subscribe to unlock.' }, (request) => {
|
|
|
104
116
|
})
|
|
105
117
|
```
|
|
106
118
|
|
|
107
|
-
You can also pass **only** a resolver, with no default message
|
|
119
|
+
You can also pass **only** a resolver, with no default message. Return a gate object for full control, or `true` to fall back to the generic built-in chrome.
|
|
120
|
+
|
|
121
|
+
That fallback is a generic built-in title with no body, so on CarPlay its message area is blank. Pass a default gate or return a gate object if you want body copy.
|
|
108
122
|
|
|
109
123
|
```ts
|
|
110
124
|
setGate((request) => request.kind === 'browse')
|