Skip to content

Commit

Permalink
Merge pull request #211 from khiemdoan/replace-methods
Browse files Browse the repository at this point in the history
Replace deprecated methods by new methods of Exoplayer
  • Loading branch information
nic0lette authored Apr 28, 2018
2 parents c3a4bbe + 2881ab4 commit 7b419cc
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.example.android.uamp.utils.LogHelper;
import com.example.android.uamp.utils.MediaIDHelper;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters;
Expand Down Expand Up @@ -207,9 +208,10 @@ public void play(QueueItem item) {
}

if (mExoPlayer == null) {
mExoPlayer =
ExoPlayerFactory.newSimpleInstance(
mContext, new DefaultTrackSelector(), new DefaultLoadControl());
mExoPlayer = ExoPlayerFactory.newSimpleInstance(
new DefaultRenderersFactory(mContext),
new DefaultTrackSelector(),
new DefaultLoadControl());
mExoPlayer.addListener(mEventListener);
}

Expand All @@ -231,9 +233,11 @@ public void play(QueueItem item) {
// Produces Extractor instances for parsing the media data.
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
// The MediaSource represents the media to be played.
ExtractorMediaSource.Factory extractorMediaFactory =
new ExtractorMediaSource.Factory(dataSourceFactory);
extractorMediaFactory.setExtractorsFactory(extractorsFactory);
MediaSource mediaSource =
new ExtractorMediaSource(
Uri.parse(source), dataSourceFactory, extractorsFactory, null, null);
extractorMediaFactory.createMediaSource(Uri.parse(source));

// Prepares media to play (happens on background thread) and triggers
// {@code onPlayerStateChanged} callback when the stream is ready to play.
Expand Down

0 comments on commit 7b419cc

Please sign in to comment.