From 2028fdd75609acd7a84fafd9b96706e2e2fab2ff Mon Sep 17 00:00:00 2001 From: bachinger Date: Thu, 12 Mar 2020 17:29:47 +0000 Subject: [PATCH] add media item based playlist methods After this change users of ExoPlayerImpl and SimpleExoPlayer can use the media item base playlist API which converts the media item to a media source. It adds the media item based methods to the ExoPlayer instead of the Player interface. This avoids a big change in the CastPlayer which requires migrating the cast extension to the MediaItem of the core module (follow up CLs). PiperOrigin-RevId: 300575567 --- .../google/android/exoplayer2/ExoPlayer.java | 117 +++++++++++++++++- .../android/exoplayer2/ExoPlayerFactory.java | 3 + .../android/exoplayer2/ExoPlayerImpl.java | 82 ++++++++++-- .../android/exoplayer2/SimpleExoPlayer.java | 91 ++++++++++++++ .../exoplayer2/testutil/StubExoPlayer.java | 52 ++++++++ 5 files changed, 332 insertions(+), 13 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java index 6fc54e16fe..898896c5c4 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java @@ -24,8 +24,10 @@ import com.google.android.exoplayer2.audio.MediaCodecAudioRenderer; import com.google.android.exoplayer2.metadata.MetadataRenderer; import com.google.android.exoplayer2.source.ClippingMediaSource; import com.google.android.exoplayer2.source.ConcatenatingMediaSource; +import com.google.android.exoplayer2.source.DefaultMediaSourceFactory; import com.google.android.exoplayer2.source.LoopingMediaSource; import com.google.android.exoplayer2.source.MediaSource; +import com.google.android.exoplayer2.source.MediaSourceFactory; import com.google.android.exoplayer2.source.MergingMediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.ShuffleOrder; @@ -138,6 +140,7 @@ public interface ExoPlayer extends Player { private Clock clock; private TrackSelector trackSelector; + private MediaSourceFactory mediaSourceFactory; private LoadControl loadControl; private BandwidthMeter bandwidthMeter; private Looper looper; @@ -154,6 +157,7 @@ public interface ExoPlayer extends Player { * *