com.google.android.exoplayer2.Player.DiscontinuityReason Java Examples

The following examples show how to use com.google.android.exoplayer2.Player.DiscontinuityReason. 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: ExoPlayerImplInternal.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public void setPositionDiscontinuity(@DiscontinuityReason int discontinuityReason) {
  if (positionDiscontinuity
      && this.discontinuityReason != Player.DISCONTINUITY_REASON_INTERNAL) {
    // We always prefer non-internal discontinuity reasons. We also assume that we won't report
    // more than one non-internal discontinuity per message iteration.
    Assertions.checkArgument(discontinuityReason == Player.DISCONTINUITY_REASON_INTERNAL);
    return;
  }
  positionDiscontinuity = true;
  this.discontinuityReason = discontinuityReason;
}
 
Example #2
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void setPositionDiscontinuity(@DiscontinuityReason int discontinuityReason) {
  if (positionDiscontinuity
      && this.discontinuityReason != Player.DISCONTINUITY_REASON_INTERNAL) {
    // We always prefer non-internal discontinuity reasons. We also assume that we won't report
    // more than one non-internal discontinuity per message iteration.
    Assertions.checkArgument(discontinuityReason == Player.DISCONTINUITY_REASON_INTERNAL);
    return;
  }
  positionDiscontinuity = true;
  this.discontinuityReason = discontinuityReason;
}
 
Example #3
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void setPositionDiscontinuity(@DiscontinuityReason int discontinuityReason) {
  if (positionDiscontinuity
      && this.discontinuityReason != Player.DISCONTINUITY_REASON_INTERNAL) {
    // We always prefer non-internal discontinuity reasons. We also assume that we won't report
    // more than one non-internal discontinuity per message iteration.
    Assertions.checkArgument(discontinuityReason == Player.DISCONTINUITY_REASON_INTERNAL);
    return;
  }
  positionDiscontinuity = true;
  this.discontinuityReason = discontinuityReason;
}
 
Example #4
Source File: ExoPlayerImplInternal.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void setPositionDiscontinuity(@DiscontinuityReason int discontinuityReason) {
  if (positionDiscontinuity
      && this.discontinuityReason != Player.DISCONTINUITY_REASON_INTERNAL) {
    // We always prefer non-internal discontinuity reasons. We also assume that we won't report
    // more than one non-internal discontinuity per message iteration.
    Assertions.checkArgument(discontinuityReason == Player.DISCONTINUITY_REASON_INTERNAL);
    return;
  }
  positionDiscontinuity = true;
  this.discontinuityReason = discontinuityReason;
}
 
Example #5
Source File: ExoPlayerImplInternal.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void setPositionDiscontinuity(@DiscontinuityReason int discontinuityReason) {
  if (positionDiscontinuity
      && this.discontinuityReason != Player.DISCONTINUITY_REASON_INTERNAL) {
    // We always prefer non-internal discontinuity reasons. We also assume that we won't report
    // more than one non-internal discontinuity per message iteration.
    Assertions.checkArgument(discontinuityReason == Player.DISCONTINUITY_REASON_INTERNAL);
    return;
  }
  positionDiscontinuity = true;
  this.discontinuityReason = discontinuityReason;
}
 
Example #6
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);
}
 
Example #7
Source File: CustomizePlayerView.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onPositionDiscontinuity(@DiscontinuityReason int reason) {
    if (isPlayingAd() && controllerHideDuringAds) {
        hideController();
    }
}
 
Example #8
Source File: PlaybackSessionManager.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Handles a position discontinuity.
 *
 * @param eventTime The event time of the position discontinuity.
 * @param reason The {@link DiscontinuityReason}.
 */
void handlePositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason);
 
Example #9
Source File: AnalyticsListener.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Called when a position discontinuity occurred.
 *
 * @param eventTime The event time.
 * @param reason The reason for the position discontinuity.
 */
default void onPositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason) {}
 
Example #10
Source File: AnalyticsListener.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called when a position discontinuity occurred.
 *
 * @param eventTime The event time.
 * @param reason The reason for the position discontinuity.
 */
default void onPositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason) {}
 
Example #11
Source File: AnalyticsListener.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called when a position discontinuity occurred.
 *
 * @param eventTime The event time.
 * @param reason The reason for the position discontinuity.
 */
default void onPositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason) {}
 
Example #12
Source File: AnalyticsListener.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called when a position discontinuity occurred.
 *
 * @param eventTime The event time.
 * @param reason The reason for the position discontinuity.
 */
default void onPositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason) {}
 
Example #13
Source File: AnalyticsListener.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called when a position discontinuity occurred.
 *
 * @param eventTime The event time.
 * @param reason The reason for the position discontinuity.
 */
default void onPositionDiscontinuity(EventTime eventTime, @DiscontinuityReason int reason) {}