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


Java DrmSessionManager.STATE_ERROR属性代码示例

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


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

示例1: shouldWaitForKeys

private boolean shouldWaitForKeys(boolean sampleEncrypted) throws ExoPlaybackException {
  if (!openedDrmSession) {
    return false;
  }
  int drmManagerState = drmSessionManager.getState();
  if (drmManagerState == DrmSessionManager.STATE_ERROR) {
    throw new ExoPlaybackException(drmSessionManager.getError());
  }
  if (drmManagerState != DrmSessionManager.STATE_OPENED_WITH_KEYS &&
      (sampleEncrypted || !playClearSamplesWithoutKeys)) {
    return true;
  }
  return false;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:14,代码来源:MediaCodecTrackRenderer.java

示例2: maybeInitCodec

@SuppressWarnings("deprecation")
protected final void maybeInitCodec() throws ExoPlaybackException {
  if (!shouldInitCodec()) {
    return;
  }

  String mimeType = format.mimeType;
  MediaCrypto mediaCrypto = null;
  boolean requiresSecureDecoder = false;
  if (drmInitData != null) {
    if (drmSessionManager == null) {
      throw new ExoPlaybackException("Media requires a DrmSessionManager");
    }
    if (!openedDrmSession) {
      drmSessionManager.open(drmInitData, mimeType);
      openedDrmSession = true;
    }
    int drmSessionState = drmSessionManager.getState();
    if (drmSessionState == DrmSessionManager.STATE_ERROR) {
      throw new ExoPlaybackException(drmSessionManager.getError());
    } else if (drmSessionState == DrmSessionManager.STATE_OPENED
        || drmSessionState == DrmSessionManager.STATE_OPENED_WITH_KEYS) {
      mediaCrypto = drmSessionManager.getMediaCrypto();
      requiresSecureDecoder = drmSessionManager.requiresSecureDecoderComponent(mimeType);
    } else {
      // The drm session isn't open yet.
      return;
    }
  }

  DecoderInfo selectedDecoderInfo = MediaCodecUtil.getDecoderInfo(mimeType,
      requiresSecureDecoder);
  String selectedDecoderName = selectedDecoderInfo.name;
  codecIsAdaptive = selectedDecoderInfo.adaptive;
  try {
    codec = MediaCodec.createByCodecName(selectedDecoderName);
    configureCodec(codec, format.getFrameworkMediaFormatV16(), mediaCrypto);
    codec.start();
    inputBuffers = codec.getInputBuffers();
    outputBuffers = codec.getOutputBuffers();
  } catch (Exception e) {
    DecoderInitializationException exception = new DecoderInitializationException(
        selectedDecoderName, format, e);
    notifyDecoderInitializationError(exception);
    throw new ExoPlaybackException(exception);
  }
  codecHotswapTimeMs = getState() == TrackRenderer.STATE_STARTED ?
      SystemClock.elapsedRealtime() : -1;
  inputIndex = -1;
  outputIndex = -1;
  waitingForFirstSyncFrame = true;
  codecCounters.codecInitCount++;
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:53,代码来源:MediaCodecTrackRenderer.java

示例3: maybeInitCodec

protected final void maybeInitCodec() throws ExoPlaybackException {
  if (!shouldInitCodec()) {
    return;
  }

  String mimeType = format.mimeType;
  MediaCrypto mediaCrypto = null;
  boolean requiresSecureDecoder = false;
  if (drmInitData != null) {
    if (drmSessionManager == null) {
      throw new ExoPlaybackException("Media requires a DrmSessionManager");
    }
    if (!openedDrmSession) {
      drmSessionManager.open(drmInitData, mimeType);
      openedDrmSession = true;
    }
    int drmSessionState = drmSessionManager.getState();
    if (drmSessionState == DrmSessionManager.STATE_ERROR) {
      throw new ExoPlaybackException(drmSessionManager.getError());
    } else if (drmSessionState == DrmSessionManager.STATE_OPENED
        || drmSessionState == DrmSessionManager.STATE_OPENED_WITH_KEYS) {
      mediaCrypto = drmSessionManager.getMediaCrypto();
      requiresSecureDecoder = drmSessionManager.requiresSecureDecoderComponent(mimeType);
    } else {
      // The drm session isn't open yet.
      return;
    }
  }

  DecoderInfo selectedDecoderInfo = MediaCodecUtil.getDecoderInfo(mimeType);
  String selectedDecoderName = selectedDecoderInfo.name;
  if (requiresSecureDecoder) {
    selectedDecoderName = getSecureDecoderName(selectedDecoderName);
  }
  codecIsAdaptive = selectedDecoderInfo.adaptive;
  try {
    codec = MediaCodec.createByCodecName(selectedDecoderName);
    configureCodec(codec, format.getFrameworkMediaFormatV16(), mediaCrypto);
    codec.start();
    inputBuffers = codec.getInputBuffers();
    outputBuffers = codec.getOutputBuffers();
  } catch (Exception e) {
    DecoderInitializationException exception = new DecoderInitializationException(
        selectedDecoderName, format, e);
    notifyDecoderInitializationError(exception);
    throw new ExoPlaybackException(exception);
  }
  codecHotswapTimeMs = getState() == TrackRenderer.STATE_STARTED ?
      SystemClock.elapsedRealtime() : -1;
  inputIndex = -1;
  outputIndex = -1;
  waitingForFirstSyncFrame = true;
  codecCounters.codecInitCount++;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:54,代码来源:MediaCodecTrackRenderer.java

示例4: maybeInitCodec

protected final void maybeInitCodec() throws ExoPlaybackException {
  if (!shouldInitCodec()) {
    return;
  }

  String mimeType = format.mimeType;
  MediaCrypto mediaCrypto = null;
  boolean requiresSecureDecoder = false;
  if (drmInitData != null) {
    if (drmSessionManager == null) {
      throw new ExoPlaybackException("Media requires a DrmSessionManager");
    }
    if (!openedDrmSession) {
      drmSessionManager.open(drmInitData, mimeType);
      openedDrmSession = true;
    }
    int drmSessionState = drmSessionManager.getState();
    if (drmSessionState == DrmSessionManager.STATE_ERROR) {
      throw new ExoPlaybackException(drmSessionManager.getError());
    } else if (drmSessionState == DrmSessionManager.STATE_OPENED
        || drmSessionState == DrmSessionManager.STATE_OPENED_WITH_KEYS) {
      mediaCrypto = drmSessionManager.getMediaCrypto();
      requiresSecureDecoder = drmSessionManager.requiresSecureDecoderComponent(mimeType);
    } else {
      // The drm session isn't open yet.
      return;
    }
  }

  DecoderInfo selectedDecoderInfo = MediaCodecUtil.getDecoderInfo(mimeType);
  String selectedDecoderName = selectedDecoderInfo.name;
  if (requiresSecureDecoder) {
    selectedDecoderName = getSecureDecoderName(selectedDecoderName);
  }
  codecIsAdaptive = selectedDecoderInfo.adaptive;
  try {
    codec = MediaCodec.createByCodecName(selectedDecoderName);
    configureCodec(codec, format.getFrameworkMediaFormatV16(), mediaCrypto);
    codec.start();
    inputBuffers = codec.getInputBuffers();
    outputBuffers = codec.getOutputBuffers();
  } catch (Exception e) {
    com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException exception = new com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException(
        selectedDecoderName, format, e);
    notifyDecoderInitializationError(exception);
    throw new ExoPlaybackException(exception);
  }
  codecHotswapTimeMs = getState() == TrackRenderer.STATE_STARTED ?
      SystemClock.elapsedRealtime() : -1;
      inputIndex = -1;
      outputIndex = -1;
      waitingForFirstSyncFrame = true;
  codecCounters.codecInitCount++;
}
 
开发者ID:lsjwzh,项目名称:ExoPlayerCompat,代码行数:54,代码来源:MediaCodecTrackRenderer.java


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