Java 类com.google.android.exoplayer2.drm.ExoMediaDrm.KeyRequest 实例源码

项目:Exoplayer2Radio    文件:HttpMediaDrmCallback.java   
@Override
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
  String url = request.getDefaultUrl();
  if (TextUtils.isEmpty(url)) {
    url = defaultUrl;
  }
  Map<String, String> requestProperties = new HashMap<>();
  requestProperties.put("Content-Type", "application/octet-stream");
  if (C.PLAYREADY_UUID.equals(uuid)) {
    requestProperties.putAll(PLAYREADY_KEY_REQUEST_PROPERTIES);
  }
  synchronized (keyRequestProperties) {
    requestProperties.putAll(keyRequestProperties);
  }
  return executePost(dataSourceFactory, url, request.getData(), requestProperties);
}
项目:Exoplayer2Radio    文件:DefaultDrmSessionManager.java   
@Override
public void handleMessage(Message msg) {
  Object response;
  try {
    switch (msg.what) {
      case MSG_PROVISION:
        response = callback.executeProvisionRequest(uuid, (ProvisionRequest) msg.obj);
        break;
      case MSG_KEYS:
        response = callback.executeKeyRequest(uuid, (KeyRequest) msg.obj);
        break;
      default:
        throw new RuntimeException();
    }
  } catch (Exception e) {
    response = e;
  }
  postResponseHandler.obtainMessage(msg.what, response).sendToTarget();
}
项目:K-Sonic    文件:HttpMediaDrmCallback.java   
@Override
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
  String url = request.getDefaultUrl();
  if (TextUtils.isEmpty(url)) {
    url = defaultUrl;
  }
  Map<String, String> requestProperties = new HashMap<>();
  requestProperties.put("Content-Type", "application/octet-stream");
  if (C.PLAYREADY_UUID.equals(uuid)) {
    requestProperties.putAll(PLAYREADY_KEY_REQUEST_PROPERTIES);
  }
  synchronized (keyRequestProperties) {
    requestProperties.putAll(keyRequestProperties);
  }
  return executePost(dataSourceFactory, url, request.getData(), requestProperties);
}
项目:K-Sonic    文件:DefaultDrmSessionManager.java   
@Override
public void handleMessage(Message msg) {
  Object response;
  try {
    switch (msg.what) {
      case MSG_PROVISION:
        response = callback.executeProvisionRequest(uuid, (ProvisionRequest) msg.obj);
        break;
      case MSG_KEYS:
        response = callback.executeKeyRequest(uuid, (KeyRequest) msg.obj);
        break;
      default:
        throw new RuntimeException();
    }
  } catch (Exception e) {
    response = e;
  }
  postResponseHandler.obtainMessage(msg.what, response).sendToTarget();
}
项目:videoPickPlayer    文件:HttpMediaDrmCallback.java   
@Override
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
  String url = request.getDefaultUrl();
  if (TextUtils.isEmpty(url)) {
    url = defaultUrl;
  }
  Map<String, String> requestProperties = new HashMap<>();
  requestProperties.put("Content-Type", "application/octet-stream");
  if (C.PLAYREADY_UUID.equals(uuid)) {
    requestProperties.putAll(PLAYREADY_KEY_REQUEST_PROPERTIES);
  }
  if (keyRequestProperties != null) {
    requestProperties.putAll(keyRequestProperties);
  }
  return executePost(url, request.getData(), requestProperties);
}
项目:videoPickPlayer    文件:StreamingDrmSessionManager.java   
@Override
public void handleMessage(Message msg) {
  Object response;
  try {
    switch (msg.what) {
      case MSG_PROVISION:
        response = callback.executeProvisionRequest(uuid, (ProvisionRequest) msg.obj);
        break;
      case MSG_KEYS:
        response = callback.executeKeyRequest(uuid, (KeyRequest) msg.obj);
        break;
      default:
        throw new RuntimeException();
    }
  } catch (Exception e) {
    response = e;
  }
  postResponseHandler.obtainMessage(msg.what, response).sendToTarget();
}
项目:transistor    文件:HttpMediaDrmCallback.java   
@Override
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
  String url = request.getDefaultUrl();
  if (forceDefaultLicenseUrl || TextUtils.isEmpty(url)) {
    url = defaultLicenseUrl;
  }
  Map<String, String> requestProperties = new HashMap<>();
  // Add standard request properties for supported schemes.
  String contentType = C.PLAYREADY_UUID.equals(uuid) ? "text/xml"
      : (C.CLEARKEY_UUID.equals(uuid) ? "application/json" : "application/octet-stream");
  requestProperties.put("Content-Type", contentType);
  if (C.PLAYREADY_UUID.equals(uuid)) {
    requestProperties.put("SOAPAction",
        "http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
  }
  // Add additional request properties.
  synchronized (keyRequestProperties) {
    requestProperties.putAll(keyRequestProperties);
  }
  return executePost(dataSourceFactory, url, request.getData(), requestProperties);
}
项目:transistor    文件:DefaultDrmSession.java   
@Override
public void handleMessage(Message msg) {
  Object response;
  try {
    switch (msg.what) {
      case MSG_PROVISION:
        response = callback.executeProvisionRequest(uuid, (ProvisionRequest) msg.obj);
        break;
      case MSG_KEYS:
        response = callback.executeKeyRequest(uuid, (KeyRequest) msg.obj);
        break;
      default:
        throw new RuntimeException();
    }
  } catch (Exception e) {
    if (maybeRetryRequest(msg)) {
      return;
    }
    response = e;
  }
  postResponseHandler.obtainMessage(msg.what, response).sendToTarget();
}
项目:Exoplayer2Radio    文件:DefaultDrmSessionManager.java   
private void postKeyRequest(byte[] scope, int keyType) {
  try {
    KeyRequest keyRequest = mediaDrm.getKeyRequest(scope, schemeInitData, schemeMimeType, keyType,
        optionalKeyRequestParameters);
    postRequestHandler.obtainMessage(MSG_KEYS, keyRequest).sendToTarget();
  } catch (Exception e) {
    onKeysError(e);
  }
}
项目:K-Sonic    文件:DefaultDrmSessionManager.java   
private void postKeyRequest(byte[] scope, int keyType) {
  try {
    KeyRequest keyRequest = mediaDrm.getKeyRequest(scope, schemeInitData, schemeMimeType, keyType,
        optionalKeyRequestParameters);
    postRequestHandler.obtainMessage(MSG_KEYS, keyRequest).sendToTarget();
  } catch (Exception e) {
    onKeysError(e);
  }
}
项目:videoPickPlayer    文件:StreamingDrmSessionManager.java   
private void postKeyRequest() {
  KeyRequest keyRequest;
  try {
    keyRequest = mediaDrm.getKeyRequest(sessionId, schemeData.data, schemeData.mimeType,
        MediaDrm.KEY_TYPE_STREAMING, optionalKeyRequestParameters);
    postRequestHandler.obtainMessage(MSG_KEYS, keyRequest).sendToTarget();
  } catch (NotProvisionedException e) {
    onKeysError(e);
  }
}
项目:transistor    文件:DefaultDrmSession.java   
private void postKeyRequest(int type, boolean allowRetry) {
  byte[] scope = type == ExoMediaDrm.KEY_TYPE_RELEASE ? offlineLicenseKeySetId : sessionId;
  try {
    KeyRequest request = mediaDrm.getKeyRequest(scope, initData, mimeType, type,
        optionalKeyRequestParameters);
    if (C.CLEARKEY_UUID.equals(uuid)) {
      request = new DefaultKeyRequest(ClearKeyUtil.adjustRequestData(request.getData()),
          request.getDefaultUrl());
    }
    postRequestHandler.obtainMessage(MSG_KEYS, request, allowRetry).sendToTarget();
  } catch (Exception e) {
    onKeysError(e);
  }
}
项目:transistor    文件:LocalMediaDrmCallback.java   
@Override
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
  return keyResponse;
}
项目:Exoplayer2Radio    文件:MediaDrmCallback.java   
/**
 * Executes a key request.
 *
 * @param uuid The UUID of the content protection scheme.
 * @param request The request.
 * @return The response data.
 * @throws Exception If an error occurred executing the request.
 */
byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception;
项目:K-Sonic    文件:MediaDrmCallback.java   
/**
 * Executes a key request.
 *
 * @param uuid The UUID of the content protection scheme.
 * @param request The request.
 * @return The response data.
 * @throws Exception If an error occurred executing the request.
 */
byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception;
项目:videoPickPlayer    文件:MediaDrmCallback.java   
/**
 * Executes a key request.
 *
 * @param uuid The UUID of the content protection scheme.
 * @param request The request.
 * @return The response data.
 * @throws Exception If an error occurred executing the request.
 */
byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception;
项目:transistor    文件:MediaDrmCallback.java   
/**
 * Executes a key request.
 *
 * @param uuid The UUID of the content protection scheme.
 * @param request The request.
 * @return The response data.
 * @throws Exception If an error occurred executing the request.
 */
byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception;