Example usage for android.media MediaCrypto isCryptoSchemeSupported

List of usage examples for android.media MediaCrypto isCryptoSchemeSupported

Introduction

In this page you can find the example usage for android.media MediaCrypto 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

/**
 * Create a MediaCrypto object./*from  ww w  .  j  a va2 s.c o m*/
 *
 * @return if a MediaCrypto object is successfully created.
 */
private boolean createMediaCrypto() {
    assert (mSessionId != null);
    assert (mMediaCrypto == null);
    try {
        final byte[] session = mSessionId.getBytes("UTF-8");
        if (MediaCrypto.isCryptoSchemeSupported(mSchemeUUID)) {
            mMediaCrypto = new MediaCrypto(mSchemeUUID, session);
        }
    } catch (android.media.MediaCryptoException e) {
        Log.e(TAG, "Cannot create MediaCrypto " + e.toString());
        return false;
    } catch (java.io.UnsupportedEncodingException e) {
        Log.e(TAG, "Cannot create MediaCrypto " + e.toString());
        return false;
    }

    assert (mMediaCrypto != null);
    nativeOnMediaCryptoReady(mNativeMediaDrmBridge);
    return true;
}