private void postKeyRequest(int type, boolean allowRetry) { byte[] scope = type == ExoMediaDrm.KEY_TYPE_RELEASE ? offlineLicenseKeySetId : sessionId; try { currentKeyRequest = mediaDrm.getKeyRequest(scope, schemeDatas, type, optionalKeyRequestParameters); postRequestHandler.post(MSG_KEYS, currentKeyRequest, allowRetry); } catch (Exception e) { onKeysError(e); } }
private byte[] blockingKeyRequest(@Mode int licenseMode, byte[] offlineLicenseKeySetId, DrmInitData drmInitData) throws DrmSessionException { DrmSession<T> drmSession = openBlockingKeyRequest(licenseMode, offlineLicenseKeySetId, drmInitData); DrmSessionException error = drmSession.getError(); byte[] keySetId = drmSession.getOfflineLicenseKeySetId(); drmSessionManager.releaseSession(drmSession); if (error != null) { throw error; } return keySetId; }
private void onKeysError(Exception e) { if (e instanceof NotProvisionedException) { provisioningManager.provisionRequired(this); } else { onError(e); } }
private static DrmInitData newDrmInitData() { return new DrmInitData( new SchemeData(C.WIDEVINE_UUID, "mimeType", new byte[] {1, 4, 7, 0, 3, 6})); } }
/** * Returns whether this {@link SchemeData} can be used to replace {@code other}. * * @param other A {@link SchemeData}. * @return Whether this {@link SchemeData} can be used to replace {@code other}. */ public boolean canReplace(SchemeData other) { return hasData() && !other.hasData() && matches(other.uuid); }
@Override public byte[] executeProvisionRequest(UUID uuid, ProvisionRequest request) throws IOException { String url = request.getDefaultUrl() + "&signedRequest=" + Util.fromUtf8Bytes(request.getData()); return executePost(dataSourceFactory, url, Util.EMPTY_BYTE_ARRAY, null); }
private boolean restoreKeys() { try { mediaDrm.restoreKeys(sessionId, offlineLicenseKeySetId); return true; } catch (Exception e) { Log.e(TAG, "Error trying to restore Widevine keys.", e); onError(e); } return false; }
private void onKeysExpired() { if (state == STATE_OPENED_WITH_KEYS) { state = STATE_OPENED; onError(new KeysExpiredException()); } }
/** * Signals that the {@link DrmInitData} passed to {@link #acquireSession} does not contain does * not contain scheme data for the required UUID. */ public static final class MissingSchemeDataException extends Exception { private MissingSchemeDataException(UUID uuid) { super("Media does not support uuid: " + uuid); } }
public void acquire() { if (++openCount == 1) { if (state == STATE_ERROR) { return; } if (openInternal(true)) { doLicense(true); } } }
public void provision() { currentProvisionRequest = mediaDrm.getProvisionRequest(); postRequestHandler.post(MSG_PROVISION, currentProvisionRequest, /* allowRetry= */ true); }
/** * @see DefaultDrmSessionManager#setPropertyString */ public synchronized void setPropertyString(String key, String value) { drmSessionManager.setPropertyString(key, value); }
/** * @see DefaultDrmSessionManager#getPropertyString */ public synchronized String getPropertyString(String key) { return drmSessionManager.getPropertyString(key); }
/** * Provides access to {@link ExoMediaDrm#setPropertyString(String, String)}. * <p> * This method may be called when the manager is in any state. * * @param key The property to write. * @param value The value to write. */ public final void setPropertyString(String key, String value) { mediaDrm.setPropertyString(key, value); }
/** * Provides access to {@link ExoMediaDrm#getPropertyByteArray(String)}. * <p> * This method may be called when the manager is in any state. * * @param key The key to request. * @return The retrieved property. */ public final byte[] getPropertyByteArray(String key) { return mediaDrm.getPropertyByteArray(key); }
/** * @see DefaultDrmSessionManager#getPropertyByteArray */ public synchronized byte[] getPropertyByteArray(String key) { return drmSessionManager.getPropertyByteArray(key); }
/** * Provides access to {@link ExoMediaDrm#getPropertyString(String)}. * <p> * This method may be called when the manager is in any state. * * @param key The key to request. * @return The retrieved property. */ public final String getPropertyString(String key) { return mediaDrm.getPropertyString(key); }
/** * @see DefaultDrmSessionManager#setPropertyByteArray */ public synchronized void setPropertyByteArray(String key, byte[] value) { drmSessionManager.setPropertyByteArray(key, value); }
private static DrmInitData newDrmInitData() { return new DrmInitData( new SchemeData(C.WIDEVINE_UUID, "mimeType", new byte[] {1, 4, 7, 0, 3, 6})); } }
public void onProvisionCompleted() { if (openInternal(false)) { doLicense(true); } }