@javascriptcommon/react-native-track-player 1.2.23 → 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 +80 -63
- package/android/proguard-rules.txt +0 -3
- package/android/src/main/AndroidManifest.xml +10 -11
- 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/{guichaguri → doublesymmetry}/trackplayer/extensions/AudioPlayerStateExt.kt +3 -3
- 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/{guichaguri → doublesymmetry}/trackplayer/model/MetadataAdapter.kt +20 -17
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/NowPlayingMetadata.kt +16 -0
- package/android/src/main/java/com/{guichaguri/trackplayer/kotlinaudio/models → doublesymmetry/trackplayer/model}/PlaybackMetadata.kt +31 -28
- package/android/src/main/java/com/{guichaguri → doublesymmetry}/trackplayer/model/State.kt +1 -1
- 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/{guichaguri → doublesymmetry}/trackplayer/module/MusicEvents.kt +10 -9
- 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/{guichaguri/trackplayer/service → doublesymmetry/trackplayer/utils}/BundleUtils.kt +50 -20
- 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/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/event/EventHolder.kt +7 -7
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/event/PlayerEventHolder.kt +22 -9
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/AudioContentType.kt +1 -1
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioItem.kt +118 -0
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/AudioItemTransitionReason.kt +3 -3
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/AudioPlayerState.kt +2 -2
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/BufferConfig.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/CacheConfig.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/Capability.kt +1 -1
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/CustomButton.kt +19 -0
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/FocusChangeData.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/MediaSessionCallback.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/PlayWhenReadyChangeData.kt +1 -3
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/PlaybackEndedReason.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/PlaybackError.kt +1 -1
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/PlayerConfig.kt +8 -5
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/PlayerOptions.kt +40 -0
- package/android/src/main/java/com/{guichaguri/trackplayer → lovegaoshi}/kotlinaudio/models/PositionChangedReason.kt +1 -1
- 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/{guichaguri/trackplayer/kotlinaudio/players → lovegaoshi/kotlinaudio/player}/QueuedAudioPlayer.kt +68 -58
- 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 +3 -4
- 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/ic_home-playstore.png +0 -0
- package/android/src/main/ic_repeat-playstore.png +0 -0
- package/android/src/main/ic_repeat_50-playstore.png +0 -0
- package/android/src/main/ic_shuffle-playstore.png +0 -0
- package/android/src/main/ic_shuffle_50-playstore.png +0 -0
- package/android/src/main/ic_shuffle_sm-playstore.png +0 -0
- package/android/src/main/ic_stop-playstore.png +0 -0
- package/android/src/main/ic_test-playstore.png +0 -0
- package/android/src/main/java/com/guichaguri/trackplayer/HeadlessJsMediaService.java +0 -225
- package/android/src/main/java/com/guichaguri/trackplayer/TrackPlayer.kt +0 -25
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/event/NotificationEventHolder.kt +0 -20
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/AAMediaSessionCallback.kt +0 -10
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/AudioItem.kt +0 -66
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/NotificationConfig.kt +0 -43
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/NotificationMetadata.kt +0 -8
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/NotificationState.kt +0 -8
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/PlayerOptions.kt +0 -9
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/models/QueuedPlayerOptions.kt +0 -49
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/notification/NotificationManager.kt +0 -678
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/players/AudioPlayer.kt +0 -10
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/players/BaseAudioPlayer.kt +0 -864
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/players/components/MediaSourceExt.kt +0 -35
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/players/components/PlayerCache.kt +0 -26
- package/android/src/main/java/com/guichaguri/trackplayer/kotlinaudio/utils/Utils.kt +0 -12
- package/android/src/main/java/com/guichaguri/trackplayer/model/Track.kt +0 -120
- package/android/src/main/java/com/guichaguri/trackplayer/model/TrackAudioItem.kt +0 -19
- package/android/src/main/java/com/guichaguri/trackplayer/model/TrackType.kt +0 -11
- package/android/src/main/java/com/guichaguri/trackplayer/module/AutoConnectionDetector.kt +0 -151
- package/android/src/main/java/com/guichaguri/trackplayer/module/MusicModule.kt +0 -1177
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicBinder.kt +0 -31
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicManager.kt +0 -347
- package/android/src/main/java/com/guichaguri/trackplayer/service/MusicService.kt +0 -1254
- package/android/src/main/java/com/guichaguri/trackplayer/service/Utils.kt +0 -228
- package/android/src/main/java/com/guichaguri/trackplayer/service/metadata/ButtonEvents.kt +0 -141
- package/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.kt +0 -396
- package/android/src/main/res/drawable-hdpi/ic_forward.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_home.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_home.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_home.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_home.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_home.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/android/src/main/res/mipmap-hdpi/ic_arrow_down_circle_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_clock_now_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_close_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_heart_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_heart_outlined_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_repeat_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_repeat_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_shuffle_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_shuffle_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_arrow_down_circle_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_clock_now_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_close_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_heart_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_heart_outlined_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_repeat_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_repeat_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_shuffle_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_shuffle_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_arrow_down_circle_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_clock_now_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_close_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_heart_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_heart_outlined_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_repeat_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_repeat_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_shuffle_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_shuffle_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_arrow_down_circle_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_clock_now_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_close_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_heart_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_heart_outlined_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_repeat_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_repeat_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_shuffle_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_shuffle_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_arrow_down_circle_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_clock_now_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_close_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_heart_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_heart_outlined_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_repeat_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_repeat_on_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_shuffle_off_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_shuffle_on_foreground.png +0 -0
- package/android/src/main/res/raw/silent_5_seconds.mp3 +0 -0
- package/android/src/main/res/strings.xml +0 -6
- package/index.d.ts +0 -235
- 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 -178
- /package/ios/{TrackPlayer.xcodeproj → Example/SwiftAudio.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
|
@@ -0,0 +1,1124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 The Android Open Source Project
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
package com.lovegaoshi.kotlinaudio.player;
|
|
17
|
+
|
|
18
|
+
import android.os.Looper;
|
|
19
|
+
import android.view.Surface;
|
|
20
|
+
import android.view.SurfaceHolder;
|
|
21
|
+
import android.view.SurfaceView;
|
|
22
|
+
import android.view.TextureView;
|
|
23
|
+
import androidx.annotation.Nullable;
|
|
24
|
+
import androidx.media3.common.AudioAttributes;
|
|
25
|
+
import androidx.media3.common.C;
|
|
26
|
+
import androidx.media3.common.DeviceInfo;
|
|
27
|
+
import androidx.media3.common.MediaItem;
|
|
28
|
+
import androidx.media3.common.MediaMetadata;
|
|
29
|
+
import androidx.media3.common.Metadata;
|
|
30
|
+
import androidx.media3.common.PlaybackException;
|
|
31
|
+
import androidx.media3.common.PlaybackParameters;
|
|
32
|
+
import androidx.media3.common.Player;
|
|
33
|
+
import androidx.media3.common.Timeline;
|
|
34
|
+
import androidx.media3.common.TrackSelectionParameters;
|
|
35
|
+
import androidx.media3.common.Tracks;
|
|
36
|
+
import androidx.media3.common.VideoSize;
|
|
37
|
+
import androidx.media3.common.text.Cue;
|
|
38
|
+
import androidx.media3.common.text.CueGroup;
|
|
39
|
+
import androidx.media3.common.util.Size;
|
|
40
|
+
import androidx.media3.common.util.UnstableApi;
|
|
41
|
+
|
|
42
|
+
import java.util.ArrayList;
|
|
43
|
+
import java.util.List;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A {@link Player} that forwards method calls to another {@link Player}. Applications can use this
|
|
47
|
+
* class to suppress or modify specific operations, by overriding the respective methods.
|
|
48
|
+
* implements 2 exoplayers that enables crossfading. For maintenance, update as media3's Forwarding
|
|
49
|
+
* Player does.
|
|
50
|
+
*/
|
|
51
|
+
@UnstableApi
|
|
52
|
+
public class ForwardingPlayer implements Player {
|
|
53
|
+
|
|
54
|
+
private final Player player1;
|
|
55
|
+
private final Player player2;
|
|
56
|
+
public Player player;
|
|
57
|
+
private boolean currentPlayer = true;
|
|
58
|
+
ArrayList<Listener> listeners = new ArrayList<>();
|
|
59
|
+
|
|
60
|
+
public void broadcastMediaItem() {
|
|
61
|
+
MediaItem currentMediaItem = player.getCurrentMediaItem();
|
|
62
|
+
if (currentMediaItem != null) {
|
|
63
|
+
// force trigger mediaEventChanged event
|
|
64
|
+
player.replaceMediaItem(
|
|
65
|
+
player.getCurrentMediaItemIndex(),
|
|
66
|
+
currentMediaItem
|
|
67
|
+
.buildUpon()
|
|
68
|
+
.setMediaMetadata(
|
|
69
|
+
currentMediaItem
|
|
70
|
+
.mediaMetadata
|
|
71
|
+
.buildUpon()
|
|
72
|
+
// use a deprecated field hoping noone will use
|
|
73
|
+
.setYear(currentMediaItem.hashCode())
|
|
74
|
+
.build()
|
|
75
|
+
).build()
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public Player switchCrossFadePlayer() {
|
|
81
|
+
Player prevPlayer = currentPlayer ? player1 : player2;
|
|
82
|
+
Player nextPlayer = currentPlayer ? player2 : player1;
|
|
83
|
+
|
|
84
|
+
for (Listener listener : listeners) {
|
|
85
|
+
prevPlayer.removeListener(new ForwardingListener(this, listener));
|
|
86
|
+
nextPlayer.addListener(new ForwardingListener(this, listener));
|
|
87
|
+
}
|
|
88
|
+
this.player = nextPlayer;
|
|
89
|
+
broadcastMediaItem();
|
|
90
|
+
currentPlayer = !currentPlayer;
|
|
91
|
+
return this.player;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Creates a new instance that forwards all operations to {@code player}. */
|
|
95
|
+
public ForwardingPlayer(Player player1, Player player2) {
|
|
96
|
+
this.player1 = player1;
|
|
97
|
+
this.player2 = player2;
|
|
98
|
+
this.player = player1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Calls {@link Player#getApplicationLooper()} on the delegate and returns the result. */
|
|
102
|
+
@Override
|
|
103
|
+
public Looper getApplicationLooper() {
|
|
104
|
+
return player.getApplicationLooper();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Calls {@link Player#addListener(Listener)} on the delegate.
|
|
109
|
+
*
|
|
110
|
+
* <p>Overrides of this method must <strong>not</strong> directly call {@code
|
|
111
|
+
* delegate.addListener}. If the override wants to pass the {@link Player.Listener} instance to
|
|
112
|
+
* the delegate {@link Player}, it must do so by calling {@code super.addListener} instead. This
|
|
113
|
+
* ensures the correct {@link Player} instance is passed to {@link
|
|
114
|
+
* Player.Listener#onEvents(Player, Events)} (i.e. this forwarding instance, and not the
|
|
115
|
+
* underlying {@code delegate} instance).
|
|
116
|
+
*/
|
|
117
|
+
@Override
|
|
118
|
+
public void addListener(Listener listener) {
|
|
119
|
+
listeners.add(listener);
|
|
120
|
+
player.addListener(new ForwardingListener(this, listener));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Calls {@link Player#removeListener(Listener)} on the delegate.
|
|
125
|
+
*
|
|
126
|
+
* <p>Overrides of this method must <strong>not</strong> directly call {@code
|
|
127
|
+
* delegate.removeListener}. If the override wants to pass the {@link Player.Listener} instance to
|
|
128
|
+
* the delegate {@link Player}, it must do so by calling {@code super.removeListener} instead.
|
|
129
|
+
*/
|
|
130
|
+
@Override
|
|
131
|
+
public void removeListener(Listener listener) {
|
|
132
|
+
listeners.remove(listener);
|
|
133
|
+
player.removeListener(new ForwardingListener(this, listener));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Calls {@link Player#setMediaItems(List)} on the delegate. */
|
|
137
|
+
@Override
|
|
138
|
+
public void setMediaItems(List<MediaItem> mediaItems) {
|
|
139
|
+
player.setMediaItems(mediaItems);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Calls {@link Player#setMediaItems(List, boolean)} ()} on the delegate. */
|
|
143
|
+
@Override
|
|
144
|
+
public void setMediaItems(List<MediaItem> mediaItems, boolean resetPosition) {
|
|
145
|
+
player.setMediaItems(mediaItems, resetPosition);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Calls {@link Player#setMediaItems(List, int, long)} on the delegate. */
|
|
149
|
+
@Override
|
|
150
|
+
public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
|
|
151
|
+
player.setMediaItems(mediaItems, startIndex, startPositionMs);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Calls {@link Player#setMediaItem(MediaItem)} on the delegate. */
|
|
155
|
+
@Override
|
|
156
|
+
public void setMediaItem(MediaItem mediaItem) {
|
|
157
|
+
player.setMediaItem(mediaItem);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Calls {@link Player#setMediaItem(MediaItem, long)} on the delegate. */
|
|
161
|
+
@Override
|
|
162
|
+
public void setMediaItem(MediaItem mediaItem, long startPositionMs) {
|
|
163
|
+
player.setMediaItem(mediaItem, startPositionMs);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Calls {@link Player#setMediaItem(MediaItem, boolean)} on the delegate. */
|
|
167
|
+
@Override
|
|
168
|
+
public void setMediaItem(MediaItem mediaItem, boolean resetPosition) {
|
|
169
|
+
player.setMediaItem(mediaItem, resetPosition);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Calls {@link Player#addMediaItem(MediaItem)} on the delegate. */
|
|
173
|
+
@Override
|
|
174
|
+
public void addMediaItem(MediaItem mediaItem) {
|
|
175
|
+
player.addMediaItem(mediaItem);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Calls {@link Player#addMediaItem(int, MediaItem)} on the delegate. */
|
|
179
|
+
@Override
|
|
180
|
+
public void addMediaItem(int index, MediaItem mediaItem) {
|
|
181
|
+
player.addMediaItem(index, mediaItem);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Calls {@link Player#addMediaItems(List)} on the delegate. */
|
|
185
|
+
@Override
|
|
186
|
+
public void addMediaItems(List<MediaItem> mediaItems) {
|
|
187
|
+
player.addMediaItems(mediaItems);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Calls {@link Player#addMediaItems(int, List)} on the delegate. */
|
|
191
|
+
@Override
|
|
192
|
+
public void addMediaItems(int index, List<MediaItem> mediaItems) {
|
|
193
|
+
player.addMediaItems(index, mediaItems);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Calls {@link Player#moveMediaItem(int, int)} on the delegate. */
|
|
197
|
+
@Override
|
|
198
|
+
public void moveMediaItem(int currentIndex, int newIndex) {
|
|
199
|
+
player.moveMediaItem(currentIndex, newIndex);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Calls {@link Player#moveMediaItems(int, int, int)} on the delegate. */
|
|
203
|
+
@Override
|
|
204
|
+
public void moveMediaItems(int fromIndex, int toIndex, int newIndex) {
|
|
205
|
+
player.moveMediaItems(fromIndex, toIndex, newIndex);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Calls {@link Player#replaceMediaItem(int, MediaItem)} on the delegate. */
|
|
209
|
+
@Override
|
|
210
|
+
public void replaceMediaItem(int index, MediaItem mediaItem) {
|
|
211
|
+
player.replaceMediaItem(index, mediaItem);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Calls {@link Player#replaceMediaItems(int, int, List)} on the delegate. */
|
|
215
|
+
@Override
|
|
216
|
+
public void replaceMediaItems(int fromIndex, int toIndex, List<MediaItem> mediaItems) {
|
|
217
|
+
player.replaceMediaItems(fromIndex, toIndex, mediaItems);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Calls {@link Player#removeMediaItem(int)} on the delegate. */
|
|
221
|
+
@Override
|
|
222
|
+
public void removeMediaItem(int index) {
|
|
223
|
+
player.removeMediaItem(index);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Calls {@link Player#removeMediaItems(int, int)} on the delegate. */
|
|
227
|
+
@Override
|
|
228
|
+
public void removeMediaItems(int fromIndex, int toIndex) {
|
|
229
|
+
player.removeMediaItems(fromIndex, toIndex);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Calls {@link Player#clearMediaItems()} on the delegate. */
|
|
233
|
+
@Override
|
|
234
|
+
public void clearMediaItems() {
|
|
235
|
+
player.clearMediaItems();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Calls {@link Player#isCommandAvailable(int)} on the delegate and returns the result. */
|
|
239
|
+
@Override
|
|
240
|
+
public boolean isCommandAvailable(@Command int command) {
|
|
241
|
+
return player.isCommandAvailable(command);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Calls {@link Player#canAdvertiseSession()} on the delegate and returns the result. */
|
|
245
|
+
@Override
|
|
246
|
+
public boolean canAdvertiseSession() {
|
|
247
|
+
return player.canAdvertiseSession();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Calls {@link Player#getAvailableCommands()} on the delegate and returns the result. */
|
|
251
|
+
@Override
|
|
252
|
+
public Commands getAvailableCommands() {
|
|
253
|
+
return player.getAvailableCommands();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Calls {@link Player#prepare()} on the delegate. */
|
|
257
|
+
@Override
|
|
258
|
+
public void prepare() {
|
|
259
|
+
player.prepare();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Calls {@link Player#getPlaybackState()} on the delegate and returns the result. */
|
|
263
|
+
@Override
|
|
264
|
+
public int getPlaybackState() {
|
|
265
|
+
return player.getPlaybackState();
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Calls {@link Player#getPlaybackSuppressionReason()} on the delegate and returns the result. */
|
|
269
|
+
@Override
|
|
270
|
+
public int getPlaybackSuppressionReason() {
|
|
271
|
+
return player.getPlaybackSuppressionReason();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Calls {@link Player#isPlaying()} on the delegate and returns the result. */
|
|
275
|
+
@Override
|
|
276
|
+
public boolean isPlaying() {
|
|
277
|
+
return player.isPlaying();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** Calls {@link Player#getPlayerError()} on the delegate and returns the result. */
|
|
281
|
+
@Nullable
|
|
282
|
+
@Override
|
|
283
|
+
public PlaybackException getPlayerError() {
|
|
284
|
+
return player.getPlayerError();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Calls {@link Player#play()} on the delegate. */
|
|
288
|
+
@Override
|
|
289
|
+
public void play() {
|
|
290
|
+
player.play();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Calls {@link Player#pause()} on the delegate. */
|
|
294
|
+
@Override
|
|
295
|
+
public void pause() {
|
|
296
|
+
player.pause();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** Calls {@link Player#setPlayWhenReady(boolean)} on the delegate. */
|
|
300
|
+
@Override
|
|
301
|
+
public void setPlayWhenReady(boolean playWhenReady) {
|
|
302
|
+
player.setPlayWhenReady(playWhenReady);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Calls {@link Player#getPlayWhenReady()} on the delegate and returns the result. */
|
|
306
|
+
@Override
|
|
307
|
+
public boolean getPlayWhenReady() {
|
|
308
|
+
return player.getPlayWhenReady();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Calls {@link Player#setRepeatMode(int)} on the delegate. */
|
|
312
|
+
@Override
|
|
313
|
+
public void setRepeatMode(@RepeatMode int repeatMode) {
|
|
314
|
+
player.setRepeatMode(repeatMode);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Calls {@link Player#getRepeatMode()} on the delegate and returns the result. */
|
|
318
|
+
@Override
|
|
319
|
+
public int getRepeatMode() {
|
|
320
|
+
return player.getRepeatMode();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/** Calls {@link Player#setShuffleModeEnabled(boolean)} on the delegate. */
|
|
324
|
+
@Override
|
|
325
|
+
public void setShuffleModeEnabled(boolean shuffleModeEnabled) {
|
|
326
|
+
player.setShuffleModeEnabled(shuffleModeEnabled);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Calls {@link Player#getShuffleModeEnabled()} on the delegate and returns the result. */
|
|
330
|
+
@Override
|
|
331
|
+
public boolean getShuffleModeEnabled() {
|
|
332
|
+
return player.getShuffleModeEnabled();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Calls {@link Player#isLoading()} on the delegate and returns the result. */
|
|
336
|
+
@Override
|
|
337
|
+
public boolean isLoading() {
|
|
338
|
+
return player.isLoading();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Calls {@link Player#seekToDefaultPosition()} on the delegate. */
|
|
342
|
+
@Override
|
|
343
|
+
public void seekToDefaultPosition() {
|
|
344
|
+
player.seekToDefaultPosition();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** Calls {@link Player#seekToDefaultPosition(int)} on the delegate. */
|
|
348
|
+
@Override
|
|
349
|
+
public void seekToDefaultPosition(int mediaItemIndex) {
|
|
350
|
+
player.seekToDefaultPosition(mediaItemIndex);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** Calls {@link Player#seekTo(long)} on the delegate. */
|
|
354
|
+
@Override
|
|
355
|
+
public void seekTo(long positionMs) {
|
|
356
|
+
player.seekTo(positionMs);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/** Calls {@link Player#seekTo(int, long)} on the delegate. */
|
|
360
|
+
@Override
|
|
361
|
+
public void seekTo(int mediaItemIndex, long positionMs) {
|
|
362
|
+
player.seekTo(mediaItemIndex, positionMs);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Calls {@link Player#getSeekBackIncrement()} on the delegate and returns the result. */
|
|
366
|
+
@Override
|
|
367
|
+
public long getSeekBackIncrement() {
|
|
368
|
+
return player.getSeekBackIncrement();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** Calls {@link Player#seekBack()} on the delegate. */
|
|
372
|
+
@Override
|
|
373
|
+
public void seekBack() {
|
|
374
|
+
player.seekBack();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Calls {@link Player#getSeekForwardIncrement()} on the delegate and returns the result. */
|
|
378
|
+
@Override
|
|
379
|
+
public long getSeekForwardIncrement() {
|
|
380
|
+
return player.getSeekForwardIncrement();
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** Calls {@link Player#seekForward()} on the delegate. */
|
|
384
|
+
@Override
|
|
385
|
+
public void seekForward() {
|
|
386
|
+
player.seekForward();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Calls {@link Player#hasPreviousMediaItem()} on the delegate and returns the result. */
|
|
390
|
+
@Override
|
|
391
|
+
public boolean hasPreviousMediaItem() {
|
|
392
|
+
return player.hasPreviousMediaItem();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** Calls {@link Player#seekToPreviousMediaItem()} on the delegate. */
|
|
396
|
+
@Override
|
|
397
|
+
public void seekToPreviousMediaItem() {
|
|
398
|
+
player.seekToPreviousMediaItem();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** Calls {@link Player#seekToPrevious()} on the delegate. */
|
|
402
|
+
@Override
|
|
403
|
+
public void seekToPrevious() {
|
|
404
|
+
player.seekToPrevious();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** Calls {@link Player#getMaxSeekToPreviousPosition()} on the delegate and returns the result. */
|
|
408
|
+
@Override
|
|
409
|
+
public long getMaxSeekToPreviousPosition() {
|
|
410
|
+
return player.getMaxSeekToPreviousPosition();
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** Calls {@link Player#hasNextMediaItem()} on the delegate and returns the result. */
|
|
414
|
+
@Override
|
|
415
|
+
public boolean hasNextMediaItem() {
|
|
416
|
+
return player.hasNextMediaItem();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** Calls {@link Player#seekToNextMediaItem()} on the delegate. */
|
|
420
|
+
@Override
|
|
421
|
+
public void seekToNextMediaItem() {
|
|
422
|
+
player.seekToNextMediaItem();
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** Calls {@link Player#seekToNext()} on the delegate. */
|
|
426
|
+
@Override
|
|
427
|
+
public void seekToNext() {
|
|
428
|
+
player.seekToNext();
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/** Calls {@link Player#setPlaybackParameters(PlaybackParameters)} on the delegate. */
|
|
432
|
+
@Override
|
|
433
|
+
public void setPlaybackParameters(PlaybackParameters playbackParameters) {
|
|
434
|
+
player.setPlaybackParameters(playbackParameters);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** Calls {@link Player#setPlaybackSpeed(float)} on the delegate. */
|
|
438
|
+
@Override
|
|
439
|
+
public void setPlaybackSpeed(float speed) {
|
|
440
|
+
player.setPlaybackSpeed(speed);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** Calls {@link Player#getPlaybackParameters()} on the delegate and returns the result. */
|
|
444
|
+
@Override
|
|
445
|
+
public PlaybackParameters getPlaybackParameters() {
|
|
446
|
+
return player.getPlaybackParameters();
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Calls {@link Player#stop()} on the delegate. */
|
|
450
|
+
@Override
|
|
451
|
+
public void stop() {
|
|
452
|
+
player.stop();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/** Calls {@link Player#release()} on the delegate. */
|
|
456
|
+
@Override
|
|
457
|
+
public void release() {
|
|
458
|
+
player.release();
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** Calls {@link Player#getCurrentTracks()} on the delegate and returns the result. */
|
|
462
|
+
@Override
|
|
463
|
+
public Tracks getCurrentTracks() {
|
|
464
|
+
return player.getCurrentTracks();
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Calls {@link Player#getTrackSelectionParameters()} on the delegate and returns the result. */
|
|
468
|
+
@Override
|
|
469
|
+
public TrackSelectionParameters getTrackSelectionParameters() {
|
|
470
|
+
return player.getTrackSelectionParameters();
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** Calls {@link Player#setTrackSelectionParameters(TrackSelectionParameters)} on the delegate. */
|
|
474
|
+
@Override
|
|
475
|
+
public void setTrackSelectionParameters(TrackSelectionParameters parameters) {
|
|
476
|
+
player.setTrackSelectionParameters(parameters);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Calls {@link Player#getMediaMetadata()} on the delegate and returns the result. */
|
|
480
|
+
@Override
|
|
481
|
+
public MediaMetadata getMediaMetadata() {
|
|
482
|
+
return player.getMediaMetadata();
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Calls {@link Player#getPlaylistMetadata()} on the delegate and returns the result. */
|
|
486
|
+
@Override
|
|
487
|
+
public MediaMetadata getPlaylistMetadata() {
|
|
488
|
+
return player.getPlaylistMetadata();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/** Calls {@link Player#setPlaylistMetadata(MediaMetadata)} on the delegate. */
|
|
492
|
+
@Override
|
|
493
|
+
public void setPlaylistMetadata(MediaMetadata mediaMetadata) {
|
|
494
|
+
player.setPlaylistMetadata(mediaMetadata);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** Calls {@link Player#getCurrentManifest()} on the delegate and returns the result. */
|
|
498
|
+
@Nullable
|
|
499
|
+
@Override
|
|
500
|
+
public Object getCurrentManifest() {
|
|
501
|
+
return player.getCurrentManifest();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** Calls {@link Player#getCurrentTimeline()} on the delegate and returns the result. */
|
|
505
|
+
@Override
|
|
506
|
+
public Timeline getCurrentTimeline() {
|
|
507
|
+
return player.getCurrentTimeline();
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Calls {@link Player#getCurrentPeriodIndex()} on the delegate and returns the result. */
|
|
511
|
+
@Override
|
|
512
|
+
public int getCurrentPeriodIndex() {
|
|
513
|
+
return player.getCurrentPeriodIndex();
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Calls {@link Player#getCurrentWindowIndex()} on the delegate and returns the result.
|
|
518
|
+
*
|
|
519
|
+
* @deprecated Use {@link #getCurrentMediaItemIndex()} instead.
|
|
520
|
+
*/
|
|
521
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
522
|
+
@Deprecated
|
|
523
|
+
@Override
|
|
524
|
+
public int getCurrentWindowIndex() {
|
|
525
|
+
return player.getCurrentWindowIndex();
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** Calls {@link Player#getCurrentMediaItemIndex()} on the delegate and returns the result. */
|
|
529
|
+
@Override
|
|
530
|
+
public int getCurrentMediaItemIndex() {
|
|
531
|
+
return player.getCurrentMediaItemIndex();
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Calls {@link Player#getNextWindowIndex()} on the delegate and returns the result.
|
|
536
|
+
*
|
|
537
|
+
* @deprecated Use {@link #getNextMediaItemIndex()} instead.
|
|
538
|
+
*/
|
|
539
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
540
|
+
@Deprecated
|
|
541
|
+
@Override
|
|
542
|
+
public int getNextWindowIndex() {
|
|
543
|
+
return player.getNextWindowIndex();
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/** Calls {@link Player#getNextMediaItemIndex()} on the delegate and returns the result. */
|
|
547
|
+
@Override
|
|
548
|
+
public int getNextMediaItemIndex() {
|
|
549
|
+
return player.getNextMediaItemIndex();
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Calls {@link Player#getPreviousWindowIndex()} on the delegate and returns the result.
|
|
554
|
+
*
|
|
555
|
+
* @deprecated Use {@link #getPreviousMediaItemIndex()} instead.
|
|
556
|
+
*/
|
|
557
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
558
|
+
@Deprecated
|
|
559
|
+
@Override
|
|
560
|
+
public int getPreviousWindowIndex() {
|
|
561
|
+
return player.getPreviousWindowIndex();
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/** Calls {@link Player#getPreviousMediaItemIndex()} on the delegate and returns the result. */
|
|
565
|
+
@Override
|
|
566
|
+
public int getPreviousMediaItemIndex() {
|
|
567
|
+
return player.getPreviousMediaItemIndex();
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** Calls {@link Player#getCurrentMediaItem()} on the delegate and returns the result. */
|
|
571
|
+
@Nullable
|
|
572
|
+
@Override
|
|
573
|
+
public MediaItem getCurrentMediaItem() {
|
|
574
|
+
return player.getCurrentMediaItem();
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** Calls {@link Player#getMediaItemCount()} on the delegate and returns the result. */
|
|
578
|
+
@Override
|
|
579
|
+
public int getMediaItemCount() {
|
|
580
|
+
return player.getMediaItemCount();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/** Calls {@link Player#getMediaItemAt(int)} on the delegate and returns the result. */
|
|
584
|
+
@Override
|
|
585
|
+
public MediaItem getMediaItemAt(int index) {
|
|
586
|
+
return player.getMediaItemAt(index);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** Calls {@link Player#getDuration()} on the delegate and returns the result. */
|
|
590
|
+
@Override
|
|
591
|
+
public long getDuration() {
|
|
592
|
+
return player.getDuration();
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/** Calls {@link Player#getCurrentPosition()} on the delegate and returns the result. */
|
|
596
|
+
@Override
|
|
597
|
+
public long getCurrentPosition() {
|
|
598
|
+
return player.getCurrentPosition();
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/** Calls {@link Player#getBufferedPosition()} on the delegate and returns the result. */
|
|
602
|
+
@Override
|
|
603
|
+
public long getBufferedPosition() {
|
|
604
|
+
return player.getBufferedPosition();
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** Calls {@link Player#getBufferedPercentage()} on the delegate and returns the result. */
|
|
608
|
+
@Override
|
|
609
|
+
public int getBufferedPercentage() {
|
|
610
|
+
return player.getBufferedPercentage();
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/** Calls {@link Player#getTotalBufferedDuration()} on the delegate and returns the result. */
|
|
614
|
+
@Override
|
|
615
|
+
public long getTotalBufferedDuration() {
|
|
616
|
+
return player.getTotalBufferedDuration();
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Calls {@link Player#isCurrentWindowDynamic()} on the delegate and returns the result.
|
|
621
|
+
*
|
|
622
|
+
* @deprecated Use {@link #isCurrentMediaItemDynamic()} instead.
|
|
623
|
+
*/
|
|
624
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
625
|
+
@Deprecated
|
|
626
|
+
@Override
|
|
627
|
+
public boolean isCurrentWindowDynamic() {
|
|
628
|
+
return player.isCurrentWindowDynamic();
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/** Calls {@link Player#isCurrentMediaItemDynamic()} on the delegate and returns the result. */
|
|
632
|
+
@Override
|
|
633
|
+
public boolean isCurrentMediaItemDynamic() {
|
|
634
|
+
return player.isCurrentMediaItemDynamic();
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Calls {@link Player#isCurrentWindowLive()} on the delegate and returns the result.
|
|
639
|
+
*
|
|
640
|
+
* @deprecated Use {@link #isCurrentMediaItemLive()} instead.
|
|
641
|
+
*/
|
|
642
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
643
|
+
@Deprecated
|
|
644
|
+
@Override
|
|
645
|
+
public boolean isCurrentWindowLive() {
|
|
646
|
+
return player.isCurrentWindowLive();
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/** Calls {@link Player#isCurrentMediaItemLive()} on the delegate and returns the result. */
|
|
650
|
+
@Override
|
|
651
|
+
public boolean isCurrentMediaItemLive() {
|
|
652
|
+
return player.isCurrentMediaItemLive();
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/** Calls {@link Player#getCurrentLiveOffset()} on the delegate and returns the result. */
|
|
656
|
+
@Override
|
|
657
|
+
public long getCurrentLiveOffset() {
|
|
658
|
+
return player.getCurrentLiveOffset();
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Calls {@link Player#isCurrentWindowSeekable()} on the delegate and returns the result.
|
|
663
|
+
*
|
|
664
|
+
* @deprecated Use {@link #isCurrentMediaItemSeekable()} instead.
|
|
665
|
+
*/
|
|
666
|
+
@SuppressWarnings("deprecation") // Forwarding to deprecated method
|
|
667
|
+
@Deprecated
|
|
668
|
+
@Override
|
|
669
|
+
public boolean isCurrentWindowSeekable() {
|
|
670
|
+
return player.isCurrentWindowSeekable();
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/** Calls {@link Player#isCurrentMediaItemSeekable()} on the delegate and returns the result. */
|
|
674
|
+
@Override
|
|
675
|
+
public boolean isCurrentMediaItemSeekable() {
|
|
676
|
+
return player.isCurrentMediaItemSeekable();
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/** Calls {@link Player#isPlayingAd()} on the delegate and returns the result. */
|
|
680
|
+
@Override
|
|
681
|
+
public boolean isPlayingAd() {
|
|
682
|
+
return player.isPlayingAd();
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** Calls {@link Player#getCurrentAdGroupIndex()} on the delegate and returns the result. */
|
|
686
|
+
@Override
|
|
687
|
+
public int getCurrentAdGroupIndex() {
|
|
688
|
+
return player.getCurrentAdGroupIndex();
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/** Calls {@link Player#getCurrentAdIndexInAdGroup()} on the delegate and returns the result. */
|
|
692
|
+
@Override
|
|
693
|
+
public int getCurrentAdIndexInAdGroup() {
|
|
694
|
+
return player.getCurrentAdIndexInAdGroup();
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/** Calls {@link Player#getContentDuration()} on the delegate and returns the result. */
|
|
698
|
+
@Override
|
|
699
|
+
public long getContentDuration() {
|
|
700
|
+
return player.getContentDuration();
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** Calls {@link Player#getContentPosition()} on the delegate and returns the result. */
|
|
704
|
+
@Override
|
|
705
|
+
public long getContentPosition() {
|
|
706
|
+
return player.getContentPosition();
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/** Calls {@link Player#getContentBufferedPosition()} on the delegate and returns the result. */
|
|
710
|
+
@Override
|
|
711
|
+
public long getContentBufferedPosition() {
|
|
712
|
+
return player.getContentBufferedPosition();
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/** Calls {@link Player#getAudioAttributes()} on the delegate and returns the result. */
|
|
716
|
+
@Override
|
|
717
|
+
public AudioAttributes getAudioAttributes() {
|
|
718
|
+
return player.getAudioAttributes();
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** Calls {@link Player#setVolume(float)} on the delegate. */
|
|
722
|
+
@Override
|
|
723
|
+
public void setVolume(float volume) {
|
|
724
|
+
player.setVolume(volume);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/** Calls {@link Player#getVolume()} on the delegate and returns the result. */
|
|
728
|
+
@Override
|
|
729
|
+
public float getVolume() {
|
|
730
|
+
return player.getVolume();
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/** Calls {@link Player#getVideoSize()} on the delegate and returns the result. */
|
|
734
|
+
@Override
|
|
735
|
+
public VideoSize getVideoSize() {
|
|
736
|
+
return player.getVideoSize();
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/** Calls {@link Player#getSurfaceSize()} on the delegate and returns the result. */
|
|
740
|
+
@Override
|
|
741
|
+
public Size getSurfaceSize() {
|
|
742
|
+
return player.getSurfaceSize();
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** Calls {@link Player#clearVideoSurface()} on the delegate. */
|
|
746
|
+
@Override
|
|
747
|
+
public void clearVideoSurface() {
|
|
748
|
+
player.clearVideoSurface();
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** Calls {@link Player#clearVideoSurface(Surface)} on the delegate. */
|
|
752
|
+
@Override
|
|
753
|
+
public void clearVideoSurface(@Nullable Surface surface) {
|
|
754
|
+
player.clearVideoSurface(surface);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/** Calls {@link Player#setVideoSurface(Surface)} on the delegate. */
|
|
758
|
+
@Override
|
|
759
|
+
public void setVideoSurface(@Nullable Surface surface) {
|
|
760
|
+
player.setVideoSurface(surface);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/** Calls {@link Player#setVideoSurfaceHolder(SurfaceHolder)} on the delegate. */
|
|
764
|
+
@Override
|
|
765
|
+
public void setVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder) {
|
|
766
|
+
player.setVideoSurfaceHolder(surfaceHolder);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/** Calls {@link Player#clearVideoSurfaceHolder(SurfaceHolder)} on the delegate. */
|
|
770
|
+
@Override
|
|
771
|
+
public void clearVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder) {
|
|
772
|
+
player.clearVideoSurfaceHolder(surfaceHolder);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/** Calls {@link Player#setVideoSurfaceView(SurfaceView)} on the delegate. */
|
|
776
|
+
@Override
|
|
777
|
+
public void setVideoSurfaceView(@Nullable SurfaceView surfaceView) {
|
|
778
|
+
player.setVideoSurfaceView(surfaceView);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/** Calls {@link Player#clearVideoSurfaceView(SurfaceView)} on the delegate. */
|
|
782
|
+
@Override
|
|
783
|
+
public void clearVideoSurfaceView(@Nullable SurfaceView surfaceView) {
|
|
784
|
+
player.clearVideoSurfaceView(surfaceView);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** Calls {@link Player#setVideoTextureView(TextureView)} on the delegate. */
|
|
788
|
+
@Override
|
|
789
|
+
public void setVideoTextureView(@Nullable TextureView textureView) {
|
|
790
|
+
player.setVideoTextureView(textureView);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/** Calls {@link Player#clearVideoTextureView(TextureView)} on the delegate. */
|
|
794
|
+
@Override
|
|
795
|
+
public void clearVideoTextureView(@Nullable TextureView textureView) {
|
|
796
|
+
player.clearVideoTextureView(textureView);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** Calls {@link Player#getCurrentCues()} on the delegate and returns the result. */
|
|
800
|
+
@Override
|
|
801
|
+
public CueGroup getCurrentCues() {
|
|
802
|
+
return player.getCurrentCues();
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/** Calls {@link Player#getDeviceInfo()} on the delegate and returns the result. */
|
|
806
|
+
@Override
|
|
807
|
+
public DeviceInfo getDeviceInfo() {
|
|
808
|
+
return player.getDeviceInfo();
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/** Calls {@link Player#getDeviceVolume()} on the delegate and returns the result. */
|
|
812
|
+
@Override
|
|
813
|
+
public int getDeviceVolume() {
|
|
814
|
+
return player.getDeviceVolume();
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/** Calls {@link Player#isDeviceMuted()} on the delegate and returns the result. */
|
|
818
|
+
@Override
|
|
819
|
+
public boolean isDeviceMuted() {
|
|
820
|
+
return player.isDeviceMuted();
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* @deprecated Use {@link #setDeviceVolume(int, int)} instead.
|
|
825
|
+
*/
|
|
826
|
+
@SuppressWarnings("deprecation") // Intentionally forwarding deprecated method
|
|
827
|
+
@Deprecated
|
|
828
|
+
@Override
|
|
829
|
+
public void setDeviceVolume(int volume) {
|
|
830
|
+
player.setDeviceVolume(volume);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/** Calls {@link Player#setDeviceVolume(int, int)} on the delegate. */
|
|
834
|
+
@Override
|
|
835
|
+
public void setDeviceVolume(int volume, @C.VolumeFlags int flags) {
|
|
836
|
+
player.setDeviceVolume(volume, flags);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* @deprecated Use {@link #increaseDeviceVolume(int)} instead.
|
|
841
|
+
*/
|
|
842
|
+
@SuppressWarnings("deprecation") // Intentionally forwarding deprecated method
|
|
843
|
+
@Deprecated
|
|
844
|
+
@Override
|
|
845
|
+
public void increaseDeviceVolume() {
|
|
846
|
+
player.increaseDeviceVolume();
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/** Calls {@link Player#increaseDeviceVolume(int)} on the delegate. */
|
|
850
|
+
@Override
|
|
851
|
+
public void increaseDeviceVolume(@C.VolumeFlags int flags) {
|
|
852
|
+
player.increaseDeviceVolume(flags);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* @deprecated Use {@link #decreaseDeviceVolume(int)} instead.
|
|
857
|
+
*/
|
|
858
|
+
@SuppressWarnings("deprecation") // Intentionally forwarding deprecated method
|
|
859
|
+
@Deprecated
|
|
860
|
+
@Override
|
|
861
|
+
public void decreaseDeviceVolume() {
|
|
862
|
+
player.decreaseDeviceVolume();
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/** Calls {@link Player#decreaseDeviceVolume(int)} on the delegate. */
|
|
866
|
+
@Override
|
|
867
|
+
public void decreaseDeviceVolume(@C.VolumeFlags int flags) {
|
|
868
|
+
player.decreaseDeviceVolume(flags);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* @deprecated Use {@link #setDeviceMuted(boolean, int)} instead.
|
|
873
|
+
*/
|
|
874
|
+
@SuppressWarnings("deprecation") // Intentionally forwarding deprecated method
|
|
875
|
+
@Deprecated
|
|
876
|
+
@Override
|
|
877
|
+
public void setDeviceMuted(boolean muted) {
|
|
878
|
+
player.setDeviceMuted(muted);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/** Calls {@link Player#setDeviceMuted(boolean, int)} on the delegate. */
|
|
882
|
+
@Override
|
|
883
|
+
public void setDeviceMuted(boolean muted, @C.VolumeFlags int flags) {
|
|
884
|
+
player.setDeviceMuted(muted, flags);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/** Calls {@link Player#setAudioAttributes(AudioAttributes, boolean)} on the delegate. */
|
|
888
|
+
@Override
|
|
889
|
+
public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
|
|
890
|
+
player.setAudioAttributes(audioAttributes, handleAudioFocus);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/** Returns the {@link Player} to which operations are forwarded. */
|
|
894
|
+
public Player getWrappedPlayer() {
|
|
895
|
+
return player;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
private static final class ForwardingListener implements Listener {
|
|
899
|
+
|
|
900
|
+
private final ForwardingPlayer forwardingPlayer;
|
|
901
|
+
private final Listener listener;
|
|
902
|
+
|
|
903
|
+
public ForwardingListener(ForwardingPlayer forwardingPlayer, Listener listener) {
|
|
904
|
+
this.forwardingPlayer = forwardingPlayer;
|
|
905
|
+
this.listener = listener;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
@Override
|
|
909
|
+
public void onEvents(Player player, Events events) {
|
|
910
|
+
// Replace player with forwarding player.
|
|
911
|
+
listener.onEvents(forwardingPlayer, events);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
@Override
|
|
915
|
+
public void onTimelineChanged(Timeline timeline, @TimelineChangeReason int reason) {
|
|
916
|
+
listener.onTimelineChanged(timeline, reason);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
@Override
|
|
920
|
+
public void onMediaItemTransition(
|
|
921
|
+
@Nullable MediaItem mediaItem, @MediaItemTransitionReason int reason) {
|
|
922
|
+
listener.onMediaItemTransition(mediaItem, reason);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
@Override
|
|
926
|
+
public void onTracksChanged(Tracks tracks) {
|
|
927
|
+
listener.onTracksChanged(tracks);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
@Override
|
|
931
|
+
public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
|
|
932
|
+
listener.onMediaMetadataChanged(mediaMetadata);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
@Override
|
|
936
|
+
public void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {
|
|
937
|
+
listener.onPlaylistMetadataChanged(mediaMetadata);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
@Override
|
|
941
|
+
public void onIsLoadingChanged(boolean isLoading) {
|
|
942
|
+
listener.onIsLoadingChanged(isLoading);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
@Override
|
|
946
|
+
@SuppressWarnings("deprecation")
|
|
947
|
+
public void onLoadingChanged(boolean isLoading) {
|
|
948
|
+
listener.onIsLoadingChanged(isLoading);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
@Override
|
|
952
|
+
public void onAvailableCommandsChanged(Commands availableCommands) {
|
|
953
|
+
listener.onAvailableCommandsChanged(availableCommands);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
@Override
|
|
957
|
+
public void onTrackSelectionParametersChanged(TrackSelectionParameters parameters) {
|
|
958
|
+
listener.onTrackSelectionParametersChanged(parameters);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
@Override
|
|
962
|
+
@SuppressWarnings("deprecation")
|
|
963
|
+
public void onPlayerStateChanged(boolean playWhenReady, @State int playbackState) {
|
|
964
|
+
listener.onPlayerStateChanged(playWhenReady, playbackState);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
@Override
|
|
968
|
+
public void onPlaybackStateChanged(@State int playbackState) {
|
|
969
|
+
listener.onPlaybackStateChanged(playbackState);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
@Override
|
|
973
|
+
public void onPlayWhenReadyChanged(
|
|
974
|
+
boolean playWhenReady, @PlayWhenReadyChangeReason int reason) {
|
|
975
|
+
listener.onPlayWhenReadyChanged(playWhenReady, reason);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
@Override
|
|
979
|
+
public void onPlaybackSuppressionReasonChanged(
|
|
980
|
+
@PlayWhenReadyChangeReason int playbackSuppressionReason) {
|
|
981
|
+
listener.onPlaybackSuppressionReasonChanged(playbackSuppressionReason);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
@Override
|
|
985
|
+
public void onIsPlayingChanged(boolean isPlaying) {
|
|
986
|
+
listener.onIsPlayingChanged(isPlaying);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
@Override
|
|
990
|
+
public void onRepeatModeChanged(@RepeatMode int repeatMode) {
|
|
991
|
+
listener.onRepeatModeChanged(repeatMode);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
@Override
|
|
995
|
+
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
|
|
996
|
+
listener.onShuffleModeEnabledChanged(shuffleModeEnabled);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
@Override
|
|
1000
|
+
public void onPlayerError(PlaybackException error) {
|
|
1001
|
+
listener.onPlayerError(error);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
@Override
|
|
1005
|
+
public void onPlayerErrorChanged(@Nullable PlaybackException error) {
|
|
1006
|
+
listener.onPlayerErrorChanged(error);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
@Override
|
|
1010
|
+
@SuppressWarnings("deprecation")
|
|
1011
|
+
public void onPositionDiscontinuity(@DiscontinuityReason int reason) {
|
|
1012
|
+
listener.onPositionDiscontinuity(reason);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
@Override
|
|
1016
|
+
public void onPositionDiscontinuity(
|
|
1017
|
+
PositionInfo oldPosition, PositionInfo newPosition, @DiscontinuityReason int reason) {
|
|
1018
|
+
listener.onPositionDiscontinuity(oldPosition, newPosition, reason);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
@Override
|
|
1022
|
+
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
|
|
1023
|
+
listener.onPlaybackParametersChanged(playbackParameters);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
@Override
|
|
1027
|
+
public void onSeekBackIncrementChanged(long seekBackIncrementMs) {
|
|
1028
|
+
listener.onSeekBackIncrementChanged(seekBackIncrementMs);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
@Override
|
|
1032
|
+
public void onSeekForwardIncrementChanged(long seekForwardIncrementMs) {
|
|
1033
|
+
listener.onSeekForwardIncrementChanged(seekForwardIncrementMs);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
@Override
|
|
1037
|
+
public void onMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs) {
|
|
1038
|
+
listener.onMaxSeekToPreviousPositionChanged(maxSeekToPreviousPositionMs);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
@Override
|
|
1042
|
+
public void onVideoSizeChanged(VideoSize videoSize) {
|
|
1043
|
+
listener.onVideoSizeChanged(videoSize);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
@Override
|
|
1047
|
+
public void onSurfaceSizeChanged(int width, int height) {
|
|
1048
|
+
listener.onSurfaceSizeChanged(width, height);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
@Override
|
|
1052
|
+
public void onRenderedFirstFrame() {
|
|
1053
|
+
listener.onRenderedFirstFrame();
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
@Override
|
|
1057
|
+
public void onAudioSessionIdChanged(int audioSessionId) {
|
|
1058
|
+
listener.onAudioSessionIdChanged(audioSessionId);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
@Override
|
|
1062
|
+
public void onAudioAttributesChanged(AudioAttributes audioAttributes) {
|
|
1063
|
+
listener.onAudioAttributesChanged(audioAttributes);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
@Override
|
|
1067
|
+
public void onVolumeChanged(float volume) {
|
|
1068
|
+
listener.onVolumeChanged(volume);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
@Override
|
|
1072
|
+
public void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {
|
|
1073
|
+
listener.onSkipSilenceEnabledChanged(skipSilenceEnabled);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
@SuppressWarnings("deprecation") // Intentionally forwarding deprecated method
|
|
1077
|
+
@Override
|
|
1078
|
+
public void onCues(List<Cue> cues) {
|
|
1079
|
+
listener.onCues(cues);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
@Override
|
|
1083
|
+
public void onCues(CueGroup cueGroup) {
|
|
1084
|
+
listener.onCues(cueGroup);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
@Override
|
|
1088
|
+
public void onMetadata(Metadata metadata) {
|
|
1089
|
+
listener.onMetadata(metadata);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
@Override
|
|
1093
|
+
public void onDeviceInfoChanged(DeviceInfo deviceInfo) {
|
|
1094
|
+
listener.onDeviceInfoChanged(deviceInfo);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
@Override
|
|
1098
|
+
public void onDeviceVolumeChanged(int volume, boolean muted) {
|
|
1099
|
+
listener.onDeviceVolumeChanged(volume, muted);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
@Override
|
|
1103
|
+
public boolean equals(@Nullable Object o) {
|
|
1104
|
+
if (this == o) {
|
|
1105
|
+
return true;
|
|
1106
|
+
}
|
|
1107
|
+
if (!(o instanceof ForwardingListener)) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
ForwardingListener that = (ForwardingListener) o;
|
|
1111
|
+
if (!forwardingPlayer.equals(that.forwardingPlayer)) {
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
return listener.equals(that.listener);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
@Override
|
|
1118
|
+
public int hashCode() {
|
|
1119
|
+
int result = forwardingPlayer.hashCode();
|
|
1120
|
+
result = 31 * result + listener.hashCode();
|
|
1121
|
+
return result;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|