Search in sources :

Example 11 with EventTime

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

the class MediaMetricsListener method onVideoSizeChanged.

@Override
public void onVideoSizeChanged(EventTime eventTime, VideoSize videoSize) {
    @Nullable PendingFormatUpdate pendingVideoFormat = this.pendingVideoFormat;
    if (pendingVideoFormat != null && pendingVideoFormat.format.height == Format.NO_VALUE) {
        Format formatWithHeightAndWidth = pendingVideoFormat.format.buildUpon().setWidth(videoSize.width).setHeight(videoSize.height).build();
        this.pendingVideoFormat = new PendingFormatUpdate(formatWithHeightAndWidth, pendingVideoFormat.selectionReason, pendingVideoFormat.sessionId);
    }
}
Also used : Format(com.google.android.exoplayer2.Format) Nullable(androidx.annotation.Nullable)

Example 12 with EventTime

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

the class DefaultAnalyticsCollector method onVideoDecoderInitialized.

@Override
// Calling deprecated listener method.
@SuppressWarnings("deprecation")
public final void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
    EventTime eventTime = generateReadingMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_VIDEO_DECODER_INITIALIZED, listener -> {
        listener.onVideoDecoderInitialized(eventTime, decoderName, initializationDurationMs);
        listener.onVideoDecoderInitialized(eventTime, decoderName, initializedTimestampMs, initializationDurationMs);
        listener.onDecoderInitialized(eventTime, C.TRACK_TYPE_VIDEO, decoderName, initializationDurationMs);
    });
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 13 with EventTime

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

the class DefaultAnalyticsCollector method onSkipSilenceEnabledChanged.

@Override
public final void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {
    EventTime eventTime = generateReadingMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_SKIP_SILENCE_ENABLED_CHANGED, listener -> listener.onSkipSilenceEnabledChanged(eventTime, skipSilenceEnabled));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 14 with EventTime

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

the class DefaultAnalyticsCollector method onPlaybackStateChanged.

@Override
public final void onPlaybackStateChanged(@Player.State int playbackState) {
    EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
    sendEvent(eventTime, AnalyticsListener.EVENT_PLAYBACK_STATE_CHANGED, listener -> listener.onPlaybackStateChanged(eventTime, playbackState));
}
Also used : EventTime(com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)

Example 15 with EventTime

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

the class DefaultAnalyticsCollector method generateMediaPeriodEventTime.

private EventTime generateMediaPeriodEventTime(int windowIndex, @Nullable MediaPeriodId mediaPeriodId) {
    checkNotNull(player);
    if (mediaPeriodId != null) {
        boolean isInKnownTimeline = mediaPeriodQueueTracker.getMediaPeriodIdTimeline(mediaPeriodId) != null;
        return isInKnownTimeline ? generateEventTime(mediaPeriodId) : generateEventTime(Timeline.EMPTY, windowIndex, mediaPeriodId);
    }
    Timeline timeline = player.getCurrentTimeline();
    boolean windowIsInTimeline = windowIndex < timeline.getWindowCount();
    return generateEventTime(windowIsInTimeline ? timeline : Timeline.EMPTY, windowIndex, /* mediaPeriodId= */
    null);
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

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