Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix single-segment audio
Brendan Allanf0af7368e1c2
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 345a38c38..07d44f777 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -214,7 +214,7 @@ export type Audio = { duration: number; sample_rate: number; channels: number }export type AudioConfiguration = { mute: boolean; improve: boolean }export type AudioInputLevelChange = numberexport type AudioMeta = { path: string }-export type AuthStore = { token: string; user_id: string; expires: number; plan: Plan | null }+export type AuthStore = { token: string; user_id: string | null; expires: number; plan: Plan | null }export type AuthenticationInvalid = nullexport type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; inset: number; crop: Crop | null }export type BackgroundSource = { type: "wallpaper"; id: number } | { type: "image"; path: string | null } | { type: "color"; value: [number, number, number] } | { type: "gradient"; from: [number, number, number]; to: [number, number, number]; angle?: number }diff --git a/crates/editor/src/playback.rs b/crates/editor/src/playback.rsindex 64a93799b..93568321c 100644--- a/crates/editor/src/playback.rs+++ b/crates/editor/src/playback.rs@@ -61,17 +61,17 @@ impl Playback {.map(|t| t.duration()).unwrap_or(f64::MAX);- // Lock the mutex and check if audio data is available- // if let Some(audio_data) = self.audio.as_ref() {- // AudioPlayback {- // audio: audio_data.clone(),- // stop_rx: stop_rx.clone(),- // start_frame_number: self.start_frame_number,- // duration,- // project: self.project.clone(),- // }- // .spawn();- // };+ // TODO: make this work with >1 segment+ if let Some(audio_data) = self.segments[0].audio.as_ref() {+ AudioPlayback {+ audio: audio_data.clone(),+ stop_rx: stop_rx.clone(),+ start_frame_number: self.start_frame_number,+ duration,+ project: self.project.clone(),+ }+ .spawn();+ };loop {if frame_number as f64 > FPS as f64 * duration {diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rsindex d088382eb..be65e8d42 100644--- a/crates/export/src/lib.rs+++ b/crates/export/src/lib.rs@@ -92,28 +92,29 @@ pub async fn export_video_to_file(let audio_dir = tempfile::tempdir().unwrap();let video_dir = tempfile::tempdir().unwrap();- let mut audio = None::<AudioRender>;- // if let Some(audio_data) = audio.as_ref() {- // let (tx, rx) = tokio::sync::mpsc::channel::<Vec<u8>>(30);-- // let pipe_path =- // cap_utils::create_channel_named_pipe(rx, audio_dir.path().join("audio.pipe"));-- // ffmpeg.add_input(cap_ffmpeg_cli::FFmpegRawAudioInput {- // input: pipe_path,- // sample_format: "f64le".to_string(),- // sample_rate: audio_data.info.sample_rate,- // channels: audio_data.info.channels as u16,- // });-- // let buffer = AudioFrameBuffer::new(audio_data.clone());- // Some(AudioRender {- // buffer,- // pipe_tx: tx,- // })- // } else {- // None- // };+ let mut audio = if let Some(audio_data) =+ audio_segments.get(0).and_then(|d| d.as_ref().as_ref())+ {+ let (tx, rx) = tokio::sync::mpsc::channel::<Vec<u8>>(30);++ let pipe_path =+ cap_utils::create_channel_named_pipe(rx, audio_dir.path().join("audio.pipe"));++ ffmpeg.add_input(cap_ffmpeg_cli::FFmpegRawAudioInput {+ input: pipe_path,+ sample_format: "f64le".to_string(),+ sample_rate: audio_data.info.sample_rate,+ channels: audio_data.info.channels as u16,+ });++ let buffer = AudioFrameBuffer::new(audio_data.clone());+ Some(AudioRender {+ buffer,+ pipe_tx: tx,+ })+ } else {+ None+ };let video_tx = {let (tx, rx) = tokio::sync::mpsc::channel::<Vec<u8>>(30);