MediaCrypto
class MediaCrypto
| kotlin.Any | |
| ↳ | android.media.MediaCrypto | 
MediaCrypto class can be used in conjunction with android.media.MediaCodec to decode encrypted media data. Crypto schemes are assigned 16 byte UUIDs, the method isCryptoSchemeSupported can be used to query if a given scheme is supported on the device.
Summary
| Public constructors | |
|---|---|
| MediaCrypto(uuid: UUID, sessionId: ByteArray)Instantiate a MediaCrypto object and associate it with a MediaDrm session | |
| Public methods | |
|---|---|
| static Boolean | isCryptoSchemeSupported(uuid: UUID)Query if the given scheme identified by its UUID is supported on this device. | 
| Unit | release() | 
| Boolean | Query if the crypto scheme requires the use of a secure decoder to decode data of the given mime type. | 
| Unit | setMediaDrmSession(sessionId: ByteArray)Associate a new MediaDrm session with this MediaCrypto instance. | 
| Protected methods | |
|---|---|
| Unit | finalize() | 
Public constructors
MediaCrypto
MediaCrypto(
uuid: UUID,
sessionId: ByteArray)
Instantiate a MediaCrypto object and associate it with a MediaDrm session
| Parameters | |
|---|---|
| uuid | UUID: The UUID of the crypto scheme. This value cannot be null. | 
| sessionId | ByteArray: The MediaDrm sessionId to associate with this MediaCrypto session. The sessionId may be changed after the MediaCrypto is created using setMediaDrmSessionThis value cannot benull. | 
Public methods
isCryptoSchemeSupported
static fun isCryptoSchemeSupported(uuid: UUID): Boolean
Query if the given scheme identified by its UUID is supported on this device.
| Parameters | |
|---|---|
| uuid | UUID: The UUID of the crypto scheme. This value cannot be null. | 
requiresSecureDecoderComponent
fun requiresSecureDecoderComponent(mime: String): Boolean
Query if the crypto scheme requires the use of a secure decoder to decode data of the given mime type.
| Parameters | |
|---|---|
| mime | String: The mime type of the media data This value cannot be null. | 
setMediaDrmSession
fun setMediaDrmSession(sessionId: ByteArray): Unit
Associate a new MediaDrm session with this MediaCrypto instance.
The MediaDrm session is used to securely load decryption keys for a crypto scheme. The crypto keys loaded through the MediaDrm session may be selected for use during the decryption operation performed by android.media.MediaCodec#queueSecureInputBuffer by specifying their key IDs in the android.media.MediaCodec.CryptoInfo#key field.
| Parameters | |
|---|---|
| sessionId | ByteArray: The MediaDrm sessionId to associate with this MediaCrypto instance. The session's scheme must match the scheme UUID used when constructing this MediaCrypto instance. This value cannot be null. | 
| Exceptions | |
|---|---|
| android.media.MediaCryptoException | on failure to set the sessionId | 
Protected methods
finalize
protected fun finalize(): Unit
| Exceptions | |
|---|---|
| java.lang.Throwable | the Exceptionraised by this method | 
