Search in sources :

Example 36 with EventTime

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime in project ExoPlayer by google.

the class DefaultPlaybackSessionManager method updateSessionsWithTimelineChange.

@Override
public synchronized void updateSessionsWithTimelineChange(EventTime eventTime) {
    Assertions.checkNotNull(listener);
    Timeline previousTimeline = currentTimeline;
    currentTimeline = eventTime.timeline;
    Iterator<SessionDescriptor> iterator = sessions.values().iterator();
    while (iterator.hasNext()) {
        SessionDescriptor session = iterator.next();
        if (!session.tryResolvingToNewTimeline(previousTimeline, currentTimeline) || session.isFinishedAtEventTime(eventTime)) {
            iterator.remove();
            if (session.isCreated) {
                if (session.sessionId.equals(currentSessionId)) {
                    currentSessionId = null;
                }
                listener.onSessionFinished(eventTime, session.sessionId, /* automaticTransitionToNextPlayback= */
                false);
            }
        }
    }
    updateCurrentSession(eventTime);
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Example 37 with EventTime

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime in project ExoPlayer by google.

the class DefaultAnalyticsCollector method onMediaItemTransition.

@Override
public final void onMediaItemTransition(@Nullable MediaItem mediaItem, @Player.MediaItemTransitionReason int reason) {
    EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_MEDIA_ITEM_TRANSITION, listener -> listener.onMediaItemTransition(eventTime, mediaItem, reason));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 38 with EventTime

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime in project ExoPlayer by google.

the class DefaultAnalyticsCollector method onAvailableCommandsChanged.

@Override
public void onAvailableCommandsChanged(Player.Commands availableCommands) {
    EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_AVAILABLE_COMMANDS_CHANGED, listener -> listener.onAvailableCommandsChanged(eventTime, availableCommands));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 39 with EventTime

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime in project ExoPlayer by google.

the class DefaultAnalyticsCollector method onLoadStarted.

// MediaSourceEventListener implementation.
@Override
public final void onLoadStarted(int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
    EventTime eventTime = generateMediaPeriodEventTime(windowIndex, mediaPeriodId);
    sendEvent(eventTime, AnalyticsListener.EVENT_LOAD_STARTED, listener -> listener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 40 with EventTime

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime in project ExoPlayer by google.

the class DefaultAnalyticsCollector method onSeekForwardIncrementChanged.

@Override
public void onSeekForwardIncrementChanged(long seekForwardIncrementMs) {
    EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_SEEK_FORWARD_INCREMENT_CHANGED, listener -> listener.onSeekForwardIncrementChanged(eventTime, seekForwardIncrementMs));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Aggregations

EventTime (com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)103 Test (org.junit.Test)41 FakeTimeline (com.google.android.exoplayer2.testutil.FakeTimeline)38 Timeline (com.google.android.exoplayer2.Timeline)37 MediaPeriodId (com.google.android.exoplayer2.source.MediaSource.MediaPeriodId)34 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)26 TimelineWindowDefinition (com.google.android.exoplayer2.testutil.FakeTimeline.TimelineWindowDefinition)14 Nullable (androidx.annotation.Nullable)9 AdPlaybackState (com.google.android.exoplayer2.source.ads.AdPlaybackState)6 TestExoPlayerBuilder (com.google.android.exoplayer2.testutil.TestExoPlayerBuilder)6 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)5 InOrder (org.mockito.InOrder)5 AnalyticsListener (com.google.android.exoplayer2.analytics.AnalyticsListener)4 ApplicationProvider (androidx.test.core.app.ApplicationProvider)3 AndroidJUnit4 (androidx.test.ext.junit.runners.AndroidJUnit4)3 ExoPlayer (com.google.android.exoplayer2.ExoPlayer)3 MediaItem (com.google.android.exoplayer2.MediaItem)3 PlaybackException (com.google.android.exoplayer2.PlaybackException)3 PlaybackParameters (com.google.android.exoplayer2.PlaybackParameters)3 Player (com.google.android.exoplayer2.Player)3