Java Code Examples for com.google.android.exoplayer2.Player#DISCONTINUITY_REASON_PERIOD_TRANSITION

The following examples show how to use com.google.android.exoplayer2.Player#DISCONTINUITY_REASON_PERIOD_TRANSITION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventLogger.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
  switch (reason) {
    case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
      return "PERIOD_TRANSITION";
    case Player.DISCONTINUITY_REASON_SEEK:
      return "SEEK";
    case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
      return "SEEK_ADJUSTMENT";
    case Player.DISCONTINUITY_REASON_AD_INSERTION:
      return "AD_INSERTION";
    case Player.DISCONTINUITY_REASON_INTERNAL:
      return "INTERNAL";
    default:
      return "?";
  }
}
 
Example 2
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
  switch (reason) {
    case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
      return "PERIOD_TRANSITION";
    case Player.DISCONTINUITY_REASON_SEEK:
      return "SEEK";
    case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
      return "SEEK_ADJUSTMENT";
    case Player.DISCONTINUITY_REASON_AD_INSERTION:
      return "AD_INSERTION";
    case Player.DISCONTINUITY_REASON_INTERNAL:
      return "INTERNAL";
    default:
      return "?";
  }
}
 
Example 3
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
  switch (reason) {
    case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
      return "PERIOD_TRANSITION";
    case Player.DISCONTINUITY_REASON_SEEK:
      return "SEEK";
    case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
      return "SEEK_ADJUSTMENT";
    case Player.DISCONTINUITY_REASON_AD_INSERTION:
      return "AD_INSERTION";
    case Player.DISCONTINUITY_REASON_INTERNAL:
      return "INTERNAL";
    default:
      return "?";
  }
}
 
Example 4
Source File: EventLogger.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
  switch (reason) {
    case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
      return "PERIOD_TRANSITION";
    case Player.DISCONTINUITY_REASON_SEEK:
      return "SEEK";
    case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
      return "SEEK_ADJUSTMENT";
    case Player.DISCONTINUITY_REASON_AD_INSERTION:
      return "AD_INSERTION";
    case Player.DISCONTINUITY_REASON_INTERNAL:
      return "INTERNAL";
    default:
      return "?";
  }
}
 
Example 5
Source File: EventLogger.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
  switch (reason) {
    case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
      return "PERIOD_TRANSITION";
    case Player.DISCONTINUITY_REASON_SEEK:
      return "SEEK";
    case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
      return "SEEK_ADJUSTMENT";
    case Player.DISCONTINUITY_REASON_AD_INSERTION:
      return "AD_INSERTION";
    case Player.DISCONTINUITY_REASON_INTERNAL:
      return "INTERNAL";
    default:
      return "?";
  }
}
 
Example 6
Source File: EventLogger.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason) {
    switch (reason) {
        case Player.DISCONTINUITY_REASON_PERIOD_TRANSITION:
            return "PERIOD_TRANSITION";
        case Player.DISCONTINUITY_REASON_SEEK:
            return "SEEK";
        case Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT:
            return "SEEK_ADJUSTMENT";
        case Player.DISCONTINUITY_REASON_INTERNAL:
            return "INTERNAL";
        default:
            return "?";
    }
}
 
Example 7
Source File: QueuedExoPlayer.java    From Jockey with Apache License 2.0 5 votes vote down vote up
@Internal void onPositionDiscontinuity(int reason) {
    if (mQueue.size() == 0) {
        return;
    }

    if (reason == Player.DISCONTINUITY_REASON_PERIOD_TRANSITION) {
        onCompletion();
    }

    mQueueIndex = mExoPlayer.getCurrentWindowIndex() % mQueue.size();
    onStart();
}
 
Example 8
Source File: ReactExoplayerView.java    From react-native-video with MIT License 5 votes vote down vote up
@Override
public void onPositionDiscontinuity(int reason) {
    if (playerNeedsSource) {
        // This will only occur if the user has performed a seek whilst in the error state. Update the
        // resume position so that if the user then retries, playback will resume from the position to
        // which they seeked.
        updateResumePosition();
    }
    // When repeat is turned on, reaching the end of the video will not cause a state change
    // so we need to explicitly detect it.
    if (reason == Player.DISCONTINUITY_REASON_PERIOD_TRANSITION
            && player.getRepeatMode() == Player.REPEAT_MODE_ONE) {
        eventEmitter.end();
    }
}
 
Example 9
Source File: DefaultPlaybackSessionManager.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void handlePositionDiscontinuity(
    EventTime eventTime, @DiscontinuityReason int reason) {
  Assertions.checkNotNull(listener);
  boolean hasAutomaticTransition =
      reason == Player.DISCONTINUITY_REASON_PERIOD_TRANSITION
          || reason == Player.DISCONTINUITY_REASON_AD_INSERTION;
  Iterator<SessionDescriptor> iterator = sessions.values().iterator();
  while (iterator.hasNext()) {
    SessionDescriptor session = iterator.next();
    if (session.isFinishedAtEventTime(eventTime)) {
      iterator.remove();
      if (session.isCreated) {
        boolean isRemovingActiveSession = session.sessionId.equals(activeSessionId);
        boolean isAutomaticTransition = hasAutomaticTransition && isRemovingActiveSession;
        if (isRemovingActiveSession) {
          activeSessionId = null;
        }
        listener.onSessionFinished(eventTime, session.sessionId, isAutomaticTransition);
      }
    }
  }
  SessionDescriptor activeSessionDescriptor =
      getOrAddSession(eventTime.windowIndex, eventTime.mediaPeriodId);
  if (eventTime.mediaPeriodId != null
      && eventTime.mediaPeriodId.isAd()
      && (currentMediaPeriodId == null
          || currentMediaPeriodId.windowSequenceNumber
              != eventTime.mediaPeriodId.windowSequenceNumber
          || currentMediaPeriodId.adGroupIndex != eventTime.mediaPeriodId.adGroupIndex
          || currentMediaPeriodId.adIndexInAdGroup != eventTime.mediaPeriodId.adIndexInAdGroup)) {
    // New ad playback started. Find corresponding content session and notify ad playback started.
    MediaPeriodId contentMediaPeriodId =
        new MediaPeriodId(
            eventTime.mediaPeriodId.periodUid, eventTime.mediaPeriodId.windowSequenceNumber);
    SessionDescriptor contentSession =
        getOrAddSession(eventTime.windowIndex, contentMediaPeriodId);
    if (contentSession.isCreated && activeSessionDescriptor.isCreated) {
      listener.onAdPlaybackStarted(
          eventTime, contentSession.sessionId, activeSessionDescriptor.sessionId);
    }
  }
  updateActiveSession(eventTime, activeSessionDescriptor);
}