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


Java C.usToMs方法代码示例

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


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

示例1: updateImaStateForPlayerState

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
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,代码行数:26,代码来源:ImaAdsLoader.java

示例2: getWindow

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public Window getWindow(int windowIndex, Window window, boolean setIds,
    long defaultPositionProjectionUs) {
  window = timeline.getWindow(0, window, setIds, defaultPositionProjectionUs);
  window.durationUs = endUs != C.TIME_UNSET ? endUs - startUs : C.TIME_UNSET;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:21,代码来源:ClippingMediaSource.java

示例3: onTimelineChanged

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
  if (timeline.isEmpty()) {
    // The player is being re-prepared and this source will be released.
    return;
  }
  Assertions.checkArgument(timeline.getPeriodCount() == 1);
  this.timeline = timeline;
  long contentDurationUs = timeline.getPeriod(0, period).durationUs;
  contentDurationMs = C.usToMs(contentDurationUs);
  if (contentDurationUs != C.TIME_UNSET) {
    adPlaybackState.contentDurationUs = contentDurationUs;
  }
  updateImaStateForPlayerState();
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:16,代码来源:ImaAdsLoader.java

示例4: adjustMediaTime

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
private long adjustMediaTime(long mediaTimeUs) {
  long mediaTimeMs = C.usToMs(mediaTimeUs);
  return mediaTimeMs == C.TIME_UNSET ? C.TIME_UNSET : mediaTimeOffsetMs + mediaTimeMs;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:5,代码来源:AdaptiveMediaSourceEventListener.java


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