Example usage for android.media MediaDrm isCryptoSchemeSupported

List of usage examples for android.media MediaDrm isCryptoSchemeSupported

Introduction

In this page you can find the example usage for android.media MediaDrm isCryptoSchemeSupported.

Prototype

public static final boolean isCryptoSchemeSupported(@NonNull UUID uuid) 

Source Link

Document

Query if the given scheme identified by its UUID is supported on this device.

Usage

From source file:org.chromium.media.MediaDrmBridge.java

/**
 * Check whether the crypto scheme is supported for the given container.
 * If |containerMimeType| is an empty string, we just return whether
 * the crypto scheme is supported./*w  ww. j a va 2  s . c om*/
 * TODO(qinmin): Implement the checking for container.
 *
 * @return true if the container and the crypto scheme is supported, or
 * false otherwise.
 */
@CalledByNative
private static boolean isCryptoSchemeSupported(byte[] schemeUUID, String containerMimeType) {
    UUID cryptoScheme = getUUIDFromBytes(schemeUUID);
    return MediaDrm.isCryptoSchemeSupported(cryptoScheme);
}

From source file:org.chromium.media.MediaDrmBridge.java

/**
 * Create a new MediaDrmBridge from the crypto scheme UUID.
 *
 * @param schemeUUID Crypto scheme UUID.
 * @param securityLevel Security level to be used.
 * @param nativeMediaDrmBridge Native object of this class.
 */// www . j a va  2 s.com
@CalledByNative
private static MediaDrmBridge create(byte[] schemeUUID, String securityLevel, int nativeMediaDrmBridge) {
    UUID cryptoScheme = getUUIDFromBytes(schemeUUID);
    if (cryptoScheme == null || !MediaDrm.isCryptoSchemeSupported(cryptoScheme)) {
        return null;
    }

    MediaDrmBridge media_drm_bridge = null;
    try {
        media_drm_bridge = new MediaDrmBridge(cryptoScheme, securityLevel, nativeMediaDrmBridge);
    } catch (android.media.UnsupportedSchemeException e) {
        Log.e(TAG, "Unsupported DRM scheme: " + e.toString());
    } catch (java.lang.IllegalArgumentException e) {
        Log.e(TAG, "Failed to create MediaDrmBridge: " + e.toString());
    } catch (java.lang.IllegalStateException e) {
        Log.e(TAG, "Failed to create MediaDrmBridge: " + e.toString());
    }

    return media_drm_bridge;
}