Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/desktop/src-tauri/src/general_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ pub struct GeneralSettingsStore {
}

fn default_enable_native_camera_preview() -> bool {
// TODO:
// cfg!(target_os = "macos")
false
// This will help us with testing it
cfg!(all(debug_assertions, target_os = "macos"))
}

fn default_enable_new_recording_flow() -> bool {
Expand Down
25 changes: 21 additions & 4 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use serde_json::json;
use specta::Type;
use std::collections::BTreeMap;
use std::path::Path;
use std::time::Duration;
use std::{
fs::File,
future::Future,
Expand All @@ -77,6 +78,7 @@ use tauri_plugin_shell::ShellExt;
use tauri_specta::Event;
use tokio::sync::mpsc;
use tokio::sync::{Mutex, RwLock};
use tokio::time::timeout;
use tracing::debug;
use tracing::error;
use tracing::trace;
Expand Down Expand Up @@ -286,10 +288,25 @@ async fn set_camera_input(
.unwrap_or_default()
{
let (camera_tx, camera_rx) = flume::bounded::<RawCameraFrame>(4);
camera_preview
.init_preview_window(window, camera_rx)
.await
.unwrap();

let prev_err = &mut None;
if timeout(Duration::from_secs(3), async {
while let Err(err) = camera_preview
.init_preview_window(window.clone(), camera_rx.clone())
.await
{
error!("Error initializing camera feed: {err}");
*prev_err = Some(err);
tokio::time::sleep(Duration::from_millis(200)).await;
}
})
.await
.is_err()
{
let _ = window.close();
return Err(format!("Timeout initializing camera preview: {prev_err:?}"));
};

Some(camera_tx)
} else {
None
Expand Down
Loading