fromSource

fun AudioRecording.Companion.fromSource(source: Source, fileName: String? = null): AudioRecording

Decodes an audio file from a Source stream (e.g. Android ContentResolver, platform input streams, or any kotlinx.io.Source).

val source = contentResolver.openInputStream(uri)!!.asSource().buffered()
val recording = AudioRecording.fromSource(source)

Parameters

source

The source to read from. Will be consumed but not closed.

fileName

Optional filename for extension-based format fallback.


Decodes an audio file from a Source using an explicit container format.