Sdílet prostřednictvím


MediaPlayer.GetKeyRequest Method

Definition

A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content.

[Android.Runtime.Register("getKeyRequest", "([B[BLjava/lang/String;ILjava/util/Map;)Landroid/media/MediaDrm$KeyRequest;", "GetGetKeyRequest_arrayBarrayBLjava_lang_String_ILjava_util_Map_Handler", ApiSince=26)]
public virtual Android.Media.MediaDrm.KeyRequest GetKeyRequest (byte[]? keySetId, byte[]? initData, string? mimeType, Android.Media.MediaDrmKeyType keyType, System.Collections.Generic.IDictionary<string,string>? optionalParameters);
[<Android.Runtime.Register("getKeyRequest", "([B[BLjava/lang/String;ILjava/util/Map;)Landroid/media/MediaDrm$KeyRequest;", "GetGetKeyRequest_arrayBarrayBLjava_lang_String_ILjava_util_Map_Handler", ApiSince=26)>]
abstract member GetKeyRequest : byte[] * byte[] * string * Android.Media.MediaDrmKeyType * System.Collections.Generic.IDictionary<string, string> -> Android.Media.MediaDrm.KeyRequest
override this.GetKeyRequest : byte[] * byte[] * string * Android.Media.MediaDrmKeyType * System.Collections.Generic.IDictionary<string, string> -> Android.Media.MediaDrm.KeyRequest

Parameters

keySetId
Byte[]

is the key-set identifier of the offline keys being released when keyType is MediaDrm#KEY_TYPE_RELEASE. It should be set to null for other key requests, when keyType is MediaDrm#KEY_TYPE_STREAMING or MediaDrm#KEY_TYPE_OFFLINE.

initData
Byte[]

is the container-specific initialization data when the keyType is MediaDrm#KEY_TYPE_STREAMING or MediaDrm#KEY_TYPE_OFFLINE. Its meaning is interpreted based on the mime type provided in the mimeType parameter. It could contain, for example, the content ID, key ID or other data obtained from the content metadata that is required in generating the key request. When the keyType is MediaDrm#KEY_TYPE_RELEASE, it should be set to null.

mimeType
String

identifies the mime type of the content

keyType
MediaDrmKeyType

specifies the type of the request. The request may be to acquire keys for streaming, MediaDrm#KEY_TYPE_STREAMING, or for offline content MediaDrm#KEY_TYPE_OFFLINE, or to release previously acquired keys (MediaDrm#KEY_TYPE_RELEASE), which are identified by a keySetId.

optionalParameters
IDictionary<String,String>

are included in the key request message to allow a client application to provide additional message parameters to the server. This may be null if no additional parameters are to be sent.

Returns

Attributes

Remarks

Java documentation for android.media.MediaPlayer.getKeyRequest(byte[], byte[], java.lang.String, int, java.util.Map).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to