TransformerKt

A Kotlin coroutine wrapper around Media3's Transformer API.

Use the extension functions on a Transformer instance:

suspend fun transform(context: Context, input: Uri, output: File) {
val transformer = Transformer.Builder(context).build()
val result = transformer.start(input, output) { progress ->
// Update UI with progress
}

// Handle the result
}

Or as a Flow:

suspend fun transform(context: Context, input: Uri, output: File) {
val transformer = Transformer.Builder(context).build()
transformer.start(input, output).collect (status) {
// Handle the result
}
}

Properties

Link copied to clipboard
Link copied to clipboard

A TransformationRequest that transforms the video to H264 and audio to AAC.

Link copied to clipboard

A TransformationRequest that transforms the video to H264.

Link copied to clipboard

A TransformationRequest that uses the default values.

Functions

Link copied to clipboard
fun build(context: Context, block: Transformer.Builder.() -> Unit = {}): Transformer

Build a Transformer instance.