Remove usages of deprecated SimpleExoPlayer.Builder

PiperOrigin-RevId: 390130681
This commit is contained in:
kimvde 2021-08-11 15:48:29 +01:00 committed by Oliver Woodman
parent 7dffb2dc4d
commit 01613a2e55
62 changed files with 162 additions and 140 deletions

View File

@ -21,6 +21,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.DiscontinuityReason;
@ -94,7 +95,7 @@ import java.util.ArrayList;
currentItemIndex = C.INDEX_UNSET;
trackSelector = new DefaultTrackSelector(context);
exoPlayer = new SimpleExoPlayer.Builder(context).setTrackSelector(trackSelector).build();
exoPlayer = new ExoPlayer.Builder(context).setTrackSelector(trackSelector).build();
exoPlayer.addListener(this);
localPlayerView.setPlayer(exoPlayer);

View File

@ -24,6 +24,7 @@ import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -172,7 +173,7 @@ public final class MainActivity extends Activity {
throw new IllegalStateException();
}
SimpleExoPlayer player = new SimpleExoPlayer.Builder(getApplicationContext()).build();
SimpleExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
player.setRepeatMode(Player.REPEAT_MODE_ALL);
player.setMediaSource(mediaSource);
player.prepare();

View File

@ -32,6 +32,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -272,7 +273,7 @@ public class PlayerActivity extends AppCompatActivity
trackSelector.setParameters(trackSelectorParameters);
lastSeenTrackGroupArray = null;
player =
new SimpleExoPlayer.Builder(/* context= */ this, renderersFactory)
new ExoPlayer.Builder(/* context= */ this, renderersFactory)
.setMediaSourceFactory(mediaSourceFactory)
.setTrackSelector(trackSelector)
.build();

View File

@ -28,6 +28,7 @@ import android.widget.Button;
import android.widget.GridLayout;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -216,7 +217,7 @@ public final class MainActivity extends Activity {
} else {
throw new IllegalStateException();
}
SimpleExoPlayer player = new SimpleExoPlayer.Builder(getApplicationContext()).build();
SimpleExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
player.setMediaSource(mediaSource);
player.prepare();
player.play();

View File

@ -49,7 +49,7 @@ MediaSourceFactory mediaSourceFactory =
new DefaultMediaSourceFactory(context)
.setAdsLoaderProvider(adsLoaderProvider)
.setAdViewProvider(playerView);
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(mediaSourceFactory)
.build();
~~~

View File

@ -246,7 +246,7 @@ class ExtendedCollector extends AnalyticsCollector {
}
// Usage - Setup and listener registration.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setAnalyticsCollector(new ExtendedCollector())
.build();
player.addAnalyticsListener(new ExtendedListener() {

View File

@ -60,7 +60,7 @@ DefaultDataSource.Factory dataSourceFactory =
// Inject the DefaultDataSourceFactory when creating the player.
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();
~~~
@ -82,7 +82,7 @@ DataSource.Factory cacheDataSourceFactory =
.setCache(simpleCache)
.setUpstreamDataSourceFactory(httpDataSourceFactory);
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(cacheDataSourceFactory))
.build();
@ -107,7 +107,7 @@ DataSource.Factory dataSourceFactory = () -> {
return dataSource;
};
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();
~~~
@ -158,7 +158,7 @@ LoadErrorHandlingPolicy loadErrorHandlingPolicy =
};
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context)
.setLoadErrorHandlingPolicy(loadErrorHandlingPolicy))
@ -181,7 +181,7 @@ DefaultExtractorsFactory extractorsFactory =
new DefaultExtractorsFactory()
.setMp3ExtractorFlags(Mp3Extractor.FLAG_ENABLE_INDEX_SEEKING);
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context, extractorsFactory))
.build();

View File

@ -17,7 +17,7 @@ You can then create a `MediaItem` for a DASH MPD URI and pass it to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(dashUri));
// Prepare the player.
@ -45,7 +45,7 @@ MediaSource mediaSource =
new DashMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(dashUri));
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -322,7 +322,7 @@ DataSource.Factory cacheDataSourceFactory =
.setUpstreamDataSourceFactory(httpDataSourceFactory)
.setCacheWriteDataSinkFactory(null); // Disable writing.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(cacheDataSourceFactory))
.build();

View File

