Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

cmd-shift-click to use custom mp4 muxer

Brendan Allan78e661e31923
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index 206bee253..8c5c116cf 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -239,7 +239,7 @@ function ExportButton() {
const { videoId, project, prettyName } = useEditorContext();
const exportVideo = createMutation(() => ({
- mutationFn: async () => {
+ mutationFn: async (useCustomMuxer: boolean) => {
const path = await save({
filters: [{ name: "mp4 filter", extensions: ["mp4"] }],
defaultPath: `~/Desktop/${prettyName()}.mp4`,
@@ -285,7 +285,7 @@ function ExportButton() {
project,
progress,
true,
- false
+ useCustomMuxer
);
await commands.copyFileToPath(videoPath, path);
@@ -303,7 +303,13 @@ function ExportButton() {
}));
return (
- <Button variant="primary" size="md" onClick={() => exportVideo.mutate()}>
+ <Button
+ variant="primary"
+ size="md"
+ onClick={(e) =>
+ exportVideo.mutate((e.ctrlKey || e.metaKey) && e.shiftKey)
+ }
+ >
Export
</Button>
);
@@ -316,7 +322,7 @@ function ShareButton() {
);
const uploadVideo = createMutation(() => ({
- mutationFn: async () => {
+ mutationFn: async (useCustomMuxer: boolean) => {
console.log("Starting upload process...");
if (!recordingMeta()) {
console.error("No recording metadata available");
@@ -478,7 +484,9 @@ function ShareButton() {
fallback={
<Button
disabled={uploadVideo.isPending}
- onClick={() => uploadVideo.mutate()}
+ onClick={(e) =>
+ uploadVideo.mutate((e.ctrlKey || e.metaKey) && e.shiftKey)
+ }
variant="primary"
class="flex items-center space-x-1"
>
@@ -502,7 +510,9 @@ function ShareButton() {
<Tooltip.Trigger>
<Button
disabled={uploadVideo.isPending}
- onClick={() => uploadVideo.mutate()}
+ onClick={(e) =>
+ uploadVideo.mutate((e.ctrlKey || e.metaKey) && e.shiftKey)
+ }
variant="secondary"
class="flex items-center space-x-1"
>
diff --git a/apps/desktop/src/routes/recordings-overlay.tsx b/apps/desktop/src/routes/recordings-overlay.tsx
index 62c3ecf49..b0a6b2d69 100644
--- a/apps/desktop/src/routes/recordings-overlay.tsx
+++ b/apps/desktop/src/routes/recordings-overlay.tsx
@@ -470,7 +470,11 @@ export default function () {
: "Copy to Clipboard"
}
tooltipPlacement="left"
- onClick={() => copy.mutate()}
+ onClick={(e) =>
+ copy.mutate(
+ (e.ctrlKey || e.metaKey) && e.shiftKey
+ )
+ }
disabled={save.isPending || upload.isPending}
>
<Switch
@@ -504,8 +508,10 @@ export default function () {
: "Create Shareable Link"
}
tooltipPlacement="left"
- onClick={() => {
- upload.mutate();
+ onClick={(e) => {
+ upload.mutate(
+ (e.ctrlKey || e.metaKey) && e.shiftKey
+ );
}}
disabled={
copy.isPending ||
@@ -537,7 +543,11 @@ export default function () {
<Button
variant="white"
size="sm"
- onClick={() => save.mutate()}
+ onClick={(e) =>
+ save.mutate(
+ (e.ctrlKey || e.metaKey) && e.shiftKey
+ )
+ }
disabled={copy.isPending || upload.isPending}
>
<Switch fallback="Export">
@@ -700,7 +710,7 @@ function createRecordingMutations(
}));
const copy = createMutation(() => ({
- mutationFn: async () => {
+ mutationFn: async (useCustomMuxer: boolean) => {
setProgressState({
type: "copying",
progress: 0,
@@ -750,7 +760,7 @@ function createRecordingMutations(
presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG,
progress,
false,
- false
+ useCustomMuxer
);
// Show quick progress animation for existing video
@@ -801,7 +811,7 @@ function createRecordingMutations(
}));
const save = createMutation(() => ({
- mutationFn: async () => {
+ mutationFn: async (useCustomMuxer: boolean) => {
setProgressState({
type: "saving",
progress: 0,
@@ -917,7 +927,7 @@ function createRecordingMutations(
}));
const upload = createMutation(() => ({
- mutationFn: async () => {
+ mutationFn: async (useCustomMuxer: boolean) => {
if (recordingMeta.data?.sharing) {
setProgressState({
type: "copying",
@@ -1005,7 +1015,7 @@ function createRecordingMutations(
presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG,
progress,
false,
- false
+ useCustomMuxer
);
console.log("Using existing rendered video");
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index 0faafba6c..ad5cfe0fc 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -187,8 +187,6 @@ pub async fn render_video_to_channel(
if let Some((screen_frame, camera_frame)) =
segment.decoders.get_frames((time * 30.0) as u32).await
{
- println!("frame {frame_number} decoded");
-
let frame = produce_frame(
&constants,
&screen_frame,
@@ -199,11 +197,7 @@ pub async fn render_video_to_channel(
)
.await?;
- println!("frame {frame_number} produced");
-
sender.send(frame.0).await?;
-
- println!("frame {frame_number} sent");
} else {
println!("no decoder frames: {:?}", (time, segment_i));
};