Skip to content

Commit

Permalink
Merge pull request #210 from CapSoftware/muxer-kb-shortcut
Browse files Browse the repository at this point in the history
cmd-shift-click to use custom mp4 muxer
  • Loading branch information
Brendonovich authored Dec 16, 2024
2 parents 2ad90de + 78e661e commit 5b5f7ce
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
22 changes: 16 additions & 6 deletions apps/desktop/src/routes/editor/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down Expand Up @@ -285,7 +285,7 @@ function ExportButton() {
project,
progress,
true,
false
useCustomMuxer
);
await commands.copyFileToPath(videoPath, path);

Expand All @@ -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>
);
Expand All @@ -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");
Expand Down Expand Up @@ -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"
>
Expand All @@ -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"
>
Expand Down
28 changes: 19 additions & 9 deletions apps/desktop/src/routes/recordings-overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ||
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -700,7 +710,7 @@ function createRecordingMutations(
}));

const copy = createMutation(() => ({
mutationFn: async () => {
mutationFn: async (useCustomMuxer: boolean) => {
setProgressState({
type: "copying",
progress: 0,
Expand Down Expand Up @@ -750,7 +760,7 @@ function createRecordingMutations(
presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG,
progress,
false,
false
useCustomMuxer
);

// Show quick progress animation for existing video
Expand Down Expand Up @@ -801,7 +811,7 @@ function createRecordingMutations(
}));

const save = createMutation(() => ({
mutationFn: async () => {
mutationFn: async (useCustomMuxer: boolean) => {
setProgressState({
type: "saving",
progress: 0,
Expand Down Expand Up @@ -917,7 +927,7 @@ function createRecordingMutations(
}));

const upload = createMutation(() => ({
mutationFn: async () => {
mutationFn: async (useCustomMuxer: boolean) => {
if (recordingMeta.data?.sharing) {
setProgressState({
type: "copying",
Expand Down Expand Up @@ -1005,7 +1015,7 @@ function createRecordingMutations(
presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG,
progress,
false,
false
useCustomMuxer
);
console.log("Using existing rendered video");

Expand Down
6 changes: 0 additions & 6 deletions crates/rendering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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));
};
Expand Down

1 comment on commit 5b5f7ce

@vercel
Copy link

@vercel vercel bot commented on 5b5f7ce Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.