Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Handle system audio loading errors gracefully

Richie McIlroyfbc87557d22e
diff --git a/crates/rendering/src/project_recordings.rs b/crates/rendering/src/project_recordings.rs
index a373fcaa7..839cb59dd 100644
--- a/crates/rendering/src/project_recordings.rs
+++ b/crates/rendering/src/project_recordings.rs
@@ -154,6 +154,18 @@ impl ProjectRecordingsMeta {
})
};
+ let system_audio = match Option::map(s.system_audio.as_ref(), load_audio)
+ .transpose()
+ {
+ Ok(audio) => audio,
+ Err(e) => {
+ tracing::warn!(
+ "Failed to load system audio for segment, treating as no audio: {e}"
+ );
+ None
+ }
+ };
+
Ok::<_, String>(SegmentRecordings {
display: load_video(&s.display).map_err(|e| format!("video / {e}"))?,
camera: Option::map(s.camera.as_ref(), load_video)
@@ -162,9 +174,7 @@ impl ProjectRecordingsMeta {
mic: Option::map(s.mic.as_ref(), load_audio)
.transpose()
.map_err(|e| format!("mic / {e}"))?,
- system_audio: Option::map(s.system_audio.as_ref(), load_audio)
- .transpose()
- .map_err(|e| format!("system audio / {e}"))?,
+ system_audio,
})
})
.enumerate()