Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test(recording): let synthetic camera and microphone feeds lose their device

Richie McIlroy9cbdf3d5cfea
diff --git a/crates/recording/src/feeds/camera.rs b/crates/recording/src/feeds/camera.rs
index 5a8304307..47e354584 100644
--- a/crates/recording/src/feeds/camera.rs
+++ b/crates/recording/src/feeds/camera.rs
@@ -2067,6 +2067,12 @@ pub mod synthetic {
.map_err(|error| anyhow::anyhow!("synthetic camera lock: {error}"))
}
+ /// Takes the device away the way the app does when it disappears or
+ /// is deselected (`RemoveInput`); a locked feed defers it.
+ pub async fn remove_input(&self) {
+ let _ = self.feed.ask(RemoveInput).await;
+ }
+
pub async fn push_native(&self, frame: NativeCameraFrame) {
let _ = self.feed.tell(NewNativeFrame(frame)).await;
}
diff --git a/crates/recording/src/feeds/microphone.rs b/crates/recording/src/feeds/microphone.rs
index 754cb064a..5efa225f5 100644
--- a/crates/recording/src/feeds/microphone.rs
+++ b/crates/recording/src/feeds/microphone.rs
@@ -3158,6 +3158,12 @@ pub mod synthetic {
.map_err(|error| anyhow::anyhow!("synthetic microphone lock: {error}"))
}
+ /// Takes the device away the way the app does when it disappears or
+ /// is deselected (`RemoveInput`); a locked feed defers it.
+ pub async fn remove_input(&self) {
+ let _ = self.feed.ask(RemoveInput).await;
+ }
+
/// Delivers interleaved f32 samples whose first frame was captured at
/// `timestamp`.
pub async fn push(&self, samples: &[f32], timestamp: Timestamp) {