Skip to content

Commit

Permalink
Merge branch 'luke/video-to-sfx' of github.com:elevenlabs/elevenlabs-…
Browse files Browse the repository at this point in the history
…examples into luke/video-to-sfx
  • Loading branch information
malerba118 committed Jun 16, 2024
2 parents 18d2c30 + 4248ac4 commit ef189e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/sound-effects/video-to-sfx/lib/videoToSFX.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { maxDuration } from "./../app/api/route";
import { posthog } from "posthog-js";
import {
VideoToSFXRequestBody,
VideoToSFXResponseBody,
} from "@/app/api/interface";

const apiVideoToSFX = async (frames: string[]) => {
const apiVideoToSFX = async (frames: string[], maxDuration: number) => {
posthog?.capture("video_to_sfx_started");
const response = await fetch("/api", {
method: "POST",
body: JSON.stringify({ frames } as VideoToSFXRequestBody),
body: JSON.stringify({ frames, maxDuration } as VideoToSFXRequestBody),
});
if (!response.ok) {
const errorText = await response.text();
Expand Down Expand Up @@ -62,7 +63,7 @@ export const convertVideoToSFX = async (
const frame = await getFramesFromVideo(video, canvas, i);
frames.push(frame as string);
}
const sfx = await apiVideoToSFX(frames);
const sfx = await apiVideoToSFX(frames, video.duration);
resolve({
soundEffects: sfx.soundEffects,
caption: sfx.caption,
Expand Down

0 comments on commit ef189e2

Please sign in to comment.