Java Code Examples for android.media.MediaDrm#setOnEventListener()

The following examples show how to use android.media.MediaDrm#setOnEventListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamingDrmSessionManager.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param playbackLooper The looper associated with the media playback thread. Should usually be
 *     obtained using {@link com.google.android.exoplayer.ExoPlayer#getPlaybackLooper()}.
 * @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.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @throws UnsupportedSchemeException If the specified DRM scheme is not supported.
 */
public StreamingDrmSessionManager(UUID uuid, Looper playbackLooper, MediaDrmCallback callback,
    HashMap<String, String> optionalKeyRequestParameters, Handler eventHandler,
    EventListener eventListener) throws UnsupportedSchemeException {
  this.uuid = uuid;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  mediaDrm = new MediaDrm(uuid);
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
  mediaDrmHandler = new MediaDrmHandler(playbackLooper);
  postResponseHandler = new PostResponseHandler(playbackLooper);
  state = STATE_CLOSED;
}
 
Example 2
Source File: MediaDrmBridge.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private MediaDrmBridge(UUID schemeUUID, String securityLevel, int nativeMediaDrmBridge)
        throws android.media.UnsupportedSchemeException {
    mSchemeUUID = schemeUUID;
    mMediaDrm = new MediaDrm(schemeUUID);
    mHandler = new Handler();
    mNativeMediaDrmBridge = nativeMediaDrmBridge;
    mResetDeviceCredentialsPending = false;
    mMediaDrm.setOnEventListener(new MediaDrmListener());
    mMediaDrm.setPropertyString(PRIVACY_MODE, "enable");
    String currentSecurityLevel = mMediaDrm.getPropertyString(SECURITY_LEVEL);
    Log.e(TAG, "Security level: current " + currentSecurityLevel + ", new " + securityLevel);
    if (!securityLevel.equals(currentSecurityLevel))
        mMediaDrm.setPropertyString(SECURITY_LEVEL, securityLevel);
}
 
Example 3
Source File: MediaDrmBridge.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private MediaDrmBridge(UUID schemeUUID, String securityLevel, int nativeMediaDrmBridge)
        throws android.media.UnsupportedSchemeException {
    mSchemeUUID = schemeUUID;
    mMediaDrm = new MediaDrm(schemeUUID);
    mHandler = new Handler();
    mNativeMediaDrmBridge = nativeMediaDrmBridge;
    mResetDeviceCredentialsPending = false;
    mMediaDrm.setOnEventListener(new MediaDrmListener());
    mMediaDrm.setPropertyString(PRIVACY_MODE, "enable");
    String currentSecurityLevel = mMediaDrm.getPropertyString(SECURITY_LEVEL);
    Log.e(TAG, "Security level: current " + currentSecurityLevel + ", new " + securityLevel);
    if (!securityLevel.equals(currentSecurityLevel))
        mMediaDrm.setPropertyString(SECURITY_LEVEL, securityLevel);
}