Skip to main content

export_recording

Function export_recording 

Source
pub async fn export_recording(
    app: AppHandle,
    format: Option<String>,
    output_dir: Option<String>,
) -> Result<String, String>
Expand description

Export the pending recording to output_dir in format, then return the final absolute path (M-SAVE.1 / .2).

  • format — slug ("mp4-h264" / "webm-vp9"); None → default (mp4-h264). The scratch is MP4/H.264: an MP4 export is a fast move; a WebM export re-encodes the scratch to VP9 + Opus (M-SAVE.2). H.265 / AV1 aren’t exposed in the UI and return an “unsupported” error.
  • output_dir — override folder; None / empty → the persisted default (recorder_settings::resolved_output_dir).

Runs the move / transcode + the AVIF poster on the blocking thread pool (spawn_blocking) so the webview stays responsive during a multi-second WebM transcode. On success the chosen format is persisted as the Save-panel default; on failure the pending export is restored so the user can retry.

§Errors

  • "no recording is awaiting export" — nothing pending.
  • move / transcode failure (permissions, disk full, gst error) — surfaced verbatim.
  • "export to … is not supported" — H.265 / AV1.