# TrackEncryptionBox

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

*** ** * ** ***

<br />

```
@UnstableApi
class TrackEncryptionBox
```

<br />

*** ** * ** ***

Encapsulates information parsed from a track encryption (tenc) box or sample group description (sgpd) box in an MP4 stream.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#TrackEncryptionBox(boolean,java.lang.String,int,byte[],int,int,byte[])( isEncrypted: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, schemeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, perSampleIvSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, keyId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, defaultEncryptedBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, defaultClearBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, defaultInitializationVector: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>? )` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#cryptoData()` A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData` instance containing the encryption information from this `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox`. |
| `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/extractor/mp4/TrackEncryptionBox#defaultInitializationVector()` If `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#perSampleIvSize()` is 0, holds the default initialization vector as defined in the track encryption box or sample group description box. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#isEncrypted()` Indicates the encryption state of the samples in the sample group. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#perSampleIvSize()` The initialization vector size in bytes for the samples in the corresponding sample group. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#schemeType()` The protection scheme type, as defined by the 'schm' box, or null if unknown. |

## Public constructors

### TrackEncryptionBox

```
TrackEncryptionBox(
    isEncrypted: Boolean,
    schemeType: String?,
    perSampleIvSize: Int,
    keyId: ByteArray<Byte>!,
    defaultEncryptedBlocks: Int,
    defaultClearBlocks: Int,
    defaultInitializationVector: ByteArray<Byte>?
)
```

| Parameters |
|---|---|
| `isEncrypted: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#isEncrypted()`. |
| `schemeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#schemeType()`. |
| `perSampleIvSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#perSampleIvSize()`. |
| `keyId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData#encryptionKey()`. |
| `defaultEncryptedBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData#encryptedBlocks()`. |
| `defaultClearBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData#clearBlocks()`. |
| `defaultInitializationVector: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | See `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#defaultInitializationVector()`. |

## Public properties

### cryptoData

```
val cryptoData: TrackOutput.CryptoData!
```

A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/TrackOutput.CryptoData` instance containing the encryption information from this `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox`.

### defaultInitializationVector

```
val defaultInitializationVector: Array<Byte>?
```

If `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox#perSampleIvSize()` is 0, holds the default initialization vector as defined in the track encryption box or sample group description box. Null otherwise.

### isEncrypted

```
val isEncrypted: Boolean
```

Indicates the encryption state of the samples in the sample group.

### perSampleIvSize

```
val perSampleIvSize: Int
```

The initialization vector size in bytes for the samples in the corresponding sample group.

### schemeType

```
val schemeType: String?
```

The protection scheme type, as defined by the 'schm' box, or null if unknown.