public interface

Transformer.Listener

 androidx.media3.transformer.Transformer.Listener

Overview

A listener for the export events.

If the export is not cancelled, either Transformer.Listener.onError(Composition, ExportResult, ExportException) or Transformer.Listener.onCompleted(Composition, ExportResult) will be called once for each export.

Summary

Methods
public voidonCompleted(Composition composition, ExportResult exportResult)

Called when the export is completed successfully.

public voidonError(Composition composition, ExportResult exportResult, ExportException exportException)

Called if an exception occurs during the export.

public voidonFallbackApplied(Composition composition, TransformationRequest originalTransformationRequest, TransformationRequest fallbackTransformationRequest)

Called when falling back to an alternative TransformationRequest or changing the video frames' resolution is necessary to comply with muxer or device constraints.

public voidonFallbackApplied(MediaItem inputMediaItem, TransformationRequest originalTransformationRequest, TransformationRequest fallbackTransformationRequest)

public voidonTransformationCompleted(MediaItem inputMediaItem)

public voidonTransformationCompleted(MediaItem inputMediaItem, TransformationResult result)

public voidonTransformationError(MediaItem inputMediaItem, java.lang.Exception exception)

public voidonTransformationError(MediaItem inputMediaItem, TransformationException exception)

public voidonTransformationError(MediaItem inputMediaItem, TransformationResult result, TransformationException exception)

Methods

public void onTransformationCompleted(MediaItem inputMediaItem)

Deprecated: Use Transformer.Listener.onCompleted(Composition, ExportResult) instead.

public void onTransformationCompleted(MediaItem inputMediaItem, TransformationResult result)

Deprecated: Use Transformer.Listener.onCompleted(Composition, ExportResult) instead.

public void onCompleted(Composition composition, ExportResult exportResult)

Called when the export is completed successfully.

Parameters:

composition: The Composition for which the export is completed.
exportResult: The ExportResult of the export.

public void onTransformationError(MediaItem inputMediaItem, java.lang.Exception exception)

Deprecated: Use Transformer.Listener.onError(Composition, ExportResult, ExportException) instead.

public void onTransformationError(MediaItem inputMediaItem, TransformationException exception)

Deprecated: Use Transformer.Listener.onError(Composition, ExportResult, ExportException) instead.

public void onTransformationError(MediaItem inputMediaItem, TransformationResult result, TransformationException exception)

Deprecated: Use Transformer.Listener.onError(Composition, ExportResult, ExportException) instead.

public void onError(Composition composition, ExportResult exportResult, ExportException exportException)

Called if an exception occurs during the export.

The export output file (if any) is not deleted in this case.

Parameters:

composition: The Composition for which the exception occurs.
exportResult: The ExportResult of the export.
exportException: The ExportException describing the exception. This is the same instance as the exception in result.

public void onFallbackApplied(MediaItem inputMediaItem, TransformationRequest originalTransformationRequest, TransformationRequest fallbackTransformationRequest)

Deprecated: Use Transformer.Listener.onFallbackApplied(Composition, TransformationRequest, TransformationRequest) instead.

public void onFallbackApplied(Composition composition, TransformationRequest originalTransformationRequest, TransformationRequest fallbackTransformationRequest)

Called when falling back to an alternative TransformationRequest or changing the video frames' resolution is necessary to comply with muxer or device constraints.

Parameters:

composition: The Composition for which the export is requested.
originalTransformationRequest: The unsupported TransformationRequest used when building Transformer.
fallbackTransformationRequest: The alternative TransformationRequest, with supported TransformationRequest.audioMimeType, TransformationRequest.videoMimeType, TransformationRequest.outputHeight, and TransformationRequest.hdrMode values set.