當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaSource.prepareSource方法代碼示例

本文整理匯總了Java中com.google.android.exoplayer2.source.MediaSource.prepareSource方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaSource.prepareSource方法的具體用法?Java MediaSource.prepareSource怎麽用?Java MediaSource.prepareSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.exoplayer2.source.MediaSource的用法示例。


在下文中一共展示了MediaSource.prepareSource方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareInternal

import com.google.android.exoplayer2.source.MediaSource; //導入方法依賴的package包/類
private void prepareInternal(MediaSource mediaSource, boolean resetPosition) {
  pendingPrepareCount++;
  resetInternal(true);
  loadControl.onPrepared();
  if (resetPosition) {
    playbackInfo = new PlaybackInfo(null, null, 0, C.TIME_UNSET);
  } else {
    // The new start position is the current playback position.
    playbackInfo = new PlaybackInfo(null, null, playbackInfo.periodId, playbackInfo.positionUs,
        playbackInfo.contentPositionUs);
  }
  this.mediaSource = mediaSource;
  mediaSource.prepareSource(player, true, this);
  setState(Player.STATE_BUFFERING);
  handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:17,代碼來源:ExoPlayerImplInternal.java

示例2: prepareInternal

import com.google.android.exoplayer2.source.MediaSource; //導入方法依賴的package包/類
private void prepareInternal(MediaSource mediaSource, boolean resetPosition) {
  eventHandler.sendEmptyMessage(MSG_PREPARE_ACK);
  resetInternal(true);
  loadControl.onPrepared();
  if (resetPosition) {
    playbackInfo = new PlaybackInfo(0, C.TIME_UNSET);
  }
  this.mediaSource = mediaSource;
  mediaSource.prepareSource(player, true, this);
  setState(ExoPlayer.STATE_BUFFERING);
  handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:13,代碼來源:ExoPlayerImplInternal.java

示例3: prepareInternal

import com.google.android.exoplayer2.source.MediaSource; //導入方法依賴的package包/類
private void prepareInternal(MediaSource mediaSource, boolean resetPosition) {
  resetInternal(true);
  loadControl.onPrepared();
  if (resetPosition) {
    playbackInfo = new PlaybackInfo(0, C.TIME_UNSET);
  }
  this.mediaSource = mediaSource;
  mediaSource.prepareSource(player, true, this);
  setState(ExoPlayer.STATE_BUFFERING);
  handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:12,代碼來源:ExoPlayerImplInternal.java

示例4: prepareInternal

import com.google.android.exoplayer2.source.MediaSource; //導入方法依賴的package包/類
private void prepareInternal(MediaSource mediaSource, boolean resetPosition)
    throws ExoPlaybackException {
  resetInternal();
  loadControl.onPrepared();
  if (resetPosition) {
    playbackInfo = new PlaybackInfo(0, C.TIME_UNSET);
  }
  this.mediaSource = mediaSource;
  mediaSource.prepareSource(this);
  setState(ExoPlayer.STATE_BUFFERING);
  handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:13,代碼來源:ExoPlayerImplInternal.java

示例5: createPeriod

import com.google.android.exoplayer2.source.MediaSource; //導入方法依賴的package包/類
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator) {
  if (adPlaybackState.adGroupCount > 0 && id.isAd()) {
    final int adGroupIndex = id.adGroupIndex;
    final int adIndexInAdGroup = id.adIndexInAdGroup;
    if (adGroupMediaSources[adGroupIndex].length <= adIndexInAdGroup) {
      Uri adUri = adPlaybackState.adUris[id.adGroupIndex][id.adIndexInAdGroup];
      final MediaSource adMediaSource =
          adMediaSourceFactory.createMediaSource(adUri, eventHandler, eventListener);
      int oldAdCount = adGroupMediaSources[id.adGroupIndex].length;
      if (adIndexInAdGroup >= oldAdCount) {
        int adCount = adIndexInAdGroup + 1;
        adGroupMediaSources[adGroupIndex] =
            Arrays.copyOf(adGroupMediaSources[adGroupIndex], adCount);
        adDurationsUs[adGroupIndex] = Arrays.copyOf(adDurationsUs[adGroupIndex], adCount);
        Arrays.fill(adDurationsUs[adGroupIndex], oldAdCount, adCount, C.TIME_UNSET);
      }
      adGroupMediaSources[adGroupIndex][adIndexInAdGroup] = adMediaSource;
      deferredMediaPeriodByAdMediaSource.put(adMediaSource, new ArrayList<DeferredMediaPeriod>());
      adMediaSource.prepareSource(player, false, new MediaSource.Listener() {
        @Override
        public void onSourceInfoRefreshed(MediaSource source, Timeline timeline,
            @Nullable Object manifest) {
          onAdSourceInfoRefreshed(adMediaSource, adGroupIndex, adIndexInAdGroup, timeline);
        }
      });
    }
    MediaSource mediaSource = adGroupMediaSources[adGroupIndex][adIndexInAdGroup];
    DeferredMediaPeriod deferredMediaPeriod =
        new DeferredMediaPeriod(mediaSource, new MediaPeriodId(0), allocator);
    List<DeferredMediaPeriod> mediaPeriods = deferredMediaPeriodByAdMediaSource.get(mediaSource);
    if (mediaPeriods == null) {
      deferredMediaPeriod.createPeriod();
    } else {
      // Keep track of the deferred media period so it can be populated with the real media period
      // when the source's info becomes available.
      mediaPeriods.add(deferredMediaPeriod);
    }
    return deferredMediaPeriod;
  } else {
    DeferredMediaPeriod mediaPeriod = new DeferredMediaPeriod(contentMediaSource, id, allocator);
    mediaPeriod.createPeriod();
    return mediaPeriod;
  }
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:46,代碼來源:AdsMediaSource.java


注:本文中的com.google.android.exoplayer2.source.MediaSource.prepareSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。