Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
"use server";
import { db } from "@cap/database";
import { getCurrentUser } from "@cap/database/auth/session";
import { videos } from "@cap/database/schema";
import type { Video } from "@cap/web-domain";
import { eq } from "drizzle-orm";
import { startVideoProcessingWorkflow } from "@/lib/video-processing";
export async function triggerInstantRecordingProcessing({
videoId,
}: {
videoId: Video.VideoId;
}): Promise<{ success: boolean }> {
const user = await getCurrentUser();
if (!user) throw new Error("Unauthorized");
const [video] = await db()
.select()
.from(videos)
.where(eq(videos.id, videoId));
if (!video) throw new Error("Video not found");
if (video.ownerId !== user.id) throw new Error("Unauthorized");
const rawFileKey = `${user.id}/${videoId}/result.mp4`;
await startVideoProcessingWorkflow({
videoId,
userId: user.id,
rawFileKey,
bucketId: video.bucket ?? null,
processingMessage: "Starting video processing...",
startFailureMessage: "Video uploaded, but processing could not start.",
mode: "singlepart",
});
return { success: true };
}