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
|
@@ -44,9 +44,10 @@ export function getProgress(): Progress {
|
|
|
44
44
|
// MARK: - Event Callbacks
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* Emits the progress every `progressUpdateEventInterval` seconds while the
|
|
48
|
+
* player is loading, buffering or playing. Off by default (the interval is
|
|
49
|
+
* `null`). Subscribe with `onProgressUpdated.addListener(cb)`, which returns
|
|
50
|
+
* an unsubscribe function.
|
|
50
51
|
*/
|
|
51
52
|
export const onProgressUpdated =
|
|
52
53
|
NativeUpdatedValue.emitterize<PlaybackProgressUpdatedEvent>(
|
|
@@ -56,9 +57,14 @@ export const onProgressUpdated =
|
|
|
56
57
|
// MARK: - Hooks
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
|
-
* Hook that returns the current playback progress and updates
|
|
60
|
+
* Hook that returns the current playback progress and updates on each
|
|
61
|
+
* progress event.
|
|
60
62
|
*
|
|
61
|
-
* Progress
|
|
63
|
+
* Progress events are off by default (`progressUpdateEventInterval: null`), so
|
|
64
|
+
* this hook does not update until you set an interval in `setupPlayer` or
|
|
65
|
+
* `updateOptions`. Events fire only while loading, buffering or playing, so a
|
|
66
|
+
* seek while paused does not show. For updates without configuration, use
|
|
67
|
+
* {@link usePolledProgress}.
|
|
62
68
|
* @returns The current playback progress
|
|
63
69
|
*/
|
|
64
70
|
export function useProgress(): Progress {
|
|
@@ -36,6 +36,11 @@ export type PlaybackState =
|
|
|
36
36
|
|
|
37
37
|
export type Playback = {
|
|
38
38
|
state: PlaybackState
|
|
39
|
+
/**
|
|
40
|
+
* What made playback fail, in the `'error'` state. On iOS and Android, also
|
|
41
|
+
* a failure still being retried (`retrying: true`) while loading, buffering
|
|
42
|
+
* or paused.
|
|
43
|
+
*/
|
|
39
44
|
error?: PlaybackError
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -52,9 +57,9 @@ export function getPlayback(): Playback {
|
|
|
52
57
|
// MARK: - Event Callbacks
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
60
|
+
* Emits the {@link Playback} each time the playback state or error changes.
|
|
61
|
+
* Subscribe with `onPlaybackChanged.addListener(cb)`, which returns an
|
|
62
|
+
* unsubscribe function.
|
|
58
63
|
*/
|
|
59
64
|
export const onPlaybackChanged = NativeUpdatedValue.emitterize<Playback>(
|
|
60
65
|
(cb) => (nativeBrowser.onPlaybackChanged = cb)
|
|
@@ -4,12 +4,16 @@ import { onActiveTrackChanged } from '../queue/activeTrack'
|
|
|
4
4
|
|
|
5
5
|
// MARK: - Types
|
|
6
6
|
|
|
7
|
+
/** What a {@link trackPlaybackTime} callback receives each period. */
|
|
7
8
|
export interface PlaybackElapsed {
|
|
8
9
|
/** Cumulative seconds spent `playing` since this subscription started. */
|
|
9
10
|
total: number
|
|
10
11
|
/** Seconds played since the previous callback (≈ `period`). */
|
|
11
12
|
sinceLast: number
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The active track as of the latest track change since the first
|
|
15
|
+
* subscription; `undefined` until one happens.
|
|
16
|
+
*/
|
|
13
17
|
track?: Track
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -72,8 +76,11 @@ function install() {
|
|
|
72
76
|
* subscribe to {@link onActiveTrackChanged} and cancel + re-subscribe here on each
|
|
73
77
|
* change, so every track gets a fresh `total` starting at zero.
|
|
74
78
|
*
|
|
79
|
+
* On Android, subscribe after `setupPlayer` resolves. After a service restart
|
|
80
|
+
* no callback fires until every subscription is cancelled and a new one is made.
|
|
81
|
+
*
|
|
75
82
|
* @param callback Invoked once per elapsed `period`, with cumulative play time
|
|
76
|
-
* and the
|
|
83
|
+
* and the active track (see {@link PlaybackElapsed.track}).
|
|
77
84
|
* @param period Seconds of playback between calls. Must be >= 1.
|
|
78
85
|
* @returns A function that cancels this subscription (idempotent — safe to call
|
|
79
86
|
* more than once).
|
|
@@ -12,7 +12,7 @@ export function getVolume(): number {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Gets the current system volume as a number between 0 and 1.
|
|
15
|
+
* Gets the current system volume as a number between 0 and 1. On web, always 1.
|
|
16
16
|
*/
|
|
17
17
|
export function getSystemVolume(): number {
|
|
18
18
|
return nativeBrowser.getSystemVolume()
|
|
@@ -31,7 +31,7 @@ export function setVolume(level: number): void {
|
|
|
31
31
|
/**
|
|
32
32
|
* Sets the system volume.
|
|
33
33
|
* @param level - The volume as a number between 0 and 1.
|
|
34
|
-
* @remarks
|
|
34
|
+
* @remarks A no-op on iOS, which has no public API for it, and on web.
|
|
35
35
|
*/
|
|
36
36
|
export function setSystemVolume(level: number): void {
|
|
37
37
|
nativeBrowser.setSystemVolume(level)
|
|
@@ -40,9 +40,9 @@ export function setSystemVolume(level: number): void {
|
|
|
40
40
|
// MARK: - Event Callbacks
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* Emits the system volume (0 to 1) each time it changes. Never fires on web.
|
|
44
|
+
* Subscribe with `onSystemVolumeChanged.addListener(cb)`, which returns an
|
|
45
|
+
* unsubscribe function.
|
|
46
46
|
*/
|
|
47
47
|
export const onSystemVolumeChanged = NativeUpdatedValue.emitterize<number>(
|
|
48
48
|
(cb) => (nativeBrowser.onSystemVolumeChanged = cb)
|
|
@@ -52,6 +52,7 @@ export const onSystemVolumeChanged = NativeUpdatedValue.emitterize<number>(
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Hook that returns the current system volume and updates when it changes.
|
|
55
|
+
* On web, always 1.
|
|
55
56
|
* @returns The current system volume (0 to 1)
|
|
56
57
|
*/
|
|
57
58
|
export function useSystemVolume(): number {
|
|
@@ -71,8 +71,10 @@ export interface PlayerCapabilities {
|
|
|
71
71
|
/**
|
|
72
72
|
* Enable track favoriting.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* - iOS: turns on matching tracks against `setFavorites`. It shows no heart
|
|
75
|
+
* of its own: the CarPlay now-playing heart appears when
|
|
76
|
+
* `ios.carPlayNowPlayingButtons` includes `'favorite'`. Control Center
|
|
77
|
+
* and the lock screen show none.
|
|
76
78
|
* - Android: a place in the {@link RemoteButtonLayout} — the notification,
|
|
77
79
|
* Android Auto and the Android 13+ system media controls — and an
|
|
78
80
|
* (empty or filled) heart on playable browse rows.
|
|
@@ -195,14 +197,13 @@ export type RemoteButtonLayout = {
|
|
|
195
197
|
* AppKilledPlaybackBehavior options:
|
|
196
198
|
* - `'continue-playback'`: This option will continue playing audio in the
|
|
197
199
|
* background when the app is removed from recents. The notification remains.
|
|
198
|
-
* This is the default.
|
|
199
200
|
* - `'pause-playback'`: This option will pause playing audio in the background
|
|
200
201
|
* when the app is removed from recents. The notification remains and can be
|
|
201
202
|
* used to resume playback.
|
|
202
203
|
* - `'stop-playback-and-remove-notification'`: This option will stop playing
|
|
203
204
|
* audio in the background when the app is removed from recents. The
|
|
204
205
|
* notification is removed and can't be used to resume playback. Users would
|
|
205
|
-
* need to open the app again to start playing audio.
|
|
206
|
+
* need to open the app again to start playing audio. This is the default.
|
|
206
207
|
*/
|
|
207
208
|
export type AppKilledPlaybackBehavior =
|
|
208
209
|
| 'continue-playback'
|
|
@@ -210,15 +211,17 @@ export type AppKilledPlaybackBehavior =
|
|
|
210
211
|
| 'stop-playback-and-remove-notification'
|
|
211
212
|
|
|
212
213
|
/**
|
|
213
|
-
* Current player options
|
|
214
|
-
*
|
|
214
|
+
* Current player options, as {@link getOptions} reports them. The intervals and the platform
|
|
215
|
+
* block come with their defaults filled in; `capabilities` holds the values set, plus,
|
|
216
|
+
* on Android and iOS, `jumpForward` and `jumpBackward`, which are `false` until set.
|
|
215
217
|
* Platform-specific properties (android/ios) are only available on their respective platforms.
|
|
216
218
|
*
|
|
217
219
|
* @example
|
|
218
220
|
* ```typescript
|
|
219
221
|
* const options = getOptions();
|
|
220
222
|
* console.log(options.forwardJumpInterval); // 15
|
|
221
|
-
* console.log(options.capabilities);
|
|
223
|
+
* console.log(options.capabilities);
|
|
224
|
+
* // { jumpForward: false, jumpBackward: false, shuffleMode: false }
|
|
222
225
|
* console.log(options.android?.skipSilence); // true (Android only)
|
|
223
226
|
* ```
|
|
224
227
|
*/
|
|
@@ -229,9 +232,13 @@ export interface Options {
|
|
|
229
232
|
/**
|
|
230
233
|
* Jump forward interval in seconds when using jump forward controls.
|
|
231
234
|
*
|
|
232
|
-
* On Android,
|
|
233
|
-
*
|
|
234
|
-
* values are
|
|
235
|
+
* On Android, Media3 has icons for intervals of exactly 5, 10, 15 or 30
|
|
236
|
+
* seconds, which show that number; any other interval gets an icon without
|
|
237
|
+
* one. Other values are valid. On iOS a jump with no `handleRemoteJump*`
|
|
238
|
+
* override seeks by the interval. On Android it seeks by Media3's default
|
|
239
|
+
* seek increment (15 seconds forward, 5 seconds back), and the interval sets
|
|
240
|
+
* only the icon and the event's `interval`; to jump by the interval,
|
|
241
|
+
* override the control and call `seekBy`.
|
|
235
242
|
*
|
|
236
243
|
* @default 15
|
|
237
244
|
*/
|
|
@@ -240,9 +247,7 @@ export interface Options {
|
|
|
240
247
|
/**
|
|
241
248
|
* Jump backward interval in seconds when using jump backward controls.
|
|
242
249
|
*
|
|
243
|
-
*
|
|
244
|
-
* showing that number; any other interval gets an icon without one. Other
|
|
245
|
-
* values are perfectly valid — the interval also sets the seek distance.
|
|
250
|
+
* Platform differences as for {@link Options.forwardJumpInterval}.
|
|
246
251
|
*
|
|
247
252
|
* @default 15
|
|
248
253
|
*/
|
|
@@ -256,8 +261,10 @@ export interface Options {
|
|
|
256
261
|
progressUpdateEventInterval: number | null
|
|
257
262
|
|
|
258
263
|
/**
|
|
259
|
-
* The capabilities
|
|
260
|
-
*
|
|
264
|
+
* The capabilities as set, plus, on Android and iOS, `jumpForward` and
|
|
265
|
+
* `jumpBackward`, which are `false` until set. An absent field means its
|
|
266
|
+
* default: off for `jumpForward`, `jumpBackward` and `favorite`, on for the
|
|
267
|
+
* rest.
|
|
261
268
|
*/
|
|
262
269
|
capabilities: PlayerCapabilities
|
|
263
270
|
|
|
@@ -284,7 +291,7 @@ export interface IOSOptions {
|
|
|
284
291
|
carPlayUpNextButton: boolean
|
|
285
292
|
|
|
286
293
|
/**
|
|
287
|
-
* Buttons shown on the CarPlay Now Playing screen (left
|
|
294
|
+
* Buttons shown on the CarPlay Now Playing screen (left to right, at most one of each kind).
|
|
288
295
|
* @default []
|
|
289
296
|
*/
|
|
290
297
|
carPlayNowPlayingButtons: CarPlayNowPlayingButton[]
|
|
@@ -297,11 +304,16 @@ export interface IOSOptions {
|
|
|
297
304
|
carPlayPlayingIndicatorLocation: CarPlayPlayingIndicatorLocation
|
|
298
305
|
}
|
|
299
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Android runtime options as {@link getOptions} reports them.
|
|
309
|
+
* @platform android
|
|
310
|
+
*/
|
|
300
311
|
export interface AndroidOptions {
|
|
301
312
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
313
|
+
* What happens to playback and the notification when the user removes the
|
|
314
|
+
* app from recents.
|
|
315
|
+
*
|
|
316
|
+
* @default 'stop-playback-and-remove-notification'
|
|
305
317
|
*/
|
|
306
318
|
appKilledPlaybackBehavior: AppKilledPlaybackBehavior
|
|
307
319
|
|
|
@@ -324,11 +336,16 @@ export interface AndroidOptions {
|
|
|
324
336
|
remoteButtonLayout: RemoteButtonLayout | null
|
|
325
337
|
}
|
|
326
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Android options {@link updateOptions} can change at runtime.
|
|
341
|
+
* @platform android
|
|
342
|
+
*/
|
|
327
343
|
export interface AndroidUpdateOptions {
|
|
328
344
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
345
|
+
* What happens to playback and the notification when the user removes the
|
|
346
|
+
* app from recents.
|
|
347
|
+
*
|
|
348
|
+
* @default 'stop-playback-and-remove-notification'
|
|
332
349
|
*/
|
|
333
350
|
appKilledPlaybackBehavior?: AppKilledPlaybackBehavior
|
|
334
351
|
|
|
@@ -381,8 +398,9 @@ export interface IOSUpdateOptions {
|
|
|
381
398
|
carPlayUpNextButton?: boolean
|
|
382
399
|
|
|
383
400
|
/**
|
|
384
|
-
* Configure
|
|
385
|
-
* array order (left to
|
|
401
|
+
* Configure buttons, at most one of each {@link CarPlayNowPlayingButton}
|
|
402
|
+
* kind, on the CarPlay Now Playing screen, arranged in array order (left to
|
|
403
|
+
* right).
|
|
386
404
|
*
|
|
387
405
|
* @example
|
|
388
406
|
* ```typescript
|
|
@@ -444,9 +462,7 @@ export interface UpdateOptions {
|
|
|
444
462
|
/**
|
|
445
463
|
* Jump forward interval in seconds when using jump forward controls.
|
|
446
464
|
*
|
|
447
|
-
*
|
|
448
|
-
* showing that number; any other interval gets an icon without one. Other
|
|
449
|
-
* values are perfectly valid — the interval also sets the seek distance.
|
|
465
|
+
* See {@link Options.forwardJumpInterval} for how iOS and Android treat it.
|
|
450
466
|
*
|
|
451
467
|
* @default 15
|
|
452
468
|
*/
|
|
@@ -455,9 +471,7 @@ export interface UpdateOptions {
|
|
|
455
471
|
/**
|
|
456
472
|
* Jump backward interval in seconds when using jump backward controls.
|
|
457
473
|
*
|
|
458
|
-
*
|
|
459
|
-
* showing that number; any other interval gets an icon without one. Other
|
|
460
|
-
* values are perfectly valid — the interval also sets the seek distance.
|
|
474
|
+
* See {@link Options.forwardJumpInterval} for how iOS and Android treat it.
|
|
461
475
|
*
|
|
462
476
|
* @default 15
|
|
463
477
|
*/
|
|
@@ -471,8 +485,10 @@ export interface UpdateOptions {
|
|
|
471
485
|
progressUpdateEventInterval?: number | null
|
|
472
486
|
|
|
473
487
|
/**
|
|
474
|
-
* Player capabilities to enable or disable.
|
|
475
|
-
*
|
|
488
|
+
* Player capabilities to enable or disable. Most default to on;
|
|
489
|
+
* `jumpForward`, `jumpBackward` and `favorite` default to off. On Android
|
|
490
|
+
* and iOS, fields you omit keep their current value; on web, the object
|
|
491
|
+
* passed replaces the previous one.
|
|
476
492
|
*
|
|
477
493
|
* @example
|
|
478
494
|
* ```typescript
|
|
@@ -502,9 +518,7 @@ export interface NativeUpdateOptions {
|
|
|
502
518
|
/**
|
|
503
519
|
* Jump forward interval in seconds when using jump forward controls.
|
|
504
520
|
*
|
|
505
|
-
*
|
|
506
|
-
* showing that number; any other interval gets an icon without one. Other
|
|
507
|
-
* values are perfectly valid — the interval also sets the seek distance.
|
|
521
|
+
* See {@link Options.forwardJumpInterval}.
|
|
508
522
|
*
|
|
509
523
|
* @default 15
|
|
510
524
|
*/
|
|
@@ -513,9 +527,7 @@ export interface NativeUpdateOptions {
|
|
|
513
527
|
/**
|
|
514
528
|
* Jump backward interval in seconds when using jump backward controls.
|
|
515
529
|
*
|
|
516
|
-
*
|
|
517
|
-
* showing that number; any other interval gets an icon without one. Other
|
|
518
|
-
* values are perfectly valid — the interval also sets the seek distance.
|
|
530
|
+
* See {@link Options.forwardJumpInterval}.
|
|
519
531
|
*
|
|
520
532
|
* @default 15
|
|
521
533
|
*/
|
|
@@ -556,10 +568,10 @@ export function updateOptions(options: UpdateOptions): void {
|
|
|
556
568
|
// MARK: - Getters
|
|
557
569
|
|
|
558
570
|
/**
|
|
559
|
-
* Gets the current player options
|
|
560
|
-
*
|
|
571
|
+
* Gets the current player options. `capabilities` holds the values set, plus, on Android
|
|
572
|
+
* and iOS, `jumpForward` and `jumpBackward` (`false` until set); a missing capability
|
|
573
|
+
* means its default.
|
|
561
574
|
*
|
|
562
|
-
* @returns The current player options with all properties resolved to their current values
|
|
563
575
|
* @example
|
|
564
576
|
* ```typescript
|
|
565
577
|
* const options = getOptions();
|
|
@@ -575,8 +587,7 @@ export function getOptions(): Options {
|
|
|
575
587
|
// MARK: - Event Callbacks
|
|
576
588
|
|
|
577
589
|
/**
|
|
578
|
-
*
|
|
579
|
-
* @param callback - Called when the player options change
|
|
590
|
+
* Emits each time the player options change.
|
|
580
591
|
* @returns An emitter — subscribe with `addListener(callback)`, which returns a cleanup function
|
|
581
592
|
*/
|
|
582
593
|
export const onOptionsChanged = NativeUpdatedValue.emitterize<Options>(
|
|
@@ -17,8 +17,8 @@ import { validateIOSUpdateOptions } from './validateOptions'
|
|
|
17
17
|
* Parameters passed to the {@link FormatNowPlayingCallback}.
|
|
18
18
|
*
|
|
19
19
|
* The formatter owns every line shown on the now-playing surface — the track text, the live song,
|
|
20
|
-
* *and* any transient status (reconnecting / error). The library no
|
|
21
|
-
*
|
|
20
|
+
* *and* any transient status (reconnecting / error). The library renders no status text; these
|
|
21
|
+
* fields let you render (and localize) it yourself. The formatter
|
|
22
22
|
* is re-invoked on track change, each timed-metadata update, play/pause + error/rebuffer
|
|
23
23
|
* transitions, and device connectivity changes.
|
|
24
24
|
*/
|
|
@@ -27,6 +27,7 @@ export type FormatNowPlayingParams = {
|
|
|
27
27
|
track: Track
|
|
28
28
|
/**
|
|
29
29
|
* Timed metadata (ICY / ID3 "now playing song") received during playback, if any.
|
|
30
|
+
* On iOS, also a file's own tags when the file has no chapters.
|
|
30
31
|
* Always `undefined` on web — see `onTimedMetadata` for why.
|
|
31
32
|
*/
|
|
32
33
|
timedMetadata?: TimedMetadata
|
|
@@ -57,44 +58,28 @@ export type StallReason = 'buffering' | 'offline'
|
|
|
57
58
|
* Customizes what's rendered on the now-playing surface — lock screen, notification, Control Center,
|
|
58
59
|
* CarPlay, and Android Auto — for the currently playing track.
|
|
59
60
|
*
|
|
60
|
-
* Configure it via {@link SetupPlayerOptions.nowPlaying}.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* transient status line ("Reconnecting…", an error message), drop the song while paused — anything
|
|
64
|
-
* you can derive from the {@link FormatNowPlayingParams} for that moment.
|
|
61
|
+
* Configure it via {@link SetupPlayerOptions.nowPlaying}. It is re-invoked on track change, each
|
|
62
|
+
* timed-metadata update and every playback transition; identical results are de-duplicated
|
|
63
|
+
* natively, so they don't flicker the surface.
|
|
65
64
|
*
|
|
66
|
-
* The callback is **synchronous
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* ### When it's invoked
|
|
71
|
-
* The player re-invokes the formatter whenever the now-playing could change:
|
|
72
|
-
* - on track change (a new item becomes current);
|
|
73
|
-
* - on each timed-metadata update ({@link FormatNowPlayingParams.timedMetadata} arrives or changes);
|
|
74
|
-
* - on every playback transition — play / pause, a stall starting or recovering, an error.
|
|
75
|
-
*
|
|
76
|
-
* Identical results are de-duplicated natively before they reach the media session, so returning the
|
|
77
|
-
* same fields across a rapid burst of transitions is cheap and won't flicker the surface.
|
|
78
|
-
*
|
|
79
|
-
* ### What to return
|
|
80
|
-
* Return a {@link NowPlayingUpdate} with the fields to display. Each field falls back **independently**
|
|
81
|
-
* to the track's own value when omitted — so `{ artist: 'Some Song' }` replaces only the secondary
|
|
82
|
-
* line and leaves the title as the track's title. Return `undefined` (or `{}`) to use the library
|
|
83
|
-
* default entirely (the track's own `title` / `artist`).
|
|
84
|
-
*
|
|
85
|
-
* @param params - The current track, latest timed metadata, and playback signals for this moment
|
|
86
|
-
* ({@link FormatNowPlayingParams}), including a {@link StallReason} that already classifies an
|
|
87
|
-
* offline stall — no separate connectivity read needed for the now-playing line.
|
|
88
|
-
* @returns The now-playing fields to display, or `undefined` to fall back to the track's own
|
|
89
|
-
* `title` / `artist`.
|
|
65
|
+
* The callback is **synchronous**, run on the JS thread and awaited natively: no I/O in it.
|
|
66
|
+
* Each returned field falls back **independently** to the track's own value, so
|
|
67
|
+
* `{ artist: 'Some Song' }` replaces only the secondary line; `undefined` (or `{}`) keeps the
|
|
68
|
+
* track's own `title` / `artist`. See the [Now playing guide](https://audiobrowser.dev/guide/now-playing).
|
|
90
69
|
*
|
|
91
70
|
* @example
|
|
92
71
|
* ```ts
|
|
93
72
|
* setupPlayer({
|
|
94
73
|
* nowPlaying: ({ timedMetadata, playWhenReady, stalled, error }) => {
|
|
95
74
|
* if (error) return { artist: error.message ?? 'Playback error' }
|
|
96
|
-
* if (stalled)
|
|
97
|
-
*
|
|
75
|
+
* if (stalled) {
|
|
76
|
+
* return {
|
|
77
|
+
* artist: stalled === 'offline'
|
|
78
|
+
* ? 'No internet connection'
|
|
79
|
+
* : 'Reconnecting…'
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* // Show the live song only while playing; else use the track default.
|
|
98
83
|
* if (!playWhenReady || !timedMetadata?.title) return
|
|
99
84
|
* return {
|
|
100
85
|
* artist: timedMetadata.artist
|
|
@@ -152,7 +137,8 @@ export type AndroidAudioContentType =
|
|
|
152
137
|
* - `'ambient'`: The category for an app in which sound playback is nonprimary
|
|
153
138
|
* — that is, your app also works with the sound turned off. See
|
|
154
139
|
* https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient
|
|
155
|
-
* - `'soloAmbient'`: The default audio session category
|
|
140
|
+
* - `'soloAmbient'`: The system's default audio session category; the library
|
|
141
|
+
* uses `'playback'` when `category` is omitted. See
|
|
156
142
|
* https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient
|
|
157
143
|
* - `'record'`: The category for recording audio while also silencing playback
|
|
158
144
|
* audio. See
|
|
@@ -252,18 +238,24 @@ export type IOSCategoryOptions =
|
|
|
252
238
|
*/
|
|
253
239
|
export type IOSCategoryPolicy = 'default' | 'longFormAudio' | 'longFormVideo'
|
|
254
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Requirements for Android audio offload; see `audioOffload`.
|
|
243
|
+
* @platform android
|
|
244
|
+
*/
|
|
255
245
|
export interface AndroidAudioOffloadSettings {
|
|
256
246
|
/**
|
|
257
247
|
* Whether gapless playback support is required for offload.
|
|
258
248
|
* Enables smooth transitions between tracks without silence gaps.
|
|
259
|
-
*
|
|
249
|
+
* Omitting it here means not required; `audioOffload: true` requires it.
|
|
250
|
+
* @default false
|
|
260
251
|
*/
|
|
261
252
|
gaplessSupportRequired?: boolean
|
|
262
253
|
|
|
263
254
|
/**
|
|
264
255
|
* Whether playback rate change support is required for offload.
|
|
265
256
|
* Enables variable playback speeds (0.5x, 1.25x, 2x, etc.) during offload.
|
|
266
|
-
*
|
|
257
|
+
* Omitting it here means not required; `audioOffload: true` requires it.
|
|
258
|
+
* @default false
|
|
267
259
|
*/
|
|
268
260
|
rateChangeSupportRequired?: boolean
|
|
269
261
|
}
|
|
@@ -336,8 +328,8 @@ export type AndroidPlayerWakeMode = 'none' | 'local' | 'network'
|
|
|
336
328
|
export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
337
329
|
/**
|
|
338
330
|
* Minimum duration of media that the player will attempt to buffer in ms.
|
|
331
|
+
* Has no effect: the player keeps loading until `maxBuffer` is buffered.
|
|
339
332
|
*
|
|
340
|
-
* @throws Will throw if min buffer is higher than max buffer.
|
|
341
333
|
* @default 50000
|
|
342
334
|
*/
|
|
343
335
|
minBuffer?: number
|
|
@@ -350,8 +342,9 @@ export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
|
350
342
|
*
|
|
351
343
|
* - `true`: Enable with default settings (gapless + rate change support required)
|
|
352
344
|
* - `false`/`undefined`: Disabled
|
|
353
|
-
* - `{ gaplessSupportRequired
|
|
354
|
-
* Enable with specific requirements for gapless playback and playback rate changes
|
|
345
|
+
* - `{ gaplessSupportRequired?: boolean, rateChangeSupportRequired?: boolean }`:
|
|
346
|
+
* Enable with specific requirements for gapless playback and playback rate changes;
|
|
347
|
+
* an omitted field is not required, so `{}` enables offload with no requirements
|
|
355
348
|
*
|
|
356
349
|
* @default false
|
|
357
350
|
*/
|
|
@@ -359,9 +352,7 @@ export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
|
359
352
|
|
|
360
353
|
/**
|
|
361
354
|
* Maximum duration of media that the player will attempt to buffer in ms.
|
|
362
|
-
* Max buffer may not be lower than min buffer.
|
|
363
355
|
*
|
|
364
|
-
* @throws Will throw if max buffer is lower than min buffer.
|
|
365
356
|
* @default 50000
|
|
366
357
|
*/
|
|
367
358
|
maxBuffer?: number
|
|
@@ -378,7 +369,7 @@ export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
|
378
369
|
* Duration of media in ms that must be buffered for playback to start or
|
|
379
370
|
* resume following a user action such as a seek.
|
|
380
371
|
*
|
|
381
|
-
* @default
|
|
372
|
+
* @default 1000 (media3's `DEFAULT_BUFFER_FOR_PLAYBACK_MS`)
|
|
382
373
|
*/
|
|
383
374
|
playBuffer?: number
|
|
384
375
|
|
|
@@ -389,7 +380,6 @@ export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
|
389
380
|
* When null (the default), uses automatic mode:
|
|
390
381
|
* - Starts at `playBuffer` value
|
|
391
382
|
* - On rebuffer, measures how fast the buffer drained
|
|
392
|
-
* - Calculates how much buffer is needed to sustain 60s of playback
|
|
393
383
|
* - Increases threshold accordingly (up to 8000ms max)
|
|
394
384
|
* - Resets when changing tracks
|
|
395
385
|
*
|
|
@@ -412,11 +402,11 @@ export interface AndroidSetupOptions extends AndroidUpdateOptions {
|
|
|
412
402
|
* The audio content type indicates to the android system how
|
|
413
403
|
* you intend to use audio in your app.
|
|
414
404
|
*
|
|
415
|
-
* With `audioContentType:
|
|
405
|
+
* With `audioContentType: 'speech'`, the audio will be
|
|
416
406
|
* paused during short interruptions, such as when a message arrives.
|
|
417
407
|
* Otherwise the playback volume is reduced while the notification is playing.
|
|
418
408
|
*
|
|
419
|
-
* @default
|
|
409
|
+
* @default 'music'
|
|
420
410
|
*/
|
|
421
411
|
audioContentType?: AndroidAudioContentType
|
|
422
412
|
|
|
@@ -455,7 +445,10 @@ export interface IOSSetupOptions extends IOSUpdateOptions {
|
|
|
455
445
|
|
|
456
446
|
/**
|
|
457
447
|
* [AVAudioSession.Category](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category)
|
|
458
|
-
* for iOS.
|
|
448
|
+
* for iOS. Applied at `setupPlayer`; the session is activated when playback
|
|
449
|
+
* starts.
|
|
450
|
+
*
|
|
451
|
+
* @default 'playback'
|
|
459
452
|
*/
|
|
460
453
|
category?: IOSCategory
|
|
461
454
|
|
|
@@ -464,21 +457,27 @@ export interface IOSSetupOptions extends IOSUpdateOptions {
|
|
|
464
457
|
* indicates to the system how you intend to use audio in your app. You can use
|
|
465
458
|
* a mode to configure the audio system for specific use cases such as video
|
|
466
459
|
* recording, voice or video chat, or audio analysis.
|
|
467
|
-
*
|
|
460
|
+
* Applied at `setupPlayer`; the session is activated when playback starts.
|
|
468
461
|
*
|
|
469
462
|
* See https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode
|
|
463
|
+
*
|
|
464
|
+
* @default 'default'
|
|
470
465
|
*/
|
|
471
466
|
categoryMode?: IOSCategoryMode
|
|
472
467
|
|
|
473
468
|
/**
|
|
474
469
|
* [AVAudioSession.CategoryOptions](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions) for iOS.
|
|
475
|
-
*
|
|
470
|
+
* Applied at `setupPlayer`; the session is activated when playback starts.
|
|
471
|
+
*
|
|
472
|
+
* @default []
|
|
476
473
|
*/
|
|
477
474
|
categoryOptions?: IOSCategoryOptions[]
|
|
478
475
|
|
|
479
476
|
/**
|
|
480
477
|
* [AVAudioSession.RouteSharingPolicy](https://developer.apple.com/documentation/AVFAudio/AVAudioSession/RouteSharingPolicy-swift.enum) for iOS.
|
|
481
|
-
*
|
|
478
|
+
* Applied at `setupPlayer`; the session is activated when playback starts.
|
|
479
|
+
*
|
|
480
|
+
* @default 'default'
|
|
482
481
|
*/
|
|
483
482
|
categoryPolicy?: IOSCategoryPolicy
|
|
484
483
|
}
|
|
@@ -606,13 +605,15 @@ export type SetupPlayerOptions = Pick<
|
|
|
606
605
|
/**
|
|
607
606
|
* Retry policy for load errors (network failures, timeouts, etc.)
|
|
608
607
|
* - `true`: Retry indefinitely with exponential backoff, under the default
|
|
609
|
-
* duration budgets
|
|
610
|
-
*
|
|
611
|
-
*
|
|
608
|
+
* duration budgets of {@link RetryConfig}
|
|
609
|
+
* - `false`/`undefined`: no library retry. Android keeps media3's default
|
|
610
|
+
* handling, which retries a failed load a few times before surfacing the
|
|
611
|
+
* error; iOS fails at once.
|
|
612
612
|
* - `{ maxRetries: n }`: Retry up to n times with exponential backoff
|
|
613
613
|
* - `RetryConfig`: custom attempt and duration budgets
|
|
614
614
|
*
|
|
615
|
-
*
|
|
615
|
+
* Backoff timing and budgets: see the
|
|
616
|
+
* [Errors guide](https://audiobrowser.dev/guide/errors#two-duration-budgets).
|
|
616
617
|
*
|
|
617
618
|
* @default false
|
|
618
619
|
*/
|
|
@@ -620,7 +621,7 @@ export type SetupPlayerOptions = Pick<
|
|
|
620
621
|
|
|
621
622
|
/**
|
|
622
623
|
* Keep the media session alive and controllable through a terminal playback error (e.g. a dead
|
|
623
|
-
* stream), so
|
|
624
|
+
* stream), so External Surfaces such as Android Auto keep their transport controls
|
|
624
625
|
* (next / previous) instead of tearing the session down. The error is still reported via
|
|
625
626
|
* `onPlaybackError` / `playbackState`; this only affects what the OS media session observes.
|
|
626
627
|
*
|
|
@@ -643,7 +644,7 @@ export type SetupPlayerOptions = Pick<
|
|
|
643
644
|
* Each `setupPlayer` sets it: left out, remote outputs are off, and playback on one comes back
|
|
644
645
|
* to the phone.
|
|
645
646
|
*
|
|
646
|
-
* Android 11
|
|
647
|
+
* Android 11+; ignored on iOS, whose route picker already lists AirPlay devices.
|
|
647
648
|
* @default off
|
|
648
649
|
*/
|
|
649
650
|
remoteOutputs?: RemoteOutputsOptions
|
|
@@ -659,8 +660,7 @@ export type SetupPlayerOptions = Pick<
|
|
|
659
660
|
* - `true` (default): publish the track's own title / artist.
|
|
660
661
|
* - `false`: don't manage the now-playing metadata at all.
|
|
661
662
|
* - a {@link FormatNowPlayingCallback}: render it yourself — the callback owns every line,
|
|
662
|
-
* including any transient status (buffering / reconnecting / offline / error)
|
|
663
|
-
* library no longer renders on your behalf.
|
|
663
|
+
* including any transient status (buffering / reconnecting / offline / error).
|
|
664
664
|
*
|
|
665
665
|
* @default true
|
|
666
666
|
*/
|
|
@@ -710,7 +710,8 @@ function wrapNowPlayingFormatter(
|
|
|
710
710
|
/**
|
|
711
711
|
* The object's entries whose values aren't `undefined`. `null` stays: it's meaningful on some
|
|
712
712
|
* fields (`progressUpdateEventInterval: null` disables progress events, `remoteButtonLayout:
|
|
713
|
-
* null`
|
|
713
|
+
* null` goes back to the layout derived from capabilities), so only `undefined` means "not
|
|
714
|
+
* provided".
|
|
714
715
|
*/
|
|
715
716
|
function definedFields<T extends object>(obj: T): Partial<T> {
|
|
716
717
|
const out: Partial<T> = {}
|
|
@@ -737,9 +738,14 @@ function nonEmpty<K extends string, T extends object>(
|
|
|
737
738
|
* natively as part of setup itself, so there is no setup-then-command ordering for consumers
|
|
738
739
|
* to know about, and no window where the player exists without its options.
|
|
739
740
|
*
|
|
740
|
-
* Calling it again
|
|
741
|
-
*
|
|
742
|
-
*
|
|
741
|
+
* Calling it again is how a setup-only option changes after launch, and works differently per
|
|
742
|
+
* platform. On Android, newly provided fields are merged over the previous ones, except
|
|
743
|
+
* `remoteOutputs`, which is off when left out, and `nowPlaying`, which is on when left out
|
|
744
|
+
* and keeps an earlier formatter until a call passes another one. The audio engine is rebuilt
|
|
745
|
+
* only when construction-bound fields (buffers, wake mode, …) changed. On iOS, each call
|
|
746
|
+
* replaces the player: the queue is cleared, and setup-only fields you omit (`ios` session
|
|
747
|
+
* category and `buffer`, `retry`, …) go back to their defaults. Runtime options set earlier
|
|
748
|
+
* carry over on both.
|
|
743
749
|
*
|
|
744
750
|
* @param options - The options to initialize the player with.
|
|
745
751
|
*
|