import { AbsoluteFill, Img, staticFile } from 'remotion'; import React from 'react' import * as Montserrat from "@remotion/google-fonts/Montserrat"; import { Group, PosterSingleTextWithBGExtra, Transcript, Word } from 'common-utils'; function adjustFontSize(text: string, fullFont?: number): number { if (!fullFont) { fullFont = 160 } const wordCount = text.split(' ').length; return fullFont - (wordCount * (wordCount > 5 ? 4.5 : 1)); } function splitSentence(sentence: string): [string, string] { const words = sentence.trim().split(' '); const lastWord = words[words.length - 1]; const lastWordIndex = sentence.lastIndexOf(lastWord); const firstPart = sentence.slice(0, lastWordIndex).trim(); const secondPart = sentence.slice(lastWordIndex).trim(); return [firstPart, secondPart]; } export const PosterSingleTextWithBG: React.FC = (item) => { const { audioCaption, text = "No Text" } = item; const bgImagePath = item.mediaAbsPaths?.[0]?.path const { textBgColor, } = item.extras as PosterSingleTextWithBGExtra const baseStyle = { textAlign: 'center', borderColor: "transparent", borderRadius: "2rem", borderLeftWidth: "4px", borderRightWidth: "4px", color: "#fff", textShadow: "0px 0px 50px #000, 0px 0px 50px #000", padding: "0.2rem 1.5rem", }; const { fontFamily } = Montserrat.loadFont("normal", { weights: ["400"], ignoreTooManyRequestsWarning: true }); let curZoom = 1.5 let lines = audioCaption?.words || [{ word: text } as Word] return ( { bgImagePath && }

{ lines.map(line => { return ( {line.word} ) }) }

); }; function ColoredCircleFunction({ color, size, radius, transform }: any) { const circleStyle = { width: size, height: size, borderRadius: radius, backgroundColor: color, transform: transform }; return (
); } export const ColoredCircle = ColoredCircleFunction;