# RawAssetLoader

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

*** ** * ** ***

<br />

```
@UnstableApi
class RawAssetLoader : AssetLoader
```

<br />

*** ** * ** ***

An `https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader` implementation that loads raw audio and/or video data.

Typically instantiated in a custom `https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader.Factory` saving a reference to the created `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader`.

Provide raw audio data as input by calling `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#queueAudioData(java.nio.ByteBuffer,long,boolean)`. This method must always be called from the same thread, which can be any thread.

Provide video frames as input by calling `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#queueInputTexture(int,long)`, then `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#signalEndOfVideoInput()` when finished. These two methods must be called from the same thread, which can be any thread.

All other methods are for internal use only and must never be called.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#RawAssetLoader(androidx.media3.transformer.EditedMediaItem,androidx.media3.transformer.AssetLoader.Listener,androidx.media3.common.Format,androidx.media3.common.Format,androidx.media3.common.OnInputFrameProcessedListener)( editedMediaItem: https://developer.android.com/reference/kotlin/androidx/media3/transformer/EditedMediaItem!, assetLoaderListener: https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader.Listener!, audioFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?, videoFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?, frameProcessedListener: https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener? )` Creates an instance. |

| ### Public functions |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#getDecoderNames()()` Return the used decoders' names. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer.ProgressState https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#getProgress(androidx.media3.transformer.ProgressHolder)(progressHolder: https://developer.android.com/reference/kotlin/androidx/media3/transformer/ProgressHolder!)` Returns the current `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer.ProgressState` and updates `progressHolder` with the current progress if it is `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer#PROGRESS_STATE_AVAILABLE()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#queueAudioData(java.nio.ByteBuffer,long,boolean)( audioData: https://developer.android.com/reference/java/nio/ByteBuffer.html!, presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, isLast: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Attempts to provide raw audio data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#queueInputTexture(int,long)(texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Attempts to provide an input texture. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#release()()` Stops loading data and releases all resources associated with the asset loader. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#signalEndOfVideoInput()()` Signals that no further input frames will be rendered. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#start()()` Starts the asset loader. |

### Inherited Constants

From [androidx.media3.transformer.AssetLoader](https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader#SUPPORTED_OUTPUT_TYPE_DECODED() = 2`

Indicates that the asset loader can output decoded samples.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader#SUPPORTED_OUTPUT_TYPE_ENCODED() = 1`

Indicates that the asset loader can output encoded samples.

## Public constructors

### RawAssetLoader

```
RawAssetLoader(
    editedMediaItem: EditedMediaItem!,
    assetLoaderListener: AssetLoader.Listener!,
    audioFormat: Format?,
    videoFormat: Format?,
    frameProcessedListener: OnInputFrameProcessedListener?
)
```

Creates an instance.

| Parameters |
|---|---|
| `editedMediaItem: https://developer.android.com/reference/kotlin/androidx/media3/transformer/EditedMediaItem!` | The `https://developer.android.com/reference/kotlin/androidx/media3/transformer/EditedMediaItem` for which raw data is provided. The `https://developer.android.com/reference/kotlin/androidx/media3/transformer/EditedMediaItem#durationUs()` must be set. |
| `assetLoaderListener: https://developer.android.com/reference/kotlin/androidx/media3/transformer/AssetLoader.Listener!` | Listener for asset loading events. |
| `audioFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | The audio format, or `null` if only video data is provided. |
| `videoFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | The video format, or `null` if only audio data is provided. The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#width()` and the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#height()` must be set. |
| `frameProcessedListener: https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener?` | Listener for the event when a frame has been processed, or ` null` if only audio data is provided. The listener receives a GL sync object (if supported) to allow reusing the texture after it's no longer in use. |

## Public functions

### getDecoderNames

```
fun getDecoderNames(): ImmutableMap<Int!, String!>!
```

Return the used decoders' names.

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | The decoders' names keyed by `https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType`. |

### getProgress

```
@Transformer.ProgressState
fun getProgress(progressHolder: ProgressHolder!): Int
```

Returns the current `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer.ProgressState` and updates `progressHolder` with the current progress if it is `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer#PROGRESS_STATE_AVAILABLE()`.

| Parameters |
|---|---|
| `progressHolder: https://developer.android.com/reference/kotlin/androidx/media3/transformer/ProgressHolder!` | A `https://developer.android.com/reference/kotlin/androidx/media3/transformer/ProgressHolder`, updated to hold the percentage progress if `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer#PROGRESS_STATE_AVAILABLE()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/transformer/Transformer.ProgressState`. |

### queueAudioData

```
fun queueAudioData(
    audioData: ByteBuffer!,
    presentationTimeUs: Long,
    isLast: Boolean
): Boolean
```

Attempts to provide raw audio data.

| Parameters |
|---|---|
| `audioData: https://developer.android.com/reference/java/nio/ByteBuffer.html!` | The raw audio data. The `https://developer.android.com/reference/java/nio/ByteBuffer.html` can be reused after calling this method. |
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation time for the raw audio data, in microseconds. |
| `isLast: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Signals the last audio data. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the raw audio data was successfully queued. If `false`, the caller should try again later. |

### queueInputTexture

```
fun queueInputTexture(texId: Int, presentationTimeUs: Long): Boolean
```

Attempts to provide an input texture.

Must be called on the same thread as `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#signalEndOfVideoInput()`.

| Parameters |
|---|---|
| `texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The ID of the texture to queue. |
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation time for the texture, in microseconds. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the texture was successfully queued. If `false`, the caller should try again later. |

### release

```
fun release(): Unit
```

Stops loading data and releases all resources associated with the asset loader.

### signalEndOfVideoInput

```
fun signalEndOfVideoInput(): Unit
```

Signals that no further input frames will be rendered.

Must be called on the same thread as `https://developer.android.com/reference/kotlin/androidx/media3/transformer/RawAssetLoader#queueInputTexture(int,long)`.

### start

```
fun start(): Unit
```

Starts the asset loader.