MCPcopy Index your code
hub / github.com/CapSoftware/Cap / captureFrame

Function captureFrame

apps/web/components/tools/MediaFormatConverter.tsx:511–520  ·  view source on GitHub ↗
(time: number)

Source from the content-addressed store, hash-verified

509 });
510
511 const captureFrame = async (time: number): Promise<void> => {
512 return new Promise((resolve) => {
513 videoElement.currentTime = time;
514 videoElement.onseeked = () => {
515 ctx.drawImage(videoElement, 0, 0, targetWidth, targetHeight);
516 gifEncoder.addFrame(canvas, { delay: frameDelay, copy: true });
517 resolve();
518 };
519 });
520 };
521
522 gifEncoder.on("progress", (progress: number) => {
523 setProgress(Math.min(Math.round(progress * 90 + 5), 95));

Callers 1

convertVideoToGifFunction · 0.70

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected