• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BehindLiveWindowException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer.BehindLiveWindowException的典型用法代码示例。如果您正苦于以下问题:Java BehindLiveWindowException类的具体用法?Java BehindLiveWindowException怎么用?Java BehindLiveWindowException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: updateRepresentation

import com.google.android.exoplayer.BehindLiveWindowException; //导入依赖的package包/类
public void updateRepresentation(long newPeriodDurationUs, Representation newRepresentation)
    throws BehindLiveWindowException{
  DashSegmentIndex oldIndex = representation.getIndex();
  DashSegmentIndex newIndex = newRepresentation.getIndex();

  periodDurationUs = newPeriodDurationUs;
  representation = newRepresentation;
  if (oldIndex == null) {
    // Segment numbers cannot shift if the index isn't defined by the manifest.
    return;
  }

  segmentIndex = newIndex;
  if (!oldIndex.isExplicit()) {
    // Segment numbers cannot shift if the index isn't explicit.
    return;
  }

  int oldIndexLastSegmentNum = oldIndex.getLastSegmentNum(periodDurationUs);
  long oldIndexEndTimeUs = oldIndex.getTimeUs(oldIndexLastSegmentNum)
      + oldIndex.getDurationUs(oldIndexLastSegmentNum, periodDurationUs);
  int newIndexFirstSegmentNum = newIndex.getFirstSegmentNum();
  long newIndexStartTimeUs = newIndex.getTimeUs(newIndexFirstSegmentNum);
  if (oldIndexEndTimeUs == newIndexStartTimeUs) {
    // The new index continues where the old one ended, with no overlap.
    segmentNumShift += oldIndex.getLastSegmentNum(periodDurationUs) + 1
        - newIndexFirstSegmentNum;
  } else if (oldIndexEndTimeUs < newIndexStartTimeUs) {
    // There's a gap between the old index and the new one which means we've slipped behind the
    // live window and can't proceed.
    throw new BehindLiveWindowException();
  } else {
    // The new index overlaps with the old one.
    segmentNumShift += oldIndex.getSegmentNum(newIndexStartTimeUs, periodDurationUs)
        - newIndexFirstSegmentNum;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:38,代码来源:DashChunkSource.java


示例2: updatePeriod

import com.google.android.exoplayer.BehindLiveWindowException; //导入依赖的package包/类
public void updatePeriod(MediaPresentationDescription manifest, int manifestIndex,
    ExposedTrack selectedTrack) throws BehindLiveWindowException {
  Period period = manifest.getPeriod(manifestIndex);
  long periodDurationUs = getPeriodDurationUs(manifest, manifestIndex);
  List<Representation> representations = period.adaptationSets
      .get(selectedTrack.adaptationSetIndex).representations;

  for (int j = 0; j < representationIndices.length; j++) {
    Representation representation = representations.get(representationIndices[j]);
    representationHolders.get(representation.format.id).updateRepresentation(periodDurationUs,
        representation);
  }
  updateRepresentationIndependentProperties(periodDurationUs,
      representations.get(representationIndices[0]));
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:16,代码来源:DashChunkSource.java


示例3: processManifest

import com.google.android.exoplayer.BehindLiveWindowException; //导入依赖的package包/类
private void processManifest(MediaPresentationDescription manifest) {
  // Remove old periods.
  Period firstPeriod = manifest.getPeriod(0);
  while (periodHolders.size() > 0
      && periodHolders.valueAt(0).startTimeUs < firstPeriod.startMs * 1000) {
    PeriodHolder periodHolder = periodHolders.valueAt(0);
    // TODO: Use periodHolders.removeAt(0) if the minimum API level is ever increased to 11.
    periodHolders.remove(periodHolder.localIndex);
  }

  // After discarding old periods, we should never have more periods than listed in the new
  // manifest.  That would mean that a previously announced period is no longer advertised.  If
  // this condition occurs, assume that we are hitting a manifest server that is out of sync and
  // behind, discard this manifest, and try again later.
  if (periodHolders.size() > manifest.getPeriodCount()) {
    return;
  }

  // Update existing periods. Only the first and last periods can change.
  try {
    int periodHolderCount = periodHolders.size();
    if (periodHolderCount > 0) {
      periodHolders.valueAt(0).updatePeriod(manifest, 0, enabledTrack);
      if (periodHolderCount > 1) {
        int lastIndex = periodHolderCount - 1;
        periodHolders.valueAt(lastIndex).updatePeriod(manifest, lastIndex, enabledTrack);
      }
    }
  } catch (BehindLiveWindowException e) {
    fatalError = e;
    return;
  }

  // Add new periods.
  for (int i = periodHolders.size(); i < manifest.getPeriodCount(); i++) {
    PeriodHolder holder = new PeriodHolder(nextPeriodHolderIndex, manifest, i, enabledTrack);
    periodHolders.put(nextPeriodHolderIndex, holder);
    nextPeriodHolderIndex++;
  }

  // Update the available range.
  TimeRange newAvailableRange = getAvailableRange(getNowUnixTimeUs());
  if (availableRange == null || !availableRange.equals(newAvailableRange)) {
    availableRange = newAvailableRange;
    notifyAvailableRangeChanged(availableRange);
  }

  currentManifest = manifest;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:50,代码来源:DashChunkSource.java


示例4: onError

import com.google.android.exoplayer.BehindLiveWindowException; //导入依赖的package包/类
@Override
public void onError(Exception e) {
    String errMsg = "Player Error";
    LOGE(TAG, errMsg, e);
    String errorString = "";
    if (e instanceof UnsupportedDrmException) {
        // Special case DRM failures.
        UnsupportedDrmException unsupportedDrmException = (UnsupportedDrmException) e;
        errorString = (Util.SDK_INT < 18) ? "error_drm_not_supported"
                : unsupportedDrmException.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
                ? "error_drm_unsupported_scheme" : "error_drm_unknown";
    } else if (e instanceof ExoPlaybackException && e.getCause() instanceof FileNotFoundException) {
        errorString = "DRM License Unavailable"; // probably license issue
    } else if (e instanceof ExoPlaybackException && e.getCause() instanceof BehindLiveWindowException) {
        LOGE(TAG, "Recovering BehindLiveWindowException"); // happens if network is bad and no more chunk in hte buffer
        mExoPlayer.prepare();
        return;
    } else if (e instanceof ExoPlaybackException && e.getCause() instanceof android.media.MediaCodec.CryptoException) {
        errorString = "DRM Error. Trying to recover"; // probably license issue
        mExoPlayer.prepare();
        return;
    } else if (e instanceof ExoPlaybackException
            && e.getCause() instanceof MediaCodecTrackRenderer.DecoderInitializationException) {
        // Special case for decoder initialization failures.
        MediaCodecTrackRenderer.DecoderInitializationException decoderInitializationException =
                (MediaCodecTrackRenderer.DecoderInitializationException) e.getCause();
        if (decoderInitializationException.decoderName == null) {
            if (decoderInitializationException.getCause() instanceof MediaCodecUtil.DecoderQueryException) {
                errorString = "error_querying_decoders ";
            } else if (decoderInitializationException.secureDecoderRequired) {
                errorString = "error_no_secure_decoder " +
                        decoderInitializationException.mimeType;
            } else {
                errorString = "error_no_decoder " +
                        decoderInitializationException.mimeType;
            }
        } else {
            errorString = "error_instantiating_decoder " +
                    decoderInitializationException.decoderName;
        }
    }
    else if (e.getCause() instanceof com.google.android.exoplayer.upstream.HttpDataSource.HttpDataSourceException) {
        mExoPlayer.prepare();
        errorString = "HttpDataSourceException . Trying to recover";
        LOGE(TAG, errorString);
        return;
    } else if (e.getCause() instanceof java.net.UnknownHostException) {
        mExoPlayer.prepare();
        errorString = "UnknownHostException . Trying to recover";
        LOGE(TAG, errorString);
        return;
    } else if (e.getCause() instanceof java.net.ConnectException) {
        mExoPlayer.prepare();
        errorString = "ConnectException . Trying to recover";
        LOGE(TAG, errorString);
        return;
    }
    else if (e.getCause() instanceof java.lang.IllegalStateException) {
        mExoPlayer.prepare();
        errorString = "IllegalStateException . Trying to recover";
        LOGE(TAG, errorString);
        return;
    }
    if (!"".equals(errorString)) {
        LOGE(TAG, errorString);
        errorString += "-";
    }
    mPlayerListener.eventWithValue(KExoPlayer.this, KPlayerListener.ErrorKey, TAG + "-" + errMsg + "-" + errorString + e.getMessage());
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:70,代码来源:KExoPlayer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EmptyStatement类代码示例发布时间:2022-05-22
下一篇:
Java SpimDataException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap