Interface AssetLoader.Listener
-
- Enclosing interface:
- AssetLoader
public static interface AssetLoader.ListenerA listener ofAssetLoaderevents.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonDurationUs(long durationUs)Called when the duration of the input media is known.voidonError(ExportException exportException)Called if an error occurs in the asset loader.SampleConsumeronOutputFormat(Format format)Called when theFormatof samples that will be output by theAssetLoaderis known.booleanonTrackAdded(Format inputFormat, @com.google.android.exoplayer2.transformer.AssetLoader.SupportedOutputTypes int supportedOutputTypes)Called when the information on a track is known.voidonTrackCount(int trackCount)Called when the number of tracks being output is known.
-
-
-
Method Detail
-
onDurationUs
void onDurationUs(long durationUs)
Called when the duration of the input media is known.Can be called from any thread.
-
onTrackCount
void onTrackCount(@IntRange(from=1L) int trackCount)Called when the number of tracks being output is known.Can be called from any thread.
-
onTrackAdded
boolean onTrackAdded(Format inputFormat, @com.google.android.exoplayer2.transformer.AssetLoader.SupportedOutputTypes int supportedOutputTypes)
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(Format).- Parameters:
inputFormat- TheFormatof samples that will be input to theAssetLoader(prior to video slow motion flattening or to decoding).supportedOutputTypes- The output types supported by thisAssetLoaderfor the track added. At least one output type must be supported.- Returns:
- Whether the
AssetLoaderneeds to provide decoded data to theSampleConsumer.
-
onOutputFormat
@Nullable SampleConsumer onOutputFormat(Format format) throws ExportException
Called when theFormatof samples that will be output by theAssetLoaderis known.Must be called after the corresponding track has been
added.For each
addedtrack, this method must be called regularly until the returnedSampleConsumeris 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 theAssetLoadermethods.- Parameters:
format- TheFormatof samples that will be output.- Returns:
- The
SampleConsumerof samples of the givenFormat, ornullif it could not be retrieved yet. - Throws:
ExportException- If an error occurs configuring theSampleConsumer.
-
onError
void onError(ExportException exportException)
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.
-
-