pub fn start_recording(
app: AppHandle,
recording_state: State<'_, RecordingState>,
preview_state: State<'_, PreviewState>,
camera_handle: State<'_, CameraPipelineHandle>,
mic_state: State<'_, MicCaptureState>,
mic_handle: State<'_, MicCaptureHandle>,
config: RecordingConfig,
) -> Result<u64, String>Expand description
Start a coordinated recording session (M-RECORD.1 of M-RECORD-EXPORT).
Spawns each enabled per-channel pipeline (camera / screen /
microphone / system audio) inside one RecordingSession
orchestrator. Picker selections (camera_id, microphone_id,
screen_source_id) are threaded through to the existing per-
channel start paths so M-CAM.4 / M-MIC.3 / M-SCK.0.1 routing
applies inside a session too.
Rollback discipline: if any one stream fails to start, the
session aborts — the streams that already started are stopped
best-effort and the function returns Err.
Lifecycle: session enters Starting. The per-channel
pipelines transition Starting → Running independently as each
produces its first frame; the recording-status event push
(M-RECORD.1 follow-up commit) will roll those up into the master
Running transition.
§Errors
"a recording session is already active"— re-entrant call without a priorstop_recording. Idempotent-by-design rather than implicit-replace because mid-session changes invalidate the M-EXPORT encoder state."no streams enabled — pick at least one input"— caller passedSessionStreams { camera: false, ... }."screen + system audio capture require macOS 13.0+"— non-macOS caller enabled either of those channels.- Underlying per-channel start error, prefixed with the channel
name (e.g.
"camera start failed: ...").