Commit 002ee4de by krocard Committed by bachinger

Deprecate EventListener in favor of Listener

#minor-release

PiperOrigin-RevId: 371348520
parent 762d19b0
Showing with 101 additions and 96 deletions
......@@ -30,7 +30,8 @@
`ExoPlayer`.
* Add `getMediaMetadata` to `Player` interface.
* Add a `Listener` interface to receive all player events in a single
object. Component Listeners have been deprecated in its favor.
object. Component Listeners and `EventListener` have been deprecated in
its favor.
* `Player.setPlaybackParameters` no longer accepts null, use
`PlaybackParameters.DEFAULT` instead.
* Use an empty string instead of the URI if the media ID is not explicitly
......
......@@ -57,14 +57,14 @@ player.prepare();
You can retrieve the current manifest by calling `Player.getCurrentManifest`.
For DASH you should cast the returned object to `DashManifest`. The
`onTimelineChanged` callback of `Player.EventListener` is also called whenever
`onTimelineChanged` callback of `Player.Listener` is also called whenever
the manifest is loaded. This will happen once for a on-demand content, and
possibly many times for live content. The code snippet below shows how an app
can do something whenever the manifest is loaded.
~~~
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onTimelineChanged(
Timeline timeline, @Player.TimelineChangeReason int reason) {
......
......@@ -60,14 +60,14 @@ player.prepare();
You can retrieve the current manifest by calling `Player.getCurrentManifest`.
For HLS you should cast the returned object to `HlsManifest`. The
`onTimelineChanged` callback of `Player.EventListener` is also called whenever
`onTimelineChanged` callback of `Player.Listener` is also called whenever
the manifest is loaded. This will happen once for a on-demand content, and
possibly many times for live content. The code snippet below shows how an app
can do something whenever the manifest is loaded.
~~~
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onTimelineChanged(
Timeline timeline, @Player.TimelineChangeReason int reason) {
......
......@@ -5,16 +5,16 @@ title: Player events
## Listening to playback events ##
Events such as changes in state and playback errors are reported to registered
[`Player.EventListener`][] instances. Registering a listener to receive such
[`Player.Listener`][] instances. Registering a listener to receive such
events is easy:
~~~
// Add a listener to receive events from the player.
player.addListener(eventListener);
player.addListener(listener);
~~~
{: .language-java}
`Player.EventListener` has empty default methods, so you only need to implement
`Player.Listener` has empty default methods, so you only need to implement
the methods you're interested in. See the [Javadoc][] for a full description of
the methods and when they're called. Some of the most important methods are
described in more detail below.
......@@ -28,7 +28,7 @@ should be preferred for different use cases.
Changes in player state can be received by implementing
`onPlaybackStateChanged(@State int state)` in a registered
`Player.EventListener`. The player can be in one of four playback states:
`Player.Listener`. The player can be in one of four playback states:
* `Player.STATE_IDLE`: This is the initial state, the state when the player is
stopped, and when playback failed.
......@@ -68,7 +68,7 @@ public void onIsPlayingChanged(boolean isPlaying) {
Errors that cause playback to fail can be received by implementing
`onPlayerError(ExoPlaybackException error)` in a registered
`Player.EventListener`. When a failure occurs, this method will be called
`Player.Listener`. When a failure occurs, this method will be called
immediately before the playback state transitions to `Player.STATE_IDLE`.
Failed or stopped playbacks can be retried by calling `ExoPlayer.retry`.
......@@ -107,7 +107,7 @@ public void onPlayerError(ExoPlaybackException error) {
Whenever the player changes to a new media item in the playlist
`onMediaItemTransition(MediaItem mediaItem,
@MediaItemTransitionReason int reason)` is called on registered
`Player.EventListener`s. The reason indicates whether this was an automatic
`Player.Listener`s. The reason indicates whether this was an automatic
transition, a seek (for example after calling `player.next()`), a repetition of
the same item, or caused by a playlist change (e.g., if the currently playing
item is removed).
......@@ -115,7 +115,7 @@ item is removed).
### Seeking ###
Calling `Player.seekTo` methods results in a series of callbacks to registered
`Player.EventListener` instances:
`Player.Listener` instances:
1. `onPositionDiscontinuity` with `reason=DISCONTINUITY_REASON_SEEK`. This is
the direct result of calling `Player.seekTo`.
......@@ -232,8 +232,8 @@ player
~~~
{: .language-java }
[`Player.EventListener`]: {{ site.exo_sdk }}/Player.EventListener.html
[Javadoc]: {{ site.exo_sdk }}/Player.EventListener.html
[`Player.Listener`]: {{ site.exo_sdk }}/Player.Listener.html
[Javadoc]: {{ site.exo_sdk }}/Player.Listener.html
[`Individual callbacks vs onEvents`]: #individual-callbacks-vs-onevents
[`ExoPlaybackException`]: {{ site.exo_sdk }}/ExoPlaybackException.html
[log output]: event-logger.html
......
......@@ -25,7 +25,7 @@ closer to the live edge again.
## Detecting and monitoring live playbacks ##
Every time a live window is updated, registered `Player.EventListener` instances
Every time a live window is updated, registered `Player.Listener` instances
will receive an `onTimelineChanged` event. You can retrieve details about the
current live playback by querying various `Player` and `Timeline.Window`
methods, as listed below and shown in the following figure.
......@@ -135,7 +135,7 @@ setting `minPlaybackSpeed` and `maxPlaybackSpeed` to `1.0f`.
The playback position may fall behind the live window, for example if the player
is paused or buffering for a long enough period of time. If this happens then
playback will fail and a `BehindLiveWindowException` will be reported via
`Player.EventListener.onPlayerError`. Application code may wish to handle such
`Player.Listener.onPlayerError`. Application code may wish to handle such
errors by resuming playback at the default position. The [PlayerActivity][] of
the demo app exemplifies this approach.
......
......@@ -101,7 +101,7 @@ MediaItem mediaItem =
## Detecting when playback transitions to another media item ##
When playback transitions to another media item, or starts repeating the same
media item, `EventListener.onMediaItemTransition(MediaItem,
media item, `Listener.onMediaItemTransition(MediaItem,
@MediaItemTransitionReason)` is called. This callback receives the new media
item, along with a `@MediaItemTransitionReason` indicating why the transition
occurred. A common use case for `onMediaItemTransition` is to update the
......@@ -135,7 +135,7 @@ public void onMediaItemTransition(
## Detecting when the playlist changes ##
When a media item is added, removed or moved,
`EventListener.onTimelineChanged(Timeline, @TimelineChangeReason)` is called
`Listener.onTimelineChanged(Timeline, @TimelineChangeReason)` is called
immediately with `TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED`. This callback is
called even when the player has not yet been prepared.
......
......@@ -59,14 +59,14 @@ player.prepare();
You can retrieve the current manifest by calling `Player.getCurrentManifest`.
For SmoothStreaming you should cast the returned object to `SsManifest`. The
`onTimelineChanged` callback of `Player.EventListener` is also called whenever
`onTimelineChanged` callback of `Player.Listener` is also called whenever
the manifest is loaded. This will happen once for a on-demand content, and
possibly many times for live content. The code snippet below shows how an app
can do something whenever the manifest is loaded.
~~~
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onTimelineChanged(
Timeline timeline, @Player.TimelineChangeReason int reason) {
......
......@@ -97,7 +97,7 @@ public class CastPlayerTest {
@Mock private CastContext mockCastContext;
@Mock private SessionManager mockSessionManager;
@Mock private CastSession mockCastSession;
@Mock private Player.EventListener mockListener;
@Mock private Player.Listener mockListener;
@Mock private PendingResult<RemoteMediaClient.MediaChannelResult> mockPendingResult;
@Captor
......
......@@ -89,7 +89,7 @@ public class FlacPlaybackTest {
"audiosinkdumps/" + fileName + ".audiosink.dump");
}
private static class TestPlaybackRunnable implements Player.EventListener, Runnable {
private static class TestPlaybackRunnable implements Player.Listener, Runnable {
private final Context context;
private final Uri uri;
......
......@@ -28,7 +28,6 @@ import com.google.android.exoplayer2.C;
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.EventListener;
import com.google.android.exoplayer2.Player.TimelineChangeReason;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline.Window;
......@@ -186,7 +185,7 @@ public final class ImaPlaybackTest {
}
}
private static final class ImaHostedTest extends ExoHostedTest implements EventListener {
private static final class ImaHostedTest extends ExoHostedTest implements Player.Listener {
private final Uri contentUri;
private final DataSpec adTagDataSpec;
......
......@@ -76,7 +76,7 @@ import java.util.List;
import java.util.Map;
/** Handles loading and playback of a single ad tag. */
/* package */ final class AdTagLoader implements Player.EventListener {
/* package */ final class AdTagLoader implements Player.Listener {
private static final String TAG = "AdTagLoader";
......
......@@ -85,7 +85,7 @@ import java.util.Set;
* href="https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/omsdk">IMA
* SDK Open Measurement documentation</a> for more information.
*/
public final class ImaAdsLoader implements Player.EventListener, AdsLoader {
public final class ImaAdsLoader implements Player.Listener, AdsLoader {
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ima");
......@@ -601,7 +601,7 @@ public final class ImaAdsLoader implements Player.EventListener, AdsLoader {
.handlePrepareError(adGroupIndex, adIndexInAdGroup, exception);
}
// Player.EventListener implementation.
// Player.Listener implementation.
@Override
public void onTimelineChanged(Timeline timeline, @Player.TimelineChangeReason int reason) {
......
......@@ -27,7 +27,7 @@ import com.google.android.exoplayer2.util.ListenerSet;
/** A fake player for testing content/ad playback. */
/* package */ final class FakePlayer extends StubExoPlayer {
private final ListenerSet<EventListener> listeners;
private final ListenerSet<Listener> listeners;
private final Timeline.Period period;
private final Object windowUid = new Object();
private final Object periodUid = new Object();
......@@ -185,12 +185,12 @@ import com.google.android.exoplayer2.util.ListenerSet;
}
@Override
public void addListener(Player.EventListener listener) {
public void addListener(Player.Listener listener) {
listeners.add(listener);
}
@Override
public void removeListener(Player.EventListener listener) {
public void removeListener(Player.Listener listener) {
listeners.remove(listener);
}
......
......@@ -1085,13 +1085,12 @@ public final class MediaSessionConnector {
}
}
private class ComponentListener extends MediaSessionCompat.Callback
implements Player.EventListener {
private class ComponentListener extends MediaSessionCompat.Callback implements Player.Listener {
private int currentWindowIndex;
private int currentWindowCount;
// Player.EventListener implementation.
// Player.Listener implementation.
@Override
public void onEvents(Player player, Player.Events events) {
......
......@@ -73,7 +73,7 @@ public class OpusPlaybackTest {
}
}
private static class TestPlaybackRunnable implements Player.EventListener, Runnable {
private static class TestPlaybackRunnable implements Player.Listener, Runnable {
private final Context context;
private final Uri uri;
......
......@@ -101,7 +101,7 @@ public class VpxPlaybackTest {
}
}
private static class TestPlaybackRunnable implements Player.EventListener, Runnable {
private static class TestPlaybackRunnable implements Player.Listener, Runnable {
private final Context context;
private final Uri uri;
......
......@@ -74,7 +74,10 @@ public interface Player {
* <p>Listeners can choose to implement individual events (e.g. {@link
* #onIsPlayingChanged(boolean)}) or {@link #onEvents(Player, Events)}, which is called after one
* or more events occurred together.
*
* @deprecated Use {@link Player.Listener}.
*/
@Deprecated
interface EventListener {
/**
......@@ -1040,7 +1043,9 @@ public interface Player {
* the player does not have a {@link Looper}, then the listener will be called on the main thread.
*
* @param listener The listener to register.
* @deprecated Use {@link #addListener(Listener)} instead.
*/
@Deprecated
void addListener(EventListener listener);
/**
......@@ -1055,7 +1060,9 @@ public interface Player {
* no longer receive events from the player.
*
* @param listener The listener to unregister.
* @deprecated Use {@link #addListener(Listener)} instead.
*/
@Deprecated
void removeListener(EventListener listener);
/**
......
......@@ -66,7 +66,7 @@ public final class ClippedPlaybackTest {
player
.get()
.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPlaybackStateChanged(@Player.State int state) {
if (state == Player.STATE_ENDED) {
......@@ -120,7 +120,7 @@ public final class ClippedPlaybackTest {
player
.get()
.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPlaybackStateChanged(@Player.State int state) {
if (state == Player.STATE_ENDED) {
......
......@@ -66,7 +66,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* Data collector that forwards analytics events to {@link AnalyticsListener AnalyticsListeners}.
*/
public class AnalyticsCollector
implements Player.EventListener,
implements Player.Listener,
AudioRendererEventListener,
VideoRendererEventListener,
MediaSourceEventListener,
......
......@@ -105,10 +105,10 @@ import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
* }</pre>
*
* If {@code rendererTrackGroups} is null then there aren't any currently mapped tracks, and so
* setting an override isn't possible. Note that a {@link Player.EventListener} registered on the
* player can be used to determine when the current tracks (and therefore the mapping) changes. If
* {@code rendererTrackGroups} is non-null then an override can be set. The next step is to query
* the properties of the available tracks to determine the {@code groupIndex} and the {@code
* setting an override isn't possible. Note that a {@link Player.Listener} registered on the player
* can be used to determine when the current tracks (and therefore the mapping) changes. If {@code
* rendererTrackGroups} is non-null then an override can be set. The next step is to query the
* properties of the available tracks to determine the {@code groupIndex} and the {@code
* trackIndices} within the group it that should be selected. The override can then be specified
* using {@link ParametersBuilder#setSelectionOverride}:
*
......
......@@ -28,7 +28,7 @@ import java.util.Locale;
* A helper class for periodically updating a {@link TextView} with debug information obtained from
* a {@link SimpleExoPlayer}.
*/
public class DebugTextViewHelper implements Player.EventListener, Runnable {
public class DebugTextViewHelper implements Player.Listener, Runnable {
private static final int REFRESH_INTERVAL_MS = 1000;
......@@ -75,7 +75,7 @@ public class DebugTextViewHelper implements Player.EventListener, Runnable {
textView.removeCallbacks(this);
}
// Player.EventListener implementation.
// Player.Listener implementation.
@Override
public final void onPlaybackStateChanged(@Player.State int playbackState) {
......
......@@ -1041,7 +1041,7 @@ public final class AnalyticsCollectorTest {
@Override
public void run(SimpleExoPlayer player) {
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPositionDiscontinuity(
Player.PositionInfo oldPosition,
......
......@@ -58,8 +58,8 @@ public class TestPlayerRunHelper {
return;
}
AtomicBoolean receivedExpectedState = new AtomicBoolean(false);
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onPlaybackStateChanged(int state) {
if (state == expectedState) {
......@@ -88,8 +88,8 @@ public class TestPlayerRunHelper {
return;
}
AtomicBoolean receivedExpectedPlayWhenReady = new AtomicBoolean(false);
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onPlayWhenReadyChanged(boolean playWhenReady, int reason) {
if (playWhenReady == expectedPlayWhenReady) {
......@@ -118,8 +118,8 @@ public class TestPlayerRunHelper {
return;
}
AtomicBoolean receivedExpectedTimeline = new AtomicBoolean(false);
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onTimelineChanged(Timeline timeline, int reason) {
if (expectedTimeline.equals(timeline)) {
......@@ -143,8 +143,8 @@ public class TestPlayerRunHelper {
public static Timeline runUntilTimelineChanged(Player player) throws TimeoutException {
verifyMainTestThread(player);
AtomicReference<Timeline> receivedTimeline = new AtomicReference<>();
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onTimelineChanged(Timeline timeline, int reason) {
receivedTimeline.set(timeline);
......@@ -158,7 +158,7 @@ public class TestPlayerRunHelper {
/**
* Runs tasks of the main {@link Looper} until a {@link
* Player.EventListener#onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)}
* Player.Listener#onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)}
* callback with the specified {@link Player.DiscontinuityReason} occurred.
*
* @param player The {@link Player}.
......@@ -170,8 +170,8 @@ public class TestPlayerRunHelper {
Player player, @Player.DiscontinuityReason int expectedReason) throws TimeoutException {
verifyMainTestThread(player);
AtomicBoolean receivedCallback = new AtomicBoolean(false);
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onPositionDiscontinuity(
Player.PositionInfo oldPosition, Player.PositionInfo newPosition, int reason) {
......@@ -196,8 +196,8 @@ public class TestPlayerRunHelper {
public static ExoPlaybackException runUntilError(Player player) throws TimeoutException {
verifyMainTestThread(player);
AtomicReference<ExoPlaybackException> receivedError = new AtomicReference<>();
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onPlayerError(ExoPlaybackException error) {
receivedError.set(error);
......
......@@ -729,7 +729,7 @@ public abstract class Action {
}
}
/** Waits for {@link Player.EventListener#onTimelineChanged(Timeline, int)}. */
/** Waits for {@link Player.Listener#onTimelineChanged(Timeline, int)}. */
public static final class WaitForTimelineChanged extends Action {
@Nullable private final Timeline expectedTimeline;
......@@ -776,8 +776,8 @@ public abstract class Action {
if (nextAction == null) {
return;
}
Player.EventListener listener =
new Player.EventListener() {
Player.Listener listener =
new Player.Listener() {
@Override
public void onTimelineChanged(
Timeline timeline, @Player.TimelineChangeReason int reason) {
......@@ -804,7 +804,7 @@ public abstract class Action {
}
/**
* Waits for {@link Player.EventListener#onPositionDiscontinuity(Player.PositionInfo,
* Waits for {@link Player.Listener#onPositionDiscontinuity(Player.PositionInfo,
* Player.PositionInfo, int)}.
*/
public static final class WaitForPositionDiscontinuity extends Action {
......@@ -825,7 +825,7 @@ public abstract class Action {
return;
}
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPositionDiscontinuity(
Player.PositionInfo oldPosition,
......@@ -846,7 +846,7 @@ public abstract class Action {
/**
* Waits for a specified playWhenReady value, returning either immediately or after a call to
* {@link Player.EventListener#onPlayWhenReadyChanged(boolean, int)}.
* {@link Player.Listener#onPlayWhenReadyChanged(boolean, int)}.
*/
public static final class WaitForPlayWhenReady extends Action {
......@@ -875,7 +875,7 @@ public abstract class Action {
nextAction.schedule(player, trackSelector, surface, handler);
} else {
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPlayWhenReadyChanged(
boolean playWhenReady, @Player.PlayWhenReadyChangeReason int reason) {
......@@ -897,7 +897,7 @@ public abstract class Action {
/**
* Waits for a specified playback state, returning either immediately or after a call to {@link
* Player.EventListener#onPlaybackStateChanged(int)}.
* Player.Listener#onPlaybackStateChanged(int)}.
*/
public static final class WaitForPlaybackState extends Action {
......@@ -926,7 +926,7 @@ public abstract class Action {
nextAction.schedule(player, trackSelector, surface, handler);
} else {
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onPlaybackStateChanged(@Player.State int playbackState) {
if (targetPlaybackState == playbackState) {
......@@ -987,7 +987,7 @@ public abstract class Action {
/**
* Waits for a specified loading state, returning either immediately or after a call to {@link
* Player.EventListener#onIsLoadingChanged(boolean)}.
* Player.Listener#onIsLoadingChanged(boolean)}.
*/
public static final class WaitForIsLoading extends Action {
......@@ -1016,7 +1016,7 @@ public abstract class Action {
nextAction.schedule(player, trackSelector, surface, handler);
} else {
player.addListener(
new Player.EventListener() {
new Player.Listener() {
@Override
public void onIsLoadingChanged(boolean isLoading) {
if (targetIsLoading == isLoading) {
......
......@@ -50,7 +50,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeoutException;
/** Helper class to run an ExoPlayer test. */
public final class ExoPlayerTestRunner implements Player.EventListener, ActionSchedule.Callback {
public final class ExoPlayerTestRunner implements Player.Listener, ActionSchedule.Callback {
/** A generic video {@link Format} which can be used to set up a {@link FakeMediaSource}. */
public static final Format VIDEO_FORMAT =
......@@ -82,7 +82,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
private Object manifest;
private ActionSchedule actionSchedule;
private Surface surface;
private Player.EventListener eventListener;
private Player.Listener playerListener;
private AnalyticsListener analyticsListener;
private Integer expectedPlayerEndedCount;
private boolean pauseAtEndOfMediaItems;
......@@ -290,14 +290,14 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
}
/**
* Sets an {@link Player.EventListener} to be registered to listen to player events.
* Sets an {@link Player.Listener} to be registered to listen to player events.
*
* @param eventListener A {@link Player.EventListener} to be registered by the test runner to
* listen to player events.
* @param playerListener A {@link Player.Listener} to be registered by the test runner to listen
* to player events.
* @return This builder.
*/
public Builder setEventListener(Player.EventListener eventListener) {
this.eventListener = eventListener;
public Builder setPlayerListener(Player.Listener playerListener) {
this.playerListener = playerListener;
return this;
}
......@@ -349,7 +349,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
initialPositionMs,
surface,
actionSchedule,
eventListener,
playerListener,
analyticsListener,
expectedPlayerEndedCount,
pauseAtEndOfMediaItems);
......@@ -363,7 +363,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
private final long initialPositionMs;
@Nullable private final Surface surface;
@Nullable private final ActionSchedule actionSchedule;
@Nullable private final Player.EventListener eventListener;
@Nullable private final Player.Listener playerListener;
@Nullable private final AnalyticsListener analyticsListener;
private final Clock clock;
......@@ -393,7 +393,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
long initialPositionMs,
@Nullable Surface surface,
@Nullable ActionSchedule actionSchedule,
@Nullable Player.EventListener eventListener,
@Nullable Player.Listener playerListener,
@Nullable AnalyticsListener analyticsListener,
int expectedPlayerEndedCount,
boolean pauseAtEndOfMediaItems) {
......@@ -404,7 +404,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
this.initialPositionMs = initialPositionMs;
this.surface = surface;
this.actionSchedule = actionSchedule;
this.eventListener = eventListener;
this.playerListener = playerListener;
this.analyticsListener = analyticsListener;
this.clock = playerBuilder.getClock();
timelines = new ArrayList<>();
......@@ -454,8 +454,8 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
player.setPauseAtEndOfMediaItems(true);
}
player.addListener(ExoPlayerTestRunner.this);
if (eventListener != null) {
player.addListener(eventListener);
if (playerListener != null) {
player.addListener(playerListener);
}
if (analyticsListener != null) {
player.addAnalyticsListener(analyticsListener);
......@@ -530,8 +530,8 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
// Assertions called on the test thread after test finished.
/**
* Asserts that the timelines reported by {@link Player.EventListener#onTimelineChanged(Timeline,
* int)} are the same to the provided timelines. This assert differs from testing equality by not
* Asserts that the timelines reported by {@link Player.Listener#onTimelineChanged(Timeline, int)}
* are the same to the provided timelines. This assert differs from testing equality by not
* comparing period ids which may be different due to id mapping of child source period ids.
*
* @param timelines A list of expected {@link Timeline}s.
......@@ -546,8 +546,8 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the timeline change reasons reported by {@link
* Player.EventListener#onTimelineChanged(Timeline, int)} are equal to the provided timeline
* change reasons.
* Player.Listener#onTimelineChanged(Timeline, int)} are equal to the provided timeline change
* reasons.
*/
public void assertTimelineChangeReasonsEqual(Integer... reasons) {
assertThat(timelineChangeReasons).containsExactlyElementsIn(Arrays.asList(reasons)).inOrder();
......@@ -555,7 +555,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the media items reported by {@link
* Player.EventListener#onMediaItemTransition(MediaItem, int)} are the same as the provided media
* Player.Listener#onMediaItemTransition(MediaItem, int)} are the same as the provided media
* items.
*
* @param mediaItems A list of expected {@link MediaItem media items}.
......@@ -566,8 +566,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the media item transition reasons reported by {@link
* Player.EventListener#onMediaItemTransition(MediaItem, int)} are the same as the provided
* reasons.
* Player.Listener#onMediaItemTransition(MediaItem, int)} are the same as the provided reasons.
*
* @param reasons A list of expected transition reasons.
*/
......@@ -577,7 +576,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the playback states reported by {@link
* Player.EventListener#onPlaybackStateChanged(int)} are equal to the provided playback states.
* Player.Listener#onPlaybackStateChanged(int)} are equal to the provided playback states.
*/
public void assertPlaybackStatesEqual(Integer... states) {
assertThat(playbackStates).containsExactlyElementsIn(states).inOrder();
......@@ -585,8 +584,8 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the last track group array reported by {@link
* Player.EventListener#onTracksChanged(TrackGroupArray, TrackSelectionArray)} is equal to the
* provided track group array.
* Player.Listener#onTracksChanged(TrackGroupArray, TrackSelectionArray)} is equal to the provided
* track group array.
*
* @param trackGroupArray The expected {@link TrackGroupArray}.
*/
......@@ -595,7 +594,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
}
/**
* Asserts that {@link Player.EventListener#onPositionDiscontinuity(Player.PositionInfo,
* Asserts that {@link Player.Listener#onPositionDiscontinuity(Player.PositionInfo,
* Player.PositionInfo, int)} was not called.
*/
public void assertNoPositionDiscontinuities() {
......@@ -604,8 +603,8 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
/**
* Asserts that the discontinuity reasons reported by {@link
* Player.EventListener#onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)}
* are equal to the provided values.
* Player.Listener#onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)} are
* equal to the provided values.
*
* @param discontinuityReasons The expected discontinuity reasons.
*/
......@@ -657,7 +656,7 @@ public final class ExoPlayerTestRunner implements Player.EventListener, ActionSc
}
}
// Player.EventListener
// Player.Listener
@Override
public void onTimelineChanged(Timeline timeline, @Player.TimelineChangeReason int reason) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment