当前位置: 首页>>代码示例>>Java>>正文


Java C.INDEX_UNSET属性代码示例

本文整理汇总了Java中com.google.android.exoplayer2.C.INDEX_UNSET属性的典型用法代码示例。如果您正苦于以下问题:Java C.INDEX_UNSET属性的具体用法?Java C.INDEX_UNSET怎么用?Java C.INDEX_UNSET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.exoplayer2.C的用法示例。


在下文中一共展示了C.INDEX_UNSET属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ImaAdsLoader

/**
 * Creates a new IMA ads loader.
 *
 * @param context The context.
 * @param adTagUri The {@link Uri} of an ad tag compatible with the Android IMA SDK. See
 *     https://developers.google.com/interactive-media-ads/docs/sdks/android/compatibility for
 *     more information.
 * @param imaSdkSettings {@link ImaSdkSettings} used to configure the IMA SDK, or {@code null} to
 *     use the default settings. If set, the player type and version fields may be overwritten.
 */
public ImaAdsLoader(Context context, Uri adTagUri, ImaSdkSettings imaSdkSettings) {
  this.adTagUri = adTagUri;
  period = new Timeline.Period();
  adCallbacks = new ArrayList<>(1);
  imaSdkFactory = ImaSdkFactory.getInstance();
  adDisplayContainer = imaSdkFactory.createAdDisplayContainer();
  adDisplayContainer.setPlayer(this);
  if (imaSdkSettings == null) {
    imaSdkSettings = imaSdkFactory.createImaSdkSettings();
  }
  imaSdkSettings.setPlayerType(IMA_SDK_SETTINGS_PLAYER_TYPE);
  imaSdkSettings.setPlayerVersion(IMA_SDK_SETTINGS_PLAYER_VERSION);
  adsLoader = imaSdkFactory.createAdsLoader(context, imaSdkSettings);
  adsLoader.addAdErrorListener(this);
  adsLoader.addAdsLoadedListener(this);
  fakeContentProgressElapsedRealtimeMs = C.TIME_UNSET;
  fakeContentProgressOffsetMs = C.TIME_UNSET;
  pendingContentPositionMs = C.TIME_UNSET;
  adGroupIndex = C.INDEX_UNSET;
  contentDurationMs = C.TIME_UNSET;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:31,代码来源:ImaAdsLoader.java

示例2: onPositionDiscontinuity

@Override
public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {
  if (adsManager == null) {
    return;
  }
  if (!playingAd && !player.isPlayingAd()) {
    checkForContentComplete();
    if (sentContentComplete) {
      for (int i = 0; i < adPlaybackState.adGroupCount; i++) {
        if (adPlaybackState.adGroupTimesUs[i] != C.TIME_END_OF_SOURCE) {
          adPlaybackState.playedAdGroup(i);
        }
      }
      updateAdPlaybackState();
    } else {
      long positionMs = player.getCurrentPosition();
      timeline.getPeriod(0, period);
      if (period.getAdGroupIndexForPositionUs(C.msToUs(positionMs)) != C.INDEX_UNSET) {
        sentPendingContentPositionMs = false;
        pendingContentPositionMs = positionMs;
      }
    }
  } else {
    updateImaStateForPlayerState();
  }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:26,代码来源:ImaAdsLoader.java

示例3: updateImaStateForPlayerState

private void updateImaStateForPlayerState() {
  boolean wasPlayingAd = playingAd;
  playingAd = player.isPlayingAd();
  if (!sentContentComplete) {
    boolean adFinished = (wasPlayingAd && !playingAd)
        || playingAdIndexInAdGroup != player.getCurrentAdIndexInAdGroup();
    if (adFinished) {
      // IMA is waiting for the ad playback to finish so invoke the callback now.
      // Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again.
      for (int i = 0; i < adCallbacks.size(); i++) {
        adCallbacks.get(i).onEnded();
      }
    }
    if (!wasPlayingAd && playingAd) {
      int adGroupIndex = player.getCurrentAdGroupIndex();
      // IMA hasn't sent CONTENT_PAUSE_REQUESTED yet, so fake the content position.
      fakeContentProgressElapsedRealtimeMs = SystemClock.elapsedRealtime();
      fakeContentProgressOffsetMs = C.usToMs(adPlaybackState.adGroupTimesUs[adGroupIndex]);
      if (fakeContentProgressOffsetMs == C.TIME_END_OF_SOURCE) {
        fakeContentProgressOffsetMs = contentDurationMs;
      }
    }
  }
  playingAdIndexInAdGroup = playingAd ? player.getCurrentAdIndexInAdGroup() : C.INDEX_UNSET;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:25,代码来源:ImaAdsLoader.java

示例4: splitNalUnits

/**
 * Splits an array of NAL units.
 * <p>
 * If the input consists of NAL start code delimited units, then the returned array consists of
 * the split NAL units, each of which is still prefixed with the NAL start code. For any other
 * input, null is returned.
 *
 * @param data An array of data.
 * @return The individual NAL units, or null if the input did not consist of NAL start code
 *     delimited units.
 */
public static byte[][] splitNalUnits(byte[] data) {
  if (!isNalStartCode(data, 0)) {
    // data does not consist of NAL start code delimited units.
    return null;
  }
  List<Integer> starts = new ArrayList<>();
  int nalUnitIndex = 0;
  do {
    starts.add(nalUnitIndex);
    nalUnitIndex = findNalStartCode(data, nalUnitIndex + NAL_START_CODE.length);
  } while (nalUnitIndex != C.INDEX_UNSET);
  byte[][] split = new byte[starts.size()][];
  for (int i = 0; i < starts.size(); i++) {
    int startIndex = starts.get(i);
    int endIndex = i < starts.size() - 1 ? starts.get(i + 1) : data.length;
    byte[] nal = new byte[endIndex - startIndex];
    System.arraycopy(data, startIndex, nal, 0, nal.length);
    split[i] = nal;
  }
  return split;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:32,代码来源:CodecSpecificDataUtil.java

示例5: getPosition

@Override
public long getPosition(long timeUs) {
  long earliestSamplePosition = Long.MAX_VALUE;
  for (Mp4Track track : tracks) {
    TrackSampleTable sampleTable = track.sampleTable;
    int sampleIndex = sampleTable.getIndexOfEarlierOrEqualSynchronizationSample(timeUs);
    if (sampleIndex == C.INDEX_UNSET) {
      // Handle the case where the requested time is before the first synchronization sample.
      sampleIndex = sampleTable.getIndexOfLaterOrEqualSynchronizationSample(timeUs);
    }
    long offset = sampleTable.offsets[sampleIndex];
    if (offset < earliestSamplePosition) {
      earliestSamplePosition = offset;
    }
  }
  return earliestSamplePosition;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:17,代码来源:Mp4Extractor.java

示例6: stopAdInternal

private void stopAdInternal() {
  Assertions.checkState(imaAdState != IMA_AD_STATE_NONE);
  imaAdState = IMA_AD_STATE_NONE;
  adPlaybackState.playedAd(adGroupIndex);
  updateAdPlaybackState();
  if (!playingAd) {
    adGroupIndex = C.INDEX_UNSET;
  }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:9,代码来源:ImaAdsLoader.java

示例7: moveNext

public boolean moveNext() {
  if (++index == length) {
    return false;
  }
  offset = chunkOffsetsAreLongs ? chunkOffsets.readUnsignedLongToLong()
      : chunkOffsets.readUnsignedInt();
  if (index == nextSamplesPerChunkChangeIndex) {
    numSamples = stsc.readUnsignedIntToInt();
    stsc.skipBytes(4); // Skip sample_description_index
    nextSamplesPerChunkChangeIndex = --remainingSamplesPerChunkChanges > 0
        ? (stsc.readUnsignedIntToInt() - 1) : C.INDEX_UNSET;
  }
  return true;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:AtomParsers.java

示例8: indexOf

/**
 * Returns the index of the track with the given format in the group.
 *
 * @param format The format.
 * @return The index of the track, or {@link C#INDEX_UNSET} if no such track exists.
 */
public int indexOf(Format format) {
  for (int i = 0; i < formats.length; i++) {
    if (format == formats[i]) {
      return i;
    }
  }
  return C.INDEX_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:TrackGroup.java

示例9: playMedia

protected void playMedia(MediaSource mediaSource) {
    boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
    if (haveResumePosition) {
        mTubiExoPlayer.seekTo(resumeWindow, resumePosition);
    }
    mTubiExoPlayer.setPlayWhenReady(shouldAutoPlay);
    mTubiExoPlayer.prepare(mediaSource, !haveResumePosition, false);
    Utils.hideSystemUI(this, true);
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:9,代码来源:TubiPlayerActivity.java

示例10: indexOf

/**
 * Returns the index of a group within the array.
 *
 * @param group The group.
 * @return The index of the group, or {@link C#INDEX_UNSET} if no such group exists.
 */
public int indexOf(TrackGroup group) {
  for (int i = 0; i < length; i++) {
    if (trackGroups[i] == group) {
      return i;
    }
  }
  return C.INDEX_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:TrackGroupArray.java

示例11: onPlaylistBlacklisted

/**
 * Called when a playlist is blacklisted.
 *
 * @param url The url that references the blacklisted playlist.
 * @param blacklistMs The amount of milliseconds for which the playlist was blacklisted.
 */
public void onPlaylistBlacklisted(HlsUrl url, long blacklistMs) {
  int trackGroupIndex = trackGroup.indexOf(url.format);
  if (trackGroupIndex != C.INDEX_UNSET) {
    int trackSelectionIndex = trackSelection.indexOf(trackGroupIndex);
    if (trackSelectionIndex != C.INDEX_UNSET) {
      trackSelection.blacklist(trackSelectionIndex, blacklistMs);
    }
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:15,代码来源:HlsChunkSource.java

示例12: reset

/**
 * Resets this reader.
 */
public void reset() {
  pageHeader.reset();
  packetArray.reset();
  currentSegmentIndex = C.INDEX_UNSET;
  populated = false;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:9,代码来源:OggPacket.java

示例13: getNextEventTimeIndex

@Override
public int getNextEventTimeIndex(long timeUs) {
  return C.INDEX_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:4,代码来源:DvbSubtitle.java

示例14: clearResumePosition

/**
 * 清除进度
 ***/
private void clearResumePosition() {
    resumeWindow = C.INDEX_UNSET;
    resumePosition = C.TIME_UNSET;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:7,代码来源:ExoUserPlayer.java

示例15: getNextEventTimeIndex

@Override
public int getNextEventTimeIndex(long timeUs) {
  int index = Util.binarySearchCeil(sortedCueTimesUs, timeUs, false, false);
  return index < sortedCueTimesUs.length ? index : C.INDEX_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:5,代码来源:WebvttSubtitle.java


注:本文中的com.google.android.exoplayer2.C.INDEX_UNSET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。