startRecording

suspend fun startRecording(video: Boolean = true, audioSource: String? = null, maxSeconds: Int = if (video) 30 else 60)(source)

Begin recording this device with scrcpy on the server host (tap start --scrcpy, default scrcpy on PATH). video defaults to silent H.264 MP4; audioSource may be output (Android 11+, redirects local playback), playback (Android 13+, keeps local sound but apps can opt out), or mic. Audio only (video = false) is Opus; both tracks are Matroska. Video is bounded to 30 seconds/16 MiB, audio only to 60 seconds/3 MiB, and maxSeconds ends the capture early. One recording per attached device; detach discards an unfinished one. Capture begins shortly after this returns, and a capture the device refuses is reported by stopRecording.