/** * Constructs an instance. Call {@link #release()} when the instance is no longer required. * * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager. * @param callback Performs key and provisioning requests. * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument * to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null. * @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm, * MediaDrmCallback, HashMap, Handler, EventListener) */ public OfflineLicenseHelper(ExoMediaDrm<T> mediaDrm, MediaDrmCallback callback, HashMap<String, String> optionalKeyRequestParameters) { handlerThread = new HandlerThread("OfflineLicenseHelper"); handlerThread.start(); conditionVariable = new ConditionVariable(); EventListener eventListener = new EventListener() { @Override public void onDrmKeysLoaded() { conditionVariable.open(); } @Override public void onDrmSessionManagerError(Exception e) { conditionVariable.open(); } @Override public void onDrmKeysRestored() { conditionVariable.open(); } @Override public void onDrmKeysRemoved() { conditionVariable.open(); } }; drmSessionManager = new DefaultDrmSessionManager<>(C.WIDEVINE_UUID, mediaDrm, callback, optionalKeyRequestParameters, new Handler(handlerThread.getLooper()), eventListener); }
/** * Constructs an instance. Call {@link #releaseResources()} when you're done with it. * * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager. * @param callback Performs key and provisioning requests. * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument * to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null. * @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm, * MediaDrmCallback, HashMap, Handler, EventListener) */ public OfflineLicenseHelper(ExoMediaDrm<T> mediaDrm, MediaDrmCallback callback, HashMap<String, String> optionalKeyRequestParameters) { handlerThread = new HandlerThread("OfflineLicenseHelper"); handlerThread.start(); conditionVariable = new ConditionVariable(); EventListener eventListener = new EventListener() { @Override public void onDrmKeysLoaded() { conditionVariable.open(); } @Override public void onDrmSessionManagerError(Exception e) { conditionVariable.open(); } @Override public void onDrmKeysRestored() { conditionVariable.open(); } @Override public void onDrmKeysRemoved() { conditionVariable.open(); } }; drmSessionManager = new DefaultDrmSessionManager<>(C.WIDEVINE_UUID, mediaDrm, callback, optionalKeyRequestParameters, new Handler(handlerThread.getLooper()), eventListener); }
/** * Constructs an instance. Call {@link #release()} when the instance is no longer required. * * @param uuid The UUID of the drm scheme. * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager. * @param callback Performs key and provisioning requests. * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument * to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null. * @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm, * MediaDrmCallback, HashMap, Handler, EventListener) */ public OfflineLicenseHelper(UUID uuid, ExoMediaDrm<T> mediaDrm, MediaDrmCallback callback, HashMap<String, String> optionalKeyRequestParameters) { handlerThread = new HandlerThread("OfflineLicenseHelper"); handlerThread.start(); conditionVariable = new ConditionVariable(); EventListener eventListener = new EventListener() { @Override public void onDrmKeysLoaded() { conditionVariable.open(); } @Override public void onDrmSessionManagerError(Exception e) { conditionVariable.open(); } @Override public void onDrmKeysRestored() { conditionVariable.open(); } @Override public void onDrmKeysRemoved() { conditionVariable.open(); } }; drmSessionManager = new DefaultDrmSessionManager<>(uuid, mediaDrm, callback, optionalKeyRequestParameters, new Handler(handlerThread.getLooper()), eventListener); }