# ExoMediaDrm.KeyRequest

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/drm/ExoMediaDrm.java+class:androidx.media3.exoplayer.drm.ExoMediaDrm.KeyRequest)

*** ** * ** ***

<br />

```
class ExoMediaDrm.KeyRequest
```

<br />

*** ** * ** ***

Contains data used to request keys from a license server.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.KeyRequest.html` |   |

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/kotlin/androidx/annotation/IntDef(value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest.RequestType` Key request types. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_INITIAL() = 0` Key request type for an initial license request. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_NONE() = 3` Key request type if keys are already loaded and available for use. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_RELEASE() = 2` Key request type for license release. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_RENEWAL() = 1` Key request type for license renewal. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_UNKNOWN() = -2147483648` Value returned from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#getRequestType()` if the underlying key request does not specify a type. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_UPDATE() = 4` Key request type if keys have been loaded, but an additional license request is needed to update their values. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#KeyRequest(byte[],java.lang.String)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, licenseServerUrl: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_UNKNOWN()`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#KeyRequest(byte[],java.lang.String,int)( data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, licenseServerUrl: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest.RequestType requestType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates an instance. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#data()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#licenseServerUrl()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest.RequestType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#requestType()` |

## Constants

### REQUEST_TYPE_INITIAL

```
const val REQUEST_TYPE_INITIAL = 0: Int
```

Key request type for an initial license request.

### REQUEST_TYPE_NONE

```
const val REQUEST_TYPE_NONE = 3: Int
```

Key request type if keys are already loaded and available for use. No license request is necessary, and no key request data is returned.

### REQUEST_TYPE_RELEASE

```
const val REQUEST_TYPE_RELEASE = 2: Int
```

Key request type for license release.

### REQUEST_TYPE_RENEWAL

```
const val REQUEST_TYPE_RENEWAL = 1: Int
```

Key request type for license renewal.

### REQUEST_TYPE_UNKNOWN

```
const val REQUEST_TYPE_UNKNOWN = -2147483648: Int
```

Value returned from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#getRequestType()` if the underlying key request does not specify a type.

### REQUEST_TYPE_UPDATE

```
const val REQUEST_TYPE_UPDATE = 4: Int
```

Key request type if keys have been loaded, but an additional license request is needed to update their values.

## Public constructors

### KeyRequest

```
KeyRequest(data: ByteArray<Byte>!, licenseServerUrl: String!)
```

Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_UNKNOWN()`.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The opaque key request data. |
| `licenseServerUrl: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The license server URL to which the request should be made. |

### KeyRequest

```
KeyRequest(
    data: ByteArray<Byte>!,
    licenseServerUrl: String!,
    @ExoMediaDrm.KeyRequest.RequestType requestType: Int
)
```

Creates an instance.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The opaque key request data. |
| `licenseServerUrl: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The license server URL to which the request should be made. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest.RequestType requestType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type of the request, or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest#REQUEST_TYPE_UNKNOWN()`. |

## Public properties

### data

```
val data: Array<Byte>!
```

### licenseServerUrl

```
val licenseServerUrl: String!
```

### requestType

```
@ExoMediaDrm.KeyRequest.RequestType
val requestType: Int
```