Migrate library usages of SimpleExoPlayer to ExoPlayer.

PiperOrigin-RevId: 402853522
This commit is contained in:
samrobinson 2021-10-13 17:37:08 +01:00 committed by Oliver Woodman
parent 3b8eba2dea
commit 3c19850ed3
59 changed files with 377 additions and 416 deletions

View File

@ -37,8 +37,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.util.Assertions;
@ -48,8 +48,8 @@ import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.dynamite.DynamiteModule;
/**
* An activity that plays video using {@link SimpleExoPlayer} and supports casting using ExoPlayer's
* Cast extension.
* An activity that plays video using {@link ExoPlayer} and supports casting using ExoPlayer's Cast
* extension.
*/
public class MainActivity extends AppCompatActivity
implements OnClickListener, PlayerManager.Listener {

View File

@ -25,7 +25,6 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.DiscontinuityReason;
import com.google.android.exoplayer2.Player.TimelineChangeReason;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.ext.cast.CastPlayer;
@ -64,7 +63,7 @@ import java.util.ArrayList;
private Player currentPlayer;
/**
* Creates a new manager for {@link SimpleExoPlayer} and {@link CastPlayer}.
* Creates a new manager for {@link ExoPlayer} and {@link CastPlayer}.
*
* @param listener A {@link Listener} for queue position changes.
* @param localPlayerView The {@link PlayerView} for local playback.

View File

@ -27,7 +27,6 @@ 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;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.FrameworkMediaDrm;
@ -65,7 +64,7 @@ public final class MainActivity extends Activity {
@Nullable private PlayerView playerView;
@Nullable private VideoProcessingGLSurfaceView videoProcessingGLSurfaceView;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -173,7 +172,7 @@ public final class MainActivity extends Activity {
throw new IllegalStateException();
}
SimpleExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
ExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
player.setRepeatMode(Player.REPEAT_MODE_ALL);
player.setMediaSource(mediaSource);
player.prepare();

View File

@ -37,7 +37,6 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.drm.FrameworkMediaDrm;
@ -61,7 +60,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
/** An activity that plays media using {@link SimpleExoPlayer}. */
/** An activity that plays media using {@link ExoPlayer}. */
public class PlayerActivity extends AppCompatActivity
implements OnClickListener, StyledPlayerControlView.VisibilityListener {
@ -75,7 +74,7 @@ public class PlayerActivity extends AppCompatActivity
protected StyledPlayerView playerView;
protected LinearLayout debugRootView;
protected TextView debugTextView;
protected @Nullable SimpleExoPlayer player;
protected @Nullable ExoPlayer player;
private boolean isShowingTrackSelectionDialog;
private Button selectTracksButton;

View File

@ -31,7 +31,6 @@ 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;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.FrameworkMediaDrm;
@ -67,7 +66,7 @@ public final class MainActivity extends Activity {
@Nullable private SurfaceView nonFullScreenView;
@Nullable private SurfaceView currentOutputView;
@Nullable private static SimpleExoPlayer player;
@Nullable private static ExoPlayer player;
@Nullable private static SurfaceControl surfaceControl;
@Nullable private static Surface videoSurface;
@ -217,7 +216,7 @@ public final class MainActivity extends Activity {
} else {
throw new IllegalStateException();
}
SimpleExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
ExoPlayer player = new ExoPlayer.Builder(getApplicationContext()).build();
player.setMediaSource(mediaSource);
player.prepare();
player.play();

View File

@ -53,7 +53,7 @@ MediaSourceFactory mediaSourceFactory =
new DefaultMediaSourceFactory(context)
.setAdsLoaderProvider(adsLoaderProvider)
.setAdViewProvider(playerView);
SimpleExoPlayer player = new ExoPlayer.Builder(context)
ExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(mediaSourceFactory)
.build();
~~~
@ -209,7 +209,7 @@ events to an ad SDK or ad server. For example, the media stream may include
timed events that need to be reported by the client (see [supported formats][]
for information on what timed metadata formats are supported by ExoPlayer). Apps
can listen for timed metadata events from the player, e.g., via
`SimpleExoPlayer.addMetadataOutput`.
`ExoPlayer.addMetadataOutput`.
The IMA extension currently only handles client-side ad insertion. It does not
provide any integration with the DAI part of the IMA SDK.

View File

@ -44,7 +44,7 @@ implementations. You can easily add your own listener and override only the
methods you are interested in:
~~~
simpleExoPlayer.addAnalyticsListener(new AnalyticsListener() {
exoPlayer.addAnalyticsListener(new AnalyticsListener() {
@Override
public void onPlaybackStateChanged(
EventTime eventTime, @Player.State int state) {
@ -98,7 +98,7 @@ current playback session at any time using
`PlaybackStatsListener.getPlaybackStats()`.
~~~
simpleExoPlayer.addAnalyticsListener(
exoPlayer.addAnalyticsListener(
new PlaybackStatsListener(
/* keepHistory= */ true, (eventTime, playbackStats) -> {
// Analytics data for the session started at `eventTime` is ready.
@ -246,7 +246,7 @@ class ExtendedCollector extends AnalyticsCollector {
}
// Usage - Setup and listener registration.
SimpleExoPlayer player = new ExoPlayer.Builder(context)
ExoPlayer player = new ExoPlayer.Builder(context)
.setAnalyticsCollector(new ExtendedCollector())
.build();
player.addAnalyticsListener(new ExtendedListener() {

View File

@ -4,13 +4,13 @@ title: Customization
At the core of the ExoPlayer library is the `Player` interface. A `Player`
exposes traditional high-level media player functionality such as the ability to
buffer media, play, pause and seek. The default implementations `ExoPlayer` and
`SimpleExoPlayer` are designed to make few assumptions about (and hence impose
few restrictions on) the type of media being played, how and where it is stored,
and how it is rendered. Rather than implementing the loading and rendering of
media directly, `ExoPlayer` implementations delegate this work to components
that are injected when a player is created or when new media sources are passed
to the player. Components common to all `ExoPlayer` implementations are:
buffer media, play, pause and seek. The default implementation `ExoPlayer` is
designed to make few assumptions about (and hence impose few restrictions on)
the type of media being played, how and where it is stored, and how it is
rendered. Rather than implementing the loading and rendering of media directly,
`ExoPlayer` implementations delegate this work to components that are injected
when a player is created or when new media sources are passed to the player.
Components common to all `ExoPlayer` implementations are:
* `MediaSource` instances that define media to be played, load the media, and
from which the loaded media can be read. `MediaSource` instances are created
@ -59,7 +59,7 @@ DefaultDataSource.Factory dataSourceFactory =
new DefaultDataSource.Factory(context, httpDataSourceFactory);
// Inject the DefaultDataSourceFactory when creating the player.
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();
@ -82,7 +82,7 @@ DataSource.Factory cacheDataSourceFactory =
.setCache(simpleCache)
.setUpstreamDataSourceFactory(httpDataSourceFactory);
SimpleExoPlayer player = new ExoPlayer.Builder(context)
ExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(cacheDataSourceFactory))
.build();
@ -107,7 +107,7 @@ DataSource.Factory dataSourceFactory = () -> {
return dataSource;
};
SimpleExoPlayer player = new ExoPlayer.Builder(context)
ExoPlayer player = new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();
~~~
@ -157,7 +157,7 @@ LoadErrorHandlingPolicy loadErrorHandlingPolicy =
}
};
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context)
@ -181,7 +181,7 @@ DefaultExtractorsFactory extractorsFactory =
new DefaultExtractorsFactory()
.setMp3ExtractorFlags(Mp3Extractor.FLAG_ENABLE_INDEX_SEEKING);
SimpleExoPlayer player = new ExoPlayer.Builder(context)
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -6,7 +6,7 @@ By default ExoPlayer only logs errors. To log player events, the `EventLogger`
class can be used. The additional logging it provides can be helpful for
understanding what the player is doing, as well as for debugging playback
issues. `EventLogger` implements `AnalyticsListener`, so registering an instance
with a `SimpleExoPlayer` is easy:
with an `ExoPlayer` is easy:
```
player.addAnalyticsListener(new EventLogger(trackSelector));

View File

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

View File

@ -14,7 +14,7 @@ For simple use cases, getting started with `ExoPlayer` consists of implementing
the following steps:
1. Add ExoPlayer as a dependency to your project.
1. Create a `SimpleExoPlayer` instance.
1. Create an `ExoPlayer` instance.
1. Attach the player to a view (for video output and user input).
1. Prepare the player with a `MediaItem` to play.
1. Release the player when done.
@ -97,7 +97,7 @@ a range of customization options. The code below is the simplest example of
creating an instance.
~~~
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
ExoPlayer player = new ExoPlayer.Builder(context).build();
~~~
{: .language-java}
@ -117,12 +117,12 @@ which the player must be accessed can be queried using
`Player.getApplicationLooper`.
If you see `IllegalStateException` being thrown with the message "Player is
accessed on the wrong thread", then some code in your app is accessing a
`SimpleExoPlayer` instance on the wrong thread (the exception's stack trace
shows you where). You can temporarily opt out from these exceptions being thrown
by calling `SimpleExoPlayer.setThrowsWhenUsingWrongThread(false)`, in which case
the issue will be logged as a warning instead. Using this opt out is not safe
and may result in unexpected or obscure errors. It will be removed in ExoPlayer
accessed on the wrong thread", then some code in your app is accessing an
`ExoPlayer` instance on the wrong thread (the exception's stack trace shows you
where). You can temporarily opt out from these exceptions being thrown by
calling `ExoPlayer.setThrowsWhenUsingWrongThread(false)`, in which case the
issue will be logged as a warning instead. Using this opt out is not safe and
may result in unexpected or obscure errors. It will be removed in ExoPlayer
2.16.
{:.info}
@ -148,10 +148,10 @@ useful for audio only use cases.
Use of ExoPlayer's pre-built UI components is optional. For video applications
that implement their own UI, the target `SurfaceView`, `TextureView`,
`SurfaceHolder` or `Surface` can be set using `SimpleExoPlayer`'s
`SurfaceHolder` or `Surface` can be set using `ExoPlayer`'s
`setVideoSurfaceView`, `setVideoTextureView`, `setVideoSurfaceHolder` and
`setVideoSurface` methods respectively. `SimpleExoPlayer`'s `addTextOutput`
method can be used to receive captions that should be rendered during playback.
`setVideoSurface` methods respectively. `ExoPlayer`'s `addTextOutput` method can
be used to receive captions that should be rendered during playback.
## Populating the playlist and preparing the player ##

View File

@ -18,7 +18,7 @@ player.
~~~
// Create a player instance.
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(hlsMediaSource);
// Prepare the player.

View File

@ -180,15 +180,15 @@ together in `onEvents`.
## Using AnalyticsListener ##
When using `SimpleExoPlayer`, an `AnalyticsListener` can be registered with the
player by calling `addAnalyticsListener`. `AnalyticsListener` implementations
are able to listen to detailed events that may be useful for analytics and
logging purposes. Please refer to the [analytics page][] for more details.
When using `ExoPlayer`, an `AnalyticsListener` can be registered with the player
by calling `addAnalyticsListener`. `AnalyticsListener` implementations are able
to listen to detailed events that may be useful for analytics and logging
purposes. Please refer to the [analytics page][] for more details.
### Using EventLogger ###
`EventLogger` is an `AnalyticsListener` provided directly by the library for
logging purposes. It can be added to a `SimpleExoPlayer` to enable useful
logging purposes. It can be added to an `ExoPlayer` to enable useful
additional logging with a single line.
```

View File

@ -96,7 +96,7 @@ values will override parameters defined by the media.
~~~
// Global settings.
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context).setLiveTargetOffsetMs(5000))
@ -166,7 +166,7 @@ implementation, which is `DefaultLivePlaybackSpeedControl`. In both cases an
instance can be set when building the player:
~~~
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context)
.setLivePlaybackSpeedControl(
new DefaultLivePlaybackSpeedControl.Builder()

View File

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

View File

@ -32,8 +32,8 @@ where `PreferredHttpDataSource.Factory` is the factory corresponding to your
preferred network stack. The `DefaultDataSourceFactory` layer adds in support
for non-http(s) sources such as local files.
The example below shows how to build a `SimpleExoPlayer` that will use
the Cronet network stack and also support playback of non-http(s) content.
The example below shows how to build an `ExoPlayer` that will use the Cronet
network stack and also support playback of non-http(s) content.
~~~
// Given a CronetEngine and Executor, build a CronetDataSource.Factory.
@ -49,7 +49,7 @@ DefaultDataSource.Factory dataSourceFactory =
/* baseDataSourceFactory= */ cronetDataSourceFactory);
// Inject the DefaultDataSourceFactory when creating the player.
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context)
.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory))
.build();

View File

@ -166,9 +166,9 @@ This can be customized by providing a custom shuffle order implementation:
~~~
// Set the custom shuffle order.
simpleExoPlayer.setShuffleOrder(shuffleOrder);
exoPlayer.setShuffleOrder(shuffleOrder);
// Enable shuffle mode.
simpleExoPlayer.setShuffleModeEnabled(/* shuffleModeEnabled= */ true);
exoPlayer.setShuffleModeEnabled(/* shuffleModeEnabled= */ true);
~~~
{: .language-java}

View File

@ -11,7 +11,7 @@ it to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

@ -49,7 +49,7 @@ By default, the player's renderers will be created using
none of them will be removed by code shrinking. If you know that your app only
needs a subset of renderers, you can specify your own `RenderersFactory`
instead. For example, an app that only plays audio can define a factory like
this when instantiating `SimpleExoPlayer` instances:
this when instantiating `ExoPlayer` instances:
~~~
RenderersFactory audioOnlyRenderersFactory =
@ -58,7 +58,7 @@ RenderersFactory audioOnlyRenderersFactory =
new MediaCodecAudioRenderer(
context, MediaCodecSelector.DEFAULT, handler, audioListener)
};
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, audioOnlyRenderersFactory).build();
~~~
{: .language-java}
@ -80,7 +80,7 @@ an app that only needs to play mp4 files can provide a factory like:
~~~
ExtractorsFactory mp4ExtractorFactory =
() -> new Extractor[] {new Mp4Extractor()};
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, mp4ExtractorFactory).build();
~~~
{: .language-java}
@ -98,18 +98,18 @@ constructor, if your app is doing one of the following:
~~~
// Only playing DASH, HLS or SmoothStreaming.
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
// Providing a customized `DefaultMediaSourceFactory`
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY)
.setMediaSourceFactory(
new DefaultMediaSourceFactory(context, customExtractorsFactory))
.build();
// Using a MediaSource directly.
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, ExtractorsFactory.EMPTY).build();
ProgressiveMediaSource mediaSource =
new ProgressiveMediaSource.Factory(

View File

@ -19,7 +19,7 @@ to the player.
~~~
// Create a player instance.
SimpleExoPlayer player = new ExoPlayer.Builder(context).build();
ExoPlayer 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 ExoPlayer.Builder(context).build();
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.

View File

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

View File

@ -230,7 +230,7 @@ audio when your app is in the background:
from killing your process to free up resources.
1. You need to hold a [`WifiLock`][] and a [`WakeLock`][]. These ensure that the
system keeps the WiFi radio and CPU awake. This can be easily done if using
[`SimpleExoPlayer`][] by calling [`setWakeMode`][], which will automatically
[`ExoPlayer`][] by calling [`setWakeMode`][], which will automatically
acquire and release the required locks at the correct times.
It's important that you release the locks (if not using `setWakeMode`) and stop
@ -335,8 +335,8 @@ is the official way to play YouTube videos on Android.
[foreground service]: https://developer.android.com/guide/components/services.html#Foreground
[`WifiLock`]: {{ site.android_sdk }}/android/net/wifi/WifiManager.WifiLock.html
[`WakeLock`]: {{ site.android_sdk }}/android/os/PowerManager.WakeLock.html
[`SimpleExoPlayer`]: {{ site.exo_sdk }}/SimpleExoPlayer.html
[`setWakeMode`]: {{ site.exo_sdk }}/SimpleExoPlayer.html#setWakeMode(int)
[`ExoPlayer`]: {{ site.exo_sdk }}/ExoPlayer.html
[`setWakeMode`]: {{ site.exo_sdk }}/ExoPlayer.html#setWakeMode(int)
[A note on threading]: {{ site.base_url }}/hello-world.html#a-note-on-threading
[OkHttp extension]: {{ site.release_v2 }}/extensions/okhttp
[CORS enabled]: https://www.w3.org/wiki/CORS_Enabled

View File

@ -29,7 +29,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.audio.AudioProcessor;
import com.google.android.exoplayer2.audio.AudioSink;
import com.google.android.exoplayer2.audio.DefaultAudioSink;
@ -96,7 +95,7 @@ public class FlacPlaybackTest {
private final Uri uri;
private final AudioSink audioSink;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@Nullable private PlaybackException playbackException;
public TestPlaybackRunnable(Uri uri, Context context, AudioSink audioSink) {

View File

@ -25,11 +25,11 @@ import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;
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;
import com.google.android.exoplayer2.Player.TimelineChangeReason;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline.Window;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.decoder.DecoderCounters;
@ -192,7 +192,7 @@ public final class ImaPlaybackTest {
private final List<AdId> expectedAdIds;
private final List<AdId> seenAdIds;
private @MonotonicNonNull ImaAdsLoader imaAdsLoader;
private @MonotonicNonNull SimpleExoPlayer player;
private @MonotonicNonNull ExoPlayer player;
private ImaHostedTest(Uri contentUri, String adsResponse, AdId... expectedAdIds) {
// fullPlaybackNoSeeking is false as the playback lasts longer than the content source
@ -207,7 +207,7 @@ public final class ImaPlaybackTest {
}
@Override
protected SimpleExoPlayer buildExoPlayer(
protected ExoPlayer buildExoPlayer(
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
player = super.buildExoPlayer(host, surface, trackSelector);
player.addAnalyticsListener(

View File

@ -29,7 +29,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
@ -79,7 +78,7 @@ public class OpusPlaybackTest {
private final Context context;
private final Uri uri;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@Nullable private PlaybackException playbackException;
public TestPlaybackRunnable(Uri uri, Context context) {

View File

@ -30,7 +30,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
@ -107,7 +106,7 @@ public class VpxPlaybackTest {
private final Context context;
private final Uri uri;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@Nullable private PlaybackException playbackException;
public TestPlaybackRunnable(Uri uri, Context context) {

View File

@ -54,7 +54,7 @@ public final class ClippedPlaybackTest {
// Expect the clipping to affect both subtitles and video.
.setClipEndPositionMs(1000)
.build();
AtomicReference<SimpleExoPlayer> player = new AtomicReference<>();
AtomicReference<ExoPlayer> player = new AtomicReference<>();
TextCapturingPlaybackListener textCapturer = new TextCapturingPlaybackListener();
getInstrumentation()
.runOnMainSync(
@ -96,7 +96,7 @@ public final class ClippedPlaybackTest {
// subtitle content (3.5s).
.setClipEndPositionMs(4_000)
.build());
AtomicReference<SimpleExoPlayer> player = new AtomicReference<>();
AtomicReference<ExoPlayer> player = new AtomicReference<>();
TextCapturingPlaybackListener textCapturer = new TextCapturingPlaybackListener();
getInstrumentation()
.runOnMainSync(

View File

@ -24,7 +24,6 @@ import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.util.ConditionVariable;
import java.util.concurrent.atomic.AtomicReference;
import okhttp3.mockwebserver.MockResponse;
@ -64,7 +63,7 @@ public final class DrmPlaybackTest {
.setLicenseUri(mockWebServer.url("license").toString())
.build())
.build();
AtomicReference<SimpleExoPlayer> player = new AtomicReference<>();
AtomicReference<ExoPlayer> player = new AtomicReference<>();
ConditionVariable playbackComplete = new ConditionVariable();
AtomicReference<PlaybackException> playbackException = new AtomicReference<>();
getInstrumentation()

View File

@ -21,11 +21,11 @@ import com.google.android.exoplayer2.metadata.MetadataOutput;
import com.google.android.exoplayer2.text.TextOutput;
import com.google.android.exoplayer2.video.VideoRendererEventListener;
/** Builds {@link Renderer} instances for use by a {@link SimpleExoPlayer}. */
/** Builds {@link Renderer} instances for use by an {@link ExoPlayer}. */
public interface RenderersFactory {
/**
* Builds the {@link Renderer} instances for a {@link SimpleExoPlayer}.
* Builds the {@link Renderer} instances for an {@link ExoPlayer}.
*
* @param eventHandler A handler to use when invoking event listeners and outputs.
* @param videoRendererEventListener An event listener for video renderers.

View File

@ -18,32 +18,32 @@ package com.google.android.exoplayer2.util;
import android.annotation.SuppressLint;
import android.os.Looper;
import android.widget.TextView;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.decoder.DecoderCounters;
import java.util.Locale;
/**
* A helper class for periodically updating a {@link TextView} with debug information obtained from
* a {@link SimpleExoPlayer}.
* an {@link ExoPlayer}.
*/
public class DebugTextViewHelper implements Player.Listener, Runnable {
private static final int REFRESH_INTERVAL_MS = 1000;
private final SimpleExoPlayer player;
private final ExoPlayer player;
private final TextView textView;
private boolean started;
/**
* @param player The {@link SimpleExoPlayer} from which debug information should be obtained. Only
* @param player The {@link ExoPlayer} from which debug information should be obtained. Only
* players which are accessed on the main thread are supported ({@code
* player.getApplicationLooper() == Looper.getMainLooper()}).
* @param textView The {@link TextView} that should be updated to display the information.
*/
public DebugTextViewHelper(SimpleExoPlayer player, TextView textView) {
public DebugTextViewHelper(ExoPlayer player, TextView textView) {
Assertions.checkArgument(player.getApplicationLooper() == Looper.getMainLooper());
this.player = player;
this.textView = textView;

View File

@ -81,7 +81,6 @@ import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Timeline.Window;
import com.google.android.exoplayer2.TracksInfo;
@ -1048,7 +1047,7 @@ public final class AnalyticsCollectorTest {
.executeRunnable(
new PlayerRunnable() {
@Override
public void run(SimpleExoPlayer player) {
public void run(ExoPlayer player) {
player.addListener(
new Player.Listener() {
@Override
@ -1422,7 +1421,7 @@ public final class AnalyticsCollectorTest {
.executeRunnable(
new PlayerRunnable() {
@Override
public void run(SimpleExoPlayer player) {
public void run(ExoPlayer player) {
player.getAnalyticsCollector().notifySeekStarted();
}
})
@ -1653,7 +1652,7 @@ public final class AnalyticsCollectorTest {
@Test
public void onEvents_isReportedWithCorrectEventTimes() throws Exception {
SimpleExoPlayer player =
ExoPlayer player =
new TestExoPlayerBuilder(ApplicationProvider.getApplicationContext()).build();
Surface surface = new Surface(new SurfaceTexture(/* texName= */ 0));
player.setVideoSurface(surface);
@ -1987,7 +1986,7 @@ public final class AnalyticsCollectorTest {
public void release_withCallbacksArrivingAfterRelease_onPlayerReleasedForwardedLast()
throws Exception {
FakeClock fakeClock = new FakeClock(/* initialTimeMs= */ 0, /* isAutoAdvancing= */ true);
SimpleExoPlayer simpleExoPlayer =
ExoPlayer exoPlayer =
new TestExoPlayerBuilder(ApplicationProvider.getApplicationContext())
.setClock(fakeClock)
.build();
@ -2001,16 +2000,16 @@ public final class AnalyticsCollectorTest {
fakeClock.advanceTime(1);
}
});
simpleExoPlayer.addAnalyticsListener(analyticsListener);
exoPlayer.addAnalyticsListener(analyticsListener);
// Prepare with media to ensure video renderer is enabled.
simpleExoPlayer.setMediaSource(
exoPlayer.setMediaSource(
new FakeMediaSource(new FakeTimeline(), ExoPlayerTestRunner.VIDEO_FORMAT));
simpleExoPlayer.prepare();
TestPlayerRunHelper.runUntilPlaybackState(simpleExoPlayer, Player.STATE_READY);
exoPlayer.prepare();
TestPlayerRunHelper.runUntilPlaybackState(exoPlayer, Player.STATE_READY);
// Release and add delay on releasing thread to verify timestamps of events.
simpleExoPlayer.release();
exoPlayer.release();
long releaseTimeMs = fakeClock.currentTimeMillis();
fakeClock.advanceTime(1);
ShadowLooper.idleMainLooper();
@ -2024,11 +2023,11 @@ public final class AnalyticsCollectorTest {
inOrder.verify(analyticsListener).onVideoDisabled(videoDisabledEventTime.capture(), any());
inOrder
.verify(analyticsListener)
.onEvents(same(simpleExoPlayer), argThat(events -> events.contains(EVENT_VIDEO_DISABLED)));
.onEvents(same(exoPlayer), argThat(events -> events.contains(EVENT_VIDEO_DISABLED)));
inOrder.verify(analyticsListener).onPlayerReleased(releasedEventTime.capture());
inOrder
.verify(analyticsListener)
.onEvents(same(simpleExoPlayer), argThat(events -> events.contains(EVENT_PLAYER_RELEASED)));
.onEvents(same(exoPlayer), argThat(events -> events.contains(EVENT_PLAYER_RELEASED)));
// Verify order of timestamps of these events.
// This verification is needed as a regression test against [internal ref: b/195396384]. The

View File

@ -27,10 +27,10 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
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.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.testutil.FakeMediaSource;
@ -49,7 +49,7 @@ import org.robolectric.shadows.ShadowLooper;
@RunWith(AndroidJUnit4.class)
public final class PlaybackStatsListenerTest {
private SimpleExoPlayer player;
private ExoPlayer player;
@Before
public void setUp() {

View File

@ -26,7 +26,6 @@ import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.robolectric.RandomizedMp3Decoder;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -87,7 +86,7 @@ public class EndToEndGaplessTest {
@Test
public void testPlayback_twoIdenticalMp3Files() throws Exception {
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(ApplicationProvider.getApplicationContext())
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -64,7 +63,7 @@ public class FlacPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -22,7 +22,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -55,7 +54,7 @@ public final class FlvPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -57,7 +56,7 @@ public final class MkaPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -23,7 +23,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -63,7 +62,7 @@ public final class MkvPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -60,7 +59,7 @@ public final class Mp3PlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -22,7 +22,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -77,7 +76,7 @@ public class Mp4PlaybackTest {
public void test() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -58,7 +57,7 @@ public final class OggPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -21,7 +21,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -45,7 +44,7 @@ public final class PlaylistPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -67,7 +66,7 @@ public final class PlaylistPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -45,7 +44,7 @@ public final class SilencePlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -66,7 +65,7 @@ public final class SilencePlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -22,7 +22,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -81,7 +80,7 @@ public class TsPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -22,7 +22,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -59,7 +58,7 @@ public final class Vp9PlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -20,7 +20,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -52,7 +51,7 @@ public final class WavPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -38,7 +38,6 @@ 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;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
@ -143,7 +142,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
public void playbackWithPredefinedAds_playsSuccessfulWithoutRendererResets() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -202,7 +201,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
public void playbackWithNewlyInsertedAds_playsSuccessfulWithoutRendererResets() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -262,7 +261,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
throws Exception {
Context context = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(context);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context, renderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -319,7 +318,7 @@ public final class ServerSideInsertedAdMediaSourceTest {
@Test
public void playbackWithSeek_isHandledCorrectly() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(context).setClock(new FakeClock(/* isAutoAdvancing= */ true)).build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */ 1)));

View File

@ -25,7 +25,6 @@ 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;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
import com.google.android.exoplayer2.robolectric.TestPlayerRunHelper;
@ -54,7 +53,7 @@ public final class DashPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();
@ -81,7 +80,7 @@ public final class DashPlaybackTest {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory =
new CapturingRenderersFactory(applicationContext);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(new FakeClock(/* isAutoAdvancing= */ true))
.build();

View File

@ -30,7 +30,6 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.Listener;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.robolectric.PlaybackOutput;
import com.google.android.exoplayer2.robolectric.RobolectricUtil;
import com.google.android.exoplayer2.robolectric.ShadowMediaCodecConfig;
@ -103,8 +102,7 @@ public final class RtspPlaybackTest {
fakeRtpDataChannel);
try (RtspServer rtspServer = new RtspServer(responseProvider)) {
SimpleExoPlayer player =
createSimpleExoPlayer(rtspServer.startAndGetPortNumber(), rtpDataChannelFactory);
ExoPlayer player = createExoPlayer(rtspServer.startAndGetPortNumber(), rtpDataChannelFactory);
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
player.prepare();
@ -126,8 +124,7 @@ public final class RtspPlaybackTest {
new RtspServer(
new ResponseProvider(
clock, ImmutableList.of(mp4aLatmRtpPacketStreamDump), fakeRtpDataChannel))) {
SimpleExoPlayer player =
createSimpleExoPlayer(rtspServer.startAndGetPortNumber(), rtpDataChannelFactory);
ExoPlayer player = createExoPlayer(rtspServer.startAndGetPortNumber(), rtpDataChannelFactory);
AtomicReference<Throwable> playbackError = new AtomicReference<>();
player.prepare();
@ -148,9 +145,9 @@ public final class RtspPlaybackTest {
}
}
private SimpleExoPlayer createSimpleExoPlayer(
private ExoPlayer createExoPlayer(
int serverRtspPortNumber, RtpDataChannel.Factory rtpDataChannelFactory) {
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(applicationContext, capturingRenderersFactory)
.setClock(clock)
.build();

View File

@ -44,7 +44,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
@ -366,7 +365,7 @@ public final class TranscodingTransformer {
private TranscodingTransformer.Listener listener;
@Nullable private MuxerWrapper muxerWrapper;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@ProgressState private int progressState;
private TranscodingTransformer(

View File

@ -44,7 +44,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
@ -363,7 +362,7 @@ public final class Transformer {
private Transformer.Listener listener;
@Nullable private MuxerWrapper muxerWrapper;
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
@ProgressState private int progressState;
private Transformer(

View File

@ -29,7 +29,6 @@ import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.RendererCapabilities;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
import com.google.android.exoplayer2.drm.DrmSessionManager;
@ -312,9 +311,9 @@ import java.util.List;
}
@Override
protected SimpleExoPlayer buildExoPlayer(
protected ExoPlayer buildExoPlayer(
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(host, new DebugRenderersFactory(host))
.setTrackSelector(trackSelector)
.build();

View File

@ -23,7 +23,6 @@ import android.os.Looper;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.util.ConditionVariable;
import com.google.android.exoplayer2.util.Util;
@ -33,8 +32,8 @@ import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.compatqual.NullableType;
/**
* Helper methods to block the calling thread until the provided {@link SimpleExoPlayer} instance
* reaches a particular state.
* Helper methods to block the calling thread until the provided {@link ExoPlayer} instance reaches
* a particular state.
*/
public class TestPlayerRunHelper {
@ -260,7 +259,7 @@ public class TestPlayerRunHelper {
* @throws TimeoutException If the {@link RobolectricUtil#DEFAULT_TIMEOUT_MS default timeout} is
* exceeded.
*/
public static void runUntilRenderedFirstFrame(SimpleExoPlayer player) throws TimeoutException {
public static void runUntilRenderedFirstFrame(ExoPlayer player) throws TimeoutException {
verifyMainTestThread(player);
AtomicBoolean receivedCallback = new AtomicBoolean(false);
Player.Listener listener =

View File

@ -26,7 +26,6 @@ import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.PlayerMessage;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.source.MediaSource;
@ -72,7 +71,7 @@ public abstract class Action {
* null} if there's no next action.
*/
public final void doActionAndScheduleNext(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -84,7 +83,7 @@ public abstract class Action {
}
/**
* Called by {@link #doActionAndScheduleNext(SimpleExoPlayer, DefaultTrackSelector, Surface,
* Called by {@link #doActionAndScheduleNext(ExoPlayer, DefaultTrackSelector, Surface,
* HandlerWrapper, ActionNode)} to perform the action and to schedule the next action node.
*
* @param player The player to which the action should be applied.
@ -96,7 +95,7 @@ public abstract class Action {
* null} if there's no next action.
*/
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -108,7 +107,7 @@ public abstract class Action {
}
/**
* Called by {@link #doActionAndScheduleNextImpl(SimpleExoPlayer, DefaultTrackSelector, Surface,
* Called by {@link #doActionAndScheduleNextImpl(ExoPlayer, DefaultTrackSelector, Surface,
* HandlerWrapper, ActionNode)} to perform the action.
*
* @param player The player to which the action should be applied.
@ -117,7 +116,7 @@ public abstract class Action {
* needed.
*/
protected abstract void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface);
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface);
/** Calls {@link Player#seekTo(long)} or {@link Player#seekTo(int, long)}. */
public static final class Seek extends Action {
@ -157,7 +156,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
try {
if (windowIndex == null) {
player.seekTo(positionMs);
@ -172,7 +171,7 @@ public abstract class Action {
}
}
/** Calls {@link SimpleExoPlayer#setMediaSources(List, int, long)}. */
/** Calls {@link ExoPlayer#setMediaSources(List, int, long)}. */
public static final class SetMediaItems extends Action {
private final int windowIndex;
@ -195,12 +194,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setMediaSources(Arrays.asList(mediaSources), windowIndex, positionMs);
}
}
/** Calls {@link SimpleExoPlayer#addMediaSources(List)}. */
/** Calls {@link ExoPlayer#addMediaSources(List)}. */
public static final class AddMediaItems extends Action {
private final MediaSource[] mediaSources;
@ -216,12 +215,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.addMediaSources(Arrays.asList(mediaSources));
}
}
/** Calls {@link SimpleExoPlayer#setMediaSources(List, boolean)}. */
/** Calls {@link ExoPlayer#setMediaSources(List, boolean)}. */
public static final class SetMediaItemsResetPosition extends Action {
private final boolean resetPosition;
@ -241,12 +240,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setMediaSources(Arrays.asList(mediaSources), resetPosition);
}
}
/** Calls {@link SimpleExoPlayer#moveMediaItem(int, int)}. */
/** Calls {@link ExoPlayer#moveMediaItem(int, int)}. */
public static class MoveMediaItem extends Action {
private final int currentIndex;
@ -265,12 +264,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.moveMediaItem(currentIndex, newIndex);
}
}
/** Calls {@link SimpleExoPlayer#removeMediaItem(int)}. */
/** Calls {@link ExoPlayer#removeMediaItem(int)}. */
public static class RemoveMediaItem extends Action {
private final int index;
@ -286,12 +285,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.removeMediaItem(index);
}
}
/** Calls {@link SimpleExoPlayer#removeMediaItems(int, int)}. */
/** Calls {@link ExoPlayer#removeMediaItems(int, int)}. */
public static class RemoveMediaItems extends Action {
private final int fromIndex;
@ -310,12 +309,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.removeMediaItems(fromIndex, toIndex);
}
}
/** Calls {@link SimpleExoPlayer#clearMediaItems()}}. */
/** Calls {@link ExoPlayer#clearMediaItems()}}. */
public static class ClearMediaItems extends Action {
/** @param tag A tag to use for logging. */
@ -325,7 +324,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.clearMediaItems();
}
}
@ -360,7 +359,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (reset == null) {
player.stop();
} else {
@ -385,7 +384,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setPlayWhenReady(playWhenReady);
}
}
@ -412,13 +411,13 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
trackSelector.setParameters(
trackSelector.buildUponParameters().setRendererDisabled(rendererIndex, disabled));
}
}
/** Calls {@link SimpleExoPlayer#clearVideoSurface()}. */
/** Calls {@link ExoPlayer#clearVideoSurface()}. */
public static final class ClearVideoSurface extends Action {
/** @param tag A tag to use for logging. */
@ -428,12 +427,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.clearVideoSurface();
}
}
/** Calls {@link SimpleExoPlayer#setVideoSurface(Surface)}. */
/** Calls {@link ExoPlayer#setVideoSurface(Surface)}. */
public static final class SetVideoSurface extends Action {
/** @param tag A tag to use for logging. */
@ -443,12 +442,12 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setVideoSurface(Assertions.checkNotNull(surface));
}
}
/** Calls {@link SimpleExoPlayer#setAudioAttributes(AudioAttributes, boolean)}. */
/** Calls {@link ExoPlayer#setAudioAttributes(AudioAttributes, boolean)}. */
public static final class SetAudioAttributes extends Action {
private final AudioAttributes audioAttributes;
@ -468,7 +467,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setAudioAttributes(audioAttributes, handleAudioFocus);
}
}
@ -482,7 +481,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.prepare();
}
}
@ -503,7 +502,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setRepeatMode(repeatMode);
}
}
@ -524,7 +523,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setShuffleOrder(shuffleOrder);
}
}
@ -545,7 +544,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setShuffleModeEnabled(shuffleModeEnabled);
}
}
@ -591,9 +590,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
final SimpleExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface) {
final ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (target instanceof PlayerTarget) {
((PlayerTarget) target).setPlayer(player);
}
@ -627,7 +624,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player.setPlaybackParameters(playbackParameters);
}
}
@ -648,7 +645,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
player
.createMessage(
(messageType, payload) -> {
@ -680,7 +677,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -724,7 +721,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -768,7 +765,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -798,7 +795,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -816,7 +813,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -839,7 +836,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -863,7 +860,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -890,7 +887,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -914,7 +911,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -940,7 +937,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -964,7 +961,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -980,7 +977,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -1004,7 +1001,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -1030,7 +1027,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -1045,7 +1042,7 @@ public abstract class Action {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -1065,7 +1062,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}
@ -1083,7 +1080,7 @@ public abstract class Action {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (runnable instanceof PlayerRunnable) {
((PlayerRunnable) runnable).setPlayer(player);
}

View File

@ -20,12 +20,12 @@ import android.view.Surface;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.PlayerMessage;
import com.google.android.exoplayer2.PlayerMessage.Target;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.source.MediaSource;
@ -91,7 +91,7 @@ public final class ActionSchedule {
* notification is needed.
*/
/* package */ void start(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper mainHandler,
@ -601,7 +601,7 @@ public final class ActionSchedule {
void onMessageArrived();
}
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
private boolean hasArrived;
@Nullable private Callback callback;
@ -613,8 +613,7 @@ public final class ActionSchedule {
}
/** Handles the message send to the component and additionally provides access to the player. */
public abstract void handleMessage(
SimpleExoPlayer player, int messageType, @Nullable Object message);
public abstract void handleMessage(ExoPlayer player, int messageType, @Nullable Object message);
@Override
public final void handleMessage(
@ -626,8 +625,8 @@ public final class ActionSchedule {
}
}
/** Sets the player to be passed to {@link #handleMessage(SimpleExoPlayer, int, Object)}. */
/* package */ void setPlayer(SimpleExoPlayer player) {
/** Sets the player to be passed to {@link #handleMessage(ExoPlayer, int, Object)}. */
/* package */ void setPlayer(ExoPlayer player) {
this.player = player;
}
}
@ -638,18 +637,18 @@ public final class ActionSchedule {
*/
public abstract static class PlayerRunnable implements Runnable {
@Nullable private SimpleExoPlayer player;
@Nullable private ExoPlayer player;
/** Executes Runnable with reference to player. */
public abstract void run(SimpleExoPlayer player);
public abstract void run(ExoPlayer player);
@Override
public final void run() {
run(Assertions.checkStateNotNull(player));
}
/** Sets the player to be passed to {@link #run(SimpleExoPlayer)} . */
/* package */ void setPlayer(SimpleExoPlayer player) {
/** Sets the player to be passed to {@link #run(ExoPlayer)} . */
/* package */ void setPlayer(ExoPlayer player) {
this.player = player;
}
}
@ -663,7 +662,7 @@ public final class ActionSchedule {
@Nullable private ActionNode next;
private @MonotonicNonNull SimpleExoPlayer player;
private @MonotonicNonNull ExoPlayer player;
private @MonotonicNonNull DefaultTrackSelector trackSelector;
@Nullable private Surface surface;
private @MonotonicNonNull HandlerWrapper mainHandler;
@ -707,7 +706,7 @@ public final class ActionSchedule {
* @param mainHandler A handler associated with the main thread of the host activity.
*/
public void schedule(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper mainHandler) {
@ -754,7 +753,7 @@ public final class ActionSchedule {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Do nothing.
}
}
@ -774,7 +773,7 @@ public final class ActionSchedule {
@Override
protected void doActionAndScheduleNextImpl(
SimpleExoPlayer player,
ExoPlayer player,
DefaultTrackSelector trackSelector,
@Nullable Surface surface,
HandlerWrapper handler,
@ -788,7 +787,7 @@ public final class ActionSchedule {
@Override
protected void doActionImpl(
SimpleExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
// Not triggered.
}
}

View File

@ -27,7 +27,6 @@ import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.audio.DefaultAudioSink;
import com.google.android.exoplayer2.decoder.DecoderCounters;
@ -66,7 +65,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
private final ConditionVariable testFinished;
@Nullable private ActionSchedule pendingSchedule;
private @MonotonicNonNull SimpleExoPlayer player;
private @MonotonicNonNull ExoPlayer player;
private @MonotonicNonNull HandlerWrapper actionHandler;
private @MonotonicNonNull DefaultTrackSelector trackSelector;
private @MonotonicNonNull Surface surface;
@ -242,12 +241,12 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
return new DefaultTrackSelector(host);
}
protected SimpleExoPlayer buildExoPlayer(
protected ExoPlayer buildExoPlayer(
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(host);
renderersFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
renderersFactory.setAllowedVideoJoiningTimeMs(/* allowedVideoJoiningTimeMs= */ 0);
SimpleExoPlayer player =
ExoPlayer player =
new ExoPlayer.Builder(host, renderersFactory).setTrackSelector(trackSelector).build();
player.setVideoSurface(surface);
return player;

View File

@ -34,7 +34,6 @@ import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.source.MediaSource;
@ -71,7 +70,7 @@ public final class ExoPlayerTestRunner implements Player.Listener, ActionSchedul
.build();
/**
* Builder to set-up a {@link ExoPlayerTestRunner}. Default fake implementations will be used for
* Builder to set-up an {@link ExoPlayerTestRunner}. Default fake implementations will be used for
* unset test properties.
*/
public static final class Builder {
@ -267,7 +266,7 @@ public final class ExoPlayerTestRunner implements Player.Listener, ActionSchedul
/**
* Sets an {@link ActionSchedule} to be run by the test runner. The first action will be
* executed immediately before {@link SimpleExoPlayer#prepare()}.
* executed immediately before {@link ExoPlayer#prepare()}.
*
* @param actionSchedule An {@link ActionSchedule} to be used by the test runner.
* @return This builder.
@ -379,7 +378,7 @@ public final class ExoPlayerTestRunner implements Player.Listener, ActionSchedul
private final ArrayList<Integer> playbackStates;
private final boolean pauseAtEndOfMediaItems;
private SimpleExoPlayer player;
private ExoPlayer player;
private Exception exception;
private boolean playerWasPrepared;