react-native-mp3-player 1.0.0
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 +205 -0
- package/README.md +88 -0
- package/android/build.gradle +114 -0
- package/android/proguard-rules.txt +0 -0
- package/android/src/main/AndroidManifest.xml +27 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/HeadlessJsMediaService.kt +199 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/TrackPlayer.kt +30 -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 +65 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/module/MusicModule.kt +775 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt +1251 -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 +64 -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/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 +133 -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 +39 -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 +689 -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 +295 -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 +47 -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 +165 -0
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/service/MusicService.kt +127 -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/Example/SwiftAudio/SwiftAudio.entitlements +12 -0
- package/ios/Example/SwiftAudio/SwiftAudioApp.swift +17 -0
- package/ios/Example/SwiftAudio.xcodeproj/project.pbxproj +412 -0
- package/ios/Example/SwiftAudio.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Example/SwiftAudio.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNTrackPlayer/Models/Capabilities.swift +52 -0
- package/ios/RNTrackPlayer/Models/MediaURL.swift +38 -0
- 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 +140 -0
- package/ios/RNTrackPlayer/RNTrackPlayer.swift +941 -0
- package/ios/RNTrackPlayer/Support/RNTrackPlayer-Bridging-Header.h +7 -0
- package/ios/RNTrackPlayer/TrackPlayer.h +14 -0
- package/ios/RNTrackPlayer/TrackPlayer.mm +246 -0
- package/ios/RNTrackPlayer/Utils/EventType.swift +44 -0
- package/ios/RNTrackPlayer/Utils/Metadata.swift +60 -0
- package/ios/SwiftAudioEx/Package.swift +20 -0
- package/ios/SwiftAudioEx/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift +521 -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 +99 -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 +129 -0
- package/lib/specs/NativeTrackPlayer.js +4 -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 +163 -0
- package/lib/src/constants/Event.js +164 -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 +5 -0
- package/lib/src/index.js +5 -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 +127 -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 +73 -0
- package/lib/src/interfaces/events/EventPayloadByEvent.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 +8 -0
- package/lib/src/interfaces/events/RemoteJumpBackwardEvent.js +1 -0
- package/lib/src/interfaces/events/RemoteJumpForwardEvent.d.ts +8 -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/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 +18 -0
- package/lib/src/interfaces/events/index.js +18 -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/trackPlayer.d.ts +347 -0
- package/lib/src/trackPlayer.js +592 -0
- package/package.json +94 -0
- package/react-native-mp3-player.podspec +22 -0
- package/specs/NativeTrackPlayer.ts +148 -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 +164 -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 +7 -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 +133 -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 +76 -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 +8 -0
- package/src/interfaces/events/RemoteJumpForwardEvent.ts +8 -0
- package/src/interfaces/events/RemotePlayIdEvent.ts +4 -0
- package/src/interfaces/events/RemotePlaySearchEvent.ts +21 -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 +18 -0
- package/src/interfaces/index.ts +15 -0
- package/src/resolveAssetSource.ts +3 -0
- package/src/trackPlayer.ts +768 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import { type UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
// init and config
|
|
7
|
+
setupPlayer(options: UnsafeObject, background: boolean): Promise<void>;
|
|
8
|
+
updateOptions(options: UnsafeObject): Promise<void>;
|
|
9
|
+
|
|
10
|
+
// player api
|
|
11
|
+
load(track: UnsafeObject): Promise<number | void>;
|
|
12
|
+
reset(): Promise<void>;
|
|
13
|
+
play(): Promise<void>;
|
|
14
|
+
pause(): Promise<void>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
setPlayWhenReady(playWhenReady: boolean): Promise<boolean>;
|
|
17
|
+
getPlayWhenReady(): Promise<boolean>;
|
|
18
|
+
seekTo(position: number): Promise<void>;
|
|
19
|
+
seekBy(offset: number): Promise<void>;
|
|
20
|
+
setVolume(level: number): Promise<void>;
|
|
21
|
+
getVolume(): Promise<number>;
|
|
22
|
+
setRate(rate: number): Promise<void>;
|
|
23
|
+
getRate(): Promise<number>;
|
|
24
|
+
getProgress(): Promise<UnsafeObject>;
|
|
25
|
+
getPlaybackState(): Promise<UnsafeObject>;
|
|
26
|
+
retry(): Promise<void>;
|
|
27
|
+
|
|
28
|
+
// playlist management
|
|
29
|
+
add(
|
|
30
|
+
tracks: UnsafeObject[],
|
|
31
|
+
insertBeforeIndex: number,
|
|
32
|
+
): Promise<number | void>;
|
|
33
|
+
move(fromIndex: number, toIndex: number): Promise<void>;
|
|
34
|
+
remove(indexes: number[]): Promise<void>;
|
|
35
|
+
removeUpcomingTracks(): Promise<void>;
|
|
36
|
+
skip(index: number, initialPosition: number): Promise<void>;
|
|
37
|
+
skipToNext(initialPosition: number): Promise<void>;
|
|
38
|
+
skipToPrevious(initialPosition: number): Promise<void>;
|
|
39
|
+
updateMetadataForTrack(
|
|
40
|
+
trackIndex: number,
|
|
41
|
+
metadata: UnsafeObject,
|
|
42
|
+
): Promise<void>;
|
|
43
|
+
updateNowPlayingMetadata(metadata: UnsafeObject): Promise<void>;
|
|
44
|
+
setQueue(tracks: UnsafeObject[]): Promise<void>;
|
|
45
|
+
getQueue(): Promise<UnsafeObject[]>;
|
|
46
|
+
setRepeatMode(mode: number): Promise<number>;
|
|
47
|
+
getRepeatMode(): Promise<number>;
|
|
48
|
+
getTrack(index: number): Promise<UnsafeObject | undefined>;
|
|
49
|
+
getActiveTrackIndex(): Promise<number | undefined>;
|
|
50
|
+
getActiveTrack(): Promise<UnsafeObject | undefined>;
|
|
51
|
+
setBrowseTree(browseTree: UnsafeObject): Promise<string>;
|
|
52
|
+
setPlaybackState(mediaID: string): Promise<void>;
|
|
53
|
+
setBrowseTreeStyle(
|
|
54
|
+
browsableStyle: number,
|
|
55
|
+
playableStyle: number,
|
|
56
|
+
): Promise<void>;
|
|
57
|
+
crossFadePrepare(previous: boolean, seekTo?: number): Promise<void>;
|
|
58
|
+
switchExoPlayer(
|
|
59
|
+
fadeDuration: number,
|
|
60
|
+
fadeInterval: number,
|
|
61
|
+
fadeToVolume: number,
|
|
62
|
+
waitUntil?: number,
|
|
63
|
+
): Promise<void>;
|
|
64
|
+
getLastConnectedPackage(): Promise<string | undefined>;
|
|
65
|
+
|
|
66
|
+
// event listeners
|
|
67
|
+
addListener(eventName: string): void;
|
|
68
|
+
removeListeners(count: number): void;
|
|
69
|
+
|
|
70
|
+
// constants
|
|
71
|
+
getConstants: () => {
|
|
72
|
+
CAPABILITY_PLAY: number;
|
|
73
|
+
CAPABILITY_PLAY_FROM_ID: number;
|
|
74
|
+
CAPABILITY_PLAY_FROM_SEARCH: number;
|
|
75
|
+
CAPABILITY_PAUSE: number;
|
|
76
|
+
CAPABILITY_STOP: number;
|
|
77
|
+
CAPABILITY_SEEK_TO: number;
|
|
78
|
+
CAPABILITY_SKIP: number;
|
|
79
|
+
CAPABILITY_SKIP_TO_NEXT: number;
|
|
80
|
+
CAPABILITY_SKIP_TO_PREVIOUS: number;
|
|
81
|
+
CAPABILITY_SET_RATING: number;
|
|
82
|
+
CAPABILITY_JUMP_FORWARD: number;
|
|
83
|
+
CAPABILITY_JUMP_BACKWARD: number;
|
|
84
|
+
CAPABILITY_LIKE: number;
|
|
85
|
+
CAPABILITY_DISLIKE: number;
|
|
86
|
+
CAPABILITY_BOOKMARK: number;
|
|
87
|
+
|
|
88
|
+
// States
|
|
89
|
+
STATE_NONE: string;
|
|
90
|
+
STATE_READY: string;
|
|
91
|
+
STATE_PLAYING: string;
|
|
92
|
+
STATE_PAUSED: string;
|
|
93
|
+
STATE_STOPPED: string;
|
|
94
|
+
STATE_BUFFERING: string;
|
|
95
|
+
STATE_LOADING: string;
|
|
96
|
+
|
|
97
|
+
// Rating Types
|
|
98
|
+
RATING_HEART: number;
|
|
99
|
+
RATING_THUMBS_UP_DOWN: number;
|
|
100
|
+
RATING_3_STARS: number;
|
|
101
|
+
RATING_4_STARS: number;
|
|
102
|
+
RATING_5_STARS: number;
|
|
103
|
+
RATING_PERCENTAGE: number;
|
|
104
|
+
|
|
105
|
+
// Repeat Modes
|
|
106
|
+
REPEAT_OFF: number;
|
|
107
|
+
REPEAT_TRACK: number;
|
|
108
|
+
REPEAT_QUEUE: number;
|
|
109
|
+
|
|
110
|
+
PITCH_ALGORITHM_LINEAR: number;
|
|
111
|
+
PITCH_ALGORITHM_MUSIC: number;
|
|
112
|
+
PITCH_ALGORITHM_VOICE: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// android methods
|
|
116
|
+
|
|
117
|
+
acquireWakeLock(): Promise<void>;
|
|
118
|
+
abandonWakeLock(): Promise<void>;
|
|
119
|
+
setAnimatedVolume(
|
|
120
|
+
volume: number,
|
|
121
|
+
duration: number,
|
|
122
|
+
interval: number,
|
|
123
|
+
msg: string,
|
|
124
|
+
): Promise<void>;
|
|
125
|
+
fadeOutPause(duration: number, interval: number): Promise<void>;
|
|
126
|
+
fadeOutNext(
|
|
127
|
+
duration: number,
|
|
128
|
+
interval: number,
|
|
129
|
+
toVolume: number,
|
|
130
|
+
): Promise<void>;
|
|
131
|
+
fadeOutPrevious(
|
|
132
|
+
duration: number,
|
|
133
|
+
interval: number,
|
|
134
|
+
toVolume: number,
|
|
135
|
+
): Promise<void>;
|
|
136
|
+
fadeOutJump(
|
|
137
|
+
index: number,
|
|
138
|
+
duration: number,
|
|
139
|
+
interval: number,
|
|
140
|
+
toVolume: number,
|
|
141
|
+
): Promise<void>;
|
|
142
|
+
setPitch(pitch: number): Promise<void>;
|
|
143
|
+
getPitch(): Promise<number>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const module = TurboModuleRegistry.getEnforcing<Spec>('TrackPlayer');
|
|
147
|
+
export const Constants = module?.getConstants();
|
|
148
|
+
export default module;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export enum AndroidAudioContentType {
|
|
2
|
+
/**
|
|
3
|
+
* Content type value to use when the content type is music.
|
|
4
|
+
*
|
|
5
|
+
* See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_MUSIC
|
|
6
|
+
*/
|
|
7
|
+
Music = 'music',
|
|
8
|
+
/**
|
|
9
|
+
* Content type value to use when the content type is speech.
|
|
10
|
+
*
|
|
11
|
+
* See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_SPEECH
|
|
12
|
+
*/
|
|
13
|
+
Speech = 'speech',
|
|
14
|
+
/**
|
|
15
|
+
* Content type value to use when the content type is a sound used to
|
|
16
|
+
* accompany a user action, such as a beep or sound effect expressing a key
|
|
17
|
+
* click, or event, such as the type of a sound for a bonus being received in
|
|
18
|
+
* a game. These sounds are mostly synthesized or short Foley sounds.
|
|
19
|
+
*
|
|
20
|
+
* See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_SONIFICATION
|
|
21
|
+
*/
|
|
22
|
+
Sonification = 'sonification',
|
|
23
|
+
/**
|
|
24
|
+
* Content type value to use when the content type is a soundtrack, typically
|
|
25
|
+
* accompanying a movie or TV program.
|
|
26
|
+
*/
|
|
27
|
+
Movie = 'movie',
|
|
28
|
+
/**
|
|
29
|
+
* Content type value to use when the content type is unknown, or other than
|
|
30
|
+
* the ones defined.
|
|
31
|
+
*
|
|
32
|
+
* See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_UNKNOWN
|
|
33
|
+
*/
|
|
34
|
+
Unknown = 'unknown',
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define how the audio playback should behave to removing the app from recents (killing it). Default is `ContinuePlayback`.
|
|
3
|
+
*/
|
|
4
|
+
export enum AppKilledPlaybackBehavior {
|
|
5
|
+
/**
|
|
6
|
+
* This option will continue playing audio in the background when the app is removed from recents. The notification remains. This is the default.
|
|
7
|
+
*/
|
|
8
|
+
ContinuePlayback = 'continue-playback',
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This option will pause playing audio in the background when the app is removed from recents. The notification remains and can be used to resume playback.
|
|
12
|
+
*/
|
|
13
|
+
PausePlayback = 'pause-playback',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This option will stop playing audio in the background when the app is removed from recents. The notification is removed and can't be used to resume playback. Users would need to open the app again to start playing audio.
|
|
17
|
+
*/
|
|
18
|
+
StopPlaybackAndRemoveNotification = 'stop-playback-and-remove-notification',
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Constants as TrackPlayer} from '../../specs/NativeTrackPlayer';
|
|
2
|
+
|
|
3
|
+
export enum Capability {
|
|
4
|
+
Play = TrackPlayer.CAPABILITY_PLAY,
|
|
5
|
+
PlayFromId = TrackPlayer.CAPABILITY_PLAY_FROM_ID,
|
|
6
|
+
PlayFromSearch = TrackPlayer.CAPABILITY_PLAY_FROM_SEARCH,
|
|
7
|
+
Pause = TrackPlayer.CAPABILITY_PAUSE,
|
|
8
|
+
Stop = TrackPlayer.CAPABILITY_STOP,
|
|
9
|
+
SeekTo = TrackPlayer.CAPABILITY_SEEK_TO,
|
|
10
|
+
Skip = TrackPlayer.CAPABILITY_SKIP,
|
|
11
|
+
SkipToNext = TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
|
|
12
|
+
SkipToPrevious = TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
|
|
13
|
+
JumpForward = TrackPlayer.CAPABILITY_JUMP_FORWARD,
|
|
14
|
+
JumpBackward = TrackPlayer.CAPABILITY_JUMP_BACKWARD,
|
|
15
|
+
SetRating = TrackPlayer.CAPABILITY_SET_RATING,
|
|
16
|
+
Like = TrackPlayer.CAPABILITY_LIKE,
|
|
17
|
+
Dislike = TrackPlayer.CAPABILITY_DISLIKE,
|
|
18
|
+
Bookmark = TrackPlayer.CAPABILITY_BOOKMARK,
|
|
19
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export enum Event {
|
|
2
|
+
PlayerError = 'player-error',
|
|
3
|
+
|
|
4
|
+
/** Fired when the state of the player changes. */
|
|
5
|
+
PlaybackState = 'playback-state',
|
|
6
|
+
/** Fired when a playback error occurs. */
|
|
7
|
+
PlaybackError = 'playback-error',
|
|
8
|
+
/** (Android Only) Fired when animated volume completed changing. */
|
|
9
|
+
PlaybackAnimatedVolumeChanged = 'playback-animated-volume-changed',
|
|
10
|
+
/** Fired after playback has paused due to the queue having reached the end. */
|
|
11
|
+
PlaybackQueueEnded = 'playback-queue-ended',
|
|
12
|
+
/**
|
|
13
|
+
* Fired when another track has become active or when there no longer is an
|
|
14
|
+
* active track.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated use `playback-active-track-changed` instead.
|
|
17
|
+
**/
|
|
18
|
+
PlaybackTrackChanged = 'playback-track-changed',
|
|
19
|
+
/**
|
|
20
|
+
* Fired when another track has become active or when there no longer is an
|
|
21
|
+
* active track.
|
|
22
|
+
**/
|
|
23
|
+
PlaybackActiveTrackChanged = 'playback-active-track-changed',
|
|
24
|
+
/**
|
|
25
|
+
* Fired when the current track receives metadata encoded in. (e.g. ID3 tags,
|
|
26
|
+
* Icy Metadata, Vorbis Comments or QuickTime metadata).
|
|
27
|
+
* @deprecated use `AudioChapterMetadataReceived, AudioTimedMetadataReceived, AudioCommonMetadataReceived` instead.
|
|
28
|
+
**/
|
|
29
|
+
PlaybackMetadataReceived = 'playback-metadata-received',
|
|
30
|
+
/**
|
|
31
|
+
* Fired when playback play when ready has changed.
|
|
32
|
+
**/
|
|
33
|
+
PlaybackPlayWhenReadyChanged = 'playback-play-when-ready-changed',
|
|
34
|
+
/**
|
|
35
|
+
* Fired when playback progress has been updated.
|
|
36
|
+
* See https://rntp.dev/docs/api/events#playbackprogressupdated
|
|
37
|
+
**/
|
|
38
|
+
PlaybackProgressUpdated = 'playback-progress-updated',
|
|
39
|
+
/**
|
|
40
|
+
* Android media3 playback resumption. most likely require a
|
|
41
|
+
* headless setup.
|
|
42
|
+
*/
|
|
43
|
+
PlaybackResume = 'playback-resume-android',
|
|
44
|
+
/**
|
|
45
|
+
* Fired when the user presses the play button.
|
|
46
|
+
* See https://rntp.dev/docs/api/events#remoteplay
|
|
47
|
+
**/
|
|
48
|
+
RemotePlay = 'remote-play',
|
|
49
|
+
/**
|
|
50
|
+
* Fired when the user presses the play/pause button.
|
|
51
|
+
**/
|
|
52
|
+
RemotePlayPause = 'remote-play-pause',
|
|
53
|
+
/**
|
|
54
|
+
* Fired when the user presses the pause button.
|
|
55
|
+
* See https://rntp.dev/docs/api/events#remotepause
|
|
56
|
+
**/
|
|
57
|
+
RemotePause = 'remote-pause',
|
|
58
|
+
/**
|
|
59
|
+
* Fired when the user presses the stop button.
|
|
60
|
+
* See https://rntp.dev/docs/api/events#remotestop
|
|
61
|
+
**/
|
|
62
|
+
RemoteStop = 'remote-stop',
|
|
63
|
+
/**
|
|
64
|
+
* Fired when the user presses the next track button.
|
|
65
|
+
* See https://rntp.dev/docs/api/events#remotenext
|
|
66
|
+
**/
|
|
67
|
+
RemoteNext = 'remote-next',
|
|
68
|
+
/**
|
|
69
|
+
* Fired when the user presses the previous track button.
|
|
70
|
+
* See https://rntp.dev/docs/api/events#remoteprevious
|
|
71
|
+
**/
|
|
72
|
+
RemotePrevious = 'remote-previous',
|
|
73
|
+
/**
|
|
74
|
+
* Fired when the user presses the jump forward button.
|
|
75
|
+
* See https://rntp.dev/docs/api/events#remotejumpforward
|
|
76
|
+
**/
|
|
77
|
+
RemoteJumpForward = 'remote-jump-forward',
|
|
78
|
+
/**
|
|
79
|
+
* Fired when the user presses the jump backward button.
|
|
80
|
+
* See https://rntp.dev/docs/api/events#remotejumpbackward
|
|
81
|
+
**/
|
|
82
|
+
RemoteJumpBackward = 'remote-jump-backward',
|
|
83
|
+
/**
|
|
84
|
+
* Fired when the user changes the position of the timeline.
|
|
85
|
+
* See https://rntp.dev/docs/api/events#remoteseek
|
|
86
|
+
**/
|
|
87
|
+
RemoteSeek = 'remote-seek',
|
|
88
|
+
/**
|
|
89
|
+
* Fired when the user changes the rating for the track remotely.
|
|
90
|
+
* See https://rntp.dev/docs/api/events#remotesetrating
|
|
91
|
+
**/
|
|
92
|
+
RemoteSetRating = 'remote-set-rating',
|
|
93
|
+
/**
|
|
94
|
+
* Fired when the app needs to handle an audio interruption.
|
|
95
|
+
* See https://rntp.dev/docs/api/events#remoteduck
|
|
96
|
+
**/
|
|
97
|
+
RemoteDuck = 'remote-duck',
|
|
98
|
+
/**
|
|
99
|
+
* (iOS only) Fired when the user presses the like button in the now playing
|
|
100
|
+
* center.
|
|
101
|
+
* See https://rntp.dev/docs/api/events#remotelike-ios-only
|
|
102
|
+
**/
|
|
103
|
+
RemoteLike = 'remote-like',
|
|
104
|
+
/**
|
|
105
|
+
* (iOS only) Fired when the user presses the dislike button in the now playing
|
|
106
|
+
* center.
|
|
107
|
+
* See https://rntp.dev/docs/api/events#remotedislike-ios-only
|
|
108
|
+
**/
|
|
109
|
+
RemoteDislike = 'remote-dislike',
|
|
110
|
+
/** (iOS only) Fired when the user presses the bookmark button in the now
|
|
111
|
+
* playing center.
|
|
112
|
+
* See https://rntp.dev/docs/api/events#remotebookmark-ios-only
|
|
113
|
+
**/
|
|
114
|
+
RemoteBookmark = 'remote-bookmark',
|
|
115
|
+
/**
|
|
116
|
+
* (Android only) Fired when the user selects a track from an external device.
|
|
117
|
+
* See https://rntp.dev/docs/api/events#remoteplayid
|
|
118
|
+
**/
|
|
119
|
+
RemotePlayId = 'remote-play-id',
|
|
120
|
+
/**
|
|
121
|
+
* (Android only) Fired when the user searches for a track (usually voice search).
|
|
122
|
+
* See https://rntp.dev/docs/api/events#remoteplaysearch
|
|
123
|
+
**/
|
|
124
|
+
RemotePlaySearch = 'remote-play-search',
|
|
125
|
+
/**
|
|
126
|
+
* (Android only) Fired when the user presses the skip button.
|
|
127
|
+
* See https://rntp.dev/docs/api/events#remoteskip
|
|
128
|
+
**/
|
|
129
|
+
RemoteSkip = 'remote-skip',
|
|
130
|
+
/**
|
|
131
|
+
* (Android only) Fired when the user enters a browsable children in android auto.
|
|
132
|
+
* See https://rntp.dev/docs/api/events#remoteBrowse
|
|
133
|
+
**/
|
|
134
|
+
RemoteBrowse = 'remote-browse',
|
|
135
|
+
/**
|
|
136
|
+
* (Android only) Fired when a custom action button is pressed.
|
|
137
|
+
* See https://rntp.dev/docs/api/events#remoteCustomAction
|
|
138
|
+
**/
|
|
139
|
+
RemoteCustomAction = 'remote-custom-action',
|
|
140
|
+
/** (iOS only) Fired when chapter metadata is received.
|
|
141
|
+
* See https://rntp.dev/docs/api/events#chaptermetadatareceived
|
|
142
|
+
**/
|
|
143
|
+
MetadataChapterReceived = 'metadata-chapter-received',
|
|
144
|
+
/**
|
|
145
|
+
* Fired when metadata is received at a specific time in the audio.
|
|
146
|
+
* See https://rntp.dev/docs/api/events#timedmetadatareceived
|
|
147
|
+
**/
|
|
148
|
+
MetadataTimedReceived = 'metadata-timed-received',
|
|
149
|
+
/**
|
|
150
|
+
* Fired when common (static) metadata is received.
|
|
151
|
+
* See https://rntp.dev/docs/api/events#commonmetadatareceived
|
|
152
|
+
**/
|
|
153
|
+
MetadataCommonReceived = 'metadata-common-received',
|
|
154
|
+
/**
|
|
155
|
+
* Fired when an android connector connects to MusicService.
|
|
156
|
+
* typical controllers are media notification and Android Auto.
|
|
157
|
+
**/
|
|
158
|
+
connectorConnected = 'android-controller-connected',
|
|
159
|
+
/**
|
|
160
|
+
* Fired when an android connector connects to MusicService.
|
|
161
|
+
* typical controllers are media notification and Android Auto.
|
|
162
|
+
**/
|
|
163
|
+
connectorDisconnected = 'android-controller-disconnected',
|
|
164
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export enum IOSCategory {
|
|
2
|
+
/**
|
|
3
|
+
* The category for playing recorded music or other sounds that are central
|
|
4
|
+
* to the successful use of your app.
|
|
5
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback
|
|
6
|
+
**/
|
|
7
|
+
Playback = 'playback',
|
|
8
|
+
/**
|
|
9
|
+
* The category for recording (input) and playback (output) of audio, such as
|
|
10
|
+
* for a Voice over Internet Protocol (VoIP) app.
|
|
11
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord
|
|
12
|
+
**/
|
|
13
|
+
PlayAndRecord = 'playAndRecord',
|
|
14
|
+
/**
|
|
15
|
+
* The category for routing distinct streams of audio data to different
|
|
16
|
+
* output devices at the same time.
|
|
17
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute
|
|
18
|
+
**/
|
|
19
|
+
MultiRoute = 'multiRoute',
|
|
20
|
+
/**
|
|
21
|
+
* The category for an app in which sound playback is nonprimary — that is,
|
|
22
|
+
* your app also works with the sound turned off.
|
|
23
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient
|
|
24
|
+
**/
|
|
25
|
+
Ambient = 'ambient',
|
|
26
|
+
/**
|
|
27
|
+
* The default audio session category.
|
|
28
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient
|
|
29
|
+
**/
|
|
30
|
+
SoloAmbient = 'soloAmbient',
|
|
31
|
+
/**
|
|
32
|
+
* The category for recording audio while also silencing playback audio.
|
|
33
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record
|
|
34
|
+
**/
|
|
35
|
+
Record = 'record',
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export enum IOSCategoryMode {
|
|
2
|
+
/**
|
|
3
|
+
* The default audio session mode.
|
|
4
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default
|
|
5
|
+
**/
|
|
6
|
+
Default = 'default',
|
|
7
|
+
/**
|
|
8
|
+
* A mode that the GameKit framework sets on behalf of an application that
|
|
9
|
+
* uses GameKit’s voice chat service.
|
|
10
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat
|
|
11
|
+
**/
|
|
12
|
+
GameChat = 'gameChat',
|
|
13
|
+
/**
|
|
14
|
+
* A mode that indicates that your app is performing measurement of audio
|
|
15
|
+
* input or output.
|
|
16
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement
|
|
17
|
+
**/
|
|
18
|
+
Measurement = 'measurement',
|
|
19
|
+
/** A mode that indicates that your app is playing back movie content.
|
|
20
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback
|
|
21
|
+
**/
|
|
22
|
+
MoviePlayback = 'moviePlayback',
|
|
23
|
+
/** A mode used for continuous spoken audio to pause the audio when another
|
|
24
|
+
* app plays a short audio prompt. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio */
|
|
25
|
+
SpokenAudio = 'spokenAudio',
|
|
26
|
+
/**
|
|
27
|
+
* A mode that indicates that your app is engaging in online video conferencing.
|
|
28
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat
|
|
29
|
+
**/
|
|
30
|
+
VideoChat = 'videoChat',
|
|
31
|
+
/**
|
|
32
|
+
* A mode that indicates that your app is recording a movie.
|
|
33
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording
|
|
34
|
+
**/
|
|
35
|
+
VideoRecording = 'videoRecording',
|
|
36
|
+
/**
|
|
37
|
+
* A mode that indicates that your app is performing two-way voice communication,
|
|
38
|
+
* such as using Voice over Internet Protocol (VoIP).
|
|
39
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat
|
|
40
|
+
**/
|
|
41
|
+
VoiceChat = 'voiceChat',
|
|
42
|
+
/**
|
|
43
|
+
* A mode that indicates that your app plays audio using text-to-speech.
|
|
44
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt
|
|
45
|
+
**/
|
|
46
|
+
VoicePrompt = 'voicePrompt',
|
|
47
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export enum IOSCategoryOptions {
|
|
2
|
+
/**
|
|
3
|
+
* An option that indicates whether audio from this session mixes with audio
|
|
4
|
+
* from active sessions in other audio apps.
|
|
5
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers
|
|
6
|
+
**/
|
|
7
|
+
MixWithOthers = 'mixWithOthers',
|
|
8
|
+
/**
|
|
9
|
+
* An option that reduces the volume of other audio sessions while audio from
|
|
10
|
+
* this session plays.
|
|
11
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers
|
|
12
|
+
**/
|
|
13
|
+
DuckOthers = 'duckOthers',
|
|
14
|
+
/**
|
|
15
|
+
* An option that determines whether to pause spoken audio content from other
|
|
16
|
+
* sessions when your app plays its audio.
|
|
17
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot
|
|
18
|
+
**/
|
|
19
|
+
InterruptSpokenAudioAndMixWithOthers = 'interruptSpokenAudioAndMixWithOthers',
|
|
20
|
+
/**
|
|
21
|
+
* An option that determines whether Bluetooth hands-free devices appear as
|
|
22
|
+
* available input routes.
|
|
23
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth
|
|
24
|
+
**/
|
|
25
|
+
AllowBluetooth = 'allowBluetooth',
|
|
26
|
+
/**
|
|
27
|
+
* An option that determines whether you can stream audio from this session
|
|
28
|
+
* to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).
|
|
29
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp
|
|
30
|
+
**/
|
|
31
|
+
AllowBluetoothA2DP = 'allowBluetoothA2DP',
|
|
32
|
+
/**
|
|
33
|
+
* An option that determines whether you can stream audio from this session
|
|
34
|
+
* to AirPlay devices.
|
|
35
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay
|
|
36
|
+
**/
|
|
37
|
+
AllowAirPlay = 'allowAirPlay',
|
|
38
|
+
/**
|
|
39
|
+
* An option that determines whether audio from the session defaults to the
|
|
40
|
+
* built-in speaker instead of the receiver.
|
|
41
|
+
* See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616462-defaulttospeaker
|
|
42
|
+
**/
|
|
43
|
+
DefaultToSpeaker = 'defaultToSpeaker',
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {Constants as TrackPlayer} from '../../specs/NativeTrackPlayer';
|
|
2
|
+
|
|
3
|
+
export enum PitchAlgorithm {
|
|
4
|
+
/**
|
|
5
|
+
* A high-quality time pitch algorithm that doesn’t perform pitch correction.
|
|
6
|
+
* */
|
|
7
|
+
Linear = TrackPlayer.PITCH_ALGORITHM_LINEAR,
|
|
8
|
+
/**
|
|
9
|
+
* A highest-quality time pitch algorithm that’s suitable for music.
|
|
10
|
+
**/
|
|
11
|
+
Music = TrackPlayer.PITCH_ALGORITHM_MUSIC,
|
|
12
|
+
/**
|
|
13
|
+
* A modest quality time pitch algorithm that’s suitable for voice.
|
|
14
|
+
**/
|
|
15
|
+
Voice = TrackPlayer.PITCH_ALGORITHM_VOICE,
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Constants as TrackPlayer} from '../../specs/NativeTrackPlayer';
|
|
2
|
+
|
|
3
|
+
export enum RatingType {
|
|
4
|
+
Heart = TrackPlayer.RATING_HEART,
|
|
5
|
+
ThumbsUpDown = TrackPlayer.RATING_THUMBS_UP_DOWN,
|
|
6
|
+
ThreeStars = TrackPlayer.RATING_3_STARS,
|
|
7
|
+
FourStars = TrackPlayer.RATING_4_STARS,
|
|
8
|
+
FiveStars = TrackPlayer.RATING_5_STARS,
|
|
9
|
+
Percentage = TrackPlayer.RATING_PERCENTAGE,
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Constants as TrackPlayer} from '../../specs/NativeTrackPlayer';
|
|
2
|
+
|
|
3
|
+
export enum RepeatMode {
|
|
4
|
+
/** Playback stops when the last track in the queue has finished playing. */
|
|
5
|
+
Off = TrackPlayer.REPEAT_OFF,
|
|
6
|
+
/** Repeats the current track infinitely during ongoing playback. */
|
|
7
|
+
Track = TrackPlayer.REPEAT_TRACK,
|
|
8
|
+
/** Repeats the entire queue infinitely. */
|
|
9
|
+
Queue = TrackPlayer.REPEAT_QUEUE,
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export enum State {
|
|
2
|
+
/** Indicates that no media is currently loaded */
|
|
3
|
+
None = 'none',
|
|
4
|
+
/** Indicates that the player is paused, but ready to start playing */
|
|
5
|
+
Ready = 'ready',
|
|
6
|
+
/** Indicates that the player is currently playing */
|
|
7
|
+
Playing = 'playing',
|
|
8
|
+
/** Indicates that the player is currently paused */
|
|
9
|
+
Paused = 'paused',
|
|
10
|
+
/** Indicates that the player is currently stopped */
|
|
11
|
+
Stopped = 'stopped',
|
|
12
|
+
/** Indicates that the initial load of the item is occurring. */
|
|
13
|
+
Loading = 'loading',
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `State.Loading` instead.
|
|
16
|
+
**/
|
|
17
|
+
Connecting = 'loading',
|
|
18
|
+
/**
|
|
19
|
+
* Indicates that the player is currently loading more data before it can
|
|
20
|
+
* continue playing or is ready to start playing.
|
|
21
|
+
*/
|
|
22
|
+
Buffering = 'buffering',
|
|
23
|
+
/**
|
|
24
|
+
* Indicates that playback of the current item failed. Call `TrackPlayer.getError()`
|
|
25
|
+
* to get more information on the type of error that occurred.
|
|
26
|
+
* Call `TrackPlayer.retry()` or `TrackPlayer.play()` to try to play the item
|
|
27
|
+
* again.
|
|
28
|
+
*/
|
|
29
|
+
Error = 'error',
|
|
30
|
+
/**
|
|
31
|
+
* Indicates that playback stopped due to the end of the queue being reached.
|
|
32
|
+
*/
|
|
33
|
+
Ended = 'ended',
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './AndroidAudioContentType';
|
|
2
|
+
export * from './AndroidAutoContentStyle';
|
|
3
|
+
export * from './AppKilledPlaybackBehavior';
|
|
4
|
+
export * from './Capability';
|
|
5
|
+
export * from './Event';
|
|
6
|
+
export * from './IOSCategory';
|
|
7
|
+
export * from './IOSCategoryMode';
|
|
8
|
+
export * from './IOSCategoryOptions';
|
|
9
|
+
export * from './PitchAlgorithm';
|
|
10
|
+
export * from './RatingType';
|
|
11
|
+
export * from './RepeatMode';
|
|
12
|
+
export * from './State';
|
|
13
|
+
export * from './TrackType';
|
|
14
|
+
export * from './MediaItemPlayable';
|