@ -92,12 +92,12 @@ to prevent build errors.
## Creating the player ##
You can create an `ExoPlayer` instance using `SimpleExoPlayer.Builder`, which
provides a range of customization options. The code below is the simplest
example of creating an instance.
You can create an `ExoPlayer` instance using `ExoPlayer.Builder`, which provides
a range of customization options. The code below is the simplest example of
creating an instance.
~~~
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
~~~
{: .language-java}

View File

@ -18,7 +18,7 @@ player.
~~~
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(hlsUri));
// Prepare the player.
@ -48,7 +48,7 @@ HlsMediaSource hlsMediaSource =
new HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(hlsUri));
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(hlsMediaSource);
// Prepare the player.

View File

@ -97,7 +97,7 @@ values will override parameters defined by the media.
~~~
// Global settings.
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context).setLiveTargetOffsetMs(5000))
.build();
@ -164,7 +164,7 @@ instance can be set when building the player:
~~~
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setLivePlaybackSpeedControl(
new DefaultLivePlaybackSpeedControl.Builder()
.setFallbackMaxPlaybackSpeed(1.04f)

View File

@ -37,7 +37,7 @@ MediaSourceFactory mediaSourceFactory =
new DefaultMediaSourceFactory(cacheDataSourceFactory)
.setAdsLoaderProvider(adsLoaderProvider)
.setAdViewProvider(playerView);
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context)
SimpleExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(mediaSourceFactory)
.build();
~~~

View File

@ -50,7 +50,7 @@ DefaultDataSource.Factory dataSourceFactory =
// Inject the DefaultDataSourceFactory when creating the player.
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();
~~~

View File

@ -11,7 +11,7 @@ it to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(progressiveUri));
// Prepare the player.
@ -31,7 +31,7 @@ DataSource.Factory dataSourceFactory = new DefaultHttpDataSource.Factory();
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(progressiveUri));
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -17,7 +17,7 @@ You can then create a `MediaItem` for an RTSP URI and pass it to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(rtspUri));
// Prepare the player.
@ -43,7 +43,7 @@ MediaSource mediaSource =
new RtspMediaSource.Factory()
.createMediaSource(MediaItem.fromUri(rtspUri));
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -59,7 +59,7 @@ RenderersFactory audioOnlyRenderersFactory =
context, MediaCodecSelector.DEFAULT, handler, audioListener)
};
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, audioOnlyRenderersFactory).build();
new ExoPlayer.Builder(context, audioOnlyRenderersFactory).build();
~~~
{: .language-java}
@ -81,14 +81,14 @@ an app that only needs to play mp4 files can provide a factory like:
ExtractorsFactory mp4ExtractorFactory =
() -> new Extractor[] {new Mp4Extractor()};
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, mp4ExtractorFactory).build();
new ExoPlayer.Builder(context, mp4ExtractorFactory).build();
~~~
{: .language-java}
This will allow other `Extractor` implementations to be removed by code
shrinking, which can result in a significant reduction in size.
You should pass `ExtractorsFactory.EMPTY` to the `SimpleExoPlayer.Builder`
You should pass `ExtractorsFactory.EMPTY` to the `ExoPlayer.Builder`
constructor, if your app is doing one of the following:
* Not playing progressive media at all, for example because it only
@ -99,18 +99,18 @@ constructor, if your app is doing one of the following:
~~~
// Only playing DASH, HLS or SmoothStreaming.
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
// Providing a customized `DefaultMediaSourceFactory`
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, ExtractorsFactory.EMPTY)
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context, customExtractorsFactory))
.build();
// Using a MediaSource directly.
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
ProgressiveMediaSource mediaSource =
new ProgressiveMediaSource.Factory(
dataSourceFactory, customExtractorsFactory)

View File

@ -19,7 +19,7 @@ to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(ssUri));
// Prepare the player.
@ -47,7 +47,7 @@ MediaSource mediaSource =
new SsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(ssUri));
// Create a player instance.
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -9,7 +9,7 @@ of which can be provided whenever an `ExoPlayer` is built.
~~~
DefaultTrackSelector trackSelector = new DefaultTrackSelector(context);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setTrackSelector(trackSelector)
.build();
~~~

View File

@ -70,7 +70,7 @@ When a player has been initialized, it can be attached to the view by calling
~~~
// Instantiate the player.
player = new SimpleExoPlayer.Builder(context).build();
player = new ExoPlayer.Builder(context).build();
// Attach player to the view.
playerView.setPlayer(player);
// Set the media source to be played.
@ -157,7 +157,7 @@ protected void onCreate(Bundle savedInstanceState) {
private void initializePlayer() {
// Instantiate the player.
player = new SimpleExoPlayer.Builder(context).build();
player = new ExoPlayer.Builder(context).build();
// Attach player to the view.
playerControlView.setPlayer(player);
// Prepare the player with the dash media source.

View File

@ -74,13 +74,13 @@ Once you've followed the instructions above to check out, build and depend on
the extension, the next step is to tell ExoPlayer to use `Libgav1VideoRenderer`.
How you do this depends on which player API you're using:
* If you're passing a `DefaultRenderersFactory` to `SimpleExoPlayer.Builder`,
you can enable using the extension by setting the `extensionRendererMode`
parameter of the `DefaultRenderersFactory` constructor to
`EXTENSION_RENDERER_MODE_ON`. This will use `Libgav1VideoRenderer` for
playback if `MediaCodecVideoRenderer` doesn't support decoding the input AV1
stream. Pass `EXTENSION_RENDERER_MODE_PREFER` to give `Libgav1VideoRenderer`
priority over `MediaCodecVideoRenderer`.
* If you're passing a `DefaultRenderersFactory` to `ExoPlayer.Builder`, you can
enable using the extension by setting the `extensionRendererMode` parameter of
the `DefaultRenderersFactory` constructor to `EXTENSION_RENDERER_MODE_ON`.
This will use `Libgav1VideoRenderer` for playback if `MediaCodecVideoRenderer`
doesn't support decoding the input AV1 stream. Pass
`EXTENSION_RENDERER_MODE_PREFER` to give `Libgav1VideoRenderer` priority over
`MediaCodecVideoRenderer`.
* If you've subclassed `DefaultRenderersFactory`, add a `Libvgav1VideoRenderer`
to the output list in `buildVideoRenderers`. ExoPlayer will use the first
`Renderer` in the list that supports the input media format.

View File

@ -90,13 +90,12 @@ Once you've followed the instructions above to check out, build and depend on
the extension, the next step is to tell ExoPlayer to use `FfmpegAudioRenderer`.
How you do this depends on which player API you're using:
* If you're passing a `DefaultRenderersFactory` to `SimpleExoPlayer.Builder`,
you can enable using the extension by setting the `extensionRendererMode`
parameter of the `DefaultRenderersFactory` constructor to
`EXTENSION_RENDERER_MODE_ON`. This will use `FfmpegAudioRenderer` for playback
if `MediaCodecAudioRenderer` doesn't support the input format. Pass
`EXTENSION_RENDERER_MODE_PREFER` to give `FfmpegAudioRenderer` priority over
`MediaCodecAudioRenderer`.
* If you're passing a `DefaultRenderersFactory` to `ExoPlayer.Builder`, you can
enable using the extension by setting the `extensionRendererMode` parameter of
the `DefaultRenderersFactory` constructor to `EXTENSION_RENDERER_MODE_ON`.
This will use `FfmpegAudioRenderer` for playback if `MediaCodecAudioRenderer`
doesn't support the input format. Pass `EXTENSION_RENDERER_MODE_PREFER` to
give `FfmpegAudioRenderer` priority over `MediaCodecAudioRenderer`.
* If you've subclassed `DefaultRenderersFactory`, add an `FfmpegAudioRenderer`
to the output list in `buildAudioRenderers`. ExoPlayer will use the first
`Renderer` in the list that supports the input media format.

View File

@ -75,13 +75,12 @@ renderer.
### Using `LibflacAudioRenderer` ###
* If you're passing a `DefaultRenderersFactory` to `SimpleExoPlayer.Builder`,
you can enable using the extension by setting the `extensionRendererMode`
parameter of the `DefaultRenderersFactory` constructor to
`EXTENSION_RENDERER_MODE_ON`. This will use `LibflacAudioRenderer` for
playback if `MediaCodecAudioRenderer` doesn't support the input format. Pass
`EXTENSION_RENDERER_MODE_PREFER` to give `LibflacAudioRenderer` priority over
`MediaCodecAudioRenderer`.
* If you're passing a `DefaultRenderersFactory` to `ExoPlayer.Builder`, you can
enable using the extension by setting the `extensionRendererMode` parameter of
the `DefaultRenderersFactory` constructor to `EXTENSION_RENDERER_MODE_ON`.
This will use `LibflacAudioRenderer` for playback if `MediaCodecAudioRenderer`
doesn't support the input format. Pass `EXTENSION_RENDERER_MODE_PREFER` to
give `LibflacAudioRenderer` priority over `MediaCodecAudioRenderer`.
* If you've subclassed `DefaultRenderersFactory`, add a `LibflacAudioRenderer`
to the output list in `buildAudioRenderers`. ExoPlayer will use the first
`Renderer` in the list that supports the input media format.

View File

@ -23,6 +23,7 @@ import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -116,7 +117,7 @@ public class FlacPlaybackTest {
new Renderer[] {
new LibflacAudioRenderer(eventHandler, audioRendererEventListener, audioSink)
};
player = new SimpleExoPlayer.Builder(context, renderersFactory).build();
player = new ExoPlayer.Builder(context, renderersFactory).build();
player.addListener(this);
MediaSource mediaSource =
new ProgressiveMediaSource.Factory(

View File

@ -79,7 +79,7 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(@Nullable ControlDispatcher controlDispatcher) {

View File

@ -21,6 +21,7 @@ import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.platform.app.InstrumentationRegistry;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
import com.google.android.exoplayer2.upstream.DataSource;
@ -69,7 +70,7 @@ import org.junit.rules.ExternalResource;
DataSource.Factory dataSourceFactory = new InstrumentingDataSourceFactory(context);
exoPlayer =
new SimpleExoPlayer.Builder(context)
new ExoPlayer.Builder(context)
.setLooper(Looper.myLooper())
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();

View File

@ -44,6 +44,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import com.google.android.exoplayer2.ControlDispatcher;
import com.google.android.exoplayer2.DefaultControlDispatcher;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -169,7 +170,7 @@ public class SessionPlayerConnectorTest {
SimpleExoPlayer simpleExoPlayer = null;
SessionPlayerConnector playerConnector = null;
try {
simpleExoPlayer = new SimpleExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
simpleExoPlayer = new ExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
playerConnector =
new SessionPlayerConnector(simpleExoPlayer, new DefaultMediaItemConverter());
playerConnector.setControlDispatcher(controlDispatcher);
@ -194,8 +195,7 @@ public class SessionPlayerConnectorTest {
Player forwardingPlayer = null;
SessionPlayerConnector playerConnector = null;
try {
Player simpleExoPlayer =
new SimpleExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
Player simpleExoPlayer = new ExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
forwardingPlayer =
new ForwardingPlayer(simpleExoPlayer) {
@Override

View File

@ -166,7 +166,7 @@ import java.util.List;
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -116,7 +116,7 @@ public final class SessionPlayerConnector extends SessionPlayer {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -176,7 +176,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param command The command name.
* @param extras Optional parameters for the command, may be null.
* @param cb A result receiver to which a result may be sent by the command, may be null.
@ -299,7 +299,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
void onSkipToPrevious(Player player, @Deprecated ControlDispatcher controlDispatcher);
/**
@ -309,7 +309,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
void onSkipToQueueItem(Player player, @Deprecated ControlDispatcher controlDispatcher, long id);
/**
@ -319,7 +319,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
void onSkipToNext(Player player, @Deprecated ControlDispatcher controlDispatcher);
}
@ -377,7 +377,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param mediaButtonEvent The {@link Intent}.
* @return True if the event was handled, false otherwise.
*/
@ -397,7 +397,7 @@ public final class MediaSessionConnector {
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param action The name of the action which was sent by a media controller.
* @param extras Optional extras sent by a media controller, may be null.
*/
@ -562,7 +562,7 @@ public final class MediaSessionConnector {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@code SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* {@code ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -79,13 +79,12 @@ Once you've followed the instructions above to check out, build and depend on
the extension, the next step is to tell ExoPlayer to use `LibopusAudioRenderer`.
How you do this depends on which player API you're using:
* If you're passing a `DefaultRenderersFactory` to `SimpleExoPlayer.Builder`,
you can enable using the extension by setting the `extensionRendererMode`
parameter of the `DefaultRenderersFactory` constructor to
`EXTENSION_RENDERER_MODE_ON`. This will use `LibopusAudioRenderer` for
playback if `MediaCodecAudioRenderer` doesn't support the input format. Pass
`EXTENSION_RENDERER_MODE_PREFER` to give `LibopusAudioRenderer` priority over
`MediaCodecAudioRenderer`.
* If you're passing a `DefaultRenderersFactory` to `ExoPlayer.Builder`, you can
enable using the extension by setting the `extensionRendererMode` parameter of
the `DefaultRenderersFactory` constructor to `EXTENSION_RENDERER_MODE_ON`.
This will use `LibopusAudioRenderer` for playback if `MediaCodecAudioRenderer`
doesn't support the input format. Pass `EXTENSION_RENDERER_MODE_PREFER` to
give `LibopusAudioRenderer` priority over `MediaCodecAudioRenderer`.
* If you've subclassed `DefaultRenderersFactory`, add a `LibopusAudioRenderer`
to the output list in `buildAudioRenderers`. ExoPlayer will use the first
`Renderer` in the list that supports the input media format.

View File

@ -23,6 +23,7 @@ import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -96,7 +97,7 @@ public class OpusPlaybackTest {
textRendererOutput,
metadataRendererOutput) ->
new Renderer[] {new LibopusAudioRenderer(eventHandler, audioRendererEventListener)};
player = new SimpleExoPlayer.Builder(context, renderersFactory).build();
player = new ExoPlayer.Builder(context, renderersFactory).build();
player.addListener(this);
MediaSource mediaSource =
new ProgressiveMediaSource.Factory(

View File

@ -89,13 +89,13 @@ Once you've followed the instructions above to check out, build and depend on
the extension, the next step is to tell ExoPlayer to use `LibvpxVideoRenderer`.
How you do this depends on which player API you're using:
* If you're passing a `DefaultRenderersFactory` to `SimpleExoPlayer.Builder`,
you can enable using the extension by setting the `extensionRendererMode`
parameter of the `DefaultRenderersFactory` constructor to
`EXTENSION_RENDERER_MODE_ON`. This will use `LibvpxVideoRenderer` for playback
if `MediaCodecVideoRenderer` doesn't support decoding the input VP9 stream.
Pass `EXTENSION_RENDERER_MODE_PREFER` to give `LibvpxVideoRenderer` priority
over `MediaCodecVideoRenderer`.
* If you're passing a `DefaultRenderersFactory` to `ExoPlayer.Builder`, you can
enable using the extension by setting the `extensionRendererMode` parameter of
the `DefaultRenderersFactory` constructor to `EXTENSION_RENDERER_MODE_ON`.
This will use `LibvpxVideoRenderer` for playback if `MediaCodecVideoRenderer`
doesn't support decoding the input VP9 stream. Pass
`EXTENSION_RENDERER_MODE_PREFER` to give `LibvpxVideoRenderer` priority over
`MediaCodecVideoRenderer`.
* If you've subclassed `DefaultRenderersFactory`, add a `LibvpxVideoRenderer`
to the output list in `buildVideoRenderers`. ExoPlayer will use the first
`Renderer` in the list that supports the input media format.

View File

@ -24,6 +24,7 @@ import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -130,7 +131,7 @@ public class VpxPlaybackTest {
videoRendererEventListener,
/* maxDroppedFramesToNotify= */ -1)
};
player = new SimpleExoPlayer.Builder(context, renderersFactory).build();
player = new ExoPlayer.Builder(context, renderersFactory).build();
player.addListener(this);
MediaSource mediaSource =
new ProgressiveMediaSource.Factory(

View File

@ -59,7 +59,7 @@ public final class ClippedPlaybackTest {
getInstrumentation()
.runOnMainSync(
() -> {
player.set(new SimpleExoPlayer.Builder(getInstrumentation().getContext()).build());
player.set(new ExoPlayer.Builder(getInstrumentation().getContext()).build());
player.get().addListener(textCapturer);
player.get().setMediaItem(mediaItem);
player.get().prepare();
@ -101,7 +101,7 @@ public final class ClippedPlaybackTest {
getInstrumentation()
.runOnMainSync(
() -> {
player.set(new SimpleExoPlayer.Builder(getInstrumentation().getContext()).build());
player.set(new ExoPlayer.Builder(getInstrumentation().getContext()).build());
player.get().addListener(textCapturer);
player.get().setMediaItems(mediaItems);
player.get().prepare();

View File

@ -52,7 +52,7 @@ public class SimpleExoPlayerTest {
public void builder_inBackgroundThread_doesNotThrow() throws Exception {
Thread builderThread =
new Thread(
() -> new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build());
() -> new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build());
AtomicReference<Throwable> builderThrow = new AtomicReference<>();
builderThread.setUncaughtExceptionHandler((thread, throwable) -> builderThrow.set(throwable));
@ -65,7 +65,7 @@ public class SimpleExoPlayerTest {
@Test
public void onPlaylistMetadataChanged_calledWhenPlaylistMetadataSet() {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
Player.Listener playerListener = mock(Player.Listener.class);
player.addListener(playerListener);
AnalyticsListener analyticsListener = mock(AnalyticsListener.class);
@ -81,7 +81,7 @@ public class SimpleExoPlayerTest {
@Test
public void release_triggersAllPendingEventsInAnalyticsListeners() throws Exception {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(
new ExoPlayer.Builder(
ApplicationProvider.getApplicationContext(),
(handler, videoListener, audioListener, textOutput, metadataOutput) ->
new Renderer[] {new FakeVideoRenderer(handler, videoListener)})
@ -107,7 +107,7 @@ public class SimpleExoPlayerTest {
public void releaseAfterRendererEvents_triggersPendingVideoEventsInListener() throws Exception {
Surface surface = new Surface(new SurfaceTexture(/* texName= */ 0));
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(
new ExoPlayer.Builder(
ApplicationProvider.getApplicationContext(),
(handler, videoListener, audioListener, textOutput, metadataOutput) ->
new Renderer[] {new FakeVideoRenderer(handler, videoListener)})
@ -133,7 +133,7 @@ public class SimpleExoPlayerTest {
@Test
public void releaseAfterVolumeChanges_triggerPendingVolumeEventInListener() throws Exception {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
Player.Listener listener = mock(Player.Listener.class);
player.addListener(listener);
@ -147,7 +147,7 @@ public class SimpleExoPlayerTest {
@Test
public void releaseAfterVolumeChanges_triggerPendingDeviceVolumeEventsInListener() {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build();
Player.Listener listener = mock(Player.Listener.class);
player.addListener(listener);

View File

@ -69,6 +69,7 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
@ -1944,7 +1945,7 @@ public final class AnalyticsCollectorTest {
public void recursiveListenerInvocation_arrivesInCorrectOrder() {
AnalyticsCollector analyticsCollector = new AnalyticsCollector(Clock.DEFAULT);
analyticsCollector.setPlayer(
new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build(),
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext()).build(),
Looper.myLooper());
AnalyticsListener listener1 = mock(AnalyticsListener.class);
AnalyticsListener listener2 =

View File

@ -22,6 +22,7 @@ import android.media.AudioFormat;
import android.media.MediaFormat;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
@ -87,7 +88,7 @@ public class EndToEndGaplessTest {
@Test
public void testPlayback_twoIdenticalMp3Files() throws Exception {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(ApplicationProvider.getApplicationContext())
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext())
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -64,7 +65,7 @@ public class FlacPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -55,7 +56,7 @@ public final class FlvPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -57,7 +58,7 @@ public final class MkaPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -61,7 +62,7 @@ public final class MkvPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -60,7 +61,7 @@ public final class Mp3PlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -77,7 +78,7 @@ public class Mp4PlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, renderersFactory)
new ExoPlayer.Builder(applicationContext, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -58,7 +59,7 @@ public final class OggPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -45,7 +46,7 @@ public final class PlaylistPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
@ -67,7 +68,7 @@ public final class PlaylistPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
@ -45,7 +46,7 @@ public final class SilencePlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
@ -66,7 +67,7 @@ public final class SilencePlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -81,7 +82,7 @@ public class TsPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -59,7 +60,7 @@ public final class Vp9PlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.e2etest;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -52,7 +53,7 @@ public final class WavPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);

View File

@ -35,6 +35,7 @@ import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -143,7 +144,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, renderersFactory)
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
@ -202,7 +203,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, renderersFactory)
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
@ -262,7 +263,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context, renderersFactory)
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
@ -319,9 +320,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
public void playbackWithSeek_isHandledCorrectly() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(context)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
new ExoPlayer.Builder(context).setClock(new FakeClock(/* isAutoAdvancing= */ true)).build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
ServerSideInsertedAdsMediaSource mediaSource =

View File

@ -22,6 +22,7 @@ import android.graphics.SurfaceTexture;
import android.view.Surface;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
@ -51,7 +52,7 @@ public final class DashPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));
@ -78,7 +79,7 @@ public final class DashPlaybackTest {
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -25,6 +25,7 @@ import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -150,7 +151,7 @@ public final class RtspPlaybackTest {
private SimpleExoPlayer createSimpleExoPlayer(
int serverRtspPortNumber, RtpDataChannel.Factory rtpDataChannelFactory) {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(applicationContext, capturingRenderersFactory)
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(clock)
.build();
player.setMediaSource(

View File

@ -37,6 +37,7 @@ import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
@ -477,7 +478,7 @@ public final class Transformer {
DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS / 10)
.build();
player =
new SimpleExoPlayer.Builder(
new ExoPlayer.Builder(
context, new TransformerRenderersFactory(muxerWrapper, transformation))
.setMediaSourceFactory(mediaSourceFactory)
.setTrackSelector(trackSelector)

View File

@ -47,12 +47,12 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ControlDispatcher;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.Events;
import com.google.android.exoplayer2.Player.State;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.RepeatModeUtil;
@ -603,7 +603,7 @@ public class PlayerControlView extends FrameLayout {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@link SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -53,9 +53,9 @@ import androidx.media.app.NotificationCompat.MediaStyle;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ControlDispatcher;
import com.google.android.exoplayer2.DefaultControlDispatcher;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.util.NotificationUtil;
import com.google.android.exoplayer2.util.Util;
import java.lang.annotation.Documented;
@ -819,9 +819,9 @@ public class PlayerNotificationManager {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@link SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}), or configure whether the
* rewind and fast forward actions should be used with {{@link #setUseRewindAction(boolean)}}
* and {@link #setUseFastForwardAction(boolean)}.
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}), or configure whether the rewind
* and fast forward actions should be used with {{@link #setUseRewindAction(boolean)}} and
* {@link #setUseFastForwardAction(boolean)}.
*/
@Deprecated
public final void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -47,13 +47,13 @@ import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ControlDispatcher;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.DiscontinuityReason;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Period;
import com.google.android.exoplayer2.source.TrackGroupArray;
@ -931,7 +931,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@link SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -65,7 +65,6 @@ import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.Events;
import com.google.android.exoplayer2.Player.State;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.TrackGroup;
import com.google.android.exoplayer2.source.TrackGroupArray;
@ -836,7 +835,7 @@ public class StyledPlayerControlView extends FrameLayout {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@link SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -48,13 +48,13 @@ import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ControlDispatcher;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ForwardingPlayer;
import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.DiscontinuityReason;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Period;
import com.google.android.exoplayer2.source.TrackGroupArray;
@ -949,7 +949,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead.
* You can also customize some operations when configuring the player (for example by using
* {@link SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public void setControlDispatcher(ControlDispatcher controlDispatcher) {

View File

@ -25,6 +25,7 @@ import androidx.annotation.RequiresApi;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.platform.app.InstrumentationRegistry;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.RendererCapabilities;
@ -314,7 +315,7 @@ import java.util.List;
protected SimpleExoPlayer buildExoPlayer(
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(host, new DebugRenderersFactory(host))
new ExoPlayer.Builder(host, new DebugRenderersFactory(host))
.setTrackSelector(trackSelector)
.build();
player.setVideoSurface(surface);

View File

@ -248,7 +248,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
renderersFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
renderersFactory.setAllowedVideoJoiningTimeMs(/* allowedVideoJoiningTimeMs= */ 0);
SimpleExoPlayer player =
new SimpleExoPlayer.Builder(host, renderersFactory).setTrackSelector(trackSelector).build();
new ExoPlayer.Builder(host, renderersFactory).setTrackSelector(trackSelector).build();
player.setVideoSurface(surface);
return player;
}

View File

@ -22,6 +22,7 @@ import android.os.Looper;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.LoadControl;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
@ -276,7 +277,7 @@ public class TestExoPlayerBuilder {
};
}
return new SimpleExoPlayer.Builder(context, playerRenderersFactory)
return new ExoPlayer.Builder(context, playerRenderersFactory)
.setTrackSelector(trackSelector)
.setLoadControl(loadControl)
.setBandwidthMeter(bandwidthMeter)