Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

use precise camera frame timing (#420)

Brendan Allancafc46a92d90
diff --git a/Cargo.lock b/Cargo.lock
index 0ee1a1b16..37ed6c519 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2266,16 +2266,6 @@ dependencies = [
"dirs-sys",
]
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if 1.0.0",
- "dirs-sys-next",
-]
-
[[package]]
name = "dirs-sys"
version = "0.5.0"
@@ -2284,21 +2274,10 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
- "redox_users 0.5.0",
+ "redox_users",
"windows-sys 0.59.0",
]
-[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users 0.4.6",
- "winapi",
-]
-
[[package]]
name = "dispatch"
version = "0.2.0"
@@ -4176,14 +4155,13 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]]
name = "mac-notification-sys"
-version = "0.6.2"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dce8f34f3717aa37177e723df6c1fc5fb02b2a1087374ea3fe0ea42316dc8f91"
+checksum = "0b95dfb34071d1592b45622bf93e315e3a72d414b6782aca9a015c12bec367ef"
dependencies = [
"cc",
- "dirs-next",
- "objc-foundation",
- "objc_id",
+ "objc2 0.6.0",
+ "objc2-foundation 0.3.0",
"time",
]
@@ -4590,7 +4568,7 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nokhwa"
version = "0.10.3"
-source = "git+https://github.com/CapSoftware/nokhwa?rev=e309b938ccd6#e309b938ccd6d17afac4017b11e7bda9f6cd9f35"
+source = "git+https://github.com/CapSoftware/nokhwa?rev=b9c8079e82e2#b9c8079e82e27f0d0f8870d0b40f19dad7cae64c"
dependencies = [
"flume 0.10.14",
"image 0.24.9",
@@ -4606,7 +4584,7 @@ dependencies = [
[[package]]
name = "nokhwa-bindings-linux"
version = "0.1.0"
-source = "git+https://github.com/CapSoftware/nokhwa?rev=e309b938ccd6#e309b938ccd6d17afac4017b11e7bda9f6cd9f35"
+source = "git+https://github.com/CapSoftware/nokhwa?rev=b9c8079e82e2#b9c8079e82e27f0d0f8870d0b40f19dad7cae64c"
dependencies = [
"nokhwa-core",
"v4l",
@@ -4616,7 +4594,7 @@ dependencies = [
[[package]]
name = "nokhwa-bindings-macos"
version = "0.2.0"
-source = "git+https://github.com/CapSoftware/nokhwa?rev=e309b938ccd6#e309b938ccd6d17afac4017b11e7bda9f6cd9f35"
+source = "git+https://github.com/CapSoftware/nokhwa?rev=b9c8079e82e2#b9c8079e82e27f0d0f8870d0b40f19dad7cae64c"
dependencies = [
"block",
"cocoa-foundation 0.1.2",
@@ -4631,7 +4609,7 @@ dependencies = [
[[package]]
name = "nokhwa-bindings-windows"
version = "0.4.0"
-source = "git+https://github.com/CapSoftware/nokhwa?rev=e309b938ccd6#e309b938ccd6d17afac4017b11e7bda9f6cd9f35"
+source = "git+https://github.com/CapSoftware/nokhwa?rev=b9c8079e82e2#b9c8079e82e27f0d0f8870d0b40f19dad7cae64c"
dependencies = [
"nokhwa-core",
"once_cell",
@@ -4641,7 +4619,7 @@ dependencies = [
[[package]]
name = "nokhwa-core"
version = "0.1.0"
-source = "git+https://github.com/CapSoftware/nokhwa?rev=e309b938ccd6#e309b938ccd6d17afac4017b11e7bda9f6cd9f35"
+source = "git+https://github.com/CapSoftware/nokhwa?rev=b9c8079e82e2#b9c8079e82e27f0d0f8870d0b40f19dad7cae64c"
dependencies = [
"bytes",
"image 0.24.9",
@@ -6052,17 +6030,6 @@ dependencies = [
"bitflags 2.9.0",
]
-[[package]]
-name = "redox_users"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
-dependencies = [
- "getrandom 0.2.15",
- "libredox",
- "thiserror 1.0.69",
-]
-
[[package]]
name = "redox_users"
version = "0.5.0"
@@ -6374,7 +6341,7 @@ dependencies = [
[[package]]
name = "scap"
version = "0.0.8"
-source = "git+https://github.com/CapSoftware/scap?rev=d99830264854#d998302648546946ad08b7d92b4e65648e2b4f6b"
+source = "git+https://github.com/CapSoftware/scap?rev=e7897ad88d1b#e7897ad88d1b641a69cbf0f1ef3c5ae8b813309f"
dependencies = [
"cocoa 0.25.0",
"core-foundation 0.10.0",
diff --git a/Cargo.toml b/Cargo.toml
index cc75182f5..90ca99631 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,12 +25,12 @@ specta = { version = "=2.0.0-rc.20", features = [
"uuid",
] }
-scap = { git = "https://github.com/CapSoftware/scap", rev = "d99830264854" }
-nokhwa = { git = "https://github.com/CapSoftware/nokhwa", rev = "e309b938ccd6", features = [
+scap = { git = "https://github.com/CapSoftware/scap", rev = "e7897ad88d1b" }
+nokhwa = { git = "https://github.com/CapSoftware/nokhwa", rev = "b9c8079e82e2", features = [
"input-native",
"serialize",
] }
-nokhwa-bindings-macos = { git = "https://github.com/CapSoftware/nokhwa", rev = "e309b938ccd6" }
+nokhwa-bindings-macos = { git = "https://github.com/CapSoftware/nokhwa", rev = "b9c8079e82e2" }
wgpu = "22.1.0"
flume = "0.11.0"
thiserror = "1.0"
diff --git a/apps/desktop/src-tauri/src/export.rs b/apps/desktop/src-tauri/src/export.rs
index bb8d60011..53a91e3d6 100644
--- a/apps/desktop/src-tauri/src/export.rs
+++ b/apps/desktop/src-tauri/src/export.rs
@@ -98,10 +98,7 @@ pub async fn export_video(
let result = exporter.export_with_custom_muxer().await;
match result {
- Ok(_) => {
- ShowCapWindow::RecordingsOverlay.show(&app).await.ok();
- Ok(output_path)
- }
+ Ok(_) => Ok(output_path),
Err(e) => {
sentry::capture_message(&e.to_string(), sentry::Level::Error);
Err(e.to_string())
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index c6673e9c7..7be4ce20e 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1516,6 +1516,8 @@ async fn take_screenshot(app: AppHandle, _state: MutableState<'_, App>) -> Resul
use cap_project::*;
RecordingMeta {
+ platform: Some(Platform::default()),
+
project_path: recording_dir.clone(),
sharing: None,
pretty_name: screenshot_name,
diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rs
index 969554908..db91ce75f 100644
--- a/apps/desktop/src-tauri/src/recording.rs
+++ b/apps/desktop/src-tauri/src/recording.rs
@@ -22,8 +22,8 @@ use cap_media::{
sources::{CaptureScreen, CaptureWindow},
};
use cap_project::{
- ProjectConfiguration, RecordingMeta, RecordingMetaInner, SharingMeta, StudioRecordingMeta,
- TimelineConfiguration, TimelineSegment, ZoomSegment,
+ Platform, ProjectConfiguration, RecordingMeta, RecordingMetaInner, SharingMeta,
+ StudioRecordingMeta, TimelineConfiguration, TimelineSegment, ZoomSegment,
};
use cap_recording::{
instant_recording::{CompletedInstantRecording, InstantRecordingHandle},
@@ -591,6 +591,7 @@ async fn handle_recording_finish(
.emit(app);
let meta = RecordingMeta {
+ platform: Some(Platform::default()),
project_path: recording_dir.clone(),
sharing,
pretty_name: format!(
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 758d06ae5..6ede462a1 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -1,654 +1,394 @@
+
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
/** user-defined commands **/
+
export const commands = {
- async getRecordingOptions(): Promise<RecordingOptions> {
+async getRecordingOptions() : Promise<RecordingOptions> {
return await TAURI_INVOKE("get_recording_options");
- },
- async setRecordingOptions(options: RecordingOptions): Promise<null> {
+},
+async setRecordingOptions(options: RecordingOptions) : Promise<null> {
return await TAURI_INVOKE("set_recording_options", { options });
- },
- async startRecording(
- recordingOptions: RecordingOptions | null
- ): Promise<null> {
+},
+async startRecording(recordingOptions: RecordingOptions | null) : Promise<null> {
return await TAURI_INVOKE("start_recording", { recordingOptions });
- },
- async stopRecording(): Promise<null> {
+},
+async stopRecording() : Promise<null> {
return await TAURI_INVOKE("stop_recording");
- },
- async pauseRecording(): Promise<null> {
+},
+async pauseRecording() : Promise<null> {
return await TAURI_INVOKE("pause_recording");
- },
- async resumeRecording(): Promise<null> {
+},
+async resumeRecording() : Promise<null> {
return await TAURI_INVOKE("resume_recording");
- },
- async listCameras(): Promise<string[]> {
+},
+async listCameras() : Promise<string[]> {
return await TAURI_INVOKE("list_cameras");
- },
- async listCaptureWindows(): Promise<CaptureWindow[]> {
+},
+async listCaptureWindows() : Promise<CaptureWindow[]> {
return await TAURI_INVOKE("list_capture_windows");
- },
- async listCaptureScreens(): Promise<CaptureScreen[]> {
+},
+async listCaptureScreens() : Promise<CaptureScreen[]> {
return await TAURI_INVOKE("list_capture_screens");
- },
- async takeScreenshot(): Promise<null> {
+},
+async takeScreenshot() : Promise<null> {
return await TAURI_INVOKE("take_screenshot");
- },
- async listAudioDevices(): Promise<string[]> {
+},
+async listAudioDevices() : Promise<string[]> {
return await TAURI_INVOKE("list_audio_devices");
- },
- async closeRecordingsOverlayWindow(): Promise<void> {
+},
+async closeRecordingsOverlayWindow() : Promise<void> {
await TAURI_INVOKE("close_recordings_overlay_window");
- },
- async setFakeWindowBounds(name: string, bounds: Bounds): Promise<null> {
+},
+async setFakeWindowBounds(name: string, bounds: Bounds) : Promise<null> {
return await TAURI_INVOKE("set_fake_window_bounds", { name, bounds });
- },
- async removeFakeWindow(name: string): Promise<null> {
+},
+async removeFakeWindow(name: string) : Promise<null> {
return await TAURI_INVOKE("remove_fake_window", { name });
- },
- async focusCapturesPanel(): Promise<void> {
+},
+async focusCapturesPanel() : Promise<void> {
await TAURI_INVOKE("focus_captures_panel");
- },
- async getCurrentRecording(): Promise<JsonValue<CurrentRecording | null>> {
+},
+async getCurrentRecording() : Promise<JsonValue<CurrentRecording | null>> {
return await TAURI_INVOKE("get_current_recording");
- },
- async exportVideo(
- videoId: string,
- progress: TAURI_CHANNEL<RenderProgress>,
- force: boolean,
- fps: number,
- resolutionBase: XY<number>
- ): Promise<string> {
- return await TAURI_INVOKE("export_video", {
- videoId,
- progress,
- force,
- fps,
- resolutionBase,
- });
- },
- async getExportEstimates(
- videoId: string,
- resolution: XY<number>,
- fps: number
- ): Promise<ExportEstimates> {
- return await TAURI_INVOKE("get_export_estimates", {
- videoId,
- resolution,
- fps,
- });
- },
- async copyFileToPath(src: string, dst: string): Promise<null> {
+},
+async exportVideo(videoId: string, progress: TAURI_CHANNEL<RenderProgress>, force: boolean, fps: number, resolutionBase: XY<number>) : Promise<string> {
+ return await TAURI_INVOKE("export_video", { videoId, progress, force, fps, resolutionBase });
+},
+async getExportEstimates(videoId: string, resolution: XY<number>, fps: number) : Promise<ExportEstimates> {
+ return await TAURI_INVOKE("get_export_estimates", { videoId, resolution, fps });
+},
+async copyFileToPath(src: string, dst: string) : Promise<null> {
return await TAURI_INVOKE("copy_file_to_path", { src, dst });
- },
- async copyVideoToClipboard(path: string): Promise<null> {
+},
+async copyVideoToClipboard(path: string) : Promise<null> {
return await TAURI_INVOKE("copy_video_to_clipboard", { path });
- },
- async copyScreenshotToClipboard(path: string): Promise<null> {
+},
+async copyScreenshotToClipboard(path: string) : Promise<null> {
return await TAURI_INVOKE("copy_screenshot_to_clipboard", { path });
- },
- async openFilePath(path: string): Promise<null> {
+},
+async openFilePath(path: string) : Promise<null> {
return await TAURI_INVOKE("open_file_path", { path });
- },
- async getVideoMetadata(
- videoId: string,
- videoType: VideoType | null
- ): Promise<VideoRecordingMetadata> {
+},
+async getVideoMetadata(videoId: string, videoType: VideoType | null) : Promise<VideoRecordingMetadata> {
return await TAURI_INVOKE("get_video_metadata", { videoId, videoType });
- },
- async createEditorInstance(
- videoId: string
- ): Promise<SerializedEditorInstance> {
+},
+async createEditorInstance(videoId: string) : Promise<SerializedEditorInstance> {
return await TAURI_INVOKE("create_editor_instance", { videoId });
- },
- async startPlayback(fps: number, resolutionBase: XY<number>): Promise<null> {
+},
+async startPlayback(fps: number, resolutionBase: XY<number>) : Promise<null> {
return await TAURI_INVOKE("start_playback", { fps, resolutionBase });
- },
- async stopPlayback(): Promise<null> {
+},
+async stopPlayback() : Promise<null> {
return await TAURI_INVOKE("stop_playback");
- },
- async setPlayheadPosition(frameNumber: number): Promise<null> {
+},
+async setPlayheadPosition(frameNumber: number) : Promise<null> {
return await TAURI_INVOKE("set_playhead_position", { frameNumber });
- },
- async setProjectConfig(config: ProjectConfiguration): Promise<null> {
+},
+async setProjectConfig(config: ProjectConfiguration) : Promise<null> {
return await TAURI_INVOKE("set_project_config", { config });
- },
- async openEditor(id: string): Promise<null> {
+},
+async openEditor(id: string) : Promise<null> {
return await TAURI_INVOKE("open_editor", { id });
- },
- async openPermissionSettings(permission: OSPermission): Promise<void> {
+},
+async openPermissionSettings(permission: OSPermission) : Promise<void> {
await TAURI_INVOKE("open_permission_settings", { permission });
- },
- async doPermissionsCheck(initialCheck: boolean): Promise<OSPermissionsCheck> {
+},
+async doPermissionsCheck(initialCheck: boolean) : Promise<OSPermissionsCheck> {
return await TAURI_INVOKE("do_permissions_check", { initialCheck });
- },
- async requestPermission(permission: OSPermission): Promise<void> {
+},
+async requestPermission(permission: OSPermission) : Promise<void> {
await TAURI_INVOKE("request_permission", { permission });
- },
- async uploadExportedVideo(
- videoId: string,
- mode: UploadMode
- ): Promise<UploadResult> {
+},
+async uploadExportedVideo(videoId: string, mode: UploadMode) : Promise<UploadResult> {
return await TAURI_INVOKE("upload_exported_video", { videoId, mode });
- },
- async uploadScreenshot(screenshotPath: string): Promise<UploadResult> {
+},
+async uploadScreenshot(screenshotPath: string) : Promise<UploadResult> {
return await TAURI_INVOKE("upload_screenshot", { screenshotPath });
- },
- async getRecordingMeta(
- id: string,
- fileType: string
- ): Promise<RecordingMetaWithType> {
+},
+async getRecordingMeta(id: string, fileType: string) : Promise<RecordingMetaWithType> {
return await TAURI_INVOKE("get_recording_meta", { id, fileType });
- },
- async saveFileDialog(
- fileName: string,
- fileType: string
- ): Promise<string | null> {
+},
+async saveFileDialog(fileName: string, fileType: string) : Promise<string | null> {
return await TAURI_INVOKE("save_file_dialog", { fileName, fileType });
- },
- async listRecordings(): Promise<[string, string, RecordingMetaWithType][]> {
+},
+async listRecordings() : Promise<([string, string, RecordingMetaWithType])[]> {
return await TAURI_INVOKE("list_recordings");
- },
- async listScreenshots(): Promise<[string, string, RecordingMeta][]> {
+},
+async listScreenshots() : Promise<([string, string, RecordingMeta])[]> {
return await TAURI_INVOKE("list_screenshots");
- },
- async checkUpgradedAndUpdate(): Promise<boolean> {
+},
+async checkUpgradedAndUpdate() : Promise<boolean> {
return await TAURI_INVOKE("check_upgraded_and_update");
- },
- async openExternalLink(url: string): Promise<null> {
+},
+async openExternalLink(url: string) : Promise<null> {
return await TAURI_INVOKE("open_external_link", { url });
- },
- async setHotkey(action: HotkeyAction, hotkey: Hotkey | null): Promise<null> {
+},
+async setHotkey(action: HotkeyAction, hotkey: Hotkey | null) : Promise<null> {
return await TAURI_INVOKE("set_hotkey", { action, hotkey });
- },
- async resetCameraPermissions(): Promise<null> {
+},
+async resetCameraPermissions() : Promise<null> {
return await TAURI_INVOKE("reset_camera_permissions");
- },
- async resetMicrophonePermissions(): Promise<null> {
+},
+async resetMicrophonePermissions() : Promise<null> {
return await TAURI_INVOKE("reset_microphone_permissions");
- },
- async isCameraWindowOpen(): Promise<boolean> {
+},
+async isCameraWindowOpen() : Promise<boolean> {
return await TAURI_INVOKE("is_camera_window_open");
- },
- async seekTo(frameNumber: number): Promise<null> {
+},
+async seekTo(frameNumber: number) : Promise<null> {
return await TAURI_INVOKE("seek_to", { frameNumber });
- },
- async positionTrafficLights(
- controlsInset: [number, number] | null
- ): Promise<void> {
+},
+async positionTrafficLights(controlsInset: [number, number] | null) : Promise<void> {
await TAURI_INVOKE("position_traffic_lights", { controlsInset });
- },
- async setTheme(theme: AppTheme): Promise<void> {
+},
+async setTheme(theme: AppTheme) : Promise<void> {
await TAURI_INVOKE("set_theme", { theme });
- },
- async globalMessageDialog(message: string): Promise<void> {
+},
+async globalMessageDialog(message: string) : Promise<void> {
await TAURI_INVOKE("global_message_dialog", { message });
- },
- async showWindow(window: ShowCapWindow): Promise<null> {
+},
+async showWindow(window: ShowCapWindow) : Promise<null> {
return await TAURI_INVOKE("show_window", { window });
- },
- async writeClipboardString(text: string): Promise<null> {
+},
+async writeClipboardString(text: string) : Promise<null> {
return await TAURI_INVOKE("write_clipboard_string", { text });
- },
- async performHapticFeedback(
- pattern: HapticPattern | null,
- time: HapticPerformanceTime | null
- ): Promise<null> {
+},
+async performHapticFeedback(pattern: HapticPattern | null, time: HapticPerformanceTime | null) : Promise<null> {
return await TAURI_INVOKE("perform_haptic_feedback", { pattern, time });
- },
- async getWallpaperPath(filename: string): Promise<string> {
+},
+async getWallpaperPath(filename: string) : Promise<string> {
return await TAURI_INVOKE("get_wallpaper_path", { filename });
- },
- async listFails(): Promise<{ [key in string]: boolean }> {
+},
+async listFails() : Promise<{ [key in string]: boolean }> {
return await TAURI_INVOKE("list_fails");
- },
- async setFail(name: string, value: boolean): Promise<void> {
+},
+async setFail(name: string, value: boolean) : Promise<void> {
await TAURI_INVOKE("set_fail", { name, value });
- },
- async updateAuthPlan(): Promise<void> {
+},
+async updateAuthPlan() : Promise<void> {
await TAURI_INVOKE("update_auth_plan");
- },
- async reuploadInstantVideo(videoId: string): Promise<null> {
+},
+async reuploadInstantVideo(videoId: string) : Promise<null> {
return await TAURI_INVOKE("reupload_instant_video", { videoId });
- },
- async setWindowTransparent(value: boolean): Promise<void> {
+},
+async setWindowTransparent(value: boolean) : Promise<void> {
await TAURI_INVOKE("set_window_transparent", { value });
- },
-};
+}
+}
/** user-defined events **/
+
export const events = __makeEvents__<{
- audioInputLevelChange: AudioInputLevelChange;
- authenticationInvalid: AuthenticationInvalid;
- currentRecordingChanged: CurrentRecordingChanged;
- editorStateChanged: EditorStateChanged;
- newNotification: NewNotification;
- newScreenshotAdded: NewScreenshotAdded;
- newStudioRecordingAdded: NewStudioRecordingAdded;
- recordingMetaChanged: RecordingMetaChanged;
- recordingOptionsChanged: RecordingOptionsChanged;
- recordingStarted: RecordingStarted;
- recordingStopped: RecordingStopped;
- renderFrameEvent: RenderFrameEvent;
- requestNewScreenshot: RequestNewScreenshot;
- requestOpenSettings: RequestOpenSettings;
- requestRestartRecording: RequestRestartRecording;
- requestStartRecording: RequestStartRecording;
- requestStopRecording: RequestStopRecording;
- uploadProgress: UploadProgress;
+audioInputLevelChange: AudioInputLevelChange,
+authenticationInvalid: AuthenticationInvalid,
+currentRecordingChanged: CurrentRecordingChanged,
+editorStateChanged: EditorStateChanged,
+newNotification: NewNotification,
+newScreenshotAdded: NewScreenshotAdded,
+newStudioRecordingAdded: NewStudioRecordingAdded,
+recordingMetaChanged: RecordingMetaChanged,
+recordingOptionsChanged: RecordingOptionsChanged,
+recordingStarted: RecordingStarted,
+recordingStopped: RecordingStopped,
+renderFrameEvent: RenderFrameEvent,
+requestNewScreenshot: RequestNewScreenshot,
+requestOpenSettings: RequestOpenSettings,
+requestRestartRecording: RequestRestartRecording,
+requestStartRecording: RequestStartRecording,
+requestStopRecording: RequestStopRecording,
+uploadProgress: UploadProgress
}>({
- audioInputLevelChange: "audio-input-level-change",
- authenticationInvalid: "authentication-invalid",
- currentRecordingChanged: "current-recording-changed",
- editorStateChanged: "editor-state-changed",
- newNotification: "new-notification",
- newScreenshotAdded: "new-screenshot-added",
- newStudioRecordingAdded: "new-studio-recording-added",
- recordingMetaChanged: "recording-meta-changed",
- recordingOptionsChanged: "recording-options-changed",
- recordingStarted: "recording-started",
- recordingStopped: "recording-stopped",
- renderFrameEvent: "render-frame-event",
- requestNewScreenshot: "request-new-screenshot",
- requestOpenSettings: "request-open-settings",
- requestRestartRecording: "request-restart-recording",
- requestStartRecording: "request-start-recording",
- requestStopRecording: "request-stop-recording",
- uploadProgress: "upload-progress",
-});
+audioInputLevelChange: "audio-input-level-change",
+authenticationInvalid: "authentication-invalid",
+currentRecordingChanged: "current-recording-changed",
+editorStateChanged: "editor-state-changed",
+newNotification: "new-notification",
+newScreenshotAdded: "new-screenshot-added",
+newStudioRecordingAdded: "new-studio-recording-added",
+recordingMetaChanged: "recording-meta-changed",
+recordingOptionsChanged: "recording-options-changed",
+recordingStarted: "recording-started",
+recordingStopped: "recording-stopped",
+renderFrameEvent: "render-frame-event",
+requestNewScreenshot: "request-new-screenshot",
+requestOpenSettings: "request-open-settings",
+requestRestartRecording: "request-restart-recording",
+requestStartRecording: "request-start-recording",
+requestStopRecording: "request-stop-recording",
+uploadProgress: "upload-progress"
+})
/** user-defined constants **/
+
+
/** user-defined types **/
-export type AppTheme = "system" | "light" | "dark";
-export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall";
-export type Audio = {
- duration: number;
- sample_rate: number;
- channels: number;
- start_time: number;
-};
-export type AudioConfiguration = { mute: boolean; improve: boolean };
-export type AudioInputLevelChange = number;
-export type AudioMeta = {
- path: string;
- /**
- * unix time of the first frame
- */
- start_time?: number | null;
-};
-export type AuthStore = {
- token: string;
- user_id: string | null;
- expires: number;
- plan: Plan | null;
- intercom_hash: string | null;
-};
-export type AuthenticationInvalid = null;
-export type BackgroundConfiguration = {
- source: BackgroundSource;
- blur: number;
- padding: number;
- rounding: number;
- inset: number;
- crop: Crop | null;
- shadow?: number;
- advancedShadow?: ShadowConfiguration | null;
-};
-export type BackgroundSource =
- | { type: "wallpaper"; path: string | null }
- | { type: "image"; path: string | null }
- | { type: "color"; value: [number, number, number] }
- | {
- type: "gradient";
- from: [number, number, number];
- to: [number, number, number];
- angle?: number;
- };
-export type Bounds = { x: number; y: number; width: number; height: number };
-export type Camera = {
- hide: boolean;
- mirror: boolean;
- position: CameraPosition;
- size: number;
- zoom_size: number | null;
- rounding?: number;
- shadow?: number;
- advanced_shadow?: ShadowConfiguration | null;
-};
-export type CameraPosition = { x: CameraXPosition; y: CameraYPosition };
-export type CameraXPosition = "left" | "center" | "right";
-export type CameraYPosition = "top" | "bottom";
-export type CaptureScreen = { id: number; name: string; refresh_rate: number };
-export type CaptureWindow = {
- id: number;
- owner_name: string;
- name: string;
- bounds: Bounds;
- refresh_rate: number;
-};
-export type CommercialLicense = {
- licenseKey: string;
- expiryDate: number | null;
- refresh: number;
- activatedOn: number;
-};
-export type Crop = { position: XY<number>; size: XY<number> };
-export type CurrentRecording = {
- target: CurrentRecordingTarget;
- type: RecordingType;
-};
-export type CurrentRecordingChanged = null;
-export type CurrentRecordingTarget =
- | { window: { id: number; bounds: Bounds } }
- | { screen: { id: number } }
- | { area: { screen: number; bounds: Bounds } };
-export type CursorAnimationStyle = "regular" | "slow" | "fast";
-export type CursorConfiguration = {
- hideWhenIdle: boolean;
- size: number;
- type: CursorType;
- animationStyle: CursorAnimationStyle;
- tension: number;
- mass: number;
- friction: number;
- raw?: boolean;
- motionBlur?: number;
-};
-export type CursorMeta = { imagePath: string; hotspot: XY<number> };
-export type CursorType = "pointer" | "circle";
-export type Cursors =
- | { [key in string]: string }
- | { [key in string]: CursorMeta };
-export type EditorStateChanged = { playhead_position: number };
-export type ExportEstimates = {
- duration_seconds: number;
- estimated_time_seconds: number;
- estimated_size_mb: number;
-};
-export type Flags = { systemAudioRecording: boolean; split: boolean };
-export type GeneralSettingsStore = {
- instanceId?: string;
- uploadIndividualFiles?: boolean;
- hideDockIcon?: boolean;
- hapticsEnabled?: boolean;
- autoCreateShareableLink?: boolean;
- enableNotifications?: boolean;
- disableAutoOpenLinks?: boolean;
- hasCompletedStartup?: boolean;
- theme?: AppTheme;
- commercialLicense?: CommercialLicense | null;
- lastVersion?: string | null;
- windowTransparency?: boolean;
- postStudioRecordingBehaviour?: PostStudioRecordingBehaviour;
- mainWindowRecordingStartBehaviour?: MainWindowRecordingStartBehaviour;
- customCursorCapture?: boolean;
- /**
- * @deprecated
- */
- openEditorAfterRecording?: boolean;
-};
-export type HapticPattern = "Alignment" | "LevelChange" | "Generic";
-export type HapticPerformanceTime = "Default" | "Now" | "DrawCompleted";
-export type Hotkey = {
- code: string;
- meta: boolean;
- ctrl: boolean;
- alt: boolean;
- shift: boolean;
-};
-export type HotkeyAction =
- | "startRecording"
- | "stopRecording"
- | "restartRecording";
-export type HotkeysConfiguration = { show: boolean };
-export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } };
-export type InstantRecordingMeta = { fps: number; sample_rate: number | null };
-export type JsonValue<T> = [T];
-export type MainWindowRecordingStartBehaviour = "close" | "minimise";
-export type MultipleSegment = {
- display: VideoMeta;
- camera?: VideoMeta | null;
- mic?: AudioMeta | null;
- system_audio?: AudioMeta | null;
- cursor?: string | null;
-};
-export type MultipleSegments = {
- segments: MultipleSegment[];
- cursors: Cursors;
-};
-export type NewNotification = {
- title: string;
- body: string;
- is_error: boolean;
-};
-export type NewScreenshotAdded = { path: string };
-export type NewStudioRecordingAdded = { path: string };
-export type OSPermission =
- | "screenRecording"
- | "camera"
- | "microphone"
- | "accessibility";
-export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied";
-export type OSPermissionsCheck = {
- screenRecording: OSPermissionStatus;
- microphone: OSPermissionStatus;
- camera: OSPermissionStatus;
- accessibility: OSPermissionStatus;
-};
-export type Plan = { upgraded: boolean; manual: boolean; last_checked: number };
-export type PostStudioRecordingBehaviour = "openEditor" | "showOverlay";
-export type Preset = { name: string; config: ProjectConfiguration };
-export type PresetsStore = { presets: Preset[]; default: number | null };
-export type ProjectConfiguration = {
- aspectRatio: AspectRatio | null;
- background: BackgroundConfiguration;
- camera: Camera;
- audio: AudioConfiguration;
- cursor: CursorConfiguration;
- hotkeys: HotkeysConfiguration;
- timeline?: TimelineConfiguration | null;
-};
-export type ProjectRecordings = { segments: SegmentRecordings[] };
-export type RecordingMeta = (StudioRecordingMeta | InstantRecordingMeta) & {
- pretty_name: string;
- sharing?: SharingMeta | null;
-};
-export type RecordingMetaChanged = { id: string };
-export type RecordingMetaWithType = ((
- | StudioRecordingMeta
- | InstantRecordingMeta
-) & { pretty_name: string; sharing?: SharingMeta | null }) & {
- type: RecordingType;
-};
-export type RecordingMode = "studio" | "instant";
-export type RecordingOptions = {
- captureTarget: ScreenCaptureTarget;
- micName: string | null;
- cameraLabel: string | null;
- captureSystemAudio?: boolean;
- mode: RecordingMode;
-};
-export type RecordingOptionsChanged = null;
-export type RecordingStarted = null;
-export type RecordingStopped = { path: string };
-export type RecordingType = "studio" | "instant";
-export type RenderFrameEvent = {
- frame_number: number;
- fps: number;
- resolution_base: XY<number>;
-};
-export type RenderProgress =
- | { type: "Starting"; total_frames: number }
- | { type: "EstimatedTotalFrames"; total_frames: number }
- | { type: "FrameRendered"; current_frame: number };
-export type RequestNewScreenshot = null;
-export type RequestOpenSettings = { page: string };
-export type RequestRestartRecording = null;
-export type RequestStartRecording = null;
-export type RequestStopRecording = null;
-export type S3UploadMeta = {
- id: string;
- user_id: string;
- aws_region?: string;
- aws_bucket?: string;
- aws_endpoint?: string;
-};
-export type ScreenCaptureTarget =
- | { variant: "window"; id: number }
- | { variant: "screen"; id: number }
- | { variant: "area"; screen: number; bounds: Bounds };
-export type SegmentRecordings = {
- display: Video;
- camera: Video | null;
- mic: Audio | null;
- system_audio: Audio | null;
-};
-export type SerializedEditorInstance = {
- framesSocketUrl: string;
- recordingDuration: number;
- savedProjectConfig: ProjectConfiguration;
- recordings: ProjectRecordings;
- path: string;
- meta: RecordingMeta;
-};
-export type ShadowConfiguration = {
- size: number;
- opacity: number;
- blur: number;
-};
-export type SharingMeta = { id: string; link: string };
-export type ShowCapWindow =
- | "Setup"
- | "Main"
- | { Settings: { page: string | null } }
- | { Editor: { project_id: string } }
- | "RecordingsOverlay"
- | "WindowCaptureOccluder"
- | { CaptureArea: { screen_id: number } }
- | { Camera: { ws_port: number } }
- | { InProgressRecording: { position: [number, number] | null } }
- | "Upgrade"
- | "SignIn"
- | "ModeSelect";
-export type SingleSegment = {
- display: VideoMeta;
- camera?: VideoMeta | null;
- audio?: AudioMeta | null;
- cursor?: string | null;
-};
-export type StudioRecordingMeta =
- | { segment: SingleSegment }
- | { inner: MultipleSegments };
-export type TimelineConfiguration = {
- segments: TimelineSegment[];
- zoomSegments: ZoomSegment[];
-};
-export type TimelineSegment = {
- recordingSegment?: number;
- timescale: number;
- start: number;
- end: number;
-};
-export type UploadMode =
- | { Initial: { pre_created_video: VideoUploadInfo | null } }
- | "Reupload";
-export type UploadProgress = { progress: number; message: string };
-export type UploadResult =
- | { Success: string }
- | "NotAuthenticated"
- | "PlanCheckFailed"
- | "UpgradeRequired";
-export type Video = {
- duration: number;
- width: number;
- height: number;
- fps: number;
- start_time: number;
-};
-export type VideoMeta = {
- path: string;
- fps?: number;
- /**
- * unix time of the first frame
- */
- start_time?: number | null;
-};
-export type VideoRecordingMetadata = { duration: number; size: number };
-export type VideoType = "screen" | "output" | "camera";
-export type VideoUploadInfo = {
- id: string;
- link: string;
- config: S3UploadMeta;
-};
-export type XY<T> = { x: T; y: T };
-export type ZoomMode = "auto" | { manual: { x: number; y: number } };
-export type ZoomSegment = {
- start: number;
- end: number;
- amount: number;
- mode: ZoomMode;
-};
+export type AppTheme = "system" | "light" | "dark"
+export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall"
+export type Audio = { duration: number; sample_rate: number; channels: number; start_time: number }
+export type AudioConfiguration = { mute: boolean; improve: boolean }
+export type AudioInputLevelChange = number
+export type AudioMeta = { path: string;
+/**
+ * unix time of the first frame
+ */
+start_time?: number | null }
+export type AuthStore = { token: string; user_id: string | null; expires: number; plan: Plan | null; intercom_hash: string | null }
+export type AuthenticationInvalid = null
+export type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; inset: number; crop: Crop | null; shadow?: number; advancedShadow?: ShadowConfiguration | null }
+export type BackgroundSource = { type: "wallpaper"; path: string | null } | { type: "image"; path: string | null } | { type: "color"; value: [number, number, number] } | { type: "gradient"; from: [number, number, number]; to: [number, number, number]; angle?: number }
+export type Bounds = { x: number; y: number; width: number; height: number }
+export type Camera = { hide: boolean; mirror: boolean; position: CameraPosition; size: number; zoom_size: number | null; rounding?: number; shadow?: number; advanced_shadow?: ShadowConfiguration | null }
+export type CameraPosition = { x: CameraXPosition; y: CameraYPosition }
+export type CameraXPosition = "left" | "center" | "right"
+export type CameraYPosition = "top" | "bottom"
+export type CaptureScreen = { id: number; name: string; refresh_rate: number }
+export type CaptureWindow = { id: number; owner_name: string; name: string; bounds: Bounds; refresh_rate: number }
+export type CommercialLicense = { licenseKey: string; expiryDate: number | null; refresh: number; activatedOn: number }
+export type Crop = { position: XY<number>; size: XY<number> }
+export type CurrentRecording = { target: CurrentRecordingTarget; type: RecordingType }
+export type CurrentRecordingChanged = null
+export type CurrentRecordingTarget = { window: { id: number; bounds: Bounds } } | { screen: { id: number } } | { area: { screen: number; bounds: Bounds } }
+export type CursorAnimationStyle = "regular" | "slow" | "fast"
+export type CursorConfiguration = { hideWhenIdle: boolean; size: number; type: CursorType; animationStyle: CursorAnimationStyle; tension: number; mass: number; friction: number; raw?: boolean; motionBlur?: number }
+export type CursorMeta = { imagePath: string; hotspot: XY<number> }
+export type CursorType = "pointer" | "circle"
+export type Cursors = { [key in string]: string } | { [key in string]: CursorMeta }
+export type EditorStateChanged = { playhead_position: number }
+export type ExportEstimates = { duration_seconds: number; estimated_time_seconds: number; estimated_size_mb: number }
+export type Flags = { systemAudioRecording: boolean; split: boolean }
+export type GeneralSettingsStore = { instanceId?: string; uploadIndividualFiles?: boolean; hideDockIcon?: boolean; hapticsEnabled?: boolean; autoCreateShareableLink?: boolean; enableNotifications?: boolean; disableAutoOpenLinks?: boolean; hasCompletedStartup?: boolean; theme?: AppTheme; commercialLicense?: CommercialLicense | null; lastVersion?: string | null; windowTransparency?: boolean; postStudioRecordingBehaviour?: PostStudioRecordingBehaviour; mainWindowRecordingStartBehaviour?: MainWindowRecordingStartBehaviour; customCursorCapture?: boolean;
+/**
+ * @deprecated
+ */
+openEditorAfterRecording?: boolean }
+export type HapticPattern = "Alignment" | "LevelChange" | "Generic"
+export type HapticPerformanceTime = "Default" | "Now" | "DrawCompleted"
+export type Hotkey = { code: string; meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }
+export type HotkeyAction = "startRecording" | "stopRecording" | "restartRecording"
+export type HotkeysConfiguration = { show: boolean }
+export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } }
+export type InstantRecordingMeta = { fps: number; sample_rate: number | null }
+export type JsonValue<T> = [T]
+export type MainWindowRecordingStartBehaviour = "close" | "minimise"
+export type MultipleSegment = { display: VideoMeta; camera?: VideoMeta | null; mic?: AudioMeta | null; system_audio?: AudioMeta | null; cursor?: string | null }
+export type MultipleSegments = { segments: MultipleSegment[]; cursors: Cursors }
+export type NewNotification = { title: string; body: string; is_error: boolean }
+export type NewScreenshotAdded = { path: string }
+export type NewStudioRecordingAdded = { path: string }
+export type OSPermission = "screenRecording" | "camera" | "microphone" | "accessibility"
+export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied"
+export type OSPermissionsCheck = { screenRecording: OSPermissionStatus; microphone: OSPermissionStatus; camera: OSPermissionStatus; accessibility: OSPermissionStatus }
+export type Plan = { upgraded: boolean; manual: boolean; last_checked: number }
+export type Platform = "MacOS" | "Windows"
+export type PostStudioRecordingBehaviour = "openEditor" | "showOverlay"
+export type Preset = { name: string; config: ProjectConfiguration }
+export type PresetsStore = { presets: Preset[]; default: number | null }
+export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null }
+export type ProjectRecordings = { segments: SegmentRecordings[] }
+export type RecordingMeta = (StudioRecordingMeta | InstantRecordingMeta) & { platform: Platform | null; pretty_name: string; sharing?: SharingMeta | null }
+export type RecordingMetaChanged = { id: string }
+export type RecordingMetaWithType = ((StudioRecordingMeta | InstantRecordingMeta) & { platform: Platform | null; pretty_name: string; sharing?: SharingMeta | null }) & { type: RecordingType }
+export type RecordingMode = "studio" | "instant"
+export type RecordingOptions = { captureTarget: ScreenCaptureTarget; micName: string | null; cameraLabel: string | null; captureSystemAudio?: boolean; mode: RecordingMode }
+export type RecordingOptionsChanged = null
+export type RecordingStarted = null
+export type RecordingStopped = { path: string }
+export type RecordingType = "studio" | "instant"
+export type RenderFrameEvent = { frame_number: number; fps: number; resolution_base: XY<number> }
+export type RenderProgress = { type: "Starting"; total_frames: number } | { type: "EstimatedTotalFrames"; total_frames: number } | { type: "FrameRendered"; current_frame: number }
+export type RequestNewScreenshot = null
+export type RequestOpenSettings = { page: string }
+export type RequestRestartRecording = null
+export type RequestStartRecording = null
+export type RequestStopRecording = null
+export type S3UploadMeta = { id: string; user_id: string; aws_region?: string; aws_bucket?: string; aws_endpoint?: string }
+export type ScreenCaptureTarget = { variant: "window"; id: number } | { variant: "screen"; id: number } | { variant: "area"; screen: number; bounds: Bounds }
+export type SegmentRecordings = { display: Video; camera: Video | null; mic: Audio | null; system_audio: Audio | null }
+export type SerializedEditorInstance = { framesSocketUrl: string; recordingDuration: number; savedProjectConfig: ProjectConfiguration; recordings: ProjectRecordings; path: string; meta: RecordingMeta }
+export type ShadowConfiguration = { size: number; opacity: number; blur: number }
+export type SharingMeta = { id: string; link: string }
+export type ShowCapWindow = "Setup" | "Main" | { Settings: { page: string | null } } | { Editor: { project_id: string } } | "RecordingsOverlay" | "WindowCaptureOccluder" | { CaptureArea: { screen_id: number } } | { Camera: { ws_port: number } } | { InProgressRecording: { position: [number, number] | null } } | "Upgrade" | "SignIn" | "ModeSelect"
+export type SingleSegment = { display: VideoMeta; camera?: VideoMeta | null; audio?: AudioMeta | null; cursor?: string | null }
+export type StudioRecordingMeta = { segment: SingleSegment } | { inner: MultipleSegments }
+export type TimelineConfiguration = { segments: TimelineSegment[]; zoomSegments: ZoomSegment[] }
+export type TimelineSegment = { recordingSegment?: number; timescale: number; start: number; end: number }
+export type UploadMode = { Initial: { pre_created_video: VideoUploadInfo | null } } | "Reupload"
+export type UploadProgress = { progress: number; message: string }
+export type UploadResult = { Success: string } | "NotAuthenticated" | "PlanCheckFailed" | "UpgradeRequired"
+export type Video = { duration: number; width: number; height: number; fps: number; start_time: number }
+export type VideoMeta = { path: string; fps?: number;
+/**
+ * unix time of the first frame
+ */
+start_time?: number | null }
+export type VideoRecordingMetadata = { duration: number; size: number }
+export type VideoType = "screen" | "output" | "camera"
+export type VideoUploadInfo = { id: string; link: string; config: S3UploadMeta }
+export type XY<T> = { x: T; y: T }
+export type ZoomMode = "auto" | { manual: { x: number; y: number } }
+export type ZoomSegment = { start: number; end: number; amount: number; mode: ZoomMode }
/** tauri-specta globals **/
import {
- invoke as TAURI_INVOKE,
- Channel as TAURI_CHANNEL,
+ invoke as TAURI_INVOKE,
+ Channel as TAURI_CHANNEL,
} from "@tauri-apps/api/core";
import * as TAURI_API_EVENT from "@tauri-apps/api/event";
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
type __EventObj__<T> = {
- listen: (
- cb: TAURI_API_EVENT.EventCallback<T>
- ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
- once: (
- cb: TAURI_API_EVENT.EventCallback<T>
- ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
- emit: null extends T
- ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
- : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
+ listen: (
+ cb: TAURI_API_EVENT.EventCallback<T>,
+ ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
+ once: (
+ cb: TAURI_API_EVENT.EventCallback<T>,
+ ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
+ emit: null extends T
+ ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
+ : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
};
export type Result<T, E> =
- | { status: "ok"; data: T }
- | { status: "error"; error: E };
+ | { status: "ok"; data: T }
+ | { status: "error"; error: E };
function __makeEvents__<T extends Record<string, any>>(
- mappings: Record<keyof T, string>
+ mappings: Record<keyof T, string>,
) {
- return new Proxy(
- {} as unknown as {
- [K in keyof T]: __EventObj__<T[K]> & {
- (handle: __WebviewWindow__): __EventObj__<T[K]>;
- };
- },
- {
- get: (_, event) => {
- const name = mappings[event as keyof T];
+ return new Proxy(
+ {} as unknown as {
+ [K in keyof T]: __EventObj__<T[K]> & {
+ (handle: __WebviewWindow__): __EventObj__<T[K]>;
+ };
+ },
+ {
+ get: (_, event) => {
+ const name = mappings[event as keyof T];
- return new Proxy((() => {}) as any, {
- apply: (_, __, [window]: [__WebviewWindow__]) => ({
- listen: (arg: any) => window.listen(name, arg),
- once: (arg: any) => window.once(name, arg),
- emit: (arg: any) => window.emit(name, arg),
- }),
- get: (_, command: keyof __EventObj__<any>) => {
- switch (command) {
- case "listen":
- return (arg: any) => TAURI_API_EVENT.listen(name, arg);
- case "once":
- return (arg: any) => TAURI_API_EVENT.once(name, arg);
- case "emit":
- return (arg: any) => TAURI_API_EVENT.emit(name, arg);
- }
- },
- });
- },
- }
- );
+ return new Proxy((() => {}) as any, {
+ apply: (_, __, [window]: [__WebviewWindow__]) => ({
+ listen: (arg: any) => window.listen(name, arg),
+ once: (arg: any) => window.once(name, arg),
+ emit: (arg: any) => window.emit(name, arg),
+ }),
+ get: (_, command: keyof __EventObj__<any>) => {
+ switch (command) {
+ case "listen":
+ return (arg: any) => TAURI_API_EVENT.listen(name, arg);
+ case "once":
+ return (arg: any) => TAURI_API_EVENT.once(name, arg);
+ case "emit":
+ return (arg: any) => TAURI_API_EVENT.emit(name, arg);
+ }
+ },
+ });
+ },
+ },
+ );
}
diff --git a/crates/media/src/feeds/camera.rs b/crates/media/src/feeds/camera.rs
index ad00c9297..c0c04bbeb 100644
--- a/crates/media/src/feeds/camera.rs
+++ b/crates/media/src/feeds/camera.rs
@@ -1,17 +1,15 @@
use cap_fail::{fail, fail_err};
-use cap_gpu_converters::{NV12Input, NV12ToRGBA, UYVYToRGBA};
-use ffmpeg::{format::Pixel, software::scaling};
+use ffmpeg::format::Pixel;
use flume::{Receiver, Sender, TryRecvError, TrySendError};
use nokhwa::{pixel_format::RgbAFormat, utils::*, Camera};
use std::{
- thread::{self, JoinHandle},
- time::{Instant, SystemTime},
+ thread::{self},
+ time::SystemTime,
};
use tracing::{debug, error, info, trace, warn};
use crate::{
- data::{FFVideo, RawVideoFormat, VideoInfo},
- frame_ws::WSFrame,
+ data::{FFVideo, VideoInfo},
MediaError,
};
@@ -323,7 +321,7 @@ fn run_camera_feed(
match camera.frame() {
Ok(raw_buffer) => {
- let captured_at = SystemTime::now();
+ let captured_at = raw_buffer.timestamp().unwrap_or_else(|| SystemTime::now());
let frame = RawCameraFrame {
frame: buffer_to_ffvideo(raw_buffer),
diff --git a/crates/media/src/sources/camera.rs b/crates/media/src/sources/camera.rs
index e0b40ff6c..936bfbdc6 100644
--- a/crates/media/src/sources/camera.rs
+++ b/crates/media/src/sources/camera.rs
@@ -30,21 +30,8 @@ impl CameraSource {
self.video_info
}
- fn process_frame(
- &self,
- clock: &mut RealTimeClock<Instant>,
- camera_frame: RawCameraFrame,
- ) -> Result<(), MediaError> {
- let RawCameraFrame {
- mut frame,
- captured_at,
- } = camera_frame;
- // match clock.timestamp_for(captured_at) {
- // None => {
- // eprintln!("Clock is currently stopped. Dropping frames.");
- // }
- // Some(timestamp) => {
- // frame.set_pts(Some(timestamp));
+ fn process_frame(&self, camera_frame: RawCameraFrame) -> Result<(), MediaError> {
+ let RawCameraFrame { frame, captured_at } = camera_frame;
if let Err(_) = self.output.send((
frame,
captured_at
@@ -54,22 +41,16 @@ impl CameraSource {
)) {
return Err(MediaError::Any("Pipeline is unreachable! Stopping capture"));
}
- // }
- // }
Ok(())
}
- fn pause_and_drain_frames(
- &self,
- clock: &mut RealTimeClock<Instant>,
- frames_rx: Receiver<RawCameraFrame>,
- ) {
+ fn pause_and_drain_frames(&self, frames_rx: Receiver<RawCameraFrame>) {
let frames: Vec<RawCameraFrame> = frames_rx.drain().collect();
drop(frames_rx);
for frame in frames {
- if let Err(error) = self.process_frame(clock, frame) {
+ if let Err(error) = self.process_frame(frame) {
eprintln!("{error}");
break;
}
@@ -83,7 +64,7 @@ impl PipelineSourceTask for CameraSource {
// #[tracing::instrument(skip_all)]
fn run(
&mut self,
- mut clock: Self::Clock,
+ _: Self::Clock,
ready_signal: crate::pipeline::task::PipelineReadySignal,
mut control_signal: crate::pipeline::control::PipelineControlSignal,
) {
@@ -99,7 +80,7 @@ impl PipelineSourceTask for CameraSource {
match control_signal.last() {
Some(Control::Play) => match frames.drain().last().or_else(|| frames.recv().ok()) {
Some(frame) => {
- if let Err(error) = self.process_frame(&mut clock, frame) {
+ if let Err(error) = self.process_frame(frame) {
eprintln!("{error}");
break;
}
@@ -111,7 +92,7 @@ impl PipelineSourceTask for CameraSource {
},
Some(Control::Shutdown) | None => {
if let Some(rx) = frames_rx.take() {
- self.pause_and_drain_frames(&mut clock, rx);
+ self.pause_and_drain_frames(rx);
}
info!("Camera source stopped");
break;
diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rs
index 0e44bb078..89aa29b8f 100644
--- a/crates/media/src/sources/screen_capture.rs
+++ b/crates/media/src/sources/screen_capture.rs
@@ -382,11 +382,12 @@ impl PipelineSourceTask for ScreenCaptureSource<AVFrameCapture> {
let video_tx = self.video_tx.clone();
let audio_tx = self.audio_tx.clone();
- let start_time_nanos = self
- .start_time
- .duration_since(SystemTime::UNIX_EPOCH)
- .unwrap()
- .as_nanos() as u64;
+ let start_time = self.start_time;
+ // let start_time_nanos = self
+ // .start_time
+ // .duration_since(SystemTime::UNIX_EPOCH)
+ // .unwrap()
+ // .as_nanos() as u64;
inner(
self,
@@ -398,72 +399,58 @@ impl PipelineSourceTask for ScreenCaptureSource<AVFrameCapture> {
return Some(ControlFlow::Continue(()));
}
- let elapsed_nanos = frame.display_time - start_time_nanos;
+ let elapsed = frame.display_time.duration_since(start_time).unwrap();
- let raw_timestamp = RawNanoseconds(frame.display_time);
- match clock.timestamp_for(raw_timestamp) {
- None => {
- warn!("Clock is currently stopped. Dropping frames.");
- None
- }
- Some(timestamp) => {
- let mut buffer = FFVideo::new(
- video_info.pixel_format,
- video_info.width,
- video_info.height,
- );
- buffer.set_pts(Some(timestamp));
+ let mut buffer =
+ FFVideo::new(video_info.pixel_format, video_info.width, video_info.height);
- let bytes_per_pixel = 4;
- let width_in_bytes = frame.width as usize * bytes_per_pixel;
- let height = frame.height as usize;
+ let bytes_per_pixel = 4;
+ let width_in_bytes = frame.width as usize * bytes_per_pixel;
+ let height = frame.height as usize;
- let src_data = &frame.data;
+ let src_data = &frame.data;
- let src_stride = src_data.len() / height;
- let dst_stride = buffer.stride(0);
+ let src_stride = src_data.len() / height;
+ let dst_stride = buffer.stride(0);
- if src_data.len() < src_stride * height {
- warn!("Frame data size mismatch.");
- return Some(ControlFlow::Continue(()));
- }
-
- if src_stride < width_in_bytes {
- warn!("Source stride is less than expected width in bytes.");
- return Some(ControlFlow::Continue(()));
- }
+ if src_data.len() < src_stride * height {
+ warn!("Frame data size mismatch.");
+ return Some(ControlFlow::Continue(()));
+ }
- if buffer.data(0).len() < dst_stride * height {
- warn!("Destination data size mismatch.");
- return Some(ControlFlow::Continue(()));
- }
+ if src_stride < width_in_bytes {
+ warn!("Source stride is less than expected width in bytes.");
+ return Some(ControlFlow::Continue(()));
+ }
- {
- let dst_data = buffer.data_mut(0);
-
- for y in 0..height {
- let src_offset = y * src_stride;
- let dst_offset = y * dst_stride;
- dst_data[dst_offset..dst_offset + width_in_bytes]
- .copy_from_slice(
- &src_data[src_offset..src_offset + width_in_bytes],
- );
- }
- }
+ if buffer.data(0).len() < dst_stride * height {
+ warn!("Destination data size mismatch.");
+ return Some(ControlFlow::Continue(()));
+ }
- let time_f = elapsed_nanos as f64 / 1_000_000_000.0;
- if let Err(_) = video_tx.send((buffer, time_f)) {
- error!("Pipeline is unreachable. Shutting down recording.");
- return Some(ControlFlow::Break(()));
- }
+ {
+ let dst_data = buffer.data_mut(0);
- None
+ for y in 0..height {
+ let src_offset = y * src_stride;
+ let dst_offset = y * dst_stride;
+ dst_data[dst_offset..dst_offset + width_in_bytes].copy_from_slice(
+ &src_data[src_offset..src_offset + width_in_bytes],
+ );
}
}
+
+ if let Err(_) = video_tx.send((buffer, elapsed.as_secs_f64())) {
+ error!("Pipeline is unreachable. Shutting down recording.");
+ return Some(ControlFlow::Break(()));
+ }
+
+ None
}
Ok(Frame::Audio(frame)) => {
if let Some(audio_tx) = &audio_tx {
- let _ = audio_tx.send((scap_audio_to_ffmpeg(frame), 0.0));
+ let elapsed = frame.time().duration_since(start_time).unwrap();
+ let _ = audio_tx.send((scap_audio_to_ffmpeg(frame), elapsed.as_secs_f64()));
}
None
}
diff --git a/crates/project/src/meta.rs b/crates/project/src/meta.rs
index c3d55f6c3..57cd95793 100644
--- a/crates/project/src/meta.rs
+++ b/crates/project/src/meta.rs
@@ -39,8 +39,25 @@ pub struct SharingMeta {
pub link: String,
}
+#[derive(Debug, Clone, Serialize, Deserialize, Type)]
+pub enum Platform {
+ MacOS,
+ Windows,
+}
+
+impl Default for Platform {
+ fn default() -> Self {
+ #[cfg(windows)]
+ return Self::Windows;
+
+ #[cfg(target_os = "macos")]
+ return Self::MacOS;
+ }
+}
+
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
pub struct RecordingMeta {
+ pub platform: Option<Platform>,
// this field is just for convenience, it shouldn't be persisted
#[serde(skip_serializing, default)]
pub project_path: PathBuf,
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index 676b22e12..af4b9b83a 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -229,7 +229,6 @@ pub async fn render_video_to_channel(
.get_frames(segment_time as f32, !project.camera.hide)
.await
{
- println!("decoded frames in {:?}", now.elapsed());
let uniforms =
ProjectUniforms::new(&constants, &project, frame_number, fps, resolution_base);
let now = Instant::now();
@@ -238,7 +237,6 @@ pub async fn render_video_to_channel(
.render(segment_frames, uniforms, &segment.cursor)
.await?;
- println!("rendered frame in {:?}", now.elapsed());
if frame.width == 0 || frame.height == 0 {
continue;
}
diff --git a/packages/ui-solid/src/auto-imports.d.ts b/packages/ui-solid/src/auto-imports.d.ts
index 9bab10ffa..08dc593bf 100644
--- a/packages/ui-solid/src/auto-imports.d.ts
+++ b/packages/ui-solid/src/auto-imports.d.ts
@@ -6,7 +6,7 @@
// biome-ignore lint: disable
export {}
declare global {
- const IconCapArrows: typeof import("~icons/cap/arrows.jsx")["default"]
+ const IconCapArrows: typeof import('~icons/cap/arrows.jsx')['default']
const IconCapAudioOn: typeof import('~icons/cap/audio-on.jsx')['default']
const IconCapAuto: typeof import("~icons/cap/auto.jsx")["default"]
const IconCapBgBlur: typeof import('~icons/cap/bg-blur.jsx')['default']
@@ -23,7 +23,7 @@ declare global {
const IconCapCorners: typeof import('~icons/cap/corners.jsx')['default']
const IconCapCrop: typeof import('~icons/cap/crop.jsx')['default']
const IconCapCursor: typeof import('~icons/cap/cursor.jsx')['default']
- const IconCapEditor: typeof import("~icons/cap/editor.jsx")["default"]
+ const IconCapEditor: typeof import('~icons/cap/editor.jsx')['default']
const IconCapEnlarge: typeof import('~icons/cap/enlarge.jsx')['default']
const IconCapFile: typeof import('~icons/cap/file.jsx')['default']
const IconCapFilmCut: typeof import('~icons/cap/film-cut.jsx')['default']
@@ -42,29 +42,29 @@ declare global {
const IconCapLogoFullDark: typeof import('~icons/cap/logo-full-dark.jsx')['default']
const IconCapMessageBubble: typeof import('~icons/cap/message-bubble.jsx')['default']
const IconCapMicrophone: typeof import('~icons/cap/microphone.jsx')['default']
- const IconCapMoreVertical: typeof import("~icons/cap/more-vertical.jsx")["default"]
+ const IconCapMoreVertical: typeof import('~icons/cap/more-vertical.jsx')['default']
const IconCapMoveLeft: typeof import("~icons/cap/move-left.jsx")["default"]
const IconCapMoveRight: typeof import("~icons/cap/move-right.jsx")["default"]
const IconCapNext: typeof import('~icons/cap/next.jsx')['default']
const IconCapPadding: typeof import('~icons/cap/padding.jsx')['default']
const IconCapPause: typeof import('~icons/cap/pause.jsx')['default']
- const IconCapPauseCircle: typeof import("~icons/cap/pause-circle.jsx")["default"]
+ const IconCapPauseCircle: typeof import('~icons/cap/pause-circle.jsx')['default']
const IconCapPlay: typeof import('~icons/cap/play.jsx')['default']
- const IconCapPlayCircle: typeof import("~icons/cap/play-circle.jsx")["default"]
+ const IconCapPlayCircle: typeof import('~icons/cap/play-circle.jsx')['default']
const IconCapPresets: typeof import('~icons/cap/presets.jsx')['default']
const IconCapPrev: typeof import('~icons/cap/prev.jsx')['default']
const IconCapRedo: typeof import('~icons/cap/redo.jsx')['default']
- const IconCapRestart: typeof import("~icons/cap/restart.jsx")["default"]
+ const IconCapRestart: typeof import('~icons/cap/restart.jsx')['default']
const IconCapScissors: typeof import('~icons/cap/scissors.jsx')['default']
const IconCapSettings: typeof import('~icons/cap/settings.jsx')['default']
const IconCapShadow: typeof import('~icons/cap/shadow.jsx')['default']
const IconCapSize: typeof import("~icons/cap/size.jsx")["default"]
- const IconCapSquare: typeof import("~icons/cap/square.jsx")["default"]
+ const IconCapSquare: typeof import('~icons/cap/square.jsx')['default']
const IconCapStop: typeof import("~icons/cap/stop.jsx")["default"]
- const IconCapStopCircle: typeof import("~icons/cap/stop-circle.jsx")["default"]
+ const IconCapStopCircle: typeof import('~icons/cap/stop-circle.jsx')['default']
const IconCapTrash: typeof import('~icons/cap/trash.jsx')['default']
const IconCapUndo: typeof import('~icons/cap/undo.jsx')['default']
- const IconCapUpload: typeof import("~icons/cap/upload.jsx")["default"]
+ const IconCapUpload: typeof import('~icons/cap/upload.jsx')['default']
const IconCapZoomIn: typeof import('~icons/cap/zoom-in.jsx')['default']
const IconCapZoomOut: typeof import('~icons/cap/zoom-out.jsx')['default']
const IconHugeiconsEaseCurveControlPoints: typeof import('~icons/hugeicons/ease-curve-control-points.jsx')['default']
@@ -78,7 +78,7 @@ declare global {
const IconLucideClock: typeof import('~icons/lucide/clock.jsx')['default']
const IconLucideDatabase: typeof import("~icons/lucide/database.jsx")["default"]
const IconLucideEdit: typeof import('~icons/lucide/edit.jsx')['default']
- const IconLucideEye: typeof import("~icons/lucide/eye.jsx")["default"]
+ const IconLucideEye: typeof import('~icons/lucide/eye.jsx')['default']
const IconLucideFolder: typeof import('~icons/lucide/folder.jsx')['default']
const IconLucideGift: typeof import('~icons/lucide/gift.jsx')['default']
const IconLucideHardDrive: typeof import('~icons/lucide/hard-drive.jsx')['default']
@@ -87,7 +87,7 @@ declare global {
const IconLucideMessageCircle: typeof import("~icons/lucide/message-circle.jsx")["default"]
const IconLucideMessageSquare: typeof import("~icons/lucide/message-square.jsx")["default"]
const IconLucideMessageSquarePlus: typeof import('~icons/lucide/message-square-plus.jsx')['default']
- const IconLucideMicOff: typeof import("~icons/lucide/mic-off.jsx")["default"]
+ const IconLucideMicOff: typeof import('~icons/lucide/mic-off.jsx')['default']
const IconLucideMonitor: typeof import("~icons/lucide/monitor.jsx")["default"]
const IconLucideRabbit: typeof import("~icons/lucide/rabbit.jsx")["default"]
const IconLucideRotateCcw: typeof import('~icons/lucide/rotate-ccw.jsx')['default']