AssetLoader.Listener
interface AssetLoader.Listener
A listener of AssetLoader events.
Summary
Public functions |
|
|---|---|
Unit |
onDurationUs(durationUs: Long)Called when the duration of the input media is known. |
Unit |
onError(exportException: ExportException!)Called if an error occurs in the asset loader. |
SampleConsumer? |
onOutputFormat(format: Format!)Called when the |
Boolean |
onTrackAdded(Called when the information on a track is known. |
Unit |
onTrackCount(trackCount: @IntRange(from = 1) Int)Called when the number of tracks being output is known. |
Public functions
onDurationUs
fun onDurationUs(durationUs: Long): Unit
Called when the duration of the input media is known.
Can be called from any thread.
onError
fun onError(exportException: ExportException!): Unit
Called if an error occurs in the asset loader. In this case, the asset loader will be released automatically.
Can be called from any thread.
onOutputFormat
fun onOutputFormat(format: Format!): SampleConsumer?
Called when the Format of samples that will be output by the AssetLoader is known.
Must be called after the corresponding track has been added.
For each added track, this method must be called regularly until the returned SampleConsumer is non-null.
Must be called from the thread that will be used to call the returned SampleConsumer's methods. This thread must be the same for all formats output, and is generally different from the one used to access the AssetLoader methods.
| Returns | |
|---|---|
SampleConsumer? |
The |
| Throws | |
|---|---|
androidx.media3.transformer.ExportException |
If an error occurs configuring the |
onTrackAdded
fun onTrackAdded(
inputFormat: Format!,
@AssetLoader.SupportedOutputTypes supportedOutputTypes: Int
): Boolean
Called when the information on a track is known.
Must be called after the duration and the track count have been reported.
Must be called once per declared track.
Must be called from the thread that will be used to call onOutputFormat.
| Parameters | |
|---|---|
inputFormat: Format! |
The |
@AssetLoader.SupportedOutputTypes supportedOutputTypes: Int |
The output |
| Returns | |
|---|---|
Boolean |
Whether the |
onTrackCount
fun onTrackCount(trackCount: @IntRange(from = 1) Int): Unit
Called when the number of tracks being output is known.
Can be called from any thread.