@javascriptcommon/react-native-track-player 1.2.9 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -21
- package/README.md +8 -0
- package/android/build.gradle +92 -18
- package/android/proguard-rules.txt +0 -3
- package/android/src/main/AndroidManifest.xml +10 -13
- package/android/src/main/java/com/doublesymmetry/trackplayer/HeadlessJsMediaService.kt +199 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/TrackPlayer.kt +33 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/extensions/AudioPlayerStateExt.kt +19 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/extensions/EnumExtensions.kt +5 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/extensions/NumberExt.kt +13 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/MetadataAdapter.kt +227 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/NowPlayingMetadata.kt +16 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/PlaybackMetadata.kt +203 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/State.kt +13 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/Track.kt +67 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/TrackAudioItem.kt +18 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/TrackMetadata.kt +38 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/module/MusicEvents.kt +67 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/module/MusicModule.kt +778 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt +1286 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/utils/AppForegroundTracker.kt +35 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/utils/BundleUtils.kt +147 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/utils/CoilBitmapLoader.kt +65 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/utils/MediaItemBuilder.kt +41 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/utils/RejectionException.kt +11 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/video/TrackPlayerVideoView.kt +42 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/video/TrackPlayerVideoViewManager.kt +18 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/event/EventHolder.kt +30 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/event/PlayerEventHolder.kt +124 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioContentType.kt +10 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioItem.kt +118 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioItemTransitionReason.kt +33 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioPlayerState.kt +30 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/BufferConfig.kt +8 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/CacheConfig.kt +17 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/Capability.kt +19 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/CustomButton.kt +19 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/FocusChangeData.kt +3 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/MediaSessionCallback.kt +17 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlayWhenReadyChangeData.kt +3 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlaybackEndedReason.kt +5 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlaybackError.kt +6 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlayerConfig.kt +36 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlayerOptions.kt +40 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PositionChangedReason.kt +39 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/RepeatMode.kt +16 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/WakeMode.kt +7 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/AudioPlayer.kt +756 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/ForwardingPlayer.java +1124 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/QueuedAudioPlayer.kt +279 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/components/APMRenderersFactory.kt +33 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/components/Buffer.kt +34 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/components/Cache.kt +27 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/components/FocusManager.kt +59 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/components/MediaFactory.kt +130 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/processors/TeeListener.kt +171 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/service/MusicService.kt +127 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/utils/FFT.java +99 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/utils/Utils.kt +113 -0
- package/android/src/main/res/drawable/baseline_repeat_24.xml +5 -0
- package/android/src/main/res/drawable/baseline_repeat_one_24.xml +5 -0
- package/android/src/main/res/drawable/forward.xml +5 -0
- package/android/src/main/res/drawable/heart_24px.xml +5 -0
- package/android/src/main/res/drawable/hearte_24px.xml +5 -0
- package/android/src/main/res/drawable/ifl_24px.xml +5 -0
- package/android/src/main/res/drawable/rewind.xml +5 -0
- package/android/src/main/res/drawable/shuffle_24px.xml +5 -0
- package/android/src/main/res/values/strings.xml +5 -0
- package/android/src/main/res/xml/automotive_app_desc.xml +3 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/22AMI.imageset/22AMillion.jpg +0 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/22AMI.imageset/Contents.json +21 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/Contents.json +6 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/cover.imageset/Contents.json +21 -0
- package/ios/Example/SwiftAudio/Assets.xcassets/cover.imageset/cover.jpg +0 -0
- package/ios/Example/SwiftAudio/AudioController.swift +46 -0
- package/ios/Example/SwiftAudio/Extensions.swift +22 -0
- package/ios/Example/SwiftAudio/PlayerView.swift +172 -0
- package/ios/Example/SwiftAudio/PlayerViewModel.swift +120 -0
- package/ios/Example/SwiftAudio/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- package/ios/Example/SwiftAudio/QueueView.swift +65 -0
- package/ios/{TrackPlayer.xcodeproj/xcuserdata/marco.xcuserdatad/xcschemes/xcschememanagement.plist → Example/SwiftAudio/SwiftAudio.entitlements} +6 -8
- package/ios/Example/SwiftAudio/SwiftAudioApp.swift +17 -0
- package/ios/Example/SwiftAudio.xcodeproj/project.pbxproj +412 -0
- package/ios/{TrackPlayer.xcodeproj → Example/SwiftAudio.xcodeproj}/project.xcworkspace/contents.xcworkspacedata +1 -1
- package/ios/RNTrackPlayer/Models/Capabilities.swift +39 -4
- package/ios/RNTrackPlayer/Models/MediaURL.swift +12 -6
- package/ios/RNTrackPlayer/Models/MetadataAdapter.swift +147 -0
- package/ios/RNTrackPlayer/Models/PitchAlgorithms.swift +13 -0
- package/ios/RNTrackPlayer/Models/SessionCategories.swift +106 -0
- package/ios/RNTrackPlayer/Models/State.swift +26 -0
- package/ios/RNTrackPlayer/Models/Track.swift +74 -54
- package/ios/RNTrackPlayer/RNTrackPlayer.swift +867 -406
- package/ios/RNTrackPlayer/Support/RNTrackPlayer-Bridging-Header.h +1 -0
- package/ios/RNTrackPlayer/TrackPlayer.h +14 -0
- package/ios/RNTrackPlayer/TrackPlayer.mm +249 -0
- package/ios/RNTrackPlayer/Utils/EventType.swift +45 -0
- package/ios/RNTrackPlayer/Utils/Metadata.swift +60 -0
- package/ios/RNTrackPlayer/Video/RNTrackPlayerVideoView.swift +83 -0
- package/ios/RNTrackPlayer/Video/RNTrackPlayerVideoViewManager.m +5 -0
- package/ios/RNTrackPlayer/Video/RNTrackPlayerVideoViewManager.swift +17 -0
- package/ios/SwiftAudioEx/Package.swift +20 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift +531 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapperDelegate.swift +27 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapperProtocol.swift +69 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapperState.swift +43 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioItem.swift +158 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioPlayer.swift +459 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioPlayerError.swift +26 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioSessionController/AudioSession.swift +33 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioSessionController/AudioSessionController.swift +135 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AudioTap.swift +96 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Event.swift +155 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/MediaItemProperty.swift +95 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/NowPlayingInfoCenter.swift +17 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/NowPlayingInfoController.swift +73 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/NowPlayingInfoControllerProtocol.swift +26 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/NowPlayingInfoKeyValue.swift +14 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/NowPlayingInfoController/NowPlayingInfoProperty.swift +234 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Observer/AVPlayerItemNotificationObserver.swift +102 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Observer/AVPlayerItemObserver.swift +136 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Observer/AVPlayerObserver.swift +120 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Observer/AVPlayerTimeObserver.swift +112 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/QueueManager.swift +356 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/QueuedAudioPlayer.swift +236 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/RemoteCommandController/RemoteCommand.swift +170 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/RemoteCommandController/RemoteCommandController.swift +206 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/RepeatMode.swift +15 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/TimeEventFrequency.swift +26 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/Utils/DispatchQueueType.swift +18 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/WaveformAudioTap.swift +159 -0
- package/lib/specs/NativeTrackPlayer.d.ts +134 -0
- package/lib/specs/NativeTrackPlayer.js +4 -0
- package/lib/src/TrackPlayerModule.web.d.ts +2 -0
- package/lib/src/TrackPlayerModule.web.js +2 -0
- package/lib/src/VideoView.d.ts +16 -0
- package/lib/src/VideoView.js +25 -0
- package/lib/src/constants/AndroidAudioContentType.d.ts +35 -0
- package/lib/src/constants/AndroidAudioContentType.js +36 -0
- package/lib/src/constants/AndroidAutoContentStyle.d.ts +10 -0
- package/lib/src/constants/AndroidAutoContentStyle.js +11 -0
- package/lib/src/constants/AppKilledPlaybackBehavior.d.ts +17 -0
- package/lib/src/constants/AppKilledPlaybackBehavior.js +18 -0
- package/lib/src/constants/Capability.d.ts +17 -0
- package/lib/src/constants/Capability.js +19 -0
- package/lib/src/constants/Event.d.ts +172 -0
- package/lib/src/constants/Event.js +173 -0
- package/lib/src/constants/IOSCategory.d.ts +36 -0
- package/lib/src/constants/IOSCategory.js +37 -0
- package/lib/src/constants/IOSCategoryMode.d.ts +47 -0
- package/lib/src/constants/IOSCategoryMode.js +48 -0
- package/lib/src/constants/IOSCategoryOptions.d.ts +44 -0
- package/lib/src/constants/IOSCategoryOptions.js +45 -0
- package/lib/src/constants/MediaItemPlayable.d.ts +4 -0
- package/lib/src/constants/MediaItemPlayable.js +5 -0
- package/lib/src/constants/PitchAlgorithm.d.ts +14 -0
- package/lib/src/constants/PitchAlgorithm.js +16 -0
- package/lib/src/constants/RatingType.d.ts +8 -0
- package/lib/src/constants/RatingType.js +10 -0
- package/lib/src/constants/RepeatMode.d.ts +8 -0
- package/lib/src/constants/RepeatMode.js +10 -0
- package/lib/src/constants/State.d.ts +34 -0
- package/lib/src/constants/State.js +35 -0
- package/lib/src/constants/TrackType.d.ts +6 -0
- package/lib/src/constants/TrackType.js +7 -0
- package/lib/src/constants/index.d.ts +14 -0
- package/lib/src/constants/index.js +14 -0
- package/lib/src/hooks/index.d.ts +6 -0
- package/lib/src/hooks/index.js +6 -0
- package/lib/src/hooks/useActiveTrack.d.ts +2 -0
- package/lib/src/hooks/useActiveTrack.js +28 -0
- package/lib/src/hooks/useAppIsInBackground.d.ts +1 -0
- package/lib/src/hooks/useAppIsInBackground.js +16 -0
- package/lib/src/hooks/useIsPlaying.d.ts +35 -0
- package/lib/src/hooks/useIsPlaying.js +50 -0
- package/lib/src/hooks/usePlayWhenReady.d.ts +1 -0
- package/lib/src/hooks/usePlayWhenReady.js +27 -0
- package/lib/src/hooks/usePlaybackState.d.ts +10 -0
- package/lib/src/hooks/usePlaybackState.js +35 -0
- package/lib/src/hooks/useProgress.d.ts +7 -0
- package/lib/src/hooks/useProgress.js +55 -0
- package/lib/src/hooks/useTrackPlayerEvents.d.ts +8 -0
- package/lib/src/hooks/useTrackPlayerEvents.js +30 -0
- package/lib/src/index.d.ts +6 -0
- package/lib/src/index.js +6 -0
- package/lib/src/interfaces/AndroidAutoBrowseTree.d.ts +5 -0
- package/lib/src/interfaces/AndroidAutoBrowseTree.js +1 -0
- package/lib/src/interfaces/AndroidOptions.d.ts +41 -0
- package/lib/src/interfaces/AndroidOptions.js +1 -0
- package/lib/src/interfaces/CustomButtons.d.ts +5 -0
- package/lib/src/interfaces/CustomButtons.js +1 -0
- package/lib/src/interfaces/FeedbackOptions.d.ts +6 -0
- package/lib/src/interfaces/FeedbackOptions.js +1 -0
- package/lib/src/interfaces/MediaItem.d.ts +18 -0
- package/lib/src/interfaces/MediaItem.js +1 -0
- package/lib/src/interfaces/MetadataOptions.d.ts +3 -0
- package/lib/src/interfaces/MetadataOptions.js +1 -0
- package/lib/src/interfaces/NowPlayingMetadata.d.ts +4 -0
- package/lib/src/interfaces/NowPlayingMetadata.js +1 -0
- package/lib/src/interfaces/PlaybackState.d.ts +8 -0
- package/lib/src/interfaces/PlaybackState.js +1 -0
- package/lib/src/interfaces/PlayerOptions.d.ts +132 -0
- package/lib/src/interfaces/PlayerOptions.js +1 -0
- package/lib/src/interfaces/Progress.d.ts +15 -0
- package/lib/src/interfaces/Progress.js +1 -0
- package/lib/src/interfaces/ResourceObject.d.ts +1 -0
- package/lib/src/interfaces/ResourceObject.js +1 -0
- package/lib/src/interfaces/ServiceHandler.d.ts +1 -0
- package/lib/src/interfaces/ServiceHandler.js +1 -0
- package/lib/src/interfaces/Track.d.ts +21 -0
- package/lib/src/interfaces/Track.js +1 -0
- package/lib/src/interfaces/TrackMetadataBase.d.ts +28 -0
- package/lib/src/interfaces/TrackMetadataBase.js +1 -0
- package/lib/src/interfaces/UpdateOptions.d.ts +52 -0
- package/lib/src/interfaces/UpdateOptions.js +1 -0
- package/lib/src/interfaces/events/AudioMetadataReceivedEvent.d.ts +33 -0
- package/lib/src/interfaces/events/AudioMetadataReceivedEvent.js +1 -0
- package/lib/src/interfaces/events/ControllerConnectedEvent.d.ts +8 -0
- package/lib/src/interfaces/events/ControllerConnectedEvent.js +1 -0
- package/lib/src/interfaces/events/EventPayloadByEvent.d.ts +77 -0
- package/lib/src/interfaces/events/EventPayloadByEvent.js +1 -0
- package/lib/src/interfaces/events/FFTUpdateEvent.d.ts +7 -0
- package/lib/src/interfaces/events/FFTUpdateEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackActiveTrackChangedEvent.d.ts +24 -0
- package/lib/src/interfaces/events/PlaybackActiveTrackChangedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackAnimatedVolumeChangedEvent.d.ts +4 -0
- package/lib/src/interfaces/events/PlaybackAnimatedVolumeChangedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackErrorEvent.d.ts +6 -0
- package/lib/src/interfaces/events/PlaybackErrorEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackMetadataReceivedEvent.d.ts +16 -0
- package/lib/src/interfaces/events/PlaybackMetadataReceivedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackPlayWhenReadyChangedEvent.d.ts +4 -0
- package/lib/src/interfaces/events/PlaybackPlayWhenReadyChangedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackProgressUpdatedEvent.d.ts +4 -0
- package/lib/src/interfaces/events/PlaybackProgressUpdatedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackQueueEndedEvent.d.ts +9 -0
- package/lib/src/interfaces/events/PlaybackQueueEndedEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackResumeEvent.d.ts +3 -0
- package/lib/src/interfaces/events/PlaybackResumeEvent.js +1 -0
- package/lib/src/interfaces/events/PlaybackTrackChangedEvent.d.ts +11 -0
- package/lib/src/interfaces/events/PlaybackTrackChangedEvent.js +1 -0
- package/lib/src/interfaces/events/PlayerErrorEvent.d.ts +6 -0
- package/lib/src/interfaces/events/PlayerErrorEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteBrowseEvent.d.ts +4 -0
- package/lib/src/interfaces/events/RemoteBrowseEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteCustomActionEvent.d.ts +7 -0
- package/lib/src/interfaces/events/RemoteCustomActionEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteDuckEvent.d.ts +13 -0
- package/lib/src/interfaces/events/RemoteDuckEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteJumpBackwardEvent.d.ts +7 -0
- package/lib/src/interfaces/events/RemoteJumpBackwardEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteJumpForwardEvent.d.ts +7 -0
- package/lib/src/interfaces/events/RemoteJumpForwardEvent.js +1 -0
- package/lib/src/interfaces/events/RemotePlayIdEvent.d.ts +4 -0
- package/lib/src/interfaces/events/RemotePlayIdEvent.js +1 -0
- package/lib/src/interfaces/events/RemotePlaySearchEvent.d.ts +9 -0
- package/lib/src/interfaces/events/RemotePlaySearchEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteSearchEvent.d.ts +3 -0
- package/lib/src/interfaces/events/RemoteSearchEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteSeekEvent.d.ts +4 -0
- package/lib/src/interfaces/events/RemoteSeekEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteSetRatingEvent.d.ts +4 -0
- package/lib/src/interfaces/events/RemoteSetRatingEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteSkipEvent.d.ts +3 -0
- package/lib/src/interfaces/events/RemoteSkipEvent.js +1 -0
- package/lib/src/interfaces/events/index.d.ts +20 -0
- package/lib/src/interfaces/events/index.js +20 -0
- package/lib/src/interfaces/index.d.ts +15 -0
- package/lib/src/interfaces/index.js +15 -0
- package/lib/src/resolveAssetSource.d.ts +2 -0
- package/lib/src/resolveAssetSource.js +3 -0
- package/lib/src/resolveAssetSource.web.d.ts +2 -0
- package/lib/src/resolveAssetSource.web.js +8 -0
- package/lib/src/trackPlayer.d.ts +371 -0
- package/lib/src/trackPlayer.js +627 -0
- package/lib/web/TrackPlayer/Player.d.ts +40 -0
- package/lib/web/TrackPlayer/Player.js +188 -0
- package/lib/web/TrackPlayer/PlaylistPlayer.d.ts +31 -0
- package/lib/web/TrackPlayer/PlaylistPlayer.js +181 -0
- package/lib/web/TrackPlayer/RepeatMode.d.ts +5 -0
- package/lib/web/TrackPlayer/RepeatMode.js +6 -0
- package/lib/web/TrackPlayer/SetupNotCalledError.d.ts +3 -0
- package/lib/web/TrackPlayer/SetupNotCalledError.js +5 -0
- package/lib/web/TrackPlayer/index.d.ts +3 -0
- package/lib/web/TrackPlayer/index.js +3 -0
- package/lib/web/TrackPlayerModule.d.ts +63 -0
- package/lib/web/TrackPlayerModule.js +153 -0
- package/lib/web/index.d.ts +3 -0
- package/lib/web/index.js +3 -0
- package/package.json +85 -6
- package/react-native-track-player.podspec +13 -13
- package/specs/NativeTrackPlayer.ts +153 -0
- package/src/TrackPlayerModule.web.ts +2 -0
- package/src/VideoView.tsx +51 -0
- package/src/constants/AndroidAudioContentType.ts +35 -0
- package/src/constants/AndroidAutoContentStyle.ts +10 -0
- package/src/constants/AppKilledPlaybackBehavior.ts +19 -0
- package/src/constants/Capability.ts +19 -0
- package/src/constants/Event.ts +173 -0
- package/src/constants/IOSCategory.ts +36 -0
- package/src/constants/IOSCategoryMode.ts +47 -0
- package/src/constants/IOSCategoryOptions.ts +44 -0
- package/src/constants/MediaItemPlayable.ts +4 -0
- package/src/constants/PitchAlgorithm.ts +16 -0
- package/src/constants/RatingType.ts +10 -0
- package/src/constants/RepeatMode.ts +10 -0
- package/src/constants/State.ts +34 -0
- package/src/constants/TrackType.ts +6 -0
- package/src/constants/index.ts +14 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useActiveTrack.ts +36 -0
- package/src/hooks/useAppIsInBackground.ts +20 -0
- package/src/hooks/useIsPlaying.ts +56 -0
- package/src/hooks/usePlayWhenReady.ts +37 -0
- package/src/hooks/usePlaybackState.ts +45 -0
- package/src/hooks/useProgress.ts +64 -0
- package/src/hooks/useTrackPlayerEvents.ts +48 -0
- package/src/index.ts +8 -0
- package/src/interfaces/AndroidAutoBrowseTree.ts +6 -0
- package/src/interfaces/AndroidOptions.ts +48 -0
- package/src/interfaces/CustomButtons.ts +6 -0
- package/src/interfaces/FeedbackOptions.ts +7 -0
- package/src/interfaces/MediaItem.ts +19 -0
- package/src/interfaces/MetadataOptions.ts +4 -0
- package/src/interfaces/NowPlayingMetadata.ts +5 -0
- package/src/interfaces/PlaybackState.ts +11 -0
- package/src/interfaces/PlayerOptions.ts +138 -0
- package/src/interfaces/Progress.ts +15 -0
- package/src/interfaces/ResourceObject.ts +1 -0
- package/src/interfaces/ServiceHandler.ts +1 -0
- package/src/interfaces/Track.ts +23 -0
- package/src/interfaces/TrackMetadataBase.ts +29 -0
- package/src/interfaces/UpdateOptions.ts +59 -0
- package/src/interfaces/events/AudioMetadataReceivedEvent.ts +37 -0
- package/src/interfaces/events/ControllerConnectedEvent.ts +9 -0
- package/src/interfaces/events/EventPayloadByEvent.ts +80 -0
- package/src/interfaces/events/FFTUpdateEvent.ts +9 -0
- package/src/interfaces/events/PlaybackActiveTrackChangedEvent.ts +29 -0
- package/src/interfaces/events/PlaybackAnimatedVolumeChangedEvent.ts +4 -0
- package/src/interfaces/events/PlaybackErrorEvent.ts +6 -0
- package/src/interfaces/events/PlaybackMetadataReceivedEvent.ts +16 -0
- package/src/interfaces/events/PlaybackPlayWhenReadyChangedEvent.ts +4 -0
- package/src/interfaces/events/PlaybackProgressUpdatedEvent.ts +5 -0
- package/src/interfaces/events/PlaybackQueueEndedEvent.ts +9 -0
- package/src/interfaces/events/PlaybackResumeEvent.ts +5 -0
- package/src/interfaces/events/PlaybackTrackChangedEvent.ts +11 -0
- package/src/interfaces/events/PlayerErrorEvent.ts +6 -0
- package/src/interfaces/events/RemoteBrowseEvent.ts +4 -0
- package/src/interfaces/events/RemoteCustomActionEvent.ts +7 -0
- package/src/interfaces/events/RemoteDuckEvent.ts +13 -0
- package/src/interfaces/events/RemoteJumpBackwardEvent.ts +7 -0
- package/src/interfaces/events/RemoteJumpForwardEvent.ts +7 -0
- package/src/interfaces/events/RemotePlayIdEvent.ts +4 -0
- package/src/interfaces/events/RemotePlaySearchEvent.ts +21 -0
- package/src/interfaces/events/RemoteSearchEvent.ts +3 -0
- package/src/interfaces/events/RemoteSeekEvent.ts +4 -0
- package/src/interfaces/events/RemoteSetRatingEvent.ts +5 -0
- package/src/interfaces/events/RemoteSkipEvent.ts +3 -0
- package/src/interfaces/events/index.ts +20 -0
- package/src/interfaces/index.ts +15 -0
- package/src/resolveAssetSource.ts +3 -0
- package/src/resolveAssetSource.web.ts +10 -0
- package/src/trackPlayer.ts +806 -0
- package/web/TrackPlayer/Player.ts +201 -0
- package/web/TrackPlayer/PlaylistPlayer.ts +215 -0
- package/web/TrackPlayer/RepeatMode.ts +6 -0
- package/web/TrackPlayer/SetupNotCalledError.ts +5 -0
- package/web/TrackPlayer/index.ts +3 -0
- package/web/TrackPlayerModule.ts +181 -0
- package/web/index.ts +4 -0
- package/CHANGELOG.md +0 -75
- package/android/react-native-music-control.iml +0 -139
- package/android/react-native-track-player.iml +0 -151
- package/android/src/main/java/com/guichaguri/trackplayer/TrackPlayer.java +0 -28
- package/android/src/main/java/com/guichaguri/trackplayer/module/MusicEvents.java +0 -55
- package/android/src/main/java/com/guichaguri/trackplayer/module/MusicModule.java +0 -298
- package/android/src/main/java/com/guichaguri/trackplayer/service/HeadlessJsMediaService.java +0 -174
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicBinder.java +0 -47
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicManager.java +0 -383
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicService.java +0 -271
- package/android/src/main/java/com/guichaguri/trackplayer/service/Utils.java +0 -243
- package/android/src/main/java/com/guichaguri/trackplayer/service/metadata/ButtonEvents.java +0 -148
- package/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.java +0 -379
- package/android/src/main/java/com/guichaguri/trackplayer/service/models/Track.java +0 -141
- package/android/src/main/java/com/guichaguri/trackplayer/service/models/TrackType.java +0 -35
- package/android/src/main/res/drawable-hdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_logo.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_next.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_pause.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_play.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_previous.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_rewind.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_stop.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_logo.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_next.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_pause.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_play.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_previous.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_rewind.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_stop.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_logo.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_next.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_pause.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_play.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_previous.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_rewind.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_stop.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_logo.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_next.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_pause.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_play.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_previous.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_rewind.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_stop.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_logo.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_next.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_pause.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_play.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_previous.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_rewind.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_stop.png +0 -0
- package/index.d.ts +0 -174
- package/index.js +0 -4
- package/ios/RNTrackPlayer/RNTrackPlayerBridge.h +0 -12
- package/ios/RNTrackPlayer/RNTrackPlayerBridge.m +0 -29
- package/ios/TrackPlayer.xcodeproj/project.pbxproj +0 -495
- package/ios/TrackPlayer.xcodeproj/project.xcworkspace/xcuserdata/marco.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/ProgressComponent.js +0 -70
- package/lib/eventTypes.js +0 -28
- package/lib/hooks.js +0 -160
- package/lib/index.js +0 -177
- /package/ios/{TrackPlayer.xcodeproj → Example/SwiftAudio.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { Event, RepeatMode, AndroidAutoContentStyle } from './constants';
|
|
2
|
+
import type { AddTrack, EventPayloadByEvent, NowPlayingMetadata, PlaybackState, PlayerOptions, Progress, ServiceHandler, Track, TrackMetadataBase, UpdateOptions, AndroidAutoBrowseTree, MediaItem } from './interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes the player with the specified options.
|
|
5
|
+
*
|
|
6
|
+
* Note that on Android this method must only be called while the app is in the
|
|
7
|
+
* foreground, otherwise it will throw an error with code
|
|
8
|
+
* `'android_cannot_setup_player_in_background'`. In this case you can wait for
|
|
9
|
+
* the app to be in the foreground and try again.
|
|
10
|
+
*
|
|
11
|
+
* @param options The options to initialize the player with.
|
|
12
|
+
* @see https://rntp.dev/docs/api/functions/lifecycle
|
|
13
|
+
*/
|
|
14
|
+
export declare function setupPlayer(options?: PlayerOptions, background?: boolean): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Register the playback service. The service will run as long as the player runs.
|
|
17
|
+
*/
|
|
18
|
+
export declare function registerPlaybackService(factory: () => ServiceHandler): void;
|
|
19
|
+
export declare function addEventListener<T extends Event>(event: T, listener: EventPayloadByEvent[T] extends never ? () => void : (event: EventPayloadByEvent[T]) => void): import("react-native").EmitterSubscription;
|
|
20
|
+
/**
|
|
21
|
+
* Adds one or more tracks to the queue.
|
|
22
|
+
*
|
|
23
|
+
* @param tracks The tracks to add to the queue.
|
|
24
|
+
* @param insertBeforeIndex (Optional) The index to insert the tracks before.
|
|
25
|
+
* By default the tracks will be added to the end of the queue.
|
|
26
|
+
*/
|
|
27
|
+
export declare function add(tracks: AddTrack[], insertBeforeIndex?: number): Promise<number | void>;
|
|
28
|
+
/**
|
|
29
|
+
* Adds a track to the queue.
|
|
30
|
+
*
|
|
31
|
+
* @param track The track to add to the queue.
|
|
32
|
+
* @param insertBeforeIndex (Optional) The index to insert the track before.
|
|
33
|
+
* By default the track will be added to the end of the queue.
|
|
34
|
+
*/
|
|
35
|
+
export declare function add(track: AddTrack, insertBeforeIndex?: number): Promise<number | void>;
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the current track or loads the track as the first in the queue.
|
|
38
|
+
*
|
|
39
|
+
* @param track The track to load.
|
|
40
|
+
*/
|
|
41
|
+
export declare function load(track: Track): Promise<number | void>;
|
|
42
|
+
/**
|
|
43
|
+
* Move a track within the queue.
|
|
44
|
+
*
|
|
45
|
+
* @param fromIndex The index of the track to be moved.
|
|
46
|
+
* @param toIndex The index to move the track to. If the index is larger than
|
|
47
|
+
* the size of the queue, then the track is moved to the end of the queue.
|
|
48
|
+
*/
|
|
49
|
+
export declare function move(fromIndex: number, toIndex: number): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Removes multiple tracks from the queue by their indexes.
|
|
52
|
+
*
|
|
53
|
+
* If the current track is removed, the next track will activated. If the
|
|
54
|
+
* current track was the last track in the queue, the first track will be
|
|
55
|
+
* activated.
|
|
56
|
+
*
|
|
57
|
+
* @param indexes The indexes of the tracks to be removed.
|
|
58
|
+
*/
|
|
59
|
+
export declare function remove(indexes: number[]): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Removes a track from the queue by its index.
|
|
62
|
+
*
|
|
63
|
+
* If the current track is removed, the next track will activated. If the
|
|
64
|
+
* current track was the last track in the queue, the first track will be
|
|
65
|
+
* activated.
|
|
66
|
+
*
|
|
67
|
+
* @param index The index of the track to be removed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function remove(index: number): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Clears any upcoming tracks from the queue.
|
|
72
|
+
*/
|
|
73
|
+
export declare function removeUpcomingTracks(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Skips to a track in the queue.
|
|
76
|
+
*
|
|
77
|
+
* @param index The index of the track to skip to.
|
|
78
|
+
* @param initialPosition (Optional) The initial position to seek to in seconds.
|
|
79
|
+
*/
|
|
80
|
+
export declare function skip(index: number, initialPosition?: number): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Skips to the next track in the queue.
|
|
83
|
+
*
|
|
84
|
+
* @param initialPosition (Optional) The initial position to seek to in seconds.
|
|
85
|
+
*/
|
|
86
|
+
export declare function skipToNext(initialPosition?: number): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Skips to the previous track in the queue.
|
|
89
|
+
*
|
|
90
|
+
* @param initialPosition (Optional) The initial position to seek to in seconds.
|
|
91
|
+
*/
|
|
92
|
+
export declare function skipToPrevious(initialPosition?: number): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Updates the configuration for the components.
|
|
95
|
+
*
|
|
96
|
+
* @param options The options to update.
|
|
97
|
+
* @see https://rntp.dev/docs/api/functions/player#updateoptionsoptions
|
|
98
|
+
*/
|
|
99
|
+
export declare function updateOptions({ alwaysPauseOnInterruption, ...options }?: UpdateOptions): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Updates the metadata of a track in the queue. If the current track is updated,
|
|
102
|
+
* the notification and the Now Playing Center will be updated accordingly.
|
|
103
|
+
*
|
|
104
|
+
* @param trackIndex The index of the track whose metadata will be updated.
|
|
105
|
+
* @param metadata The metadata to update.
|
|
106
|
+
*/
|
|
107
|
+
export declare function updateMetadataForTrack(trackIndex: number, metadata: TrackMetadataBase): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Updates the metadata content of the notification (Android) and the Now Playing Center (iOS)
|
|
110
|
+
* without affecting the data stored for the current track.
|
|
111
|
+
*/
|
|
112
|
+
export declare function updateNowPlayingMetadata(metadata: NowPlayingMetadata): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Resets the player stopping the current track and clearing the queue.
|
|
115
|
+
*/
|
|
116
|
+
export declare function reset(): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Plays or resumes the current track.
|
|
119
|
+
*/
|
|
120
|
+
export declare function play(): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Pauses the current track.
|
|
123
|
+
*/
|
|
124
|
+
export declare function pause(): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Stops the current track.
|
|
127
|
+
*/
|
|
128
|
+
export declare function stop(): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Sets whether the player will play automatically when it is ready to do so.
|
|
131
|
+
* This is the equivalent of calling `TrackPlayer.play()` when `playWhenReady = true`
|
|
132
|
+
* or `TrackPlayer.pause()` when `playWhenReady = false`.
|
|
133
|
+
*/
|
|
134
|
+
export declare function setPlayWhenReady(playWhenReady: boolean): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Gets whether the player will play automatically when it is ready to do so.
|
|
137
|
+
*/
|
|
138
|
+
export declare function getPlayWhenReady(): Promise<boolean>;
|
|
139
|
+
/**
|
|
140
|
+
* Seeks to a specified time position in the current track.
|
|
141
|
+
*
|
|
142
|
+
* @param position The position to seek to in seconds.
|
|
143
|
+
*/
|
|
144
|
+
export declare function seekTo(position: number): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Seeks by a relative time offset in the current track.
|
|
147
|
+
*
|
|
148
|
+
* @param offset The time offset to seek by in seconds.
|
|
149
|
+
*/
|
|
150
|
+
export declare function seekBy(offset: number): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Sets the volume of the player.
|
|
153
|
+
*
|
|
154
|
+
* @param volume The volume as a number between 0 and 1.
|
|
155
|
+
*/
|
|
156
|
+
export declare function setVolume(level: number): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Sets the volume of the player with a simple linear scaling.
|
|
159
|
+
* In Android this is achieved via a native thread call.
|
|
160
|
+
* In other platforms this is achieved via RN's Animated.Value.
|
|
161
|
+
*
|
|
162
|
+
* @param volume The volume as a number between 0 and 1.
|
|
163
|
+
* @param duration The duration of the animation in milliseconds. defualt is 0 ms, which just functions as TP.setVolume.
|
|
164
|
+
* @param init The initial value of the volume. This may be useful eg to be 0 for a fade in event.
|
|
165
|
+
* @param interval The interval of the animation in milliseconds. default is 20 ms.
|
|
166
|
+
* @param msg (Android) The message to be emitted after volume is fully changed, via Event.PlaybackAnimatedVolumeChanged.
|
|
167
|
+
* @param callback (other platforms) The callback to be called after volume is fully changed.
|
|
168
|
+
*/
|
|
169
|
+
export declare const setAnimatedVolume: ({ volume, duration, init, interval, msg, callback, }: {
|
|
170
|
+
volume: number;
|
|
171
|
+
duration?: number;
|
|
172
|
+
init?: number;
|
|
173
|
+
interval?: number;
|
|
174
|
+
msg?: string;
|
|
175
|
+
callback?: () => void | Promise<void>;
|
|
176
|
+
}) => Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* performs fading out to pause playback.
|
|
179
|
+
* @param duration duration of the fade progress in ms
|
|
180
|
+
* @param interval interval of the fade progress in ms
|
|
181
|
+
*/
|
|
182
|
+
export declare const fadeOutPause: (duration?: number, interval?: number) => Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* performs fading into playing the next track.
|
|
185
|
+
* @param duration duration of the fade progress in ms
|
|
186
|
+
* @param interval interval of the fade progress in ms
|
|
187
|
+
* @param toVolume volume to fade into
|
|
188
|
+
*/
|
|
189
|
+
export declare const fadeOutNext: (duration?: number, interval?: number, toVolume?: number) => Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* performs fading into playing the previous track.
|
|
192
|
+
* @param duration duration of the fade progress in ms
|
|
193
|
+
* @param interval interval of the fade progress in ms
|
|
194
|
+
* @param toVolume volume to fade into
|
|
195
|
+
*/
|
|
196
|
+
export declare const fadeOutPrevious: (duration?: number, interval?: number, toVolume?: number) => Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* performs fading into skipping to a track.
|
|
199
|
+
* @param index the index of the track to skip to
|
|
200
|
+
* @param duration duration of the fade progress in ms
|
|
201
|
+
* @param interval interval of the fade progress in ms
|
|
202
|
+
* @param toVolume volume to fade into
|
|
203
|
+
*/
|
|
204
|
+
export declare const fadeOutJump: (index: number, duration?: number, interval?: number, toVolume?: number) => Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the playback rate.
|
|
207
|
+
*
|
|
208
|
+
* @param rate The playback rate to change to, where 0.5 would be half speed,
|
|
209
|
+
* 1 would be regular speed, 2 would be double speed etc.
|
|
210
|
+
*/
|
|
211
|
+
export declare function setRate(rate: number): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Sets the playback pitch. android only
|
|
214
|
+
*
|
|
215
|
+
* @param pitch The pitch.
|
|
216
|
+
*/
|
|
217
|
+
export declare function setPitch(pitch: number): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Sets the queue.
|
|
220
|
+
*
|
|
221
|
+
* @param tracks The tracks to set as the queue.
|
|
222
|
+
* @see https://rntp.dev/docs/api/constants/repeat-mode
|
|
223
|
+
*/
|
|
224
|
+
export declare function setQueue(tracks: Track[]): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Sets the queue repeat mode.
|
|
227
|
+
*
|
|
228
|
+
* @param repeatMode The repeat mode to set.
|
|
229
|
+
* @see https://rntp.dev/docs/api/constants/repeat-mode
|
|
230
|
+
*/
|
|
231
|
+
export declare function setRepeatMode(mode: RepeatMode): Promise<RepeatMode>;
|
|
232
|
+
/**
|
|
233
|
+
* Gets the volume of the player as a number between 0 and 1.
|
|
234
|
+
*/
|
|
235
|
+
export declare function getVolume(): Promise<number>;
|
|
236
|
+
/**
|
|
237
|
+
* Gets the playback rate where 0.5 would be half speed, 1 would be
|
|
238
|
+
* regular speed and 2 would be double speed etc.
|
|
239
|
+
*/
|
|
240
|
+
export declare function getRate(): Promise<number>;
|
|
241
|
+
/**
|
|
242
|
+
* Gets the pitch of the track.
|
|
243
|
+
*/
|
|
244
|
+
export declare function getPitch(): Promise<number>;
|
|
245
|
+
/**
|
|
246
|
+
* Gets a track object from the queue.
|
|
247
|
+
*
|
|
248
|
+
* @param index The index of the track.
|
|
249
|
+
* @returns The track object or undefined if there isn't a track object at that
|
|
250
|
+
* index.
|
|
251
|
+
*/
|
|
252
|
+
export declare function getTrack(index: number): Promise<Track | undefined>;
|
|
253
|
+
/**
|
|
254
|
+
* Gets the whole queue.
|
|
255
|
+
*/
|
|
256
|
+
export declare function getQueue(): Promise<Track[]>;
|
|
257
|
+
/**
|
|
258
|
+
* Gets the index of the active track in the queue or undefined if there is no
|
|
259
|
+
* current track.
|
|
260
|
+
*/
|
|
261
|
+
export declare function getActiveTrackIndex(): Promise<number | undefined>;
|
|
262
|
+
/**
|
|
263
|
+
* Gets the active track or undefined if there is no current track.
|
|
264
|
+
*/
|
|
265
|
+
export declare function getActiveTrack(): Promise<Track | undefined>;
|
|
266
|
+
/**
|
|
267
|
+
* Gets information on the progress of the currently active track, including its
|
|
268
|
+
* current playback position in seconds, buffered position in seconds and
|
|
269
|
+
* duration in seconds.
|
|
270
|
+
*/
|
|
271
|
+
export declare function getProgress(): Promise<Progress>;
|
|
272
|
+
/**
|
|
273
|
+
* Gets the playback state of the player.
|
|
274
|
+
*
|
|
275
|
+
* @see https://rntp.dev/docs/api/constants/state
|
|
276
|
+
*/
|
|
277
|
+
export declare function getPlaybackState(): Promise<PlaybackState>;
|
|
278
|
+
/**
|
|
279
|
+
* Gets the queue repeat mode.
|
|
280
|
+
*
|
|
281
|
+
* @see https://rntp.dev/docs/api/constants/repeat-mode
|
|
282
|
+
*/
|
|
283
|
+
export declare function getRepeatMode(): Promise<RepeatMode>;
|
|
284
|
+
/**
|
|
285
|
+
* Retries the current item when the playback state is `State.Error`.
|
|
286
|
+
*/
|
|
287
|
+
export declare function retry(): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Sets the content hierarchy of Android Auto (Android only). The hierarchy structure is a dict with
|
|
290
|
+
* the mediaId as keys, and a list of MediaItem as values. To use, you must at least specify the root directory, where
|
|
291
|
+
* the key is "/". If the root directory contains BROWSABLE MediaItems, they will be shown as tabs. Do note Google requires
|
|
292
|
+
* AA to have a max of 4 tabs. You may then set the mediaId keys of the browsable MediaItems to be a list of other MediaItems.
|
|
293
|
+
*
|
|
294
|
+
* @param browseTree the content hierarchy dict.
|
|
295
|
+
* @returns a serialized copy of the browseTree set by native. For debug purposes.
|
|
296
|
+
*/
|
|
297
|
+
export declare function setBrowseTree(browseTree: AndroidAutoBrowseTree): Promise<string>;
|
|
298
|
+
/**
|
|
299
|
+
* this method enables android auto playback progress tracking; see
|
|
300
|
+
* https://developer.android.com/training/cars/media#browse-progress-bar
|
|
301
|
+
* android only.
|
|
302
|
+
* @param mediaID the mediaID.
|
|
303
|
+
* @returns
|
|
304
|
+
*/
|
|
305
|
+
export declare function setPlaybackState(mediaID: string): Promise<void>;
|
|
306
|
+
/**
|
|
307
|
+
* Sets the content style of Android Auto (Android only).
|
|
308
|
+
* there are list style and grid style. see https://developer.android.com/training/cars/media#apply_content_style .
|
|
309
|
+
* the styles are applicable to browsable nodes and playable nodes. setting the args to true will yield the list style.
|
|
310
|
+
* false = the grid style.
|
|
311
|
+
*/
|
|
312
|
+
export declare function setBrowseTreeStyle(browsableStyle: AndroidAutoContentStyle, playableStyle: AndroidAutoContentStyle): null;
|
|
313
|
+
/**
|
|
314
|
+
* Sets the search results of Android Auto (Android only). The hierarchy structure is a dict with
|
|
315
|
+
* the mediaId as keys, and a list of MediaItem as values.
|
|
316
|
+
*
|
|
317
|
+
* @param searchResults the search results.
|
|
318
|
+
* @returns a serialized copy of the searchResults set by native. For debug purposes.
|
|
319
|
+
*/
|
|
320
|
+
export declare function setSearchResults(searchResults: MediaItem[]): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* acquires the wake lock of MusicService (android only.)
|
|
323
|
+
*/
|
|
324
|
+
export declare function acquireWakeLock(): Promise<void>;
|
|
325
|
+
/**
|
|
326
|
+
* acquires the wake lock of MusicService (android only.)
|
|
327
|
+
*/
|
|
328
|
+
export declare function abandonWakeLock(): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* prepare to crossfade (android only.) the crossfade alternate
|
|
331
|
+
* player will be automatically primed to the current player's index,
|
|
332
|
+
* then by previous = true or not, skip to previous or next. player
|
|
333
|
+
* will be prepared. its advised to call this well before actually performing
|
|
334
|
+
* crossfade so the resource can be prepared.
|
|
335
|
+
*/
|
|
336
|
+
export declare function crossFadePrepare(previous?: boolean, seekTo?: number): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* perform crossfade (android only).
|
|
339
|
+
*
|
|
340
|
+
* fadeDuration and fadeInterval are both in ms.
|
|
341
|
+
*
|
|
342
|
+
* fadeToVolume is a float from 0-1.
|
|
343
|
+
*
|
|
344
|
+
* waitUntil is in ms.
|
|
345
|
+
*/
|
|
346
|
+
export declare function crossFade(fadeDuration?: number, fadeInterval?: number, fadeToVolume?: number, waitUntil?: number): Promise<void>;
|
|
347
|
+
/**
|
|
348
|
+
* get the last connected package. non android will return undefined.
|
|
349
|
+
*
|
|
350
|
+
* android without a connected package (either system.UI, android auto, or media controller) yet
|
|
351
|
+
* will return ''; else will be one of the three.
|
|
352
|
+
*
|
|
353
|
+
* I intend to use this to determine if app crashed from android auto.
|
|
354
|
+
*/
|
|
355
|
+
export declare function getLastConnectedPackage(): Promise<string | undefined>;
|
|
356
|
+
/**
|
|
357
|
+
* android only. set loudnessEnhance via audiofx's loudnessEnhancer. gain is in mB (1dB=100mB)
|
|
358
|
+
*/
|
|
359
|
+
export declare function setLoudnessEnhance(gain?: number): Promise<void>;
|
|
360
|
+
/**
|
|
361
|
+
* android only. set equalizer preset.
|
|
362
|
+
*/
|
|
363
|
+
export declare function setEqualizerPreset(preset?: number): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* android only. get the current equalizer preset index (int).
|
|
366
|
+
*/
|
|
367
|
+
export declare function getCurrentEqualizerPreset(): Promise<number>;
|
|
368
|
+
/**
|
|
369
|
+
* android only. get the current eq preset names.
|
|
370
|
+
*/
|
|
371
|
+
export declare function getEqualizerPresets(): Promise<string[]>;
|