Recorder
High-level wrapper around AudioRecordingSession providing a simplified API.
Example Usage
val recorder = Kodio.recorder()
recorder.start()
// Recording in progress...
// Stop and get result
recorder.stop()
val recording = recorder.getRecording()
// Clean up
recorder.release()
// Or use with structured concurrency
Kodio.record { recorder ->
recorder.start()
delay(5.seconds)
recorder.stop()
recorder.getRecording()
} // auto-releasedProperties
The audio format of this recorder. Before recording starts, returns the requested format from quality. After recording starts, returns the actual negotiated format from the session (which may differ if the platform couldn't honor the exact request).
Whether the recorder is in stopped state with a recording available.
Whether the recorder is currently recording.
The live audio data as a Flow of byte arrays. This emits chunks in real-time while recording.
The requested audio quality
The current unified state of the recorder.
Flow of state changes for observing the recorder.
Functions
Waits for the recording to complete (stop being called externally or error).
Gets the completed recording, if available.
Stops the current recording. After calling this, getRecording will return the recorded audio.
Access the underlying session for advanced use cases.