Use ExoPlayer's AnalyticsListener and AnalyticsCollector.

This combines all the different listeners in ExoVideosPlayerV2 into one and
moves the PlaybackLogger class towards ExoPlayer's AnalyticsCollector with
the same purpose.

In the future this allows two things:
 1. Gradually move LogginClient implementations to AnalyticsListener to
    prevent custom event forwarding.
 2. Using ExoPlayer's QoE extension (which is also an AnalyticsListener).

PiperOrigin-RevId: 232321182
This commit is contained in:
tonihei 2019-02-04 18:26:40 +00:00 committed by Oliver Woodman
parent 7a4cf96f4a
commit 3818d7329d

View File

@ -129,12 +129,13 @@ public class AnalyticsCollector
/** /**
* Sets the player for which data will be collected. Must only be called if no player has been set * Sets the player for which data will be collected. Must only be called if no player has been set
* yet. * yet or the current player is idle.
* *
* @param player The {@link Player} for which data will be collected. * @param player The {@link Player} for which data will be collected.
*/ */
public void setPlayer(Player player) { public void setPlayer(Player player) {
Assertions.checkState(this.player == null); Assertions.checkState(
this.player == null || mediaPeriodQueueTracker.mediaPeriodInfoQueue.isEmpty());
this.player = Assertions.checkNotNull(player); this.player = Assertions.checkNotNull(player);
} }