Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Remove the extension system completely

youngc574fd8d999d
diff --git a/electron/extensions/errorUtils.test.ts b/electron/extensions/errorUtils.test.ts
deleted file mode 100644
index 5b834b3b..00000000
--- a/electron/extensions/errorUtils.test.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { describe, expect, it } from "vitest";
-
-import { formatMarketplaceHttpError } from "./errorUtils";
-
-describe("formatMarketplaceHttpError", () => {
- it("hides upstream HTML when the marketplace is unavailable", () => {
- const html = "<!DOCTYPE html><html><body>SSL handshake failed</body></html>";
-
- const message = formatMarketplaceHttpError({
- status: 525,
- contentType: "text/html; charset=UTF-8",
- body: html,
- });
-
- expect(message).toBe(
- "Marketplace is temporarily unavailable (HTTP 525). Please try again later.",
- );
- expect(message).not.toContain(html);
- });
-
- it("keeps a short JSON error for client-side request failures", () => {
- expect(
- formatMarketplaceHttpError({
- status: 400,
- contentType: "application/json",
- body: JSON.stringify({ error: "Invalid search query" }),
- }),
- ).toBe("Marketplace request failed (HTTP 400): Invalid search query");
- });
-
- it("uses a JSON message when an error field is absent", () => {
- expect(
- formatMarketplaceHttpError({
- status: 409,
- contentType: "application/json",
- body: JSON.stringify({ message: "Extension version already exists" }),
- }),
- ).toBe("Marketplace request failed (HTTP 409): Extension version already exists");
- });
-
- it("prefers a string error when both JSON detail fields are present", () => {
- expect(
- formatMarketplaceHttpError({
- status: 400,
- contentType: "application/json",
- body: JSON.stringify({ error: "Primary detail", message: "Secondary detail" }),
- }),
- ).toBe("Marketplace request failed (HTTP 400): Primary detail");
- });
-
- it("hides malformed JSON bodies", () => {
- const body = '{"error":"internal route details"';
- const message = formatMarketplaceHttpError({
- status: 400,
- contentType: "application/json",
- body,
- });
-
- expect(message).toBe("Marketplace request failed (HTTP 400).");
- expect(message).not.toContain(body);
- });
-
- it("bounds long JSON details and marks truncation without splitting Unicode", () => {
- const detail = `🚀${"x".repeat(200)}`;
- const message = formatMarketplaceHttpError({
- status: 400,
- contentType: "application/problem+json",
- body: JSON.stringify({ error: detail }),
- });
-
- expect(message).toBe(`Marketplace request failed (HTTP 400): 🚀${"x".repeat(198)}…`);
- expect(Array.from(message.split(": ")[1])).toHaveLength(200);
- });
-
- it("does not expose non-JSON response bodies", () => {
- expect(
- formatMarketplaceHttpError({
- status: 404,
- contentType: "text/plain",
- body: "internal route details",
- }),
- ).toBe("Marketplace request failed (HTTP 404).");
- });
-});
diff --git a/electron/extensions/errorUtils.ts b/electron/extensions/errorUtils.ts
deleted file mode 100644
index 7d44675c..00000000
--- a/electron/extensions/errorUtils.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-export function getErrorMessage(error: unknown): string {
- return error instanceof Error ? error.message : String(error);
-}
-
-const MAX_MARKETPLACE_ERROR_DETAIL_LENGTH = 200;
-
-export function formatMarketplaceHttpError({
- status,
- contentType,
- body,
-}: {
- status: number;
- contentType: string | null;
- body: string;
-}): string {
- if (status >= 500) {
- return `Marketplace is temporarily unavailable (HTTP ${status}). Please try again later.`;
- }
-
- let detail: string | null = null;
- if (contentType?.toLowerCase().includes("json")) {
- try {
- const payload: unknown = JSON.parse(body);
- if (payload && typeof payload === "object") {
- const { error, message } = payload as { error?: unknown; message?: unknown };
- const value = typeof error === "string" ? error : message;
- if (typeof value === "string" && value.trim()) {
- const normalized = value.trim().replace(/\s+/g, " ");
- const codePoints = Array.from(normalized);
- detail =
- codePoints.length > MAX_MARKETPLACE_ERROR_DETAIL_LENGTH
- ? `${codePoints.slice(0, MAX_MARKETPLACE_ERROR_DETAIL_LENGTH - 1).join("")}…`
- : normalized;
- }
- }
- } catch {
- // Malformed or non-API responses are intentionally not exposed to the renderer.
- }
- }
-
- const summary = `Marketplace request failed (HTTP ${status})`;
- return detail ? `${summary}: ${detail}` : `${summary}.`;
-}
diff --git a/electron/extensions/extensionIpc.ts b/electron/extensions/extensionIpc.ts
deleted file mode 100644
index d1a32b67..00000000
--- a/electron/extensions/extensionIpc.ts
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Extension IPC Handlers — Main Process
- *
- * Registers IPC handlers for extension management (discover, install,
- * uninstall, enable/disable) and exposes them to the renderer via preload.
- */
-
-import { BrowserWindow, dialog, ipcMain, shell } from "electron";
-import {
- discoverExtensions,
- getExtension,
- getExtensionsDirectory,
- getRegisteredExtensions,
- installExtensionFromPath,
- setExtensionStatus,
- uninstallExtension,
-} from "./extensionLoader";
-import {
- downloadAndInstallExtension,
- fetchPendingReviews,
- getMarketplaceExtension,
- searchMarketplace,
- submitExtensionForReview,
- updateReviewStatus,
-} from "./extensionMarketplace";
-import { getErrorMessage } from "./errorUtils";
-import type { ExtensionInfo, MarketplaceReviewStatus } from "./extensionTypes";
-
-/**
- * Serialize extension info for IPC transfer (strip non-serializable fields).
- */
-function serializeExtensionInfo(info: ExtensionInfo) {
- return {
- manifest: info.manifest,
- status: info.status,
- path: info.path,
- error: info.error,
- builtin: info.builtin ?? false,
- };
-}
-
-/**
- * Register all extension-related IPC handlers.
- * Call this once during app initialization (in main.ts).
- */
-export function registerExtensionIpcHandlers(): void {
- // Discover all extensions (builtin + user-installed)
- ipcMain.handle("extensions:discover", async () => {
- const extensions = await discoverExtensions();
- return extensions.map(serializeExtensionInfo);
- });
-
- // List currently registered extensions
- ipcMain.handle("extensions:list", () => {
- return getRegisteredExtensions().map(serializeExtensionInfo);
- });
-
- // Get a specific extension by ID
- ipcMain.handle("extensions:get", (_event, id: string) => {
- const ext = getExtension(id);
- return ext ? serializeExtensionInfo(ext) : null;
- });
-
- // Enable an extension
- ipcMain.handle("extensions:enable", async (_event, id: string) => {
- return setExtensionStatus(id, "active");
- });
-
- // Disable an extension
- ipcMain.handle("extensions:disable", async (_event, id: string) => {
- return setExtensionStatus(id, "disabled");
- });
-
- // Install an extension from a folder picker
- ipcMain.handle("extensions:install-from-folder", async (event) => {
- const window = BrowserWindow.fromWebContents(event.sender);
- const result = await dialog.showOpenDialog(window!, {
- title: "Select Extension Folder",
- properties: ["openDirectory"],
- message: "Select a folder containing a recordly-extension.json manifest",
- });
-
- if (result.canceled || result.filePaths.length === 0) {
- return { success: false, reason: "cancelled" };
- }
-
- const info = await installExtensionFromPath(result.filePaths[0]);
- if (!info) {
- return {
- success: false,
- reason: "Invalid extension: missing or invalid recordly-extension.json",
- };
- }
-
- return { success: true, extension: serializeExtensionInfo(info) };
- });
-
- // Uninstall an extension
- ipcMain.handle("extensions:uninstall", async (_event, id: string) => {
- const success = await uninstallExtension(id);
- return { success };
- });
-
- // Get extensions directory path
- ipcMain.handle("extensions:get-directory", () => {
- return getExtensionsDirectory();
- });
-
- // Open extensions directory in file manager
- ipcMain.handle("extensions:open-directory", async () => {
- const dir = getExtensionsDirectory();
- await shell.openPath(dir);
- return { success: true };
- });
-
- // ── Marketplace ─────────────────────────────────────────────────────
-
- // Search/browse marketplace
- ipcMain.handle(
- "extensions:marketplace-search",
- async (
- _event,
- params: {
- query?: string;
- tags?: string[];
- sort?: "popular" | "recent" | "rating";
- page?: number;
- pageSize?: number;
- },
- ) => {
- try {
- return await searchMarketplace(params);
- } catch (error: unknown) {
- return {
- extensions: [],
- total: 0,
- page: 1,
- pageSize: 20,
- error: getErrorMessage(error),
- };
- }
- },
- );
-
- // Get a specific marketplace extension
- ipcMain.handle("extensions:marketplace-get", async (_event, id: string) => {
- return getMarketplaceExtension(id);
- });
-
- // Download and install a marketplace extension
- ipcMain.handle(
- "extensions:marketplace-install",
- async (_event, extensionId: string, downloadUrl: string) => {
- return downloadAndInstallExtension(extensionId, downloadUrl);
- },
- );
-
- // Submit an extension for marketplace review
- ipcMain.handle("extensions:marketplace-submit", async (_event, extensionId: string) => {
- return submitExtensionForReview(extensionId);
- });
-
- // ── Admin Review System ─────────────────────────────────────────────
-
- // Fetch pending reviews (admin only)
- ipcMain.handle(
- "extensions:reviews-list",
- async (
- _event,
- params: {
- status?: MarketplaceReviewStatus;
- page?: number;
- pageSize?: number;
- },
- ) => {
- try {
- return await fetchPendingReviews(params);
- } catch (error: unknown) {
- return { reviews: [], total: 0, error: getErrorMessage(error) };
- }
- },
- );
-
- // Update review status (admin only)
- ipcMain.handle(
- "extensions:review-update",
- async (_event, reviewId: string, status: MarketplaceReviewStatus, notes?: string) => {
- return updateReviewStatus(reviewId, status, notes);
- },
- );
-}
diff --git a/electron/extensions/extensionLoader.ts b/electron/extensions/extensionLoader.ts
deleted file mode 100644
index f3e8d64e..00000000
--- a/electron/extensions/extensionLoader.ts
+++ /dev/null
@@ -1,387 +0,0 @@
-/**
- * Extension Loader — Main Process
- *
- * Discovers, validates, and manages extensions installed in the
- * extensions directory (~/.recordly/extensions/ or userData/extensions/).
- *
- * Extensions are loaded from disk by reading their manifest files.
- * The actual extension code runs in the renderer process and uses the
- * permission-gated host API exposed by the renderer.
- */
-
-import { existsSync } from "node:fs";
-import fs from "node:fs/promises";
-import path from "node:path";
-import { app } from "electron";
-import type { ExtensionInfo, ExtensionManifest, ExtensionStatus } from "./extensionTypes";
-
-const EXTENSIONS_DIR_NAME = "extensions";
-const MANIFEST_FILE_NAME = "recordly-extension.json";
-const BUILTIN_EXTENSIONS_DIR = "builtin-extensions";
-const EXTENSION_STATE_FILE_NAME = "extension-state.json";
-
-/** In-memory registry of loaded extensions */
-const extensionRegistry = new Map<string, ExtensionInfo>();
-
-type PersistedExtensionStatus = Extract<ExtensionStatus, "active" | "disabled" | "installed">;
-
-/**
- * Returns the directory where user-installed extensions live.
- */
-export function getExtensionsDirectory(): string {
- return path.join(app.getPath("userData"), EXTENSIONS_DIR_NAME);
-}
-
-/**
- * Returns the built-in extensions directory (shipped with the app).
- */
-function getBuiltinExtensionsDirectory(): string {
- if (app.isPackaged) {
- return path.join(process.resourcesPath, BUILTIN_EXTENSIONS_DIR);
- }
- return path.join(app.getAppPath(), "public", BUILTIN_EXTENSIONS_DIR);
-}
-
-function getExtensionStateFilePath(): string {
- return path.join(app.getPath("userData"), EXTENSION_STATE_FILE_NAME);
-}
-
-function isPersistedExtensionStatus(value: unknown): value is PersistedExtensionStatus {
- return value === "active" || value === "disabled" || value === "installed";
-}
-
-async function readPersistedExtensionStatuses(): Promise<Record<string, PersistedExtensionStatus>> {
- const stateFile = getExtensionStateFilePath();
- if (!existsSync(stateFile)) {
- return {};
- }
-
- try {
- const raw = await fs.readFile(stateFile, "utf-8");
- const parsed = JSON.parse(raw);
-
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
- return {};
- }
-
- const entries = Object.entries(parsed).filter(
- ([key, value]) => typeof key === "string" && isPersistedExtensionStatus(value),
- );
-
- return Object.fromEntries(entries) as Record<string, PersistedExtensionStatus>;
- } catch {
- return {};
- }
-}
-
-async function writePersistedExtensionStatuses(
- statuses: Record<string, PersistedExtensionStatus>,
-): Promise<void> {
- const stateFile = getExtensionStateFilePath();
- await fs.mkdir(path.dirname(stateFile), { recursive: true });
- await fs.writeFile(stateFile, JSON.stringify(statuses, null, 2), "utf-8");
-}
-
-async function updatePersistedExtensionStatus(
- id: string,
- status: PersistedExtensionStatus | null,
-): Promise<void> {
- const statuses = await readPersistedExtensionStatuses();
-
- if (status) {
- statuses[id] = status;
- } else {
- delete statuses[id];
- }
-
- await writePersistedExtensionStatuses(statuses);
-}
-
-/**
- * Ensure the extensions directory exists.
- */
-async function ensureExtensionsDirectory(): Promise<void> {
- const dir = getExtensionsDirectory();
- await fs.mkdir(dir, { recursive: true });
-}
-
-/**
- * Validate an extension manifest for required fields and safe values.
- */
-function validateManifest(manifest: unknown, extensionPath: string): ExtensionManifest | null {
- if (!manifest || typeof manifest !== "object") {
- return null;
- }
-
- const m = manifest as Record<string, unknown>;
-
- // Required fields
- if (typeof m.id !== "string" || m.id.length === 0) return null;
- // Only allow safe characters in extension IDs
- if (!/^[a-z0-9][a-z0-9._-]*$/i.test(m.id)) return null;
- if (typeof m.name !== "string" || m.name.length === 0) return null;
- if (typeof m.version !== "string") return null;
- if (typeof m.main !== "string" || m.main.length === 0) return null;
-
- // Validate main entry doesn't escape extension directory
- const resolvedMain = path.resolve(extensionPath, m.main);
- const relativeMain = path.relative(extensionPath, resolvedMain);
- if (relativeMain.startsWith("..") || path.isAbsolute(relativeMain)) {
- console.warn(`[extensions] Extension ${m.id}: main entry escapes extension directory`);
- return null;
- }
-
- // Validate permissions array
- const validPermissions = new Set([
- "render",
- "cursor",
- "audio",
- "timeline",
- "ui",
- "assets",
- "export",
- ]);
- const permissions = Array.isArray(m.permissions) ? m.permissions : [];
- const safePermissions = permissions.filter(
- (p): p is string => typeof p === "string" && validPermissions.has(p),
- );
-
- return {
- id: m.id as string,
- name: m.name as string,
- version: m.version as string,
- description: typeof m.description === "string" ? m.description : "",
- author: typeof m.author === "string" ? m.author : undefined,
- homepage: typeof m.homepage === "string" ? m.homepage : undefined,
- license: typeof m.license === "string" ? m.license : undefined,
- engine: typeof m.engine === "string" ? m.engine : undefined,
- icon: typeof m.icon === "string" ? m.icon : undefined,
- main: m.main as string,
- permissions: safePermissions as ExtensionManifest["permissions"],
- contributes:
- typeof m.contributes === "object" && m.contributes !== null
- ? (m.contributes as ExtensionManifest["contributes"])
- : undefined,
- };
-}
-
-/**
- * Scan a directory for extensions (each subdirectory with a manifest).
- */
-async function scanExtensionsIn(directory: string, builtin: boolean): Promise<ExtensionInfo[]> {
- const results: ExtensionInfo[] = [];
-
- if (!existsSync(directory)) {
- return results;
- }
-
- let entries: string[];
- try {
- entries = await fs.readdir(directory);
- } catch {
- return results;
- }
-
- for (const entry of entries) {
- const extDir = path.join(directory, entry);
-
- // Skip non-directories (lstat — don't follow symlinks)
- let stat;
- try {
- stat = await fs.lstat(extDir);
- } catch {
- continue;
- }
- if (!stat.isDirectory()) continue;
-
- const manifestPath = path.join(extDir, MANIFEST_FILE_NAME);
- if (!existsSync(manifestPath)) continue;
-
- try {
- const raw = await fs.readFile(manifestPath, "utf-8");
- const parsed = JSON.parse(raw);
- const manifest = validateManifest(parsed, extDir);
-
- if (!manifest) {
- results.push({
- manifest: {
- id: entry,
- name: entry,
- version: "0.0.0",
- main: "",
- permissions: [],
- description: "Invalid manifest",
- },
- status: "error",
- path: extDir,
- error: "Invalid or incomplete manifest",
- builtin,
- });
- continue;
- }
-
- // Check that the entry file exists
- const entryPath = path.join(extDir, manifest.main);
- if (!existsSync(entryPath)) {
- results.push({
- manifest,
- status: "error",
- path: extDir,
- error: `Entry file not found: ${manifest.main}`,
- builtin,
- });
- continue;
- }
-
- results.push({
- manifest,
- status: "installed",
- path: extDir,
- builtin,
- });
- } catch (err) {
- results.push({
- manifest: {
- id: entry,
- name: entry,
- version: "0.0.0",
- main: "",
- permissions: [],
- description: "Failed to load",
- },
- status: "error",
- path: extDir,
- error: String(err),
- builtin,
- });
- }
- }
-
- return results;
-}
-
-/**
- * Discover and register all available extensions (builtin + user-installed).
- */
-export async function discoverExtensions(): Promise<ExtensionInfo[]> {
- await ensureExtensionsDirectory();
-
- const builtinDir = getBuiltinExtensionsDirectory();
- const userDir = getExtensionsDirectory();
-
- const [builtinExts, userExts] = await Promise.all([
- scanExtensionsIn(builtinDir, true),
- scanExtensionsIn(userDir, false),
- ]);
-
- const persistedStatuses = await readPersistedExtensionStatuses();
- const applyPersistedStatus = (ext: ExtensionInfo): ExtensionInfo => {
- if (ext.status === "error") {
- return ext;
- }
-
- return {
- ...ext,
- status: persistedStatuses[ext.manifest.id] ?? (ext.builtin ? "active" : "installed"),
- };
- };
-
- const normalizedBuiltinExts = builtinExts.map(applyPersistedStatus);
- const normalizedUserExts = userExts.map(applyPersistedStatus);
-
- // User extensions override builtin ones with the same ID
- extensionRegistry.clear();
- for (const ext of normalizedBuiltinExts) {
- extensionRegistry.set(ext.manifest.id, ext);
- }
- for (const ext of normalizedUserExts) {
- extensionRegistry.set(ext.manifest.id, ext);
- }
-
- return Array.from(extensionRegistry.values());
-}
-
-/**
- * Get all registered extensions.
- */
-export function getRegisteredExtensions(): ExtensionInfo[] {
- return Array.from(extensionRegistry.values());
-}
-
-/**
- * Get a specific extension by ID.
- */
-export function getExtension(id: string): ExtensionInfo | undefined {
- return extensionRegistry.get(id);
-}
-
-/**
- * Enable or disable an extension.
- */
-export async function setExtensionStatus(id: string, status: ExtensionStatus): Promise<boolean> {
- const ext = extensionRegistry.get(id);
- if (!ext) return false;
- ext.status = status;
-
- if (status === "active" || status === "disabled" || status === "installed") {
- await updatePersistedExtensionStatus(id, status);
- }
-
- return true;
-}
-
-/**
- * Install an extension from a directory (copy to extensions dir).
- */
-export async function installExtensionFromPath(sourcePath: string): Promise<ExtensionInfo | null> {
- const manifestPath = path.join(sourcePath, MANIFEST_FILE_NAME);
- if (!existsSync(manifestPath)) {
- return null;
- }
-
- let manifest: ExtensionManifest | null;
- try {
- const raw = await fs.readFile(manifestPath, "utf-8");
- manifest = validateManifest(JSON.parse(raw), sourcePath);
- } catch {
- return null;
- }
-
- if (!manifest) return null;
-
- const targetDir = path.join(getExtensionsDirectory(), manifest.id);
-
- // Remove existing version if present
- if (existsSync(targetDir)) {
- await fs.rm(targetDir, { recursive: true, force: true });
- }
-
- await fs.cp(sourcePath, targetDir, { recursive: true });
-
- const info: ExtensionInfo = {
- manifest,
- status: "installed",
- path: targetDir,
- };
-
- extensionRegistry.set(manifest.id, info);
- await updatePersistedExtensionStatus(manifest.id, "installed");
- return info;
-}
-
-/**
- * Uninstall a user extension (cannot uninstall builtin).
- */
-export async function uninstallExtension(id: string): Promise<boolean> {
- const ext = extensionRegistry.get(id);
- if (!ext || ext.builtin) return false;
-
- try {
- await fs.rm(ext.path, { recursive: true, force: true });
- extensionRegistry.delete(id);
- await updatePersistedExtensionStatus(id, null);
- return true;
- } catch {
- return false;
- }
-}
diff --git a/electron/extensions/extensionMarketplace.ts b/electron/extensions/extensionMarketplace.ts
deleted file mode 100644
index b7a38e46..00000000
--- a/electron/extensions/extensionMarketplace.ts
+++ /dev/null
@@ -1,362 +0,0 @@
-/**
- * Extension Marketplace — Main Process
- *
- * Handles fetching, downloading, and installing extensions from the
- * Recordly marketplace API. Also provides admin review endpoints.
- */
-
-import { createWriteStream, existsSync } from "node:fs";
-import fs from "node:fs/promises";
-import path from "node:path";
-import { Readable } from "node:stream";
-import { pipeline } from "node:stream/promises";
-import type { ReadableStream as NodeReadableStream } from "node:stream/web";
-import { app } from "electron";
-import { formatMarketplaceHttpError, getErrorMessage } from "./errorUtils";
-import { getRegisteredExtensions, installExtensionFromPath } from "./extensionLoader";
-import type {
- ExtensionReview,
- MarketplaceExtension,
- MarketplaceReviewStatus,
- MarketplaceSearchResult,
-} from "./extensionTypes";
-
-// ---------------------------------------------------------------------------
-// Configuration
-// ---------------------------------------------------------------------------
-
-const MARKETPLACE_API_BASE = "https://marketplace.recordly.dev/extensions/api/v1";
-const REQUEST_TIMEOUT_MS = 15_000;
-
-// ---------------------------------------------------------------------------
-// Zip-slip protection: recursively verify all extracted files stay within the
-// expected directory. Rejects symlinks that point outside and any entry whose
-// real path escapes the root.
-// ---------------------------------------------------------------------------
-
-async function assertNoEscapedFiles(dir: string, root: string): Promise<void> {
- const entries = await fs.readdir(dir, { withFileTypes: true });
- for (const entry of entries) {
- const entryPath = path.join(dir, entry.name);
- const real = await fs.realpath(entryPath);
- if (!real.startsWith(root + path.sep) && real !== root) {
- // Nuke the escaped file/symlink and throw
- await fs.rm(entryPath, { recursive: true, force: true }).catch(() => undefined);
- throw new Error(
- `Zip-slip detected: ${entry.name} resolves outside extraction directory`,
- );
- }
- if (entry.isDirectory()) {
- await assertNoEscapedFiles(entryPath, root);
- }
- }
-}
-
-function getMarketplaceUrl(): string {
- // Allow explicit override for local marketplace development.
- if (process.env.RECORDLY_MARKETPLACE_URL) return process.env.RECORDLY_MARKETPLACE_URL;
- return MARKETPLACE_API_BASE;
-}
-
-function getAdminKey(): string | undefined {
- return process.env.RECORDLY_ADMIN_KEY;
-}
-
-// ---------------------------------------------------------------------------
-// HTTP helpers
-// ---------------------------------------------------------------------------
-
-async function marketplaceFetch<T>(
- endpoint: string,
- options: { method?: string; body?: unknown; timeout?: number; admin?: boolean } = {},
-): Promise<T> {
- const url = `${getMarketplaceUrl()}${endpoint}`;
- const controller = new AbortController();
- const timeoutId = setTimeout(() => controller.abort(), options.timeout ?? REQUEST_TIMEOUT_MS);
-
- try {
- const headers: Record<string, string> = {
- "Content-Type": "application/json",
- "X-Recordly-Version": app.getVersion(),
- "X-Recordly-Platform": process.platform,
- };
-
- // Attach admin key for privileged endpoints
- if (options.admin) {
- const key = getAdminKey();
- if (!key) throw new Error("Admin key not configured (set RECORDLY_ADMIN_KEY env var)");
- headers["X-Admin-Key"] = key;
- }
-
- const response = await fetch(url, {
- method: options.method ?? "GET",
- headers,
- body: options.body ? JSON.stringify(options.body) : undefined,
- signal: controller.signal,
- });
-
- if (!response.ok) {
- const text = await response.text().catch(() => "");
- throw new Error(
- formatMarketplaceHttpError({
- status: response.status,
- contentType: response.headers.get("content-type"),
- body: text,
- }),
- );
- }
-
- return (await response.json()) as T;
- } finally {
- clearTimeout(timeoutId);
- }
-}
-
-// ---------------------------------------------------------------------------
-// Public API
-// ---------------------------------------------------------------------------
-
-/**
- * Search/browse marketplace extensions.
- */
-export async function searchMarketplace(params: {
- query?: string;
- tags?: string[];
- sort?: "popular" | "recent" | "rating";
- page?: number;
- pageSize?: number;
-}): Promise<MarketplaceSearchResult> {
- const searchParams = new URLSearchParams();
- if (params.query) searchParams.set("query", params.query);
- if (params.tags?.length) searchParams.set("tags", params.tags.join(","));
- if (params.sort) searchParams.set("sort", params.sort);
- if (params.page) searchParams.set("page", String(params.page));
- if (params.pageSize) searchParams.set("pageSize", String(params.pageSize));
-
- const qs = searchParams.toString();
- const result = await marketplaceFetch<MarketplaceSearchResult>(
- `/extensions${qs ? `?${qs}` : ""}`,
- );
-
- // Mark installed extensions
- const installed = getRegisteredExtensions();
- const installedIds = new Set(installed.map((e) => e.manifest.id));
- for (const ext of result.extensions) {
- ext.installed = installedIds.has(ext.id);
- }
-
- return result;
-}
-
-/**
- * Get a single marketplace extension by ID.
- */
-export async function getMarketplaceExtension(id: string): Promise<MarketplaceExtension | null> {
- try {
- const ext = await marketplaceFetch<MarketplaceExtension>(
- `/extensions/${encodeURIComponent(id)}`,
- );
- const installed = getRegisteredExtensions();
- ext.installed = installed.some((e) => e.manifest.id === ext.id);
- return ext;
- } catch {
- return null;
- }
-}
-
-/**
- * Download and install a marketplace extension.
- * Downloads the zip, extracts it to a temp dir, then installs from there.
- */
-export async function downloadAndInstallExtension(
- extensionId: string,
- downloadUrl: string,
-): Promise<{ success: boolean; error?: string }> {
- // Validate download URL against allowed marketplace origins
- const allowedOrigins = [
- "https://marketplace.recordly.dev",
- "https://recordly.dev",
- ...(app.isPackaged ? [] : ["http://localhost:3001"]),
- ];
- try {
- const url = new URL(downloadUrl);
- if (!allowedOrigins.some((o) => url.origin === o)) {
- return { success: false, error: `Untrusted download origin: ${url.origin}` };
- }
- } catch {
- return { success: false, error: "Invalid download URL" };
- }
-
- const tempDir = path.join(app.getPath("temp"), `recordly-ext-${extensionId}-${Date.now()}`);
- const zipPath = path.join(tempDir, "extension.zip");
-
- try {
- // Create temp directory
- await fs.mkdir(tempDir, { recursive: true });
-
- // Download the archive
- const controller = new AbortController();
- const timeoutId = setTimeout(() => controller.abort(), 60_000);
-
- let response: Response;
- try {
- response = await fetch(downloadUrl, {
- signal: controller.signal,
- headers: {
- "X-Recordly-Version": app.getVersion(),
- },
- });
- } finally {
- clearTimeout(timeoutId);
- }
-
- if (!response.ok) {
- throw new Error(`Download failed with status ${response.status}`);
- }
-
- if (!response.body) {
- throw new Error("Download response has no body");
- }
-
- // Write to disk
- const fileStream = createWriteStream(zipPath);
- await pipeline(Readable.fromWeb(response.body as NodeReadableStream), fileStream);
-
- // Extract the zip — use the built-in decompress or shell unzip
- const extractDir = path.join(tempDir, "extracted");
- await fs.mkdir(extractDir, { recursive: true });
-
- // Use Node's built-in unzip capability via child_process (execFile — no shell)
- const { execFile } = await import("node:child_process");
- await new Promise<void>((resolve, reject) => {
- if (process.platform === "win32") {
- // Use -LiteralPath to avoid PowerShell injection via single-quote in paths
- execFile(
- "powershell",
- [
- "-NoProfile",
- "-NonInteractive",
- "-command",
- "Expand-Archive",
- "-LiteralPath",
- zipPath,
- "-DestinationPath",
- extractDir,
- "-Force",
- ],
- (error) => {
- if (error) reject(error);
- else resolve();
- },
- );
- } else {
- execFile("unzip", ["-o", zipPath, "-d", extractDir], (error) => {
- if (error) reject(error);
- else resolve();
- });
- }
- });
-
- // Security: verify no extracted file escaped the extraction directory
- // (protects against zip-slip / path traversal entries in malicious archives)
- // Use fs.realpath so the root matches what fs.realpath returns for children
- // (on macOS /var is a symlink to /private/var — path.resolve does not
- // resolve symlinks, so root and children would mismatch).
- const resolvedExtractDir = await fs.realpath(extractDir);
- await assertNoEscapedFiles(resolvedExtractDir, resolvedExtractDir);
-
- // Find the manifest — it might be in a subfolder
- const entries = await fs.readdir(extractDir, { withFileTypes: true });
- let manifestDir = extractDir;
-
- // If there's a single directory, look inside it for the manifest.
- const dirs = entries.filter((e) => e.isDirectory());
- if (dirs.length === 1 && !existsSync(path.join(extractDir, "recordly-extension.json"))) {
- manifestDir = path.join(extractDir, dirs[0].name);
- }
-
- // Verify manifest exists
- if (!existsSync(path.join(manifestDir, "recordly-extension.json"))) {
- throw new Error(
- "Downloaded extension does not contain a recordly-extension.json manifest",
- );
- }
-
- // Install from the extracted directory
- const info = await installExtensionFromPath(manifestDir);
- if (!info) {
- throw new Error("Extension validation failed after download");
- }
-
- // Track download count (fire-and-forget — CDN may cache the GET, so POST separately)
- fetch(`${getMarketplaceUrl()}/extensions/${encodeURIComponent(extensionId)}/download`, {
- method: "POST",
- headers: { "X-Recordly-Version": app.getVersion() },
- }).catch(() => undefined);
-
- return { success: true };
- } catch (error: unknown) {
- return { success: false, error: getErrorMessage(error) };
- } finally {
- // Clean up temp directory
- await fs.rm(tempDir, { recursive: true, force: true }).catch(() => undefined);
- }
-}
-
-// ---------------------------------------------------------------------------
-// Review System (Admin)
-// ---------------------------------------------------------------------------
-
-/**
- * Fetch extensions pending review (admin only).
- */
-export async function fetchPendingReviews(params: {
- status?: MarketplaceReviewStatus;
- page?: number;
- pageSize?: number;
-}): Promise<{ reviews: ExtensionReview[]; total: number }> {
- const searchParams = new URLSearchParams();
- if (params.status) searchParams.set("status", params.status);
- if (params.page) searchParams.set("page", String(params.page));
- if (params.pageSize) searchParams.set("pageSize", String(params.pageSize));
-
- const qs = searchParams.toString();
- return marketplaceFetch<{ reviews: ExtensionReview[]; total: number }>(
- `/admin/reviews${qs ? `?${qs}` : ""}`,
- { admin: true },
- );
-}
-
-/**
- * Update the review status of a submitted extension (admin only).
- */
-export async function updateReviewStatus(
- reviewId: string,
- status: MarketplaceReviewStatus,
- notes?: string,
-): Promise<{ success: boolean }> {
- return marketplaceFetch<{ success: boolean }>(
- `/admin/reviews/${encodeURIComponent(reviewId)}`,
- {
- method: "PATCH",
- body: { status, notes },
- admin: true,
- },
- );
-}
-
-/**
- * Submit an extension for marketplace review.
- */
-export async function submitExtensionForReview(
- extensionId: string,
-): Promise<{ success: boolean; reviewId?: string; error?: string }> {
- try {
- return await marketplaceFetch<{ success: boolean; reviewId?: string }>(
- `/extensions/${encodeURIComponent(extensionId)}/submit`,
- { method: "POST" },
- );
- } catch (error: unknown) {
- return { success: false, error: getErrorMessage(error) };
- }
-}
diff --git a/electron/extensions/extensionTypes.ts b/electron/extensions/extensionTypes.ts
deleted file mode 100644
index c89e3a78..00000000
--- a/electron/extensions/extensionTypes.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Re-export of extension types for use in the main process.
- * The canonical types live in src/lib/extensions/types.ts.
- */
-
-export type {
- ExtensionContributions,
- ExtensionInfo,
- ExtensionManifest,
- ExtensionPermission,
- ExtensionReview,
- ExtensionStatus,
- MarketplaceExtension,
- MarketplaceReviewStatus,
- MarketplaceSearchResult,
-} from "../../src/lib/extensions/types";
diff --git a/src/components/video-editor/ExtensionIcon.tsx b/src/components/video-editor/ExtensionIcon.tsx
deleted file mode 100644
index ef759ab2..00000000
--- a/src/components/video-editor/ExtensionIcon.tsx
+++ /dev/null
@@ -1,151 +0,0 @@
-import type { Icon, IconProps } from "@phosphor-icons/react";
-import * as PhosphorIcons from "@phosphor-icons/react";
-
-const WINDOWS_ABSOLUTE_PATH = /^[a-zA-Z]:[\\/]/;
-const { PuzzlePiece } = PhosphorIcons;
-
-const ICON_NAME_ALIASES: Record<string, keyof typeof PhosphorIcons> = {
- Check: "Check",
- ChevronDown: "CaretDown",
- ChevronLeft: "CaretLeft",
- ChevronRight: "CaretRight",
- ChevronUp: "CaretUp",
- Download: "DownloadSimple",
- ExternalLink: "ArrowSquareOut",
- Film: "FilmSlate",
- FolderOpen: "FolderOpen",
- HelpCircle: "Question",
- ImageIcon: "ImageSquare",
- Loader2: "Spinner",
- MessageSquare: "ChatCircle",
- MessageSquareMore: "ChatCircleDots",
- Palette: "Palette",
- Puzzle: "PuzzlePiece",
- Redo2: "ArrowClockwise",
- RefreshCw: "ArrowClockwise",
- RotateCcw: "ArrowCounterClockwise",
- Save: "FloppyDisk",
- Search: "MagnifyingGlass",
- Settings2: "Gear",
- ShieldAlert: "ShieldWarning",
- Trash2: "Trash",
- Twitter: "TwitterLogo",
- Undo2: "ArrowCounterClockwise",
- Upload: "UploadSimple",
- User: "UserCircle",
- Volume1: "SpeakerLow",
- Volume2: "SpeakerHigh",
- VolumeX: "SpeakerX",
- WandSparkles: "MagicWand",
- ZoomIn: "MagnifyingGlassPlus",
-};
-
-function isImagePath(value: string): boolean {
- return (
- value.startsWith("data:") ||
- value.startsWith("file://") ||
- value.startsWith("http://") ||
- value.startsWith("https://") ||
- value.includes("/") ||
- /\.(png|svg|jpg|jpeg|webp|gif)$/i.test(value)
- );
-}
-
-function toFileHref(filePath: string): string {
- const normalized = filePath.replace(/\\/g, "/");
-
- if (normalized.startsWith("file://")) {
- return normalized;
- }
-
- if (normalized.startsWith("/")) {
- return `file://${normalized}`;
- }
-
- if (WINDOWS_ABSOLUTE_PATH.test(normalized)) {
- return `file:///${normalized}`;
- }
-
- return normalized;
-}
-
-function resolveIconSrc(icon: string, extensionPath?: string | null): string | null {
- if (!isImagePath(icon)) {
- return null;
- }
-
- if (
- icon.startsWith("data:") ||
- icon.startsWith("file://") ||
- icon.startsWith("http://") ||
- icon.startsWith("https://")
- ) {
- return icon;
- }
-
- if (icon.startsWith("/") || WINDOWS_ABSOLUTE_PATH.test(icon)) {
- return toFileHref(icon);
- }
-
- if (!extensionPath) {
- return icon;
- }
-
- const baseHref = toFileHref(extensionPath.endsWith("/") ? extensionPath : `${extensionPath}/`);
- return new URL(icon, baseHref).toString();
-}
-
-function resolvePhosphorIcon(name: string): Icon | null {
- const direct = PhosphorIcons[name as keyof typeof PhosphorIcons];
- if (typeof direct === "function") {
- return direct as Icon;
- }
-
- const alias = ICON_NAME_ALIASES[name];
- if (!alias) {
- return null;
- }
-
- const mapped = PhosphorIcons[alias];
- return typeof mapped === "function" ? (mapped as Icon) : null;
-}
-
-/**
- * Renders either a Phosphor icon (by PascalCase name) or an image (by path/URL).
- * Falls back to the PuzzlePiece icon if nothing matches.
- */
-export function ExtensionIcon({
- icon,
- extensionPath,
- className = "w-4 h-4",
- imageClassName,
- ...rest
-}: {
- icon?: string | null;
- extensionPath?: string | null;
- className?: string;
- imageClassName?: string;
-} & Omit<IconProps, "ref">) {
- if (!icon) {
- return <PuzzlePiece className={className} {...rest} />;
- }
-
- const iconSrc = resolveIconSrc(icon, extensionPath);
- if (iconSrc) {
- return (
- <img
- src={iconSrc}
- alt=""
- className={imageClassName ?? className}
- style={{ objectFit: "cover" }}
- />
- );
- }
-
- const PhosphorIcon = resolvePhosphorIcon(icon);
- if (PhosphorIcon) {
- return <PhosphorIcon className={className} {...rest} />;
- }
-
- return <PuzzlePiece className={className} {...rest} />;
-}
diff --git a/src/components/video-editor/ExtensionManager.tsx b/src/components/video-editor/ExtensionManager.tsx
index b8fc0f58..99fdc3eb 100644
--- a/src/components/video-editor/ExtensionManager.tsx
+++ b/src/components/video-editor/ExtensionManager.tsx
@@ -1,13 +1,10 @@
import { PuzzlePiece } from "@phosphor-icons/react";
-import { useScopedT } from "@/contexts/I18nContext";
export default function ExtensionManager() {
- const t = useScopedT("extensions");
-
return (
<div className="flex h-full w-[332px] min-w-[280px] max-w-[332px] flex-[2] flex-col overflow-hidden rounded-2xl border border-foreground/10 bg-editor-panel shadow-xl">
<div className="flex h-12 shrink-0 items-center border-b border-foreground/10 px-4">
- <h2 className="text-sm font-semibold text-foreground">{t("title")}</h2>
+ <h2 className="text-sm font-semibold text-foreground">Extensions</h2>
</div>
<div className="flex flex-1 items-center justify-center p-6">
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx
index 5a6fa44a..ea2c0cee 100644
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@ -21,18 +21,11 @@ import {
import { Switch } from "@/components/ui/switch";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { useTheme } from "@/contexts/ThemeContext";
-import {
- getAssetPath,
- getRenderableAssetUrl,
- getRenderableVideoUrl,
- getWallpaperThumbnailUrl,
-} from "@/lib/assetPath";
+import { getAssetPath, getRenderableVideoUrl, getWallpaperThumbnailUrl } from "@/lib/assetPath";
import {
TEMPORAL_MOTION_BLUR_DEFAULT_SAMPLE_COUNT,
TEMPORAL_MOTION_BLUR_DEFAULT_SHUTTER_FRACTION,
} from "@/lib/exporter/temporalMotionBlur";
-import type { ExtensionSettingField } from "@/lib/extensions";
-import { extensionHost, type FrameInstance } from "@/lib/extensions";
import { cn } from "@/lib/utils";
import type { BuiltInWallpaper } from "@/lib/wallpapers";
import {
@@ -120,15 +113,6 @@ const tahoeCursorUrl = cursorSetAssets.tahoe.arrow.url;
const BUILTIN_CURSOR_PREVIEW_SIZE = 28;
const BUILTIN_CURSOR_PREVIEW_FRAME_SIZE = 48;
-function getStepPrecision(step: number): number {
- if (!Number.isFinite(step) || step <= 0) return 0;
- const [mantissa = "0", exponentPart = "0"] = step.toExponential().split("e");
- const exponent = Number.parseInt(exponentPart, 10);
- const mantissaDecimals = (mantissa.split(".")[1] ?? "").replace(/0+$/, "").length;
- const precision = exponent < 0 ? Math.max(0, -exponent + mantissaDecimals) : mantissaDecimals;
- return Math.min(12, precision);
-}
-
const GRADIENTS = [
"linear-gradient( 111.6deg, rgba(114,167,232,1) 9.4%, rgba(253,129,82,1) 43.9%, rgba(253,129,82,1) 54.8%, rgba(249,202,86,1) 86.3% )",
"linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%)",
@@ -258,172 +242,6 @@ function WallpaperVideoPreview({ src }: { src: string }) {
);
}
-/**
- * Renders extension-contributed settings fields (toggle, slider, select, color, text).
- */
-function ExtensionSettingsSection({
- extensionId,
- label,
- fields,
-}: {
- extensionId: string;
- label: string;
- fields: ExtensionSettingField[];
-}) {
- const [, forceUpdate] = useState(0);
-
- return (
- <div className="flex flex-col gap-1.5 mt-2 pt-2 border-t border-foreground/[0.06]">
- <p className="text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/70">
- {label}
- </p>
- {fields.map((field) => {
- const value =
- extensionHost.getExtensionSetting(extensionId, field.id) ?? field.defaultValue;
-
- if (field.type === "toggle") {
- return (
- <div
- key={field.id}
- className="flex items-center justify-between rounded-lg bg-foreground/[0.03] px-2.5 py-1.5"
- >
- <span className="text-[11px] text-muted-foreground">{field.label}</span>
- <Switch
- checked={Boolean(value)}
- onCheckedChange={(checked) => {
- extensionHost.setExtensionSetting(
- extensionId,
- field.id,
- checked,
- );
- forceUpdate((n) => n + 1);
- }}
- className="data-[state=checked]:bg-[#2563EB] scale-75"
- />
- </div>
- );
- }
-
- if (field.type === "slider") {
- const step = field.step ?? 0.01;
- const precision = getStepPrecision(step);
- return (
- <div key={field.id} className="mt-1">
- <SliderControl
- label={field.label}
- value={
- typeof value === "number"
- ? value
- : (field.defaultValue as number)
- }
- defaultValue={field.defaultValue as number}
- min={field.min ?? 0}
- max={field.max ?? 1}
- step={step}
- onChange={(v) => {
- extensionHost.setExtensionSetting(extensionId, field.id, v);
- forceUpdate((n) => n + 1);
- }}
- formatValue={(v) => v.toFixed(precision)}
- parseInput={(text) => parseFloat(text)}
- />
- </div>
- );
- }
-
- if (field.type === "select" && field.options) {
- return (
- <div
- key={field.id}
- className="flex items-center justify-between gap-2 rounded-lg bg-foreground/[0.03] px-2.5 py-1.5"
- >
- <span className="text-[11px] text-muted-foreground flex-shrink-0">
- {field.label}
- </span>
- <Select
- value={String(value)}
- onValueChange={(v) => {
- extensionHost.setExtensionSetting(extensionId, field.id, v);
- forceUpdate((n) => n + 1);
- }}
- >
- <SelectTrigger className="h-6 w-24 text-[10px] border-foreground/10 bg-foreground/[0.03]">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {field.options.map((opt) => (
- <SelectItem
- key={opt.value}
- value={opt.value}
- className="text-[10px]"
- >
- {opt.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- );
- }
-
- if (field.type === "color") {
- return (
- <div
- key={field.id}
- className="flex items-center justify-between gap-2 rounded-lg bg-foreground/[0.03] px-2.5 py-1.5"
- >
- <span className="text-[11px] text-muted-foreground flex-shrink-0">
- {field.label}
- </span>
- <input
- type="color"
- value={String(value)}
- onChange={(e) => {
- extensionHost.setExtensionSetting(
- extensionId,
- field.id,
- e.target.value,
- );
- forceUpdate((n) => n + 1);
- }}
- className="w-7 h-5 rounded border border-foreground/10 cursor-pointer bg-transparent"
- />
- </div>
- );
- }
-
- if (field.type === "text") {
- return (
- <div
- key={field.id}
- className="flex items-center justify-between gap-2 rounded-lg bg-foreground/[0.03] px-2.5 py-1.5"
- >
- <span className="text-[11px] text-muted-foreground flex-shrink-0">
- {field.label}
- </span>
- <input
- type="text"
- value={String(value)}
- onChange={(e) => {
- extensionHost.setExtensionSetting(
- extensionId,
- field.id,
- e.target.value,
- );
- forceUpdate((n) => n + 1);
- }}
- className="w-24 h-6 rounded bg-foreground/[0.06] border border-foreground/10 px-1.5 text-[10px] text-foreground"
- />
- </div>
- );
- }
-
- return null;
- })}
- </div>
- );
-}
-
const MOTION_PRESET_ORDER: CursorMotionPresetId[] = ["focused", "smooth"];
const CURSOR_CLICK_EFFECT_OPTIONS: Array<{
@@ -811,8 +629,6 @@ interface SettingsPanelProps {
onClearWebcam?: () => void;
padding?: Padding;
onPaddingChange?: (padding: Padding) => void;
- frame?: string | null;
- onFrameChange?: (frameId: string | null) => void;
cropRegion?: CropRegion;
onCropChange?: (region: CropRegion) => void;
aspectRatio: AspectRatio;
@@ -1256,8 +1072,6 @@ export function SettingsPanel({
onClearWebcam,
padding = DEFAULT_PADDING,
onPaddingChange,
- frame = null,
- onFrameChange,
cropRegion,
onCropChange,
aspectRatio,
@@ -1301,13 +1115,7 @@ export function SettingsPanel({
const initialEditorPreferences = useMemo(() => loadEditorPreferences(), []);
const [builtInWallpapers, setBuiltInWallpapers] =
useState<BuiltInWallpaper[]>(BUILT_IN_WALLPAPERS);
- const [extensionWallpapers, setExtensionWallpapers] = useState<
- ReturnType<typeof extensionHost.getContributedWallpapers>
- >([]);
const [wallpaperPreviewPaths, setWallpaperPreviewPaths] = useState<string[]>([]);
- const [extensionWallpaperPreviewUrls, setExtensionWallpaperPreviewUrls] = useState<
- Record<string, string>
- >({});
const [customImages, setCustomImages] = useState<string[]>(
initialEditorPreferences.customWallpapers,
);
@@ -1320,10 +1128,6 @@ export function SettingsPanel({
() => builtInWallpapers.map((wallpaper) => wallpaper.publicPath),
[builtInWallpapers],
);
- const extensionWallpaperPaths = useMemo(
- () => extensionWallpapers.map((wallpaper) => wallpaper.resolvedUrl),
- [extensionWallpapers],
- );
const captionCueCount = autoCaptions.length;
const updateAutoCaptionSettings = (partial: Partial<AutoCaptionSettings>) => {
onAutoCaptionSettingsChange?.({
@@ -1365,57 +1169,6 @@ export function SettingsPanel({
};
}, []);
- useEffect(() => {
- let cancelled = false;
-
- const updateExtensionAssets = async () => {
- const wallpapers = extensionHost.getContributedWallpapers();
- const cursorStyles = extensionHost.getContributedCursorStyles();
- const [wallpaperPreviewEntries, cursorPreviewEntries] = await Promise.all([
- Promise.all(
- wallpapers.map(
- async (wallpaper) =>
- [
- wallpaper.id,
- isVideoWallpaperSource(wallpaper.resolvedThumbnailUrl)
- ? wallpaper.resolvedThumbnailUrl
- : await getWallpaperThumbnailUrl(
- wallpaper.resolvedThumbnailUrl,
- ),
- ] as const,
- ),
- ),
- Promise.all(
- cursorStyles.map(
- async (cursorStyle) =>
- [
- cursorStyle.id,
- await getRenderableAssetUrl(cursorStyle.resolvedDefaultUrl),
- ] as const,
- ),
- ),
- ]);
-
- if (cancelled) {
- return;
- }
-
- setExtensionWallpapers(wallpapers);
- setExtensionWallpaperPreviewUrls(Object.fromEntries(wallpaperPreviewEntries));
- setExtensionCursorStyles(cursorStyles);
- setExtensionCursorPreviewUrls(Object.fromEntries(cursorPreviewEntries));
- };
-
- void updateExtensionAssets();
- const unsubscribe = extensionHost.onChange(() => {
- void updateExtensionAssets();
- });
-
- return () => {
- cancelled = true;
- unsubscribe();
- };
- }, []);
const colorPalette = [
"#FF0000",
"#FFD700",
@@ -1443,39 +1196,6 @@ export function SettingsPanel({
);
const removeBackgroundEnabled = aspectRatio === "native" && isZeroPadding(padding);
- // Device frames from extension system
- const [availableFrames, setAvailableFrames] = useState<FrameInstance[]>([]);
- useEffect(() => {
- const update = () => setAvailableFrames(extensionHost.getFrames());
- update();
- return extensionHost.onChange(update);
- }, []);
-
- // Extension-contributed settings panels
- const [extensionPanels, setExtensionPanels] = useState<
- ReturnType<typeof extensionHost.getSettingsPanels>
- >([]);
- useEffect(() => {
- const update = () => setExtensionPanels(extensionHost.getSettingsPanels());
- update();
- return extensionHost.onChange(update);
- }, []);
-
- const renderExtensionPanelsForSections = (...sections: string[]) =>
- extensionPanels
- .filter((panel) => {
- const parentSection = panel.panel.parentSection;
- return parentSection ? sections.includes(parentSection) : false;
- })
- .map((panel) => (
- <ExtensionSettingsSection
- key={`${panel.extensionId}/${panel.panel.id}`}
- extensionId={panel.extensionId}
- label={panel.panel.label}
- fields={panel.panel.fields}
- />
- ));
-
const [backgroundTab, setBackgroundTab] = useState<BackgroundTab>(() =>
getBackgroundTabForWallpaper(selected),
);
@@ -1484,31 +1204,13 @@ export function SettingsPanel({
const defaultWebcam = initialEditorPreferences.webcam;
const [internalActiveEffectSection] = useState<EditorEffectSection>("scene");
const activeEffectSection = activeEffectSectionProp ?? internalActiveEffectSection;
- const [extensionCursorStyles, setExtensionCursorStyles] = useState<
- ReturnType<typeof extensionHost.getContributedCursorStyles>
- >([]);
const [builtInCursorPreviewUrls, setBuiltInCursorPreviewUrls] = useState<
Partial<Record<string, string>>
>({});
- const [extensionCursorPreviewUrls, setExtensionCursorPreviewUrls] = useState<
- Partial<Record<string, string>>
- >({});
const [showCursorClickEffectAdvanced, setShowCursorClickEffectAdvanced] = useState(false);
- const cursorPreviewUrls = useMemo(
- () => ({ ...builtInCursorPreviewUrls, ...extensionCursorPreviewUrls }),
- [builtInCursorPreviewUrls, extensionCursorPreviewUrls],
- );
+ const cursorPreviewUrls = builtInCursorPreviewUrls;
const showDevMotionControls = import.meta.env.DEV;
- const cursorStyleOptions = useMemo<CursorStyleOption[]>(
- () => [
- ...BUILTIN_CURSOR_STYLE_OPTIONS,
- ...extensionCursorStyles.map((cursorStyle) => ({
- value: cursorStyle.id as CursorStyle,
- label: cursorStyle.cursorStyle.label,
- })),
- ],
- [extensionCursorStyles],
- );
+ const cursorStyleOptions = BUILTIN_CURSOR_STYLE_OPTIONS;
useEffect(() => {
let cancelled = false;
@@ -1564,14 +1266,12 @@ export function SettingsPanel({
}
const isKnownWallpaper =
- builtInWallpaperPaths.includes(selected) ||
- wallpaperPreviewPaths.includes(selected) ||
- extensionWallpaperPaths.includes(selected);
+ builtInWallpaperPaths.includes(selected) || wallpaperPreviewPaths.includes(selected);
if (!isKnownWallpaper && isVideoWallpaperSource(selected)) {
setCustomImages((prev) => (prev.includes(selected) ? prev : [selected, ...prev]));
}
- }, [builtInWallpaperPaths, extensionWallpaperPaths, selected, wallpaperPreviewPaths]);
+ }, [builtInWallpaperPaths, selected, wallpaperPreviewPaths]);
const imageWallpaperTiles = useMemo<WallpaperTile[]>(() => {
const imageWallpapers = builtInWallpapers.filter(
@@ -1591,24 +1291,8 @@ export function SettingsPanel({
};
});
- const extensionTiles = extensionWallpapers
- .filter((wallpaper) => !isVideoWallpaperSource(wallpaper.resolvedUrl))
- .map((wallpaper) => ({
- key: wallpaper.id,
- label: wallpaper.wallpaper.label,
- value: wallpaper.resolvedUrl,
- previewUrl:
- extensionWallpaperPreviewUrls[wallpaper.id] ?? wallpaper.resolvedThumbnailUrl,
- }));
-
- return [...builtInTiles, ...extensionTiles];
- }, [
- builtInWallpaperPaths,
- builtInWallpapers,
- extensionWallpaperPreviewUrls,
- extensionWallpapers,
- wallpaperPreviewPaths,
- ]);
+ return builtInTiles;
+ }, [builtInWallpaperPaths, builtInWallpapers, wallpaperPreviewPaths]);
const videoWallpaperTiles = useMemo<WallpaperTile[]>(() => {
const builtInTiles = builtInWallpapers
@@ -1620,18 +1304,8 @@ export function SettingsPanel({
previewUrl: wallpaper.publicPath,
}));
- const extensionTiles = extensionWallpapers
- .filter((wallpaper) => isVideoWallpaperSource(wallpaper.resolvedUrl))
- .map((wallpaper) => ({
- key: wallpaper.id,
- label: wallpaper.wallpaper.label,
- value: wallpaper.resolvedUrl,
- previewUrl:
- extensionWallpaperPreviewUrls[wallpaper.id] ?? wallpaper.resolvedThumbnailUrl,
- }));
-
- return [...builtInTiles, ...extensionTiles];
- }, [builtInWallpapers, extensionWallpaperPreviewUrls, extensionWallpapers]);
+ return builtInTiles;
+ }, [builtInWallpapers]);
useEffect(() => {
saveEditorPreferences({ customWallpapers: customImages });
@@ -1819,7 +1493,6 @@ export function SettingsPanel({
const preferredWallpaper = initialEditorPreferences.wallpaper;
const hasPreferredWallpaper =
(preferredWallpaper && builtInWallpaperPaths.includes(preferredWallpaper)) ||
- (preferredWallpaper && extensionWallpaperPaths.includes(preferredWallpaper)) ||
(preferredWallpaper && customImages.includes(preferredWallpaper)) ||
(preferredWallpaper && isHexWallpaper(preferredWallpaper)) ||
(preferredWallpaper && GRADIENTS.includes(preferredWallpaper));
@@ -1827,7 +1500,6 @@ export function SettingsPanel({
onWallpaperChange(
(hasPreferredWallpaper ? preferredWallpaper : "") ||
builtInWallpaperPaths[0] ||
- extensionWallpaperPaths[0] ||
BUILT_IN_WALLPAPERS[0]?.publicPath ||
"",
);
@@ -1914,17 +1586,10 @@ export function SettingsPanel({
};
const resetFrameSection = () => {
- const preferredFrame = initialEditorPreferences.frame;
- const resolvedFrame = preferredFrame
- ? availableFrames.some((candidate) => candidate.id === preferredFrame)
- ? preferredFrame
- : null
- : null;
onShadowChange?.(initialEditorPreferences.shadowIntensity);
onBorderRadiusChange?.(initialEditorPreferences.borderRadius);
onAspectRatioChange?.(initialEditorPreferences.aspectRatio);
onPaddingChange?.({ ...initialEditorPreferences.padding });
- onFrameChange?.(resolvedFrame);
removeBackgroundStateRef.current = null;
};
@@ -2021,12 +1686,7 @@ export function SettingsPanel({
setCustomImages((prev) => prev.filter((img) => img !== imageUrl));
// If the removed image was selected, clear selection
if (selected === imageUrl) {
- onWallpaperChange(
- builtInWallpaperPaths[0] ??
- extensionWallpaperPaths[0] ??
- BUILT_IN_WALLPAPERS[0]?.publicPath ??
- "",
- );
+ onWallpaperChange(builtInWallpaperPaths[0] ?? BUILT_IN_WALLPAPERS[0]?.publicPath ?? "");
}
};
@@ -2511,53 +2171,6 @@ export function SettingsPanel({
className="data-[state=checked]:bg-[#2563EB] scale-75"
/>
</div>
- {/* Frame Picker */}
- {availableFrames.length > 0 && (
- <div className="flex flex-col gap-1.5 mt-1">
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-muted-foreground">Frame</span>
- {frame && (
- <button
- type="button"
- onClick={() => onFrameChange?.(null)}
- className="text-[9px] text-[#2563EB] hover:opacity-80"
- >
- Remove
- </button>
- )}
- </div>
- <div className="grid grid-cols-3 gap-1.5">
- {availableFrames.map((f) => {
- const isSelected = frame === f.id;
- return (
- <button
- key={f.id}
- type="button"
- onClick={() => onFrameChange?.(isSelected ? null : f.id)}
- className={cn(
- "flex flex-col items-center gap-1 p-1.5 rounded-lg border transition-all text-center",
- isSelected
- ? "border-[#2563EB]/50 bg-[#2563EB]/10 ring-1 ring-[#2563EB]/30"
- : "border-foreground/[0.06] bg-white/[0.02] hover:bg-foreground/[0.05]",
- )}
- >
- <div className="w-full aspect-video rounded bg-foreground/10 overflow-hidden flex items-center justify-center">
- <img
- src={f.thumbnailPath}
- alt={f.label}
- className="w-full h-full object-contain"
- draggable={false}
- />
- </div>
- <span className="text-[8px] text-muted-foreground truncate w-full leading-tight">
- {f.label}
- </span>
- </button>
- );
- })}
- </div>
- </div>
- )}
</div>
</section>
);
@@ -2879,7 +2492,6 @@ export function SettingsPanel({
formatValue={(value) => `${Math.round(value * 100)}%`}
parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}
/>
- {renderExtensionPanelsForSections("captions")}
</div>
</section>
);
@@ -3272,7 +2884,6 @@ export function SettingsPanel({
{backgroundSettingsContent}
{frameSectionContent}
{cropSectionContent}
- {renderExtensionPanelsForSections("scene", "appearance", "frame", "crop")}
</div>
);
@@ -3410,7 +3021,6 @@ export function SettingsPanel({
{tSettings("zoom.deleteZoom")}
</Button>
)}
- {renderExtensionPanelsForSections("zoom", "appearance", "frame", "crop")}
</section>
);
@@ -3920,7 +3530,6 @@ export function SettingsPanel({
</div>
) : null}
</div>
- {renderExtensionPanelsForSections("cursor")}
</section>
);
case "webcam":
@@ -4181,32 +3790,10 @@ export function SettingsPanel({
</div>
</div>
</div>
- {renderExtensionPanelsForSections("webcam")}
</div>
</section>
);
default: {
- // Handle extension-contributed standalone section pages (ext:extensionId/panelId)
- if (activeEffectSection?.startsWith("ext:")) {
- const panels = extensionPanels.filter(
- (p) =>
- !p.panel.parentSection &&
- `ext:${p.extensionId}/${p.panel.id}` === activeEffectSection,
- );
- if (panels.length > 0) {
- const p = panels[0];
- return (
- <section className="flex flex-col gap-2">
- <SectionLabel>{p.panel.label}</SectionLabel>
- <ExtensionSettingsSection
- extensionId={p.extensionId}
- label={p.panel.label}
- fields={p.panel.fields}
- />
- </section>
- );
- }
- }
return sceneSectionContent;
}
}
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index 4a5685a1..596a84d8 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -86,7 +86,6 @@ import {
getAspectRatioValue,
} from "@/utils/aspectRatioUtils";
import { planClipSpeedChange } from "./clipSpeedChange";
-import { ExtensionIcon } from "./ExtensionIcon";
import {
calculateMp4ExportDimensions,
calculateMp4SourceDimensions,
@@ -120,7 +119,6 @@ const PhSettings = (props: { className?: string; weight?: "fill" | "regular" })
);
import type { SourceAudioTrackSettings } from "@/components/video-editor/audio/audioTypes";
-import { extensionHost } from "@/lib/extensions";
import { useVideoEditorAudio } from "./audio/useVideoEditorAudio";
import { resolveAutoCaptionSourcePath } from "./autoCaptionSource";
import { CropControl } from "./CropControl";
@@ -534,7 +532,6 @@ export default function VideoEditor() {
const [cursorSway, setCursorSway] = useState(initialEditorPreferences.cursorSway);
const [borderRadius, setBorderRadius] = useState(initialEditorPreferences.borderRadius);
const [padding, setPadding] = useState(initialEditorPreferences.padding);
- const [frame, setFrame] = useState<string | null>(initialEditorPreferences.frame);
const [cropRegion, setCropRegion] = useState<CropRegion>(DEFAULT_CROP_REGION);
const [webcam, setWebcam] = useState<WebcamOverlaySettings>(
initialEditorPreferences.webcam ?? DEFAULT_WEBCAM_OVERLAY,
@@ -792,7 +789,6 @@ export default function VideoEditor() {
cursorSway,
borderRadius,
padding: { ...padding },
- frame,
cropRegion: { ...cropRegion },
webcam: { ...webcam },
aspectRatio,
@@ -849,7 +845,6 @@ export default function VideoEditor() {
cursorSway,
borderRadius,
padding,
- frame,
cropRegion,
webcam,
aspectRatio,
@@ -947,7 +942,6 @@ export default function VideoEditor() {
setCursorSway(snapshot.cursorSway);
setBorderRadius(snapshot.borderRadius);
setPadding({ ...snapshot.padding });
- setFrame(snapshot.frame);
setCropRegion({ ...snapshot.cropRegion });
setWebcam({ ...snapshot.webcam });
setAspectRatio(snapshot.aspectRatio);
@@ -1615,37 +1609,6 @@ export default function VideoEditor() {
mp4SourceDimensions.width,
]);
- // Extension-contributed standalone section pages (no parentSection)
- const [extensionSectionButtons, setExtensionSectionButtons] = useState<
- {
- id: EditorEffectSection;
- label: string;
- icon: typeof PhPuzzle | string;
- extensionPath?: string | null;
- }[]
- >([]);
- useEffect(() => {
- const update = () => {
- const panels = extensionHost.getSettingsPanels();
- const extensionPathById = new Map(
- extensionHost
- .getActiveExtensions()
- .map((extension) => [extension.manifest.id, extension.path]),
- );
- const standalone = panels
- .filter((p) => !p.panel.parentSection)
- .map((p) => ({
- id: `ext:${p.extensionId}/${p.panel.id}` as EditorEffectSection,
- label: p.panel.label,
- icon: p.panel.icon || (PhPuzzle as typeof PhPuzzle | string),
- extensionPath: extensionPathById.get(p.extensionId),
- }));
- setExtensionSectionButtons(standalone);
- };
- update();
- return extensionHost.onChange(update);
- }, []);
-
const editorSectionButtons = useMemo(
() => [
{ id: "scene" as const, label: t("settings.sections.scene", "Scene"), icon: PhSparkle },
@@ -1669,14 +1632,13 @@ export default function VideoEditor() {
label: t("settings.sections.settings", "Settings"),
icon: PhSettings,
},
- ...extensionSectionButtons,
{
id: "extensions" as const,
label: t("settings.sections.extensions", "Extensions"),
icon: PhPuzzle,
},
],
- [t, extensionSectionButtons],
+ [t],
);
useEffect(() => {
@@ -1729,7 +1691,6 @@ export default function VideoEditor() {
cursorSway: number;
borderRadius: number;
padding: Padding;
- frame: string | null;
cropRegion: CropRegion;
webcam: WebcamOverlaySettings;
zoomRegions: ZoomRegion[];
@@ -1852,7 +1813,6 @@ export default function VideoEditor() {
cursorSway,
borderRadius,
padding,
- frame,
cropRegion,
webcam,
zoomRegions,
@@ -1939,7 +1899,6 @@ export default function VideoEditor() {
gifFrameRate,
gifLoop,
gifSizePreset,
- frame,
sourceAudioTrackSettingsByClip,
defaultSourceAudioTrackSettings,
],
@@ -2108,7 +2067,6 @@ export default function VideoEditor() {
setCursorSway(normalizedEditor.cursorSway);
setBorderRadius(normalizedEditor.borderRadius);
setPadding(normalizedEditor.padding);
- setFrame(normalizedEditor.frame);
setCropRegion(normalizedEditor.cropRegion);
setWebcam(normalizedEditor.webcam);
setZoomRegions(normalizedEditor.zoomRegions);
@@ -2657,7 +2615,6 @@ export default function VideoEditor() {
cursorSway,
borderRadius,
padding,
- frame,
webcam,
aspectRatio,
exportEncodingMode,
@@ -2713,7 +2670,6 @@ export default function VideoEditor() {
cursorSway,
borderRadius,
padding,
- frame,
webcam,
aspectRatio,
exportEncodingMode,
@@ -3835,10 +3791,6 @@ export default function VideoEditor() {
setSelectedZoomId(id);
setSelectedAnnotationId(null);
setSelectedCaptionId(null);
- extensionHost.emitEvent({
- type: "timeline:region-added",
- data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs },
- });
},
[videoPath],
);
@@ -3860,10 +3812,6 @@ export default function VideoEditor() {
}
setZoomRegions((prev) => [...prev, newRegion]);
// Don't auto-select suggested zooms — they follow cursor and don't need user interaction
- extensionHost.emitEvent({
- type: "timeline:region-added",
- data: { id, startMs: newRegion.startMs, endMs: newRegion.endMs },
- });
},
[videoPath],
);
@@ -4026,7 +3974,6 @@ export default function VideoEditor() {
if (selectedZoomId === id) {
setSelectedZoomId(null);
}
- extensionHost.emitEvent({ type: "timeline:region-removed", data: { id } });
},
[selectedZoomId],
);
@@ -4597,7 +4544,6 @@ export default function VideoEditor() {
setExportProgress(null);
setExportError(null);
clearPendingExportSave();
- extensionHost.emitEvent({ type: "export:start" });
const smokeExportStartedAt = smokeExportConfig.enabled ? performance.now() : null;
let keepExportDialogOpen = false;
@@ -4688,7 +4634,6 @@ export default function VideoEditor() {
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
- frame,
previewWidth,
previewHeight,
maxDecodeQueue: smokeExportConfig.maxDecodeQueue,
@@ -4871,7 +4816,6 @@ export default function VideoEditor() {
cursorClickBounce,
cursorClickBounceDuration,
cursorSway,
- frame,
audioRegions,
clipRegions,
sourceAudioFallbackPaths: audio.sourceAudioFallbackPaths,
@@ -5088,7 +5032,6 @@ export default function VideoEditor() {
window.close();
}
} finally {
- extensionHost.emitEvent({ type: "export:complete" });
setIsExporting(false);
exporterRef.current = null;
setShowExportDropdown(keepExportDialogOpen);
@@ -5177,7 +5120,6 @@ export default function VideoEditor() {
smokeExportConfig.pipelineModel,
smokeExportConfig.shadowIntensity,
effectiveSpeedRegions,
- frame,
selectedClipId,
smokeExportConfig.encodingMode,
smokeExportConfig.fps,
@@ -5570,7 +5512,6 @@ export default function VideoEditor() {
connectedZoomEasing={connectedZoomEasing}
borderRadius={0}
padding={padding}
- frame={frame}
cropRegion={cropRegion}
webcam={webcam}
webcamVideoPath={webcam.sourcePath ? resolvedWebcamVideoUrl : null}
@@ -6295,18 +6236,10 @@ export default function VideoEditor() {
}}
transition={{ duration: 0.14 }}
>
- {typeof section.icon === "string" ? (
- <ExtensionIcon
- icon={section.icon}
- extensionPath={section.extensionPath}
- className="h-[27px] w-[27px]"
- />
- ) : (
- <section.icon
- className="h-[27px] w-[27px]"
- weight={isActive ? "fill" : "regular"}
- />
- )}
+ <section.icon
+ className="h-[27px] w-[27px]"
+ weight={isActive ? "fill" : "regular"}
+ />
</motion.span>
</motion.button>
<div className="ml-1.5 h-1.5 w-1.5 flex-shrink-0">
@@ -6517,8 +6450,6 @@ export default function VideoEditor() {
onClearWebcam={handleClearWebcam}
padding={padding}
onPaddingChange={setPadding}
- frame={frame}
- onFrameChange={setFrame}
cropRegion={cropRegion}
onCropChange={setCropRegion}
aspectRatio={aspectRatio}
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx
index 82b3c5c7..cf5cc744 100644
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@ -69,67 +69,6 @@ import {
stepSpringValue,
} from "./videoPlayback/motionSmoothing";
-function getContributedCursorStylesSignature() {
- return extensionHost
- .getContributedCursorStyles()
- .map(
- (cursorStyle) =>
- `${cursorStyle.id}:${cursorStyle.resolvedDefaultUrl}:${cursorStyle.resolvedClickUrl ?? ""}:${cursorStyle.cursorStyle.hotspot?.x ?? ""}:${cursorStyle.cursorStyle.hotspot?.y ?? ""}`,
- )
- .sort()
- .join("|");
-}
-
-function getRegisteredFramesSignature() {
- return extensionHost
- .getFrames()
- .map(
- (frame) =>
- `${frame.id}:${frame.filePath}:${frame.thumbnailPath}:${frame.appearance ?? ""}`,
- )
- .sort()
- .join("|");
-}
-
-function serializeExtensionSettingValue(value: unknown): string {
- try {
- const serialized = JSON.stringify(value);
- return serialized ?? "undefined";
- } catch {
- try {
- return String(value);
- } catch {
- return "[unserializable]";
- }
- }
-}
-
-function getExtensionSettingsSignature() {
- return extensionHost
- .getSettingsPanels()
- .flatMap((registeredPanel) => {
- const { extensionId, panel } = registeredPanel;
- return panel.fields.map((field) => {
- const value = extensionHost.getExtensionSetting(extensionId, field.id);
- return `${extensionId}:${panel.id}:${field.id}:${serializeExtensionSettingValue(value)}`;
- });
- })
- .sort()
- .join("|");
-}
-
-import { extensionHost } from "@/lib/extensions";
-import {
- mapCursorToCanvasNormalized,
- mapSmoothedCursorToCanvasNormalized,
-} from "@/lib/extensions/cursorCoordinates";
-import {
- clearCursorEffects,
- executeExtensionCursorEffects,
- executeExtensionRenderHooks,
- notifyCursorInteraction,
-} from "@/lib/extensions/renderHooks";
-import { applyCanvasSceneTransform } from "@/lib/extensions/sceneTransform";
import { getSquircleSvgPath } from "@/lib/geometry/squircle";
import { type AspectRatio, formatAspectRatioForCSS } from "@/utils/aspectRatioUtils";
import { AnnotationOverlay } from "./AnnotationOverlay";
@@ -261,44 +200,6 @@ function summarizeRendererAttempts(attempts: readonly PixiRendererAttempt[]): st
return `No supported Pixi preview renderer was available. Attempted: ${details}`;
}
-function getCursorPositionAtTime(
- telemetry: CursorTelemetryPoint[],
- timeMs: number,
- params?: {
- maskRect?: { x: number; y: number; width: number; height: number } | null;
- canvasWidth: number;
- canvasHeight: number;
- },
-): { cx: number; cy: number; interactionType?: string } | null {
- if (telemetry.length === 0) {
- return null;
- }
-
- let closest = telemetry[0];
- let minDist = Math.abs(telemetry[0].timeMs - timeMs);
-
- for (let index = 1; index < telemetry.length; index++) {
- const point = telemetry[index];
- const distance = Math.abs(point.timeMs - timeMs);
- if (distance < minDist) {
- minDist = distance;
- closest = point;
- }
- if (point.timeMs > timeMs) {
- break;
- }
- }
-
- return mapCursorToCanvasNormalized(
- {
- cx: closest.cx,
- cy: closest.cy,
- interactionType: closest.interactionType,
- },
- params ?? { canvasWidth: 1, canvasHeight: 1 },
- );
-}
-
function getEffectiveNativeAspectRatio(
dimensions: { width: number; height: number } | null | undefined,
cropRegion?: import("./types").CropRegion,
@@ -347,7 +248,6 @@ interface VideoPlaybackProps {
connectedZoomEasing?: ZoomTransitionEasing;
borderRadius?: number;
padding?: Padding | number;
- frame?: string | null;
cropRegion?: import("./types").CropRegion;
webcam?: WebcamOverlaySettings;
webcamVideoPath?: string | null;
@@ -432,7 +332,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
connectedZoomEasing = DEFAULT_CONNECTED_ZOOM_EASING,
borderRadius = 0,
padding = DEFAULT_PADDING,
- frame = null,
cropRegion,
webcam,
webcamVideoPath,
@@ -494,7 +393,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const [pixiRendererBackend, setPixiRendererBackend] = useState<PixiPreviewBackend | null>(
null,
);
- const [frameUpdateCounter, setFrameUpdateCounter] = useState(0);
const [annotationSceneTransform, setAnnotationSceneTransform] =
useState<SceneTransformState>({
scale: 1,
@@ -509,24 +407,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
height: 0,
});
- useEffect(() => {
- let framesSignature = getRegisteredFramesSignature();
- let settingsSignature = getExtensionSettingsSignature();
- return extensionHost.onChange(() => {
- const nextFramesSignature = getRegisteredFramesSignature();
- const nextSettingsSignature = getExtensionSettingsSignature();
- if (
- nextFramesSignature === framesSignature &&
- nextSettingsSignature === settingsSignature
- ) {
- return;
- }
- framesSignature = nextFramesSignature;
- settingsSignature = nextSettingsSignature;
- setFrameUpdateCounter((c) => c + 1);
- });
- }, []);
-
const overlayRef = useRef<HTMLDivElement | null>(null);
const focusIndicatorRef = useRef<HTMLDivElement | null>(null);
const webcamVideoRef = useRef<HTMLVideoElement | null>(null);
@@ -567,10 +447,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
}>({ x: 0, y: 0, width: 0, height: 0 });
const cropBoundsRef = useRef({ startX: 0, endX: 0, startY: 0, endY: 0 });
const maskGraphicsRef = useRef<Graphics | null>(null);
- const frameSpriteRef = useRef<Sprite | null>(null);
- const frameContainerRef = useRef<Container | null>(null);
- const frameIdRef = useRef<string | null>(frame);
- const frameReloadKeyRef = useRef<string | null>(null);
const isPlayingRef = useRef(isPlaying);
const suspendRenderingRef = useRef(suspendRendering);
const isSeekingRef = useRef(false);
@@ -596,7 +472,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const connectedZoomEasingRef = useRef(connectedZoomEasing);
const videoReadyRafRef = useRef<number | null>(null);
const cursorOverlayRef = useRef<PixiCursorOverlay | null>(null);
- const cursorEffectsCanvasRef = useRef<HTMLCanvasElement | null>(null);
const cursorTelemetryRef = useRef<CursorTelemetryPoint[]>([]);
const showCursorRef = useRef(showCursor);
const cursorSizeRef = useRef(cursorSize);
@@ -619,7 +494,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const cursorSwayRef = useRef(cursorSway);
const zoomMotionBlurRef = useRef(zoomMotionBlur);
const zoomMotionBlurTuningRef = useRef(zoomMotionBlurTuning);
- const lastEmittedClickTimeMsRef = useRef(-1);
// Spring animation state for smooth zoom transitions
const springScaleRef = useRef<SpringState>(createSpringState(1));
@@ -1117,17 +991,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
};
}
- // Look up device frame insets so layout centers the full frame (video + bezels)
- let frameInsets: { top: number; right: number; bottom: number; left: number } | null =
- null;
- if (frame) {
- const frames = extensionHost.getFrames();
- const frameData = frames.find((f) => f.id === frame);
- if (frameData?.screenInsets) {
- frameInsets = frameData.screenInsets;
- }
- }
-
const result = layoutVideoContentUtil({
container,
app,
@@ -1138,7 +1001,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
lockedVideoDimensions: lockedVideoDimensionsRef.current,
borderRadius,
padding,
- frameInsets,
+ frameInsets: null,
});
if (result) {
@@ -1172,62 +1035,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
});
cropBoundsRef.current = result.cropBounds;
- // Sync extension cursor effects canvas resolution with renderer
- const effectsCanvas = cursorEffectsCanvasRef.current;
- if (effectsCanvas) {
- const w = result.stageSize.width;
- const h = result.stageSize.height;
- if (effectsCanvas.width !== w || effectsCanvas.height !== h) {
- effectsCanvas.width = w;
- effectsCanvas.height = h;
- }
- }
-
- // Push layout info to extension host for query APIs
- extensionHost.setVideoLayout({
- maskRect: {
- x: result.maskRect.x,
- y: result.maskRect.y,
- width: result.maskRect.width,
- height: result.maskRect.height,
- },
- canvasWidth: result.stageSize.width,
- canvasHeight: result.stageSize.height,
- borderRadius,
- padding,
- });
- extensionHost.setShadowConfig({
- enabled: Boolean(showShadow) && shadowIntensity > 0,
- intensity: shadowIntensity,
- });
-
- // Position device frame sprite to fill the stage
- const frameSprite = frameSpriteRef.current;
- if (frameSprite && frame) {
- const frames = extensionHost.getFrames();
- const frameData = frames.find((f) => f.id === frame);
- if (frameData) {
- const maskRect = result.maskRect;
- const insets = frameData.screenInsets;
- if (insets) {
- // Frame is larger than screen area - compute full frame size from insets
- const screenW = maskRect.width;
- const screenH = maskRect.height;
- const frameW = screenW / (1 - insets.left - insets.right);
- const frameH = screenH / (1 - insets.top - insets.bottom);
- const frameX = maskRect.x - insets.left * frameW;
- const frameY = maskRect.y - insets.top * frameH;
- frameSprite.position.set(frameX, frameY);
- frameSprite.width = frameW;
- frameSprite.height = frameH;
- } else {
- frameSprite.position.set(maskRect.x, maskRect.y);
- frameSprite.width = maskRect.width;
- frameSprite.height = maskRect.height;
- }
- }
- }
-
// Reset camera container to identity
cameraContainer.scale.set(1);
cameraContainer.position.set(0, 0);
@@ -1245,9 +1052,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cropRegion,
borderRadius,
padding,
- frame,
- showShadow,
- shadowIntensity,
applyWebcamBubbleLayout,
syncPreviewMotionBlurQuality,
]);
@@ -1266,104 +1070,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
layoutVideoContentRef.current = layoutVideoContent;
}, [layoutVideoContent]);
- // Sync device frame ref
- useEffect(() => {
- frameIdRef.current = frame;
- extensionHost.setActiveFrame(frame ?? null);
- }, [frame]);
-
- // Manage device frame sprite
- useEffect(() => {
- const frameContainer = frameContainerRef.current;
- if (!frameContainer) return;
- const nextFrameReloadKey = `${frame ?? ""}:${frameUpdateCounter}`;
- const activeFrameData = frame
- ? extensionHost.getFrames().find((registeredFrame) => registeredFrame.id === frame)
- : null;
- const shouldRedrawDynamicFrame = Boolean(
- activeFrameData?.draw && frameSpriteRef.current,
- );
-
- // Layout-only changes should not force texture/sprite recreation.
- if (frameReloadKeyRef.current === nextFrameReloadKey && !shouldRedrawDynamicFrame) {
- layoutVideoContentRef.current?.();
- return;
- }
- frameReloadKeyRef.current = nextFrameReloadKey;
-
- // Clear existing frame sprite and its texture to free memory
- if (frameSpriteRef.current) {
- const sprite = frameSpriteRef.current;
- frameContainer.removeChild(sprite);
- if (sprite.texture) {
- sprite.texture.destroy(true); // destroy texture and its baseTexture
- }
- sprite.destroy();
- frameSpriteRef.current = null;
- }
-
- if (!frame) {
- layoutVideoContentRef.current?.();
- return;
- }
-
- let cancelled = false;
-
- function tryLoadFrame() {
- if (cancelled) return;
- const container = frameContainerRef.current;
- if (!container) return false;
- const frames = extensionHost.getFrames();
- const frameData = frames.find((f) => f.id === frame);
- if (!frameData) return false;
-
- if (frameData.draw) {
- // Resolution-independent: draw at a reasonable size, Pixi handles the rest
- const drawW = 1920;
- const drawH = 1080;
- const canvas = document.createElement("canvas");
- canvas.width = drawW;
- canvas.height = drawH;
- const ctx = canvas.getContext("2d");
- if (ctx) frameData.draw(ctx, drawW, drawH);
- if (cancelled || frameIdRef.current !== frame) return true;
- const texture = Texture.from(canvas);
- const sprite = new Sprite(texture);
- frameSpriteRef.current = sprite;
- container.addChild(sprite);
- layoutVideoContentRef.current?.();
- } else {
- const img = new Image();
- img.onload = () => {
- if (cancelled || frameIdRef.current !== frame) return;
- const texture = Texture.from(img);
- const sprite = new Sprite(texture);
- frameSpriteRef.current = sprite;
- container.addChild(sprite);
- layoutVideoContentRef.current?.();
- };
- img.src = frameData.filePath;
- }
- return true;
- }
-
- // Try immediately; if extension hasn't registered frames yet,
- // listen for changes and retry once they become available.
- if (!tryLoadFrame()) {
- const unsub = extensionHost.onChange(() => {
- if (tryLoadFrame()) unsub();
- });
- return () => {
- cancelled = true;
- unsub();
- };
- }
-
- return () => {
- cancelled = true;
- };
- }, [frame, frameUpdateCounter]);
-
// Always re-run geometric layout when layout props change, even if frame sprite isn't reloaded.
useEffect(() => {
layoutVideoContent();
@@ -1521,10 +1227,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
useEffect(() => {
isPlayingRef.current = isPlaying;
- extensionHost.emitEvent({
- type: isPlaying ? "playback:play" : "playback:pause",
- timeMs: currentTimeRef.current,
- });
// Snap springs to current position when pausing so scrubbing is instant
if (!isPlaying) {
resetSpringState(springScaleRef.current);
@@ -1715,16 +1417,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
useEffect(() => {
cursorTelemetryRef.current = cursorTelemetry;
- // Push to extension host for query APIs
- extensionHost.setCursorTelemetry(
- cursorTelemetry.map((p) => ({
- timeMs: p.timeMs,
- cx: p.cx,
- cy: p.cy,
- interactionType: p.interactionType,
- pressure: p.pressure,
- })),
- );
}, [cursorTelemetry]);
useEffect(() => {
@@ -1834,13 +1526,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
useEffect(() => {
const timeMs = currentTime * 1000;
currentTimeRef.current = timeMs;
- const videoInfo = extensionHost.getVideoInfoSnapshot();
- extensionHost.setPlaybackState({
- currentTimeMs: timeMs,
- durationMs: videoInfo?.durationMs ?? 0,
- isPlaying,
- });
- }, [currentTime, isPlaying]);
+ }, [currentTime]);
useEffect(() => {
if (!pixiReady || !videoReady) return;
@@ -2096,11 +1782,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
videoContainerRef.current = videoContainer;
videoEffectsContainer.addChild(videoContainer);
- // Device frame overlay container - sits above video but below cursor
- const frameContainer = new Container();
- frameContainerRef.current = frameContainer;
- cameraContainer.addChild(frameContainer);
-
const cursorContainer = new Container();
cursorContainerRef.current = cursorContainer;
cameraContainer.addChild(cursorContainer);
@@ -2170,8 +1851,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cameraContainerRef.current = null;
videoEffectsContainerRef.current = null;
videoContainerRef.current = null;
- frameContainerRef.current = null;
- frameSpriteRef.current = null;
cursorContainerRef.current = null;
videoSpriteRef.current = null;
};
@@ -2395,14 +2074,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
state.focusY = targetFocus.cy;
state.progress = targetProgress;
- // Push zoom state to extension host for query APIs
- extensionHost.setZoomState({
- scale: targetScaleFactor,
- focusX: targetFocus.cx,
- focusY: targetFocus.cy,
- progress: targetProgress,
- });
-
const projectedTransform = computeZoomTransform({
stageSize: stageSizeRef.current,
baseMask: baseMaskRef.current,
@@ -2464,185 +2135,15 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
applyWebcamBubbleLayout(animationStateRef.current.appliedScale || 1);
const timeMs = currentTimeRef.current;
- const effectsCanvas = cursorEffectsCanvasRef.current;
- const extensionCanvasWidth = effectsCanvas?.width || stageSizeRef.current.width;
- const extensionCanvasHeight = effectsCanvas?.height || stageSizeRef.current.height;
- let smoothedCursorForHooks: {
- cx: number;
- cy: number;
- trail: Array<{ cx: number; cy: number }>;
- } | null = null;
-
- // Update cursor overlay + emit cursor events
const cursorOverlay = cursorOverlayRef.current;
if (cursorOverlay) {
- const telemetry = cursorTelemetryRef.current;
cursorOverlay.update(
- telemetry,
+ cursorTelemetryRef.current,
timeMs,
baseMaskRef.current,
showCursorRef.current,
!isPlayingRef.current || isSeekingRef.current,
);
-
- smoothedCursorForHooks = mapSmoothedCursorToCanvasNormalized(
- cursorOverlay.getSmoothedCursorSnapshot(),
- {
- maskRect: baseMaskRef.current,
- canvasWidth: extensionCanvasWidth,
- canvasHeight: extensionCanvasHeight,
- },
- );
- extensionHost.setSmoothedCursor(
- smoothedCursorForHooks
- ? {
- timeMs,
- cx: smoothedCursorForHooks.cx,
- cy: smoothedCursorForHooks.cy,
- trail: smoothedCursorForHooks.trail,
- }
- : null,
- );
-
- // Emit cursor:click events for extensions
- if (isPlayingRef.current && telemetry.length > 0) {
- for (let i = telemetry.length - 1; i >= 0; i--) {
- const p = telemetry[i];
- if (p.timeMs > timeMs) continue;
- if (p.timeMs < timeMs - 100) break;
- if (
- p.interactionType &&
- p.interactionType !== "move" &&
- p.timeMs !== lastEmittedClickTimeMsRef.current
- ) {
- const extensionCursor = mapCursorToCanvasNormalized(
- {
- cx: p.cx,
- cy: p.cy,
- interactionType: p.interactionType,
- },
- {
- maskRect: baseMaskRef.current,
- canvasWidth: extensionCanvasWidth,
- canvasHeight: extensionCanvasHeight,
- },
- );
- lastEmittedClickTimeMsRef.current = p.timeMs;
- extensionHost.emitEvent({
- type: "cursor:click",
- timeMs: p.timeMs,
- data: extensionCursor,
- });
- if (extensionCursor) {
- notifyCursorInteraction(
- p.timeMs,
- extensionCursor.cx,
- extensionCursor.cy,
- p.interactionType,
- );
- }
- }
- break;
- }
- }
- }
-
- if (!cursorOverlay) {
- extensionHost.setSmoothedCursor(null);
- }
-
- if (effectsCanvas && effectsCanvas.width > 0 && effectsCanvas.height > 0) {
- const ctx2d = effectsCanvas.getContext("2d");
- if (ctx2d) {
- ctx2d.clearRect(0, 0, effectsCanvas.width, effectsCanvas.height);
-
- const maskRect = baseMaskRef.current;
- const animationState = animationStateRef.current;
- const videoInfo = extensionHost.getVideoInfoSnapshot();
- const rawCursor = getCursorPositionAtTime(
- cursorTelemetryRef.current,
- timeMs,
- {
- maskRect,
- canvasWidth: effectsCanvas.width,
- canvasHeight: effectsCanvas.height,
- },
- );
- const hookParams = {
- width: effectsCanvas.width,
- height: effectsCanvas.height,
- timeMs,
- durationMs: videoInfo?.durationMs ?? 0,
- cursor: smoothedCursorForHooks
- ? {
- cx: smoothedCursorForHooks.cx,
- cy: smoothedCursorForHooks.cy,
- interactionType: rawCursor?.interactionType,
- }
- : rawCursor,
- smoothedCursor: smoothedCursorForHooks,
- videoLayout:
- maskRect.width > 0 && maskRect.height > 0
- ? {
- maskRect: {
- x: maskRect.x,
- y: maskRect.y,
- width: maskRect.width,
- height: maskRect.height,
- },
- borderRadius,
- padding,
- }
- : undefined,
- zoom: {
- scale: animationState.scale,
- focusX: animationState.focusX,
- focusY: animationState.focusY,
- progress: animationState.progress,
- },
- shadow: {
- enabled: Boolean(showShadow) && shadowIntensity > 0,
- intensity: shadowIntensity,
- },
- sceneTransform: {
- scale: animationState.appliedScale,
- x: animationState.x,
- y: animationState.y,
- },
- };
-
- ctx2d.save();
- applyCanvasSceneTransform(ctx2d, {
- scale: animationState.appliedScale,
- x: animationState.x,
- y: animationState.y,
- });
- executeExtensionRenderHooks("post-video", ctx2d, hookParams);
- executeExtensionRenderHooks("post-zoom", ctx2d, hookParams);
- executeExtensionRenderHooks("post-cursor", ctx2d, hookParams);
-
- if (isSeekingRef.current) {
- clearCursorEffects();
- } else {
- executeExtensionCursorEffects(
- ctx2d,
- timeMs,
- effectsCanvas.width,
- effectsCanvas.height,
- {
- zoom: hookParams.zoom,
- sceneTransform: hookParams.sceneTransform,
- videoLayout: hookParams.videoLayout,
- },
- );
- }
- ctx2d.restore();
-
- executeExtensionRenderHooks("post-webcam", ctx2d, hookParams);
- executeExtensionRenderHooks("post-annotations", ctx2d, hookParams);
-
- executeExtensionRenderHooks("final", ctx2d, hookParams);
- }
}
};
@@ -2652,15 +2153,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
app.ticker.remove(ticker);
}
};
- }, [
- pixiReady,
- videoReady,
- applyWebcamBubbleLayout,
- borderRadius,
- padding,
- showShadow,
- shadowIntensity,
- ]);
+ }, [pixiReady, videoReady, applyWebcamBubbleLayout]);
useEffect(() => {
const overlay = cursorOverlayRef.current;
@@ -2724,58 +2217,10 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cursorSway,
]);
- useEffect(() => {
- let cancelled = false;
- let signature = getContributedCursorStylesSignature();
-
- const refreshSelectedCursorStyle = async () => {
- const overlay = cursorOverlayRef.current;
- if (!overlay) {
- return;
- }
-
- try {
- await preloadCursorAssets();
- } catch (error) {
- console.warn("Failed to refresh contributed cursor styles in preview:", error);
- return;
- }
-
- if (cancelled || cursorOverlayRef.current !== overlay) {
- return;
- }
-
- overlay.setStyle(cursorStyleRef.current);
- overlay.reset();
- };
-
- const unsubscribe = extensionHost.onChange(() => {
- const nextSignature = getContributedCursorStylesSignature();
- if (nextSignature === signature) {
- return;
- }
-
- signature = nextSignature;
- void refreshSelectedCursorStyle();
- });
-
- return () => {
- cancelled = true;
- unsubscribe();
- };
- }, []);
-
const handleLoadedMetadata = (e: React.SyntheticEvent<HTMLVideoElement, Event>) => {
const video = e.currentTarget;
onDurationChange(video.duration);
- // Push video info to extension host for query APIs
- extensionHost.setVideoInfo({
- width: video.videoWidth,
- height: video.videoHeight,
- durationMs: Number.isFinite(video.duration) ? video.duration * 1000 : 0,
- fps: 60, // Not available from HTMLVideoElement; default to 60
- });
const targetTime = clampMediaTimeToDuration(
currentTime,
Number.isFinite(video.duration) ? video.duration : null,
@@ -2994,12 +2439,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
</div>
</div>
)}
- {/* Canvas overlay for extension cursor effects (drawn via Canvas 2D API) */}
- <canvas
- ref={cursorEffectsCanvasRef}
- className="absolute inset-0 w-full h-full pointer-events-none"
- style={{ zIndex: 1 }}
- />
{/* Only render overlay after PIXI and video are fully initialized */}
{pixiReady && videoReady && (
<div
diff --git a/src/components/video-editor/editorPreferences.test.ts b/src/components/video-editor/editorPreferences.test.ts
index 59566e62..53e4bff2 100644
--- a/src/components/video-editor/editorPreferences.test.ts
+++ b/src/components/video-editor/editorPreferences.test.ts
@@ -266,7 +266,6 @@ describe("editorPreferences", () => {
cursorSway: 1.5,
borderRadius: 18,
padding: { top: 30, right: 30, bottom: 30, left: 30, linked: true },
- frame: DEFAULT_EDITOR_PREFERENCES.frame,
aspectRatio: "4:5",
exportEncodingMode: "quality",
exportBackendPreference: DEFAULT_EDITOR_PREFERENCES.exportBackendPreference,
diff --git a/src/components/video-editor/editorPreferences.ts b/src/components/video-editor/editorPreferences.ts
index fbf354ab..731e6418 100644
--- a/src/components/video-editor/editorPreferences.ts
+++ b/src/components/video-editor/editorPreferences.ts
@@ -49,7 +49,6 @@ type PersistedEditorControls = Pick<
| "cursorSway"
| "borderRadius"
| "padding"
- | "frame"
| "webcam"
| "aspectRatio"
| "exportEncodingMode"
@@ -137,7 +136,6 @@ export const DEFAULT_EDITOR_PREFERENCES: EditorPreferences = {
cursorSway: DEFAULT_EDITOR_CONTROLS.cursorSway,
borderRadius: DEFAULT_EDITOR_CONTROLS.borderRadius,
padding: DEFAULT_EDITOR_CONTROLS.padding,
- frame: DEFAULT_EDITOR_CONTROLS.frame,
webcam: DEFAULT_EDITOR_CONTROLS.webcam,
aspectRatio: DEFAULT_EDITOR_CONTROLS.aspectRatio,
exportEncodingMode: DEFAULT_EDITOR_CONTROLS.exportEncodingMode,
@@ -336,7 +334,6 @@ function normalizeEditorControls(
cursorSway: sanitizedRaw.cursorSway ?? fallback.cursorSway,
borderRadius: sanitizedRaw.borderRadius ?? fallback.borderRadius,
padding: sanitizedRaw.padding ?? fallback.padding,
- frame: sanitizedRaw.frame !== undefined ? sanitizedRaw.frame : fallback.frame,
webcam: sanitizedRaw.webcam ?? fallback.webcam,
aspectRatio: sanitizedRaw.aspectRatio ?? fallback.aspectRatio,
exportEncodingMode: sanitizedRaw.exportEncodingMode ?? fallback.exportEncodingMode,
@@ -401,7 +398,6 @@ function normalizeEditorControls(
cursorSway: normalized.cursorSway,
borderRadius: normalized.borderRadius,
padding: normalized.padding,
- frame: normalized.frame,
webcam: normalized.webcam,
aspectRatio: normalized.aspectRatio,
exportEncodingMode: normalized.exportEncodingMode,
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index 9810d5fb..93c0c5a1 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -127,8 +127,6 @@ export interface ProjectEditorState {
cursorSway: number;
borderRadius: number;
padding: Padding;
- /** Selected frame ID (e.g. "recordly.frames/browser-dark"), or null for none */
- frame: string | null;
cropRegion: CropRegion;
zoomRegions: ZoomRegion[];
trimRegions: TrimRegion[];
@@ -978,7 +976,6 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
}
return { ...DEFAULT_PADDING };
})(),
- frame: typeof editor.frame === "string" ? editor.frame : null,
cropRegion: {
x: cropX,
y: cropY,
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 75fd2dc9..253cf52f 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -55,7 +55,7 @@ export interface CursorVisualSettings {
style: CursorStyle;
}
-export type CursorStyle = "macos" | "tahoe" | "tahoe-inverted" | "dot" | "figma" | (string & {}); // extension-contributed cursor styles
+export type CursorStyle = "macos" | "tahoe" | "tahoe-inverted" | "dot" | "figma" | (string & {});
export const DEFAULT_CURSOR_STYLE: CursorStyle = "tahoe";
export type CursorClickEffectStyle = "none" | "spotlight" | "ripple" | "echo";
diff --git a/src/components/video-editor/videoPlayback/cursorRenderer.ts b/src/components/video-editor/videoPlayback/cursorRenderer.ts
index 22156e24..79e6da01 100644
--- a/src/components/video-editor/videoPlayback/cursorRenderer.ts
+++ b/src/components/video-editor/videoPlayback/cursorRenderer.ts
@@ -2,7 +2,6 @@ import { Assets, BlurFilter, Container, Graphics, Sprite, Texture } from "pixi.j
import { MotionBlurFilter } from "pixi-filters/motion-blur";
import minimalCursorUrl from "@/assets/cursors/custom/minimal-cursor.svg";
import { getRenderableAssetUrl } from "@/lib/assetPath";
-import { extensionHost } from "@/lib/extensions";
import {
type CursorClickEffectStyle,
type CursorStyle,
@@ -174,24 +173,11 @@ const SUPPORTED_CURSOR_KEYS: CursorAssetKey[] = [
"not-allowed",
];
-const DEFAULT_CURSOR_PACK_ANCHOR = { x: 0.08, y: 0.08 } as const;
const CURSOR_PACK_POINTER_TYPES = new Set<CursorAssetKey>(["pointer", "open-hand", "closed-hand"]);
const BUILTIN_CURSOR_PACK_SOURCES: Record<string, CursorPackSource> = {};
function getCursorPackSources(): Record<string, CursorPackSource> {
- const sources: Record<string, CursorPackSource> = { ...BUILTIN_CURSOR_PACK_SOURCES };
-
- for (const cursorStyle of extensionHost.getContributedCursorStyles()) {
- const hotspot = cursorStyle.cursorStyle.hotspot ?? DEFAULT_CURSOR_PACK_ANCHOR;
- sources[cursorStyle.id] = {
- defaultUrl: cursorStyle.resolvedDefaultUrl,
- pointerUrl: cursorStyle.resolvedClickUrl ?? cursorStyle.resolvedDefaultUrl,
- defaultAnchor: hotspot,
- pointerAnchor: hotspot,
- };
- }
-
- return sources;
+ return { ...BUILTIN_CURSOR_PACK_SOURCES };
}
function buildCursorPackSourcesSignature(sources: Record<string, CursorPackSource>): string {
diff --git a/src/components/video-editor/videoPlayback/videoEventHandlers.test.ts b/src/components/video-editor/videoPlayback/videoEventHandlers.test.ts
index fd5d1322..52237aaf 100644
--- a/src/components/video-editor/videoPlayback/videoEventHandlers.test.ts
+++ b/src/components/video-editor/videoPlayback/videoEventHandlers.test.ts
@@ -1,12 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-vi.mock("@/lib/extensions", () => ({
- extensionHost: {
- emitEvent: vi.fn(),
- },
-}));
-
-import { extensionHost } from "@/lib/extensions";
import { createVideoEventHandlers } from "./videoEventHandlers";
type PresentedFrameCallback = (now: DOMHighResTimeStamp, metadata: { mediaTime?: number }) => void;
@@ -34,7 +27,6 @@ function createMockVideo(overrides: Partial<MockVideo> = {}): MockVideo {
}
describe("createVideoEventHandlers", () => {
- const emitEventMock = vi.mocked(extensionHost.emitEvent);
let requestAnimationFrameMock: ReturnType<typeof vi.fn>;
let cancelAnimationFrameMock: ReturnType<typeof vi.fn>;
@@ -43,7 +35,6 @@ describe("createVideoEventHandlers", () => {
cancelAnimationFrameMock = vi.fn();
vi.stubGlobal("requestAnimationFrame", requestAnimationFrameMock);
vi.stubGlobal("cancelAnimationFrame", cancelAnimationFrameMock);
- emitEventMock.mockReset();
});
afterEach(() => {
@@ -86,10 +77,6 @@ describe("createVideoEventHandlers", () => {
expect(onTimeUpdate).toHaveBeenCalledWith(1.25);
expect(currentTimeRef.current).toBe(1250);
- expect(emitEventMock).toHaveBeenLastCalledWith({
- type: "playback:timeupdate",
- timeMs: 1250,
- });
});
it("falls back to requestAnimationFrame when requestVideoFrameCallback is unavailable", () => {
diff --git a/src/components/video-editor/videoPlayback/videoEventHandlers.ts b/src/components/video-editor/videoPlayback/videoEventHandlers.ts
index b85bf00d..d3ac2db5 100644
--- a/src/components/video-editor/videoPlayback/videoEventHandlers.ts
+++ b/src/components/video-editor/videoPlayback/videoEventHandlers.ts
@@ -1,5 +1,4 @@
import type React from "react";
-import { extensionHost } from "@/lib/extensions";
import { enablePitchPreservingPlayback } from "@/lib/mediaTiming";
import type { SpeedRegion, TrimRegion } from "../types";
@@ -47,7 +46,6 @@ export function createVideoEventHandlers(params: VideoEventHandlersParams) {
const emitTime = (timeValue: number) => {
currentTimeRef.current = timeValue * 1000;
onTimeUpdate(timeValue);
- extensionHost.emitEvent({ type: "playback:timeupdate", timeMs: timeValue * 1000 });
};
// Helper function to check if current time is within a trim region
diff --git a/src/contexts/I18nContext.tsx b/src/contexts/I18nContext.tsx
index bc3b01db..da831a16 100644
--- a/src/contexts/I18nContext.tsx
+++ b/src/contexts/I18nContext.tsx
@@ -17,7 +17,6 @@ import {
import enCommon from "@/i18n/locales/en/common.json";
import enDialogs from "@/i18n/locales/en/dialogs.json";
import enEditor from "@/i18n/locales/en/editor.json";
-import enExtensions from "@/i18n/locales/en/extensions.json";
import enLaunch from "@/i18n/locales/en/launch.json";
import enSettings from "@/i18n/locales/en/settings.json";
import enShortcuts from "@/i18n/locales/en/shortcuts.json";
@@ -25,7 +24,6 @@ import enTimeline from "@/i18n/locales/en/timeline.json";
import esCommon from "@/i18n/locales/es/common.json";
import esDialogs from "@/i18n/locales/es/dialogs.json";
import esEditor from "@/i18n/locales/es/editor.json";
-import esExtensions from "@/i18n/locales/es/extensions.json";
import esLaunch from "@/i18n/locales/es/launch.json";
import esSettings from "@/i18n/locales/es/settings.json";
import esShortcuts from "@/i18n/locales/es/shortcuts.json";
@@ -33,7 +31,6 @@ import esTimeline from "@/i18n/locales/es/timeline.json";
import frCommon from "@/i18n/locales/fr/common.json";
import frDialogs from "@/i18n/locales/fr/dialogs.json";
import frEditor from "@/i18n/locales/fr/editor.json";
-import frExtensions from "@/i18n/locales/fr/extensions.json";
import frLaunch from "@/i18n/locales/fr/launch.json";
import frSettings from "@/i18n/locales/fr/settings.json";
import frShortcuts from "@/i18n/locales/fr/shortcuts.json";
@@ -41,7 +38,6 @@ import frTimeline from "@/i18n/locales/fr/timeline.json";
import deCommon from "@/i18n/locales/de/common.json";
import deDialogs from "@/i18n/locales/de/dialogs.json";
import deEditor from "@/i18n/locales/de/editor.json";
-import deExtensions from "@/i18n/locales/de/extensions.json";
import deLaunch from "@/i18n/locales/de/launch.json";
import deSettings from "@/i18n/locales/de/settings.json";
import deShortcuts from "@/i18n/locales/de/shortcuts.json";
@@ -49,7 +45,6 @@ import deTimeline from "@/i18n/locales/de/timeline.json";
import itCommon from "@/i18n/locales/it/common.json";
import itDialogs from "@/i18n/locales/it/dialogs.json";
import itEditor from "@/i18n/locales/it/editor.json";
-import itExtensions from "@/i18n/locales/it/extensions.json";
import itLaunch from "@/i18n/locales/it/launch.json";
import itSettings from "@/i18n/locales/it/settings.json";
import itShortcuts from "@/i18n/locales/it/shortcuts.json";
@@ -57,7 +52,6 @@ import itTimeline from "@/i18n/locales/it/timeline.json";
import koCommon from "@/i18n/locales/ko/common.json";
import koDialogs from "@/i18n/locales/ko/dialogs.json";
import koEditor from "@/i18n/locales/ko/editor.json";
-import koExtensions from "@/i18n/locales/ko/extensions.json";
import koLaunch from "@/i18n/locales/ko/launch.json";
import koSettings from "@/i18n/locales/ko/settings.json";
import koShortcuts from "@/i18n/locales/ko/shortcuts.json";
@@ -65,7 +59,6 @@ import koTimeline from "@/i18n/locales/ko/timeline.json";
import nlCommon from "@/i18n/locales/nl/common.json";
import nlDialogs from "@/i18n/locales/nl/dialogs.json";
import nlEditor from "@/i18n/locales/nl/editor.json";
-import nlExtensions from "@/i18n/locales/nl/extensions.json";
import nlLaunch from "@/i18n/locales/nl/launch.json";
import nlSettings from "@/i18n/locales/nl/settings.json";
import nlShortcuts from "@/i18n/locales/nl/shortcuts.json";
@@ -73,7 +66,6 @@ import nlTimeline from "@/i18n/locales/nl/timeline.json";
import ptBRCommon from "@/i18n/locales/pt-BR/common.json";
import ptBRDialogs from "@/i18n/locales/pt-BR/dialogs.json";
import ptBREditor from "@/i18n/locales/pt-BR/editor.json";
-import ptBRExtensions from "@/i18n/locales/pt-BR/extensions.json";
import ptBRLaunch from "@/i18n/locales/pt-BR/launch.json";
import ptBRSettings from "@/i18n/locales/pt-BR/settings.json";
import ptBRShortcuts from "@/i18n/locales/pt-BR/shortcuts.json";
@@ -81,7 +73,6 @@ import ptBRTimeline from "@/i18n/locales/pt-BR/timeline.json";
import zhCNCommon from "@/i18n/locales/zh-CN/common.json";
import zhCNDialogs from "@/i18n/locales/zh-CN/dialogs.json";
import zhCNEditor from "@/i18n/locales/zh-CN/editor.json";
-import zhCNExtensions from "@/i18n/locales/zh-CN/extensions.json";
import zhCNLaunch from "@/i18n/locales/zh-CN/launch.json";
import zhCNSettings from "@/i18n/locales/zh-CN/settings.json";
import zhCNShortcuts from "@/i18n/locales/zh-CN/shortcuts.json";
@@ -89,7 +80,6 @@ import zhCNTimeline from "@/i18n/locales/zh-CN/timeline.json";
import zhTWCommon from "@/i18n/locales/zh-TW/common.json";
import zhTWDialogs from "@/i18n/locales/zh-TW/dialogs.json";
import zhTWEditor from "@/i18n/locales/zh-TW/editor.json";
-import zhTWExtensions from "@/i18n/locales/zh-TW/extensions.json";
import zhTWLaunch from "@/i18n/locales/zh-TW/launch.json";
import zhTWSettings from "@/i18n/locales/zh-TW/settings.json";
import zhTWShortcuts from "@/i18n/locales/zh-TW/shortcuts.json";
@@ -108,7 +98,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: enSettings,
dialogs: enDialogs,
shortcuts: enShortcuts,
- extensions: enExtensions,
},
es: {
common: esCommon,
@@ -118,7 +107,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: esSettings,
dialogs: esDialogs,
shortcuts: esShortcuts,
- extensions: esExtensions,
},
fr: {
common: frCommon,
@@ -128,7 +116,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: frSettings,
dialogs: frDialogs,
shortcuts: frShortcuts,
- extensions: frExtensions,
},
de: {
common: deCommon,
@@ -138,7 +125,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: deSettings,
dialogs: deDialogs,
shortcuts: deShortcuts,
- extensions: deExtensions,
},
it: {
common: itCommon,
@@ -148,7 +134,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: itSettings,
dialogs: itDialogs,
shortcuts: itShortcuts,
- extensions: itExtensions,
},
nl: {
common: nlCommon,
@@ -158,7 +143,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: nlSettings,
dialogs: nlDialogs,
shortcuts: nlShortcuts,
- extensions: nlExtensions,
},
ko: {
common: koCommon,
@@ -168,7 +152,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: koSettings,
dialogs: koDialogs,
shortcuts: koShortcuts,
- extensions: koExtensions,
},
"pt-BR": {
common: ptBRCommon,
@@ -178,7 +161,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: ptBRSettings,
dialogs: ptBRDialogs,
shortcuts: ptBRShortcuts,
- extensions: ptBRExtensions,
},
"zh-CN": {
common: zhCNCommon,
@@ -188,7 +170,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: zhCNSettings,
dialogs: zhCNDialogs,
shortcuts: zhCNShortcuts,
- extensions: zhCNExtensions,
},
"zh-TW": {
common: zhTWCommon,
@@ -198,7 +179,6 @@ const messages: Record<AppLocale, LocaleBundle> = {
settings: zhTWSettings,
dialogs: zhTWDialogs,
shortcuts: zhTWShortcuts,
- extensions: zhTWExtensions,
},
} as const;
diff --git a/src/hooks/useExtensions.ts b/src/hooks/useExtensions.ts
deleted file mode 100644
index 4b198cd6..00000000
--- a/src/hooks/useExtensions.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import type {
- ExtensionInfo,
- ExtensionReview,
- MarketplaceReviewStatus,
- MarketplaceSearchResult,
-} from "@/lib/extensions";
-
-const UNAVAILABLE_ERROR = "Extensions are no longer available in Recordly.";
-
-export interface UseExtensionsResult {
- extensions: ExtensionInfo[];
- activeIds: Set<string>;
- ready: boolean;
- refresh: () => Promise<void>;
- toggleExtension: (id: string) => Promise<void>;
- installFromFolder: () => Promise<boolean>;
- uninstall: (id: string) => Promise<boolean>;
- openDirectory: () => Promise<void>;
- marketplaceSearch: (params: {
- query?: string;
- tags?: string[];
- sort?: "popular" | "recent" | "rating";
- page?: number;
- pageSize?: number;
- }) => Promise<MarketplaceSearchResult>;
- marketplaceInstall: (
- extensionId: string,
- downloadUrl: string,
- ) => Promise<{ success: boolean; error?: string }>;
- marketplaceSubmit: (extensionId: string) => Promise<{ success: boolean; error?: string }>;
- fetchReviews: (params: {
- status?: MarketplaceReviewStatus;
- page?: number;
- pageSize?: number;
- }) => Promise<{ reviews: ExtensionReview[]; total: number }>;
- updateReview: (
- reviewId: string,
- status: MarketplaceReviewStatus,
- notes?: string,
- ) => Promise<{ success: boolean }>;
-}
-
-const unavailableResult = { success: false, error: UNAVAILABLE_ERROR } as const;
-
-export function useExtensions(): UseExtensionsResult {
- return {
- extensions: [],
- activeIds: new Set(),
- ready: true,
- refresh: async () => undefined,
- toggleExtension: async () => undefined,
- installFromFolder: async () => false,
- uninstall: async () => false,
- openDirectory: async () => undefined,
- marketplaceSearch: async (params) => ({
- extensions: [],
- total: 0,
- page: params.page ?? 1,
- pageSize: params.pageSize ?? 20,
- }),
- marketplaceInstall: async () => unavailableResult,
- marketplaceSubmit: async () => unavailableResult,
- fetchReviews: async () => ({ reviews: [], total: 0 }),
- updateReview: async () => ({ success: false }),
- };
-}
diff --git a/src/i18n/config.ts b/src/i18n/config.ts
index 88200f78..567d72ef 100644
--- a/src/i18n/config.ts
+++ b/src/i18n/config.ts
@@ -21,7 +21,6 @@ export const I18N_NAMESPACES = [
"settings",
"dialogs",
"shortcuts",
- "extensions",
] as const;
export type AppLocale = (typeof SUPPORTED_LOCALES)[number];
diff --git a/src/i18n/locales/de/extensions.json b/src/i18n/locales/de/extensions.json
deleted file mode 100644
index 1b6ab83f..00000000
--- a/src/i18n/locales/de/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Erweiterungen",
- "tabs": {
- "browse": "Durchsuchen",
- "installed": "Installiert"
- },
- "actions": {
- "submit": "Erweiterung einreichen",
- "docs": "Dokumentation zu Erweiterungen",
- "refresh": "Aktualisieren",
- "openFolder": "Erweiterungsordner öffnen",
- "uninstall": "Deinstallieren",
- "install": "Installieren",
- "installing": "Wird installiert",
- "add": "Hinzufügen",
- "retry": "Wiederholen",
- "close": "Schließen",
- "folder": "Ordner"
- },
- "status": {
- "enabled": "Aktiviert",
- "disabled": "Deaktiviert",
- "installed": "Installiert"
- },
- "detail": {
- "by": "Von {{author}}",
- "unknownAuthor": "Unbekannter Autor",
- "noDescription": "Keine Beschreibung",
- "downloads": "{{count}} Downloads",
- "preview": "Vorschau",
- "screenshotAlt": "Screenshot {{number}}",
- "description": "Beschreibung",
- "tags": "Tags",
- "permissions": "Berechtigungen",
- "location": "Speicherort",
- "error": "Fehler: {{message}}"
- },
- "empty": {
- "title": "Keine Erweiterungen",
- "description": "Installiere Erweiterungen, um Rahmen, Cursor-Effekte und Editor-Werkzeuge hinzuzufügen."
- },
- "search": {
- "placeholder": "Erweiterungen suchen...",
- "noResults": "Keine Erweiterungen gefunden",
- "noMarketplace": "Noch keine Erweiterungen im Marktplatz verfügbar",
- "count": "{{count}} Erweiterung",
- "countPlural": "{{count}} Erweiterungen"
- },
- "toast": {
- "installedAndEnabled": "Erweiterung installiert und aktiviert",
- "uninstalled": "{{name}} deinstalliert",
- "uninstallFailed": "Deinstallation von {{name}} fehlgeschlagen",
- "searchFailed": "Suche im Marktplatz fehlgeschlagen",
- "refreshed": "Erweiterungen aktualisiert",
- "refreshFailed": "Erweiterungen konnten nicht aktualisiert werden",
- "marketplaceInstalled": "{{name}} wurde installiert und aktiviert",
- "marketplaceInstallFailed": "Die Installation von {{name}} ist fehlgeschlagen",
- "enableFailed": "Die Aktivierung der Erweiterung ist fehlgeschlagen"
- }
-}
diff --git a/src/i18n/locales/en/extensions.json b/src/i18n/locales/en/extensions.json
deleted file mode 100644
index e1556777..00000000
--- a/src/i18n/locales/en/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Extensions",
- "tabs": {
- "browse": "Browse",
- "installed": "Installed"
- },
- "actions": {
- "submit": "Submit an extension",
- "docs": "Extension docs",
- "refresh": "Refresh",
- "openFolder": "Open extensions folder",
- "uninstall": "Uninstall",
- "install": "Install",
- "installing": "Installing",
- "add": "Add",
- "retry": "Retry",
- "close": "Close",
- "folder": "Folder"
- },
- "status": {
- "enabled": "Enabled",
- "disabled": "Disabled",
- "installed": "Installed"
- },
- "detail": {
- "by": "By {{author}}",
- "unknownAuthor": "Unknown author",
- "noDescription": "No description",
- "downloads": "{{count}} downloads",
- "preview": "Preview",
- "screenshotAlt": "Screenshot {{number}}",
- "description": "Description",
- "tags": "Tags",
- "permissions": "Permissions",
- "location": "Location",
- "error": "Error: {{message}}"
- },
- "empty": {
- "title": "No Extensions",
- "description": "Install extensions to add frames, cursor effects, and editor tools."
- },
- "search": {
- "placeholder": "Search extensions...",
- "noResults": "No extensions found",
- "noMarketplace": "No marketplace extensions available yet",
- "count": "{{count}} extension",
- "countPlural": "{{count}} extensions"
- },
- "toast": {
- "installedAndEnabled": "Extension installed and enabled",
- "uninstalled": "Uninstalled {{name}}",
- "uninstallFailed": "Failed to uninstall {{name}}",
- "searchFailed": "Failed to search marketplace",
- "refreshed": "Extensions refreshed",
- "refreshFailed": "Failed to refresh extensions",
- "marketplaceInstalled": "Installed and enabled {{name}}",
- "marketplaceInstallFailed": "Failed to install {{name}}",
- "enableFailed": "Failed to enable extension"
- }
-}
diff --git a/src/i18n/locales/es/extensions.json b/src/i18n/locales/es/extensions.json
deleted file mode 100644
index 7f5deacf..00000000
--- a/src/i18n/locales/es/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Extensiones",
- "tabs": {
- "browse": "Explorar",
- "installed": "Instaladas"
- },
- "actions": {
- "submit": "Enviar una extensión",
- "docs": "Documentación de extensiones",
- "refresh": "Actualizar",
- "openFolder": "Abrir carpeta de extensiones",
- "uninstall": "Desinstalar",
- "install": "Instalar",
- "installing": "Instalando",
- "add": "Añadir",
- "retry": "Reintentar",
- "close": "Cerrar",
- "folder": "Carpeta"
- },
- "status": {
- "enabled": "Activada",
- "disabled": "Desactivada",
- "installed": "Instalada"
- },
- "detail": {
- "by": "Por {{author}}",
- "unknownAuthor": "Autor desconocido",
- "noDescription": "Sin descripción",
- "downloads": "{{count}} descargas",
- "preview": "Vista previa",
- "screenshotAlt": "Captura de pantalla {{number}}",
- "description": "Descripción",
- "tags": "Etiquetas",
- "permissions": "Permisos",
- "location": "Ubicación",
- "error": "Error: {{message}}"
- },
- "empty": {
- "title": "Sin extensiones",
- "description": "Instala extensiones para añadir marcos, efectos de cursor y herramientas de edición."
- },
- "search": {
- "placeholder": "Buscar extensiones...",
- "noResults": "No se encontraron extensiones",
- "noMarketplace": "Aún no hay extensiones en el marketplace",
- "count": "{{count}} extensión",
- "countPlural": "{{count}} extensiones"
- },
- "toast": {
- "installedAndEnabled": "Extensión instalada y activada",
- "uninstalled": "{{name}} desinstalada",
- "uninstallFailed": "Error al desinstalar {{name}}",
- "searchFailed": "Error al buscar en el marketplace",
- "refreshed": "Extensiones actualizadas",
- "refreshFailed": "Error al actualizar extensiones",
- "marketplaceInstalled": "{{name}} instalada y activada",
- "enableFailed": "Error al activar la extensión",
- "marketplaceInstallFailed": "Error al instalar {{name}}"
- }
-}
diff --git a/src/i18n/locales/fr/extensions.json b/src/i18n/locales/fr/extensions.json
deleted file mode 100644
index 28ccaec6..00000000
--- a/src/i18n/locales/fr/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Extensions",
- "tabs": {
- "browse": "Parcourir",
- "installed": "Installées"
- },
- "actions": {
- "submit": "Soumettre une extension",
- "docs": "Documentation des extensions",
- "refresh": "Actualiser",
- "openFolder": "Ouvrir le dossier des extensions",
- "uninstall": "Désinstaller",
- "install": "Installer",
- "installing": "Installation",
- "add": "Ajouter",
- "retry": "Réessayer",
- "close": "Fermer",
- "folder": "Dossier"
- },
- "status": {
- "enabled": "Activée",
- "disabled": "Désactivée",
- "installed": "Installée"
- },
- "detail": {
- "by": "Par {{author}}",
- "unknownAuthor": "Auteur inconnu",
- "noDescription": "Aucune description",
- "downloads": "{{count}} téléchargements",
- "preview": "Aperçu",
- "screenshotAlt": "Capture d’écran {{number}}",
- "description": "Description",
- "tags": "Tags",
- "permissions": "Autorisations",
- "location": "Emplacement",
- "error": "Erreur : {{message}}"
- },
- "empty": {
- "title": "Aucune extension",
- "description": "Installez des extensions pour ajouter des cadres, des effets de curseur et des outils d’édition."
- },
- "search": {
- "placeholder": "Rechercher des extensions...",
- "noResults": "Aucune extension trouvée",
- "noMarketplace": "Aucune extension disponible sur le marketplace pour le moment",
- "count": "{{count}} extension",
- "countPlural": "{{count}} extensions"
- },
- "toast": {
- "installedAndEnabled": "Extension installée et activée",
- "uninstalled": "{{name}} désinstallée",
- "uninstallFailed": "Échec de la désinstallation de {{name}}",
- "searchFailed": "Échec de la recherche sur le marketplace",
- "refreshed": "Extensions actualisées",
- "refreshFailed": "Échec de l’actualisation des extensions",
- "marketplaceInstalled": "{{name}} installée et activée",
- "marketplaceInstallFailed": "Échec de l’installation de {{name}}",
- "enableFailed": "Échec de l’activation de l’extension"
- }
-}
diff --git a/src/i18n/locales/it/extensions.json b/src/i18n/locales/it/extensions.json
deleted file mode 100644
index 4fcfbadd..00000000
--- a/src/i18n/locales/it/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Estensioni",
- "tabs": {
- "browse": "Esplora",
- "installed": "Installate"
- },
- "actions": {
- "submit": "Invia un'estensione",
- "docs": "Documentazione estensioni",
- "refresh": "Aggiorna",
- "openFolder": "Apri cartella estensioni",
- "uninstall": "Disinstalla",
- "install": "Installa",
- "installing": "Installazione in corso",
- "add": "Aggiungi",
- "retry": "Riprova",
- "close": "Chiudi",
- "folder": "Cartella"
- },
- "status": {
- "enabled": "Abilitata",
- "disabled": "Disabilitata",
- "installed": "Installata"
- },
- "detail": {
- "by": "Di {{author}}",
- "unknownAuthor": "Autore sconosciuto",
- "noDescription": "Nessuna descrizione",
- "downloads": "{{count}} download",
- "preview": "Anteprima",
- "screenshotAlt": "Schermata {{number}}",
- "description": "Descrizione",
- "tags": "Tag",
- "permissions": "Autorizzazioni",
- "location": "Posizione",
- "error": "Errore: {{message}}"
- },
- "empty": {
- "title": "Nessuna estensione",
- "description": "Installa estensioni per aggiungere cornici, effetti del cursore e strumenti per l'editor."
- },
- "search": {
- "placeholder": "Cerca estensioni...",
- "noResults": "Nessuna estensione trovata",
- "noMarketplace": "Nessuna estensione del marketplace ancora disponibile",
- "count": "{{count}} estensione",
- "countPlural": "{{count}} estensioni"
- },
- "toast": {
- "installedAndEnabled": "Estensione installata e abilitata",
- "uninstalled": "{{name}} disinstallata",
- "uninstallFailed": "Disinstallazione di {{name}} non riuscita",
- "searchFailed": "Ricerca nel marketplace non riuscita",
- "refreshed": "Estensioni aggiornate",
- "refreshFailed": "Aggiornamento delle estensioni non riuscito",
- "marketplaceInstalled": "{{name}} installata e abilitata",
- "marketplaceInstallFailed": "Installazione di {{name}} non riuscita",
- "enableFailed": "Abilitazione dell'estensione non riuscita"
- }
-}
diff --git a/src/i18n/locales/ko/extensions.json b/src/i18n/locales/ko/extensions.json
deleted file mode 100644
index 68f60fbd..00000000
--- a/src/i18n/locales/ko/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "확장 프로그램",
- "tabs": {
- "browse": "둘러보기",
- "installed": "설치됨"
- },
- "actions": {
- "submit": "확장 프로그램 제출",
- "docs": "확장 프로그램 문서",
- "refresh": "새로고침",
- "openFolder": "확장 프로그램 폴더 열기",
- "uninstall": "제거",
- "install": "설치",
- "installing": "설치 중",
- "add": "추가",
- "retry": "다시 시도",
- "close": "닫기",
- "folder": "폴더"
- },
- "status": {
- "enabled": "활성화",
- "disabled": "비활성화",
- "installed": "설치됨"
- },
- "detail": {
- "by": "{{author}} 제작",
- "unknownAuthor": "알 수 없는 작성자",
- "noDescription": "설명 없음",
- "downloads": "{{count}}회 다운로드",
- "preview": "미리보기",
- "screenshotAlt": "스크린샷 {{number}}",
- "description": "설명",
- "tags": "태그",
- "permissions": "권한",
- "location": "위치",
- "error": "오류: {{message}}"
- },
- "empty": {
- "title": "확장 프로그램 없음",
- "description": "프레임, 커서 효과 및 편집 도구를 추가하려면 확장 프로그램을 설치하세요."
- },
- "search": {
- "placeholder": "확장 프로그램 검색...",
- "noResults": "확장 프로그램을 찾을 수 없음",
- "noMarketplace": "아직 마켓플레이스 확장 프로그램이 없습니다",
- "count": "확장 프로그램 {{count}}개",
- "countPlural": "확장 프로그램 {{count}}개"
- },
- "toast": {
- "installedAndEnabled": "확장 프로그램이 설치되고 활성화되었습니다",
- "uninstalled": "{{name}} 제거됨",
- "uninstallFailed": "{{name}} 제거 실패",
- "searchFailed": "마켓플레이스 검색 실패",
- "refreshed": "확장 프로그램 새로고침 완료",
- "refreshFailed": "확장 프로그램 새로고침 실패",
- "marketplaceInstalled": "{{name}} 설치 및 활성화됨",
- "enableFailed": "확장 프로그램 활성화 실패",
- "marketplaceInstallFailed": "{{name}} 설치 실패"
- }
-}
diff --git a/src/i18n/locales/nl/extensions.json b/src/i18n/locales/nl/extensions.json
deleted file mode 100644
index d6693472..00000000
--- a/src/i18n/locales/nl/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Extensies",
- "tabs": {
- "browse": "Bladeren",
- "installed": "Geïnstalleerd"
- },
- "actions": {
- "submit": "Een extensie indienen",
- "docs": "Extensiedocumentatie",
- "refresh": "Vernieuwen",
- "openFolder": "Extensiemap openen",
- "uninstall": "Verwijderen",
- "install": "Installeren",
- "installing": "Installeren",
- "add": "Toevoegen",
- "retry": "Opnieuw",
- "close": "Sluiten",
- "folder": "Map"
- },
- "status": {
- "enabled": "Ingeschakeld",
- "disabled": "Uitgeschakeld",
- "installed": "Geïnstalleerd"
- },
- "detail": {
- "by": "Door {{author}}",
- "unknownAuthor": "Onbekende auteur",
- "noDescription": "Geen beschrijving",
- "downloads": "{{count}} downloads",
- "preview": "Voorbeeld",
- "screenshotAlt": "Schermafbeelding {{number}}",
- "description": "Beschrijving",
- "tags": "Tags",
- "permissions": "Machtigingen",
- "location": "Locatie",
- "error": "Fout: {{message}}"
- },
- "empty": {
- "title": "Geen extensies",
- "description": "Installeer extensies om frames, cursoreffecten en bewerkingstools toe te voegen."
- },
- "search": {
- "placeholder": "Extensies zoeken...",
- "noResults": "Geen extensies gevonden",
- "noMarketplace": "Er zijn nog geen marketplace extensies beschikbaar",
- "count": "{{count}} extensie",
- "countPlural": "{{count}} extensies"
- },
- "toast": {
- "installedAndEnabled": "Extensie geïnstalleerd en ingeschakeld",
- "uninstalled": "{{name}} verwijderd",
- "uninstallFailed": "Kan {{name}} niet verwijderen",
- "searchFailed": "Kan niet zoeken in marketplace",
- "refreshed": "Extensies vernieuwd",
- "refreshFailed": "Kan extensies niet vernieuwen",
- "marketplaceInstalled": "{{name}} geïnstalleerd en ingeschakeld",
- "enableFailed": "Kan extensie niet inschakelen",
- "marketplaceInstallFailed": "Kan {{name}} niet installeren"
- }
-}
diff --git a/src/i18n/locales/pt-BR/extensions.json b/src/i18n/locales/pt-BR/extensions.json
deleted file mode 100644
index f7d8abc4..00000000
--- a/src/i18n/locales/pt-BR/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Extensões",
- "tabs": {
- "browse": "Explorar",
- "installed": "Instaladas"
- },
- "actions": {
- "submit": "Enviar uma extensão",
- "docs": "Documentação de extensões",
- "refresh": "Atualizar",
- "openFolder": "Abrir pasta de extensões",
- "uninstall": "Desinstalar",
- "install": "Instalar",
- "installing": "Instalando",
- "add": "Adicionar",
- "retry": "Tentar novamente",
- "close": "Fechar",
- "folder": "Pasta"
- },
- "status": {
- "enabled": "Ativada",
- "disabled": "Desativada",
- "installed": "Instalada"
- },
- "detail": {
- "by": "Por {{author}}",
- "unknownAuthor": "Autor desconhecido",
- "noDescription": "Sem descrição",
- "downloads": "{{count}} downloads",
- "preview": "Prévia",
- "screenshotAlt": "Captura de tela {{number}}",
- "description": "Descrição",
- "tags": "Tags",
- "permissions": "Permissões",
- "location": "Localização",
- "error": "Erro: {{message}}"
- },
- "empty": {
- "title": "Sem extensões",
- "description": "Instale extensões para adicionar molduras, efeitos de cursor e ferramentas de edição."
- },
- "search": {
- "placeholder": "Buscar extensões...",
- "noResults": "Nenhuma extensão encontrada",
- "noMarketplace": "Ainda não há extensões disponíveis no marketplace",
- "count": "{{count}} extensão",
- "countPlural": "{{count}} extensões"
- },
- "toast": {
- "installedAndEnabled": "Extensão instalada e ativada",
- "uninstalled": "{{name}} desinstalada",
- "uninstallFailed": "Falha ao desinstalar {{name}}",
- "searchFailed": "Falha ao buscar no marketplace",
- "refreshed": "Extensões atualizadas",
- "refreshFailed": "Falha ao atualizar extensões",
- "marketplaceInstalled": "{{name}} instalada e ativada",
- "marketplaceInstallFailed": "Falha ao instalar {{name}}",
- "enableFailed": "Falha ao ativar extensão"
- }
-}
diff --git a/src/i18n/locales/ru/extensions.json b/src/i18n/locales/ru/extensions.json
deleted file mode 100644
index 984d4dc0..00000000
--- a/src/i18n/locales/ru/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "Расширения",
- "tabs": {
- "browse": "Обзор",
- "installed": "Установленные"
- },
- "actions": {
- "submit": "Отправить расширение",
- "docs": "Документация",
- "refresh": "Обновить",
- "openFolder": "Открыть папку с расширениями",
- "uninstall": "Удалить",
- "install": "Установить",
- "installing": "Установка",
- "add": "Добавить",
- "retry": "Повторить",
- "close": "Закрыть",
- "folder": "Папка с расширениями"
- },
- "status": {
- "enabled": "Включить",
- "disabled": "Выключить",
- "installed": "Установлено"
- },
- "detail": {
- "by": "Автор: {{author}}",
- "unknownAuthor": "Неизвестный автор",
- "noDescription": "Описание отсутствует",
- "downloads": "Загрузок: {{count}}",
- "preview": "Предпросмотр",
- "screenshotAlt": "Скриншот {{number}}",
- "description": "Описание",
- "tags": "Теги",
- "permissions": "Разрешения",
- "location": "Расположение",
- "error": "Ошибка: {{message}}"
- },
- "empty": {
- "title": "У вас пока нет расширений",
- "description": "Устанавливайте расширения: рамки, курсоры и дополнительные инструменты для редактирования."
- },
- "search": {
- "placeholder": "Поиск расширений...",
- "noResults": "Ничего не найдено",
- "noMarketplace": "В магазине пока нет доступных расширений",
- "count": "Найдено расширений: {{count}}",
- "countPlural": "Найдено расширений: {{count}}"
- },
- "toast": {
- "installedAndEnabled": "Расширение установлено и включено",
- "uninstalled": "Удалено: {{name}}",
- "uninstallFailed": "Не удалось удалить {{name}}",
- "searchFailed": "Ошибка при поиске в магазине расширений",
- "refreshed": "Список расширений обновлен",
- "refreshFailed": "Не удалось обновить расширения",
- "marketplaceInstalled": "Установлено и включено: {{name}}",
- "marketplaceInstallFailed": "Не удалось установить {{name}}",
- "enableFailed": "Не удалось включить расширение"
- }
-}
diff --git a/src/i18n/locales/zh-CN/extensions.json b/src/i18n/locales/zh-CN/extensions.json
deleted file mode 100644
index 582223e7..00000000
--- a/src/i18n/locales/zh-CN/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "扩展",
- "tabs": {
- "browse": "浏览",
- "installed": "已安装"
- },
- "actions": {
- "submit": "提交扩展",
- "docs": "扩展文档",
- "refresh": "刷新",
- "openFolder": "打开扩展文件夹",
- "uninstall": "卸载",
- "install": "安装",
- "installing": "安装中",
- "add": "添加",
- "retry": "重试",
- "close": "关闭",
- "folder": "文件夹"
- },
- "status": {
- "enabled": "已启用",
- "disabled": "已禁用",
- "installed": "已安装"
- },
- "detail": {
- "by": "由 {{author}} 开发",
- "unknownAuthor": "未知作者",
- "noDescription": "暂无描述",
- "downloads": "{{count}} 次下载",
- "preview": "预览",
- "screenshotAlt": "截图 {{number}}",
- "description": "描述",
- "tags": "标签",
- "permissions": "权限",
- "location": "位置",
- "error": "错误:{{message}}"
- },
- "empty": {
- "title": "没有扩展",
- "description": "安装扩展以添加相框、光标效果和编辑工具。"
- },
- "search": {
- "placeholder": "搜索扩展...",
- "noResults": "未找到扩展",
- "noMarketplace": "暂无可用的市场扩展",
- "count": "{{count}} 个扩展",
- "countPlural": "{{count}} 个扩展"
- },
- "toast": {
- "installedAndEnabled": "扩展已安装并启用",
- "uninstalled": "已卸载 {{name}}",
- "uninstallFailed": "卸载 {{name}} 失败",
- "searchFailed": "搜索市场失败",
- "refreshed": "扩展已刷新",
- "refreshFailed": "刷新扩展失败",
- "marketplaceInstalled": "已安装并启用 {{name}}",
- "enableFailed": "启用扩展失败",
- "marketplaceInstallFailed": "安装 {{name}} 失败"
- }
-}
diff --git a/src/i18n/locales/zh-TW/extensions.json b/src/i18n/locales/zh-TW/extensions.json
deleted file mode 100644
index cd85f835..00000000
--- a/src/i18n/locales/zh-TW/extensions.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "title": "擴充功能",
- "tabs": {
- "browse": "瀏覽",
- "installed": "已安裝"
- },
- "actions": {
- "submit": "提交擴充功能",
- "docs": "擴充功能文件",
- "refresh": "重新整理",
- "openFolder": "開啟擴充功能資料夾",
- "uninstall": "解除安裝",
- "install": "安裝",
- "installing": "安裝中",
- "add": "新增",
- "retry": "重試",
- "close": "關閉",
- "folder": "資料夾"
- },
- "status": {
- "enabled": "已啟用",
- "disabled": "已停用",
- "installed": "已安裝"
- },
- "detail": {
- "by": "作者:{{author}}",
- "unknownAuthor": "未知作者",
- "noDescription": "無描述",
- "downloads": "下載次數:{{count}}",
- "preview": "預覽",
- "screenshotAlt": "截圖 {{number}}",
- "description": "描述",
- "tags": "標籤",
- "permissions": "權限",
- "location": "位置",
- "error": "錯誤:{{message}}"
- },
- "empty": {
- "title": "沒有擴充功能",
- "description": "安裝擴充功能以新增外框、游標特效與編輯器工具。"
- },
- "search": {
- "placeholder": "搜尋擴充功能...",
- "noResults": "找不到擴充功能",
- "noMarketplace": "目前尚無市集擴充功能",
- "count": "{{count}} 個擴充功能",
- "countPlural": "{{count}} 個擴充功能"
- },
- "toast": {
- "installedAndEnabled": "擴充功能已安裝並啟用",
- "uninstalled": "已解除安裝 {{name}}",
- "uninstallFailed": "解除安裝 {{name}} 失敗",
- "searchFailed": "搜尋市集失敗",
- "refreshed": "已重新整理擴充功能",
- "refreshFailed": "重新整理擴充功能失敗",
- "marketplaceInstalled": "已安裝並啟用 {{name}}",
- "marketplaceInstallFailed": "安裝 {{name}} 失敗",
- "enableFailed": "啟用擴充功能失敗"
- }
-}
diff --git a/src/lib/exporter/backendPolicy.test.ts b/src/lib/exporter/backendPolicy.test.ts
index 6d375968..69ae5b8f 100644
--- a/src/lib/exporter/backendPolicy.test.ts
+++ b/src/lib/exporter/backendPolicy.test.ts
@@ -53,7 +53,7 @@ describe("backendPolicy", () => {
backendPreference: "auto",
platform: "win32",
nativeStaticLayoutAvailable: true,
- nativeStaticLayoutSkipReasons: ["unsupported-frame-overlay"],
+ nativeStaticLayoutSkipReasons: ["unsupported-caption-overlay"],
}),
).toEqual({
selectedRoute: "breeze-stream",
diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.ts
index 9891a518..a4b73f83 100644
--- a/src/lib/exporter/frameRenderer.ts
+++ b/src/lib/exporter/frameRenderer.ts
@@ -56,17 +56,6 @@ import {
getWebcamOverlayPosition,
} from "@/components/video-editor/webcamOverlay";
import { getAssetPath, getExportableVideoUrl, getRenderableAssetUrl } from "@/lib/assetPath";
-import { extensionHost } from "@/lib/extensions";
-import {
- mapCursorToCanvasNormalized,
- mapSmoothedCursorToCanvasNormalized,
-} from "@/lib/extensions/cursorCoordinates";
-import {
- executeExtensionCursorEffects,
- executeExtensionRenderHooks,
- notifyCursorInteraction,
-} from "@/lib/extensions/renderHooks";
-import { applyCanvasSceneTransform } from "@/lib/extensions/sceneTransform";
import { drawSquircleOnCanvas, drawSquircleOnGraphics } from "@/lib/geometry/squircle";
import {
clampMediaTimeToDuration,
@@ -143,7 +132,6 @@ interface FrameRenderConfig {
cursorClickBounce?: number;
cursorClickBounceDuration?: number;
cursorSway?: number;
- frame?: string | null;
}
interface AnimationState {
@@ -205,10 +193,7 @@ interface LayoutCache {
interface RenderSnapshot {
timeMs: number;
- cursorTimeMs: number;
- smoothedCursor: ReturnType<typeof mapSmoothedCursorToCanvasNormalized>;
sceneTransform: { scale: number; x: number; y: number };
- zoom: { scale: number; focusX: number; focusY: number; progress: number };
}
function createAnimationState(): AnimationState {
@@ -285,10 +270,6 @@ export class FrameRenderer {
private webcamBubbleCtx: CanvasRenderingContext2D | null = null;
private lastSyncedWebcamTime: number | null = null;
private cleanupWebcamSource: (() => void) | null = null;
- private frameImage: HTMLImageElement | null = null;
- private frameInsets: { top: number; right: number; bottom: number; left: number } | null = null;
- private frameDraw: ((ctx: CanvasRenderingContext2D, w: number, h: number) => void) | null =
- null;
constructor(config: FrameRenderConfig) {
this.config = config;
@@ -451,7 +432,6 @@ export class FrameRenderer {
// Setup background (render separately, not in PixiJS)
await this.setupBackground();
await this.setupWebcamSource();
- await this.setupFrame();
if ((this.config.zoomMotionBlur ?? 0) > 0) {
this.zoomBlurFilter = new ZoomBlurFilter({ strength: 0, maxKernelSize: 13 });
@@ -1414,37 +1394,6 @@ export class FrameRenderer {
}
}
- private async setupFrame(): Promise<void> {
- const frameId = this.config.frame;
- if (!frameId) return;
-
- const { extensionHost } = await import("@/lib/extensions/extensionHost");
- const frames = extensionHost.getFrames();
- const frame = frames.find((f) => f.id === frameId);
- if (!frame) {
- console.warn(`[FrameRenderer] Device frame "${frameId}" not found`);
- return;
- }
-
- this.frameInsets = frame.screenInsets;
-
- if (frame.draw) {
- // Prefer draw function — renders at export resolution, no bitmap scaling
- this.frameDraw = frame.draw;
- return;
- }
-
- const img = new Image();
- img.crossOrigin = "anonymous";
- await new Promise<void>((resolve, reject) => {
- img.onload = () => resolve();
- img.onerror = () => reject(new Error(`Failed to load device frame image: ${frameId}`));
- img.src = frame.filePath;
- });
-
- this.frameImage = img;
- }
-
async renderFrame(
videoFrame: VideoFrame,
timestamp: number,
@@ -1499,19 +1448,6 @@ export class FrameRenderer {
: null;
if (temporalSnapshot) {
- extensionHost.setSmoothedCursor(
- temporalSnapshot.smoothedCursor
- ? {
- timeMs: temporalSnapshot.timeMs,
- cx: temporalSnapshot.smoothedCursor.cx,
- cy: temporalSnapshot.smoothedCursor.cy,
- trail: temporalSnapshot.smoothedCursor.trail,
- }
- : null,
- );
-
- this.drawFrame(temporalSnapshot.sceneTransform);
-
if (
this.config.annotationRegions &&
this.config.annotationRegions.length > 0 &&
@@ -1550,67 +1486,6 @@ export class FrameRenderer {
);
}
- if (this.compositeCtx) {
- const maskRect = this.layoutCache?.maskRect;
- const hookParams = {
- width: this.config.width,
- height: this.config.height,
- timeMs: temporalSnapshot.timeMs,
- durationMs: 0,
- cursor: temporalSnapshot.smoothedCursor
- ? {
- cx: temporalSnapshot.smoothedCursor.cx,
- cy: temporalSnapshot.smoothedCursor.cy,
- interactionType: this.getCursorPosition(
- temporalSnapshot.cursorTimeMs,
- )?.interactionType,
- }
- : this.getCursorPosition(temporalSnapshot.cursorTimeMs),
- smoothedCursor: temporalSnapshot.smoothedCursor,
- videoLayout: maskRect
- ? {
- maskRect: {
- x: maskRect.x,
- y: maskRect.y,
- width: maskRect.width,
- height: maskRect.height,
- },
- borderRadius: this.config.borderRadius ?? 0,
- padding: this.config.padding ?? 0,
- }
- : undefined,
- zoom: temporalSnapshot.zoom,
- shadow: {
- enabled: this.config.showShadow,
- intensity: this.config.shadowIntensity,
- },
- sceneTransform: temporalSnapshot.sceneTransform,
- };
-
- this.compositeCtx.save();
- applyCanvasSceneTransform(this.compositeCtx, temporalSnapshot.sceneTransform);
- executeExtensionRenderHooks("post-video", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-zoom", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-cursor", this.compositeCtx, hookParams);
- this.emitCursorInteractions(temporalSnapshot.cursorTimeMs);
- executeExtensionCursorEffects(
- this.compositeCtx,
- temporalSnapshot.timeMs,
- this.config.width,
- this.config.height,
- {
- zoom: hookParams.zoom,
- sceneTransform: hookParams.sceneTransform,
- videoLayout: hookParams.videoLayout,
- },
- );
- this.compositeCtx.restore();
-
- executeExtensionRenderHooks("post-webcam", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-annotations", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("final", this.compositeCtx, hookParams);
- }
-
return;
}
@@ -1637,25 +1512,6 @@ export class FrameRenderer {
);
}
- const smoothedCursor = mapSmoothedCursorToCanvasNormalized(
- this.cursorOverlay?.getSmoothedCursorSnapshot() ?? null,
- {
- maskRect: layoutCache.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- extensionHost.setSmoothedCursor(
- smoothedCursor
- ? {
- timeMs,
- cx: smoothedCursor.cx,
- cy: smoothedCursor.cy,
- trail: smoothedCursor.trail,
- }
- : null,
- );
-
const TICKS_PER_FRAME = 1;
for (let i = 0; i < TICKS_PER_FRAME; i++) {
@@ -1691,11 +1547,6 @@ export class FrameRenderer {
this.compositeWithShadows();
// Draw device frame overlay on top of video content
- this.drawFrame({
- scale: this.animationState.appliedScale,
- x: this.animationState.x,
- y: this.animationState.y,
- });
// Render annotations on top if present
if (
@@ -1740,149 +1591,6 @@ export class FrameRenderer {
timeMs,
);
}
-
- // Extension render hooks — run after all built-in rendering
- if (this.compositeCtx) {
- const maskRect = this.layoutCache?.maskRect;
- const hookParams = {
- width: this.config.width,
- height: this.config.height,
- timeMs,
- durationMs: 0,
- cursor: smoothedCursor
- ? {
- cx: smoothedCursor.cx,
- cy: smoothedCursor.cy,
- interactionType: this.getCursorPosition(cursorTimeMs)?.interactionType,
- }
- : this.getCursorPosition(cursorTimeMs),
- smoothedCursor,
- videoLayout: maskRect
- ? {
- maskRect: {
- x: maskRect.x,
- y: maskRect.y,
- width: maskRect.width,
- height: maskRect.height,
- },
- borderRadius: this.config.borderRadius ?? 0,
- padding: this.config.padding ?? 0,
- }
- : undefined,
- zoom: {
- scale: this.animationState.scale,
- focusX: this.animationState.focusX,
- focusY: this.animationState.focusY,
- progress: this.animationState.progress,
- },
- shadow: {
- enabled: this.config.showShadow,
- intensity: this.config.shadowIntensity,
- },
- sceneTransform: {
- scale: this.animationState.appliedScale,
- x: this.animationState.x,
- y: this.animationState.y,
- },
- };
-
- this.compositeCtx.save();
- applyCanvasSceneTransform(this.compositeCtx, {
- scale: this.animationState.appliedScale,
- x: this.animationState.x,
- y: this.animationState.y,
- });
- executeExtensionRenderHooks("post-video", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-zoom", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-cursor", this.compositeCtx, hookParams);
-
- // Cursor click effects
- this.emitCursorInteractions(cursorTimeMs);
- executeExtensionCursorEffects(
- this.compositeCtx,
- timeMs,
- this.config.width,
- this.config.height,
- {
- zoom: hookParams.zoom,
- sceneTransform: hookParams.sceneTransform,
- videoLayout: hookParams.videoLayout,
- },
- );
- this.compositeCtx.restore();
-
- executeExtensionRenderHooks("post-webcam", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-annotations", this.compositeCtx, hookParams);
-
- executeExtensionRenderHooks("final", this.compositeCtx, hookParams);
- }
- }
-
- /**
- * Get the cursor position (normalized 0-1) at the given time.
- */
- private getCursorPosition(
- timeMs: number,
- ): { cx: number; cy: number; interactionType?: string } | null {
- const telemetry = this.config.cursorTelemetry;
- if (!telemetry || telemetry.length === 0) return null;
-
- // Find the closest telemetry point
- let closest = telemetry[0];
- let minDist = Math.abs(telemetry[0].timeMs - timeMs);
- for (let i = 1; i < telemetry.length; i++) {
- const dist = Math.abs(telemetry[i].timeMs - timeMs);
- if (dist < minDist) {
- minDist = dist;
- closest = telemetry[i];
- }
- if (telemetry[i].timeMs > timeMs) break;
- }
-
- return mapCursorToCanvasNormalized(
- { cx: closest.cx, cy: closest.cy, interactionType: closest.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- }
-
- /**
- * Emit cursor interaction events for extensions based on telemetry clicks.
- */
- private lastEmittedClickTimeMs = -1;
-
- private emitCursorInteractions(timeMs: number): void {
- const telemetry = this.config.cursorTelemetry;
- if (!telemetry || telemetry.length === 0) return;
-
- // Find click events near this time
- for (const point of telemetry) {
- if (point.timeMs > timeMs) break;
- if (point.timeMs < timeMs - 100) continue;
- if (!point.interactionType || point.interactionType === "move") continue;
- if (point.timeMs === this.lastEmittedClickTimeMs) continue;
-
- const mappedCursor = mapCursorToCanvasNormalized(
- { cx: point.cx, cy: point.cy, interactionType: point.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- if (!mappedCursor) continue;
-
- this.lastEmittedClickTimeMs = point.timeMs;
- notifyCursorInteraction(
- point.timeMs,
- mappedCursor.cx,
- mappedCursor.cy,
- point.interactionType,
- );
- }
}
private updateLayout(): void {
@@ -1902,7 +1610,7 @@ export class FrameRenderer {
width,
height,
padding,
- frameInsets: this.frameInsets,
+ frameInsets: null,
cropRegion,
videoWidth,
videoHeight,
@@ -2095,15 +1803,6 @@ export class FrameRenderer {
);
}
- const smoothedCursor = mapSmoothedCursorToCanvasNormalized(
- this.cursorOverlay?.getSmoothedCursorSnapshot() ?? null,
- {
- maskRect: layoutCache.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
-
this.updateAnimationState(timeMs);
applyZoomTransform({
@@ -2133,19 +1832,11 @@ export class FrameRenderer {
return {
timeMs,
- cursorTimeMs,
- smoothedCursor,
sceneTransform: {
scale: this.animationState.appliedScale,
x: this.animationState.x,
y: this.animationState.y,
},
- zoom: {
- scale: this.animationState.scale,
- focusX: this.animationState.focusX,
- focusY: this.animationState.focusY,
- progress: this.animationState.progress,
- },
};
}
@@ -2271,71 +1962,6 @@ export class FrameRenderer {
this.drawWebcamOverlay(ctx, w, h);
}
- private drawFrame(sceneTransform?: { scale: number; x: number; y: number }): void {
- if ((!this.frameImage && !this.frameDraw) || !this.compositeCtx || !this.layoutCache)
- return;
-
- const ctx = this.compositeCtx;
- const maskRect = this.layoutCache.maskRect;
- const insets = this.frameInsets;
- const transform = sceneTransform ?? { scale: 1, x: 0, y: 0 };
- const drawWithTransform = (draw: () => void) => {
- ctx.save();
- applyCanvasSceneTransform(ctx, transform);
- draw();
- ctx.restore();
- };
-
- if (!insets) {
- // No insets: draw frame spanning entire mask area
- if (this.frameDraw) {
- const c = document.createElement("canvas");
- c.width = Math.round(maskRect.width);
- c.height = Math.round(maskRect.height);
- const dCtx = c.getContext("2d");
- if (dCtx) this.frameDraw(dCtx, c.width, c.height);
- drawWithTransform(() => {
- ctx.drawImage(c, maskRect.x, maskRect.y, maskRect.width, maskRect.height);
- });
- } else {
- drawWithTransform(() => {
- ctx.drawImage(
- this.frameImage!,
- maskRect.x,
- maskRect.y,
- maskRect.width,
- maskRect.height,
- );
- });
- }
- return;
- }
-
- // Calculate frame dimensions from insets
- const screenW = maskRect.width;
- const screenH = maskRect.height;
- const frameW = screenW / (1 - insets.left - insets.right);
- const frameH = screenH / (1 - insets.top - insets.bottom);
- const frameX = maskRect.x - insets.left * frameW;
- const frameY = maskRect.y - insets.top * frameH;
-
- if (this.frameDraw) {
- // Draw at the exact export resolution — no bitmap scaling
- const c = document.createElement("canvas");
- c.width = Math.round(frameW);
- c.height = Math.round(frameH);
- const dCtx = c.getContext("2d");
- if (dCtx) this.frameDraw(dCtx, c.width, c.height);
- drawWithTransform(() => {
- ctx.drawImage(c, frameX, frameY, frameW, frameH);
- });
- } else {
- drawWithTransform(() => {
- ctx.drawImage(this.frameImage!, frameX, frameY, frameW, frameH);
- });
- }
- }
-
private drawWebcamOverlay(ctx: CanvasRenderingContext2D, width: number, height: number): void {
const webcam = this.config.webcam;
const webcamDecodedFrame = this.webcamDecodedFrame;
@@ -2623,8 +2249,5 @@ export class FrameRenderer {
this.webcamBubbleCanvas = null;
this.webcamBubbleCtx = null;
this.lastSyncedWebcamTime = null;
- this.frameImage = null;
- this.frameInsets = null;
- this.frameDraw = null;
}
}
diff --git a/src/lib/exporter/gifExporter.ts b/src/lib/exporter/gifExporter.ts
index 2630e592..d9e1b85e 100644
--- a/src/lib/exporter/gifExporter.ts
+++ b/src/lib/exporter/gifExporter.ts
@@ -88,7 +88,6 @@ interface GifExporterConfig {
cursorClickBounce?: number;
cursorClickBounceDuration?: number;
cursorSway?: number;
- frame?: string | null;
previewWidth?: number;
previewHeight?: number;
maxDecodeQueue?: number;
@@ -195,7 +194,6 @@ export function buildGifFrameRendererConfig(
cursorClickBounce: config.cursorClickBounce,
cursorClickBounceDuration: config.cursorClickBounceDuration,
cursorSway: config.cursorSway,
- frame: config.frame,
};
}
diff --git a/src/lib/exporter/modernFrameRenderer.ts b/src/lib/exporter/modernFrameRenderer.ts
index 325bb28f..b9eefea1 100644
--- a/src/lib/exporter/modernFrameRenderer.ts
+++ b/src/lib/exporter/modernFrameRenderer.ts
@@ -66,17 +66,6 @@ import {
isWebcamCropRegionDefault,
} from "@/components/video-editor/webcamOverlay";
import { getAssetPath, getExportableVideoUrl, getRenderableAssetUrl } from "@/lib/assetPath";
-import { extensionHost } from "@/lib/extensions";
-import {
- mapCursorToCanvasNormalized,
- mapSmoothedCursorToCanvasNormalized,
-} from "@/lib/extensions/cursorCoordinates";
-import {
- executeExtensionCursorEffects,
- executeExtensionRenderHooks,
- notifyCursorInteraction,
-} from "@/lib/extensions/renderHooks";
-import { applyCanvasSceneTransform } from "@/lib/extensions/sceneTransform";
import { drawSquircleOnCanvas, drawSquircleOnGraphics } from "@/lib/geometry/squircle";
import {
clampMediaTimeToDuration,
@@ -164,7 +153,6 @@ interface FrameRenderConfig {
cursorSway?: number;
zoomSmoothness?: number;
zoomClassicMode?: boolean;
- frame?: string | null;
nativeReadbackMode?: "pixels" | "canvas";
}
@@ -388,7 +376,6 @@ export class FrameRenderer {
private cameraContainer: Container | null = null;
private videoEffectsContainer: Container | null = null;
private videoContainer: Container | null = null;
- private frameContainer: Container | null = null;
private cursorContainer: Container | null = null;
private overlayContainer: Container | null = null;
private annotationContainer: Container | null = null;
@@ -438,20 +425,6 @@ export class FrameRenderer {
private captionSprite: Sprite | null = null;
private captionTextureSource: MutableVideoTextureSource | null = null;
private captionRenderKey: string | null = null;
- private frameSprite: Sprite | null = null;
- private frameImage: HTMLImageElement | null = null;
- private frameDraw:
- | ((ctx: CanvasRenderingContext2D, width: number, height: number) => void)
- | null = null;
- private frameInsets: {
- top: number;
- right: number;
- bottom: number;
- left: number;
- } | null = null;
- private frameRasterCanvas: HTMLCanvasElement | null = null;
- private frameRasterWidth = 0;
- private frameRasterHeight = 0;
private exportCompositeCanvas: ExportCompositeCanvasState | null = null;
private temporalCompositeCanvas: ExportCompositeCanvasState | null = null;
private outputCanvasOverride: HTMLCanvasElement | null = null;
@@ -481,9 +454,6 @@ export class FrameRenderer {
private retainedSceneBitmap: ImageBitmap | null = null;
private retainedBackgroundBitmapTimestamp: number | null = null;
private retainedBackgroundBitmap: ImageBitmap | null = null;
- private compositeCanvas: HTMLCanvasElement | null = null;
- private compositeCtx: CanvasRenderingContext2D | null = null;
- private lastEmittedClickTimeMs = -1;
private cleanupWebcamSource: (() => void) | null = null;
constructor(config: FrameRenderConfig) {
@@ -547,7 +517,6 @@ export class FrameRenderer {
this.cameraContainer = new Container();
this.videoEffectsContainer = new Container();
this.videoContainer = new Container();
- this.frameContainer = new Container();
this.cursorContainer = new Container();
this.overlayContainer = new Container();
this.annotationContainer = new Container();
@@ -565,7 +534,6 @@ export class FrameRenderer {
);
this.cameraContainer.addChild(this.videoEffectsContainer);
- this.cameraContainer.addChild(this.frameContainer);
this.cameraContainer.addChild(this.cursorContainer);
this.videoEffectsContainer.addChild(this.videoContainer);
this.videoEffectsContainer.filterArea = new Rectangle(
@@ -627,7 +595,6 @@ export class FrameRenderer {
}
await this.setupBackground();
- await this.setupFrame();
await this.setupWebcamSource();
this.annotationScaleFactor = this.calculateAnnotationScaleFactor();
@@ -643,18 +610,6 @@ export class FrameRenderer {
this.motionBlurFilter = new MotionBlurFilter([0, 0], 5, 0);
}
- this.compositeCanvas = document.createElement("canvas");
- this.compositeCanvas.width = this.config.width;
- this.compositeCanvas.height = this.config.height;
- this.compositeCtx = configureHighQuality2DContext(
- this.compositeCanvas.getContext("2d", {
- willReadFrequently: false,
- }),
- );
- if (!this.compositeCtx) {
- throw new Error("Failed to get 2D context for composite canvas");
- }
-
this.updateVideoEffectsFilterState();
console.log(`[FrameRenderer] Export renderer backend: ${this.rendererBackend}`);
@@ -2133,41 +2088,6 @@ export class FrameRenderer {
return getRenderableAssetUrl(wallpaperAsset);
}
- private async setupFrame(): Promise<void> {
- const frameId = this.config.frame;
- if (!frameId) {
- return;
- }
-
- const frames = extensionHost.getFrames();
- const frame = frames.find((candidate) => candidate.id === frameId);
- if (!frame) {
- console.warn(`[ModernFrameRenderer] Device frame "${frameId}" not found`);
- return;
- }
-
- this.frameInsets = frame.screenInsets;
-
- if (frame.draw) {
- this.frameDraw = frame.draw;
- return;
- }
-
- const image = new Image();
- image.crossOrigin = "anonymous";
- await new Promise<void>((resolve, reject) => {
- image.onload = () => resolve();
- image.onerror = () =>
- reject(
- new Error(
- `[ModernFrameRenderer] Failed to load device frame image: ${frameId}`,
- ),
- );
- image.src = frame.filePath;
- });
- this.frameImage = image;
- }
-
private async fallbackBackgroundForwardFrameSourceToMediaElement(): Promise<boolean> {
const sourceUrl = this.backgroundForwardFrameSourceUrl;
this.backgroundForwardFrameSource?.cancel();
@@ -3223,16 +3143,6 @@ export class FrameRenderer {
: null;
if (temporalSnapshot) {
- const sourceCanvas =
- this.outputCanvasOverride ?? this.ensureTemporalCompositeCanvas()?.canvas;
- if (sourceCanvas && this.shouldCompositeExtensionFrame()) {
- this.compositeExtensions(
- temporalSnapshot.timeMs,
- temporalSnapshot.cursorTimeMs,
- sourceCanvas,
- );
- this.outputCanvasOverride = this.compositeCanvas;
- }
return;
}
@@ -3311,228 +3221,6 @@ export class FrameRenderer {
this.outputCanvasOverride = null;
this.app.render();
- this.compositeExtensions(timeMs, cursorTimeMs);
- }
-
- private shouldCompositeExtensionFrame(): boolean {
- return (
- extensionHost.hasCursorEffects() ||
- extensionHost.hasRenderHooks("post-zoom") ||
- extensionHost.hasRenderHooks("post-cursor") ||
- extensionHost.hasRenderHooks("post-annotations") ||
- extensionHost.hasRenderHooks("final")
- );
- }
-
- private compositeExtensions(
- timeMs: number,
- cursorTimeMs: number,
- sourceCanvas?: CanvasImageSource,
- ): void {
- if (!this.app || !this.compositeCtx || !this.compositeCanvas) {
- return;
- }
-
- if (!this.shouldCompositeExtensionFrame()) {
- return;
- }
-
- this.compositeCtx.clearRect(0, 0, this.config.width, this.config.height);
- this.compositeCtx.drawImage(sourceCanvas ?? (this.app.canvas as HTMLCanvasElement), 0, 0);
-
- const maskRect = this.layoutCache?.maskRect;
- const smoothedCursor = mapSmoothedCursorToCanvasNormalized(
- this.cursorOverlay?.getSmoothedCursorSnapshot() ?? null,
- {
- maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- extensionHost.setSmoothedCursor(
- smoothedCursor
- ? {
- timeMs,
- cx: smoothedCursor.cx,
- cy: smoothedCursor.cy,
- trail: smoothedCursor.trail,
- }
- : null,
- );
- const rawCursor = this.getCursorPosition(cursorTimeMs);
- const hookParams = {
- width: this.config.width,
- height: this.config.height,
- timeMs,
- durationMs: 0,
- cursor: smoothedCursor
- ? {
- cx: smoothedCursor.cx,
- cy: smoothedCursor.cy,
- interactionType: rawCursor?.interactionType,
- }
- : rawCursor,
- smoothedCursor,
- videoLayout: maskRect
- ? {
- maskRect: {
- x: maskRect.x,
- y: maskRect.y,
- width: maskRect.width,
- height: maskRect.height,
- },
- borderRadius: this.config.borderRadius ?? 0,
- padding: this.config.padding ?? 0,
- }
- : undefined,
- zoom: {
- scale: this.animationState.scale,
- focusX: this.animationState.focusX,
- focusY: this.animationState.focusY,
- progress: this.animationState.progress,
- },
- shadow: {
- enabled: this.config.showShadow,
- intensity: this.config.shadowIntensity,
- },
- sceneTransform: {
- scale: this.animationState.appliedScale,
- x: this.animationState.x,
- y: this.animationState.y,
- },
- };
-
- this.compositeCtx.save();
- applyCanvasSceneTransform(this.compositeCtx, {
- scale: this.animationState.appliedScale,
- x: this.animationState.x,
- y: this.animationState.y,
- });
- executeExtensionRenderHooks("post-video", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-zoom", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-cursor", this.compositeCtx, hookParams);
- this.emitCursorInteractions(cursorTimeMs);
- executeExtensionCursorEffects(
- this.compositeCtx,
- timeMs,
- this.config.width,
- this.config.height,
- {
- zoom: hookParams.zoom,
- sceneTransform: hookParams.sceneTransform,
- videoLayout: hookParams.videoLayout,
- },
- );
- this.compositeCtx.restore();
-
- executeExtensionRenderHooks("post-webcam", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("post-annotations", this.compositeCtx, hookParams);
- executeExtensionRenderHooks("final", this.compositeCtx, hookParams);
- }
-
- private getCursorPosition(
- timeMs: number,
- ): { cx: number; cy: number; interactionType?: string } | null {
- const telemetry = this.config.cursorTelemetry;
- if (!telemetry || telemetry.length === 0) {
- return null;
- }
-
- // Clamp to first/last sample when out of range
- if (timeMs <= telemetry[0].timeMs) {
- const s = telemetry[0];
- return mapCursorToCanvasNormalized(
- { cx: s.cx, cy: s.cy, interactionType: s.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- }
- if (timeMs >= telemetry[telemetry.length - 1].timeMs) {
- const s = telemetry[telemetry.length - 1];
- return mapCursorToCanvasNormalized(
- { cx: s.cx, cy: s.cy, interactionType: s.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- }
-
- // Binary search for surrounding samples
- let lo = 0;
- let hi = telemetry.length - 1;
- while (lo < hi - 1) {
- const mid = (lo + hi) >> 1;
- if (telemetry[mid].timeMs <= timeMs) {
- lo = mid;
- } else {
- hi = mid;
- }
- }
-
- const a = telemetry[lo];
- const b = telemetry[hi];
- const span = b.timeMs - a.timeMs;
-
- // Linear interpolation between samples
- const t = span > 0 ? (timeMs - a.timeMs) / span : 0;
- const cx = a.cx + (b.cx - a.cx) * t;
- const cy = a.cy + (b.cy - a.cy) * t;
-
- return mapCursorToCanvasNormalized(
- { cx, cy, interactionType: a.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- }
-
- private emitCursorInteractions(timeMs: number): void {
- const telemetry = this.config.cursorTelemetry;
- if (!telemetry || telemetry.length === 0) {
- return;
- }
-
- for (const point of telemetry) {
- if (point.timeMs > timeMs) {
- break;
- }
- if (point.timeMs < timeMs - 100) {
- continue;
- }
- if (!point.interactionType || point.interactionType === "move") {
- continue;
- }
- if (point.timeMs === this.lastEmittedClickTimeMs) {
- continue;
- }
-
- const mappedCursor = mapCursorToCanvasNormalized(
- { cx: point.cx, cy: point.cy, interactionType: point.interactionType },
- {
- maskRect: this.layoutCache?.maskRect,
- canvasWidth: this.config.width,
- canvasHeight: this.config.height,
- },
- );
- if (!mappedCursor) {
- continue;
- }
-
- this.lastEmittedClickTimeMs = point.timeMs;
- notifyCursorInteraction(
- point.timeMs,
- mappedCursor.cx,
- mappedCursor.cy,
- point.interactionType,
- );
- }
}
private updateLayout(): void {
@@ -3552,7 +3240,7 @@ export class FrameRenderer {
width,
height,
padding,
- frameInsets: this.frameInsets,
+ frameInsets: null,
cropRegion,
videoWidth,
videoHeight,
@@ -3597,85 +3285,6 @@ export class FrameRenderer {
sourceCrop: cropRegion,
},
};
-
- this.updateFrameLayout();
- }
-
- private updateFrameLayout(): void {
- if (!this.frameContainer || !this.layoutCache) {
- return;
- }
-
- if (!this.frameImage && !this.frameDraw) {
- if (this.frameSprite) {
- const texture = this.frameSprite.texture;
- this.frameContainer.removeChild(this.frameSprite);
- this.frameSprite.destroy();
- texture.destroy(true);
- this.frameSprite = null;
- }
- return;
- }
-
- const maskRect = this.layoutCache.maskRect;
- const insets = this.frameInsets;
- let frameX = maskRect.x;
- let frameY = maskRect.y;
- let frameWidth = maskRect.width;
- let frameHeight = maskRect.height;
-
- if (insets) {
- const screenWidth = maskRect.width;
- const screenHeight = maskRect.height;
- frameWidth = screenWidth / (1 - insets.left - insets.right);
- frameHeight = screenHeight / (1 - insets.top - insets.bottom);
- frameX = maskRect.x - insets.left * frameWidth;
- frameY = maskRect.y - insets.top * frameHeight;
- }
-
- if (this.frameDraw) {
- const targetWidth = Math.max(1, Math.round(frameWidth));
- const targetHeight = Math.max(1, Math.round(frameHeight));
- if (
- !this.frameRasterCanvas ||
- this.frameRasterWidth !== targetWidth ||
- this.frameRasterHeight !== targetHeight
- ) {
- const canvas = document.createElement("canvas");
- canvas.width = targetWidth;
- canvas.height = targetHeight;
- const context = configureHighQuality2DContext(canvas.getContext("2d"));
- if (!context) {
- return;
- }
- this.frameDraw(context, targetWidth, targetHeight);
- this.frameRasterCanvas = canvas;
- this.frameRasterWidth = targetWidth;
- this.frameRasterHeight = targetHeight;
-
- const texture = Texture.from(canvas);
- if (!this.frameSprite) {
- this.frameSprite = new Sprite(texture);
- this.frameContainer.addChild(this.frameSprite);
- } else {
- const previousTexture = this.frameSprite.texture;
- this.frameSprite.texture = texture;
- previousTexture.destroy(true);
- }
- }
- } else if (this.frameImage && !this.frameSprite) {
- const texture = Texture.from(this.frameImage);
- this.frameSprite = new Sprite(texture);
- this.frameContainer.addChild(this.frameSprite);
- }
-
- if (!this.frameSprite) {
- return;
- }
-
- this.frameSprite.position.set(frameX, frameY);
- this.frameSprite.width = frameWidth;
- this.frameSprite.height = frameHeight;
}
private updateVideoShadowLayout(layout: {
@@ -3832,10 +3441,6 @@ export class FrameRenderer {
throw new Error("Renderer not initialized");
}
- if (this.shouldCompositeExtensionFrame() && this.compositeCanvas) {
- return this.compositeCanvas;
- }
-
return this.outputCanvasOverride ?? (this.app.canvas as HTMLCanvasElement);
}
@@ -3844,9 +3449,7 @@ export class FrameRenderer {
return null;
}
- const finalCanvas =
- this.outputCanvasOverride ??
- (this.shouldCompositeExtensionFrame() ? this.compositeCanvas : null);
+ const finalCanvas = this.outputCanvasOverride;
if (finalCanvas) {
const context = finalCanvas.getContext("2d");
@@ -3879,9 +3482,6 @@ export class FrameRenderer {
if (this.captionSprite?.texture) {
texturesToDestroy.add(this.captionSprite.texture);
}
- if (this.frameSprite?.texture) {
- texturesToDestroy.add(this.frameSprite.texture);
- }
for (const layer of this.videoShadowLayers) {
if (layer.sprite?.texture) {
texturesToDestroy.add(layer.sprite.texture);
@@ -3926,7 +3526,6 @@ export class FrameRenderer {
this.cameraContainer = null;
this.videoEffectsContainer = null;
this.videoContainer = null;
- this.frameContainer = null;
this.cursorContainer = null;
this.overlayContainer = null;
this.annotationContainer = null;
@@ -3996,13 +3595,6 @@ export class FrameRenderer {
this.captionSprite = null;
this.captionTextureSource = null;
this.captionRenderKey = null;
- this.frameSprite = null;
- this.frameImage = null;
- this.frameDraw = null;
- this.frameInsets = null;
- this.frameRasterCanvas = null;
- this.frameRasterWidth = 0;
- this.frameRasterHeight = 0;
this.exportCompositeCanvas = null;
this.temporalCompositeCanvas = null;
this.outputCanvasOverride = null;
diff --git a/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts b/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
index cdc62d12..a1783d8b 100644
--- a/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
+++ b/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
@@ -288,21 +288,6 @@ describe("ModernVideoExporter native static-layout eligibility", () => {
).toBe("unsupported-cursor-click-effect");
});
- it("reports frame overlays as the remaining native overlay blocker", () => {
- const exporter = createExporter({ frame: "macbook" });
-
- expect(
- exporter.getNativeStaticLayoutSkipReason(
- {
- audioMode: "copy-source",
- audioSourcePath: "recording.mp4",
- },
- videoInfo,
- 60,
- ),
- ).toBe("unsupported-frame-overlay");
- });
-
it("allows native static-layout with background blur", () => {
const exporter = createExporter({ backgroundBlur: 12 });
@@ -385,7 +370,6 @@ describe("ModernVideoExporter native static-layout eligibility", () => {
annotationRegions: [{ id: "annotation-1", startMs: 0, endMs: 1_000 }],
autoCaptions: [{ id: "caption-1", text: "hello", startMs: 0, endMs: 1_000 }],
webcam: { enabled: true },
- frame: "macbook",
cropRegion: { x: 0.1, y: 0, width: 0.9, height: 1 },
});
@@ -404,7 +388,6 @@ describe("ModernVideoExporter native static-layout eligibility", () => {
"unsupported-annotation-overlay",
"unsupported-caption-overlay",
"unsupported-webcam-source",
- "unsupported-frame-overlay",
]);
});
diff --git a/src/lib/exporter/modernVideoExporter.ts b/src/lib/exporter/modernVideoExporter.ts
index 2f889872..73df81ee 100644
--- a/src/lib/exporter/modernVideoExporter.ts
+++ b/src/lib/exporter/modernVideoExporter.ts
@@ -44,7 +44,6 @@ import {
getWebcamOverlaySizePx,
isWebcamCropRegionDefault,
} from "@/components/video-editor/webcamOverlay";
-import { extensionHost } from "@/lib/extensions";
import { getEffectiveVideoStreamDurationSeconds } from "@/lib/mediaTiming";
import {
DEFAULT_WALLPAPER_PATH,
@@ -149,7 +148,6 @@ interface VideoExporterConfig extends ExportConfig {
cursorSway?: number;
zoomSmoothness?: number;
zoomClassicMode?: boolean;
- frame?: string | null;
audioRegions?: AudioRegion[];
clipRegions?: ClipRegion[];
sourceAudioFallbackPaths?: string[];
@@ -643,7 +641,6 @@ export class ModernVideoExporter {
cursorSway: this.config.cursorSway,
zoomSmoothness: this.config.zoomSmoothness,
zoomClassicMode: this.config.zoomClassicMode,
- frame: this.config.frame,
});
await this.renderer.initialize();
this.rendererInitTimeMs = this.getNowMs() - stageStartedAt;
@@ -720,10 +717,6 @@ export class ModernVideoExporter {
frameIndex++;
this.processedFrameCount = frameIndex;
this.reportProgress(frameIndex, totalFrames, "extracting");
- extensionHost.emitEvent({
- type: "export:frame",
- data: { frameIndex, totalFrames },
- });
},
);
this.decodeLoopTimeMs = this.getNowMs() - decodeLoopStartedAt;
@@ -1576,10 +1569,6 @@ export class ModernVideoExporter {
reasons.push("unsupported-rectangular-webcam-overlay");
}
- if (this.config.frame) {
- reasons.push("unsupported-frame-overlay");
- }
-
const crop = this.config.cropRegion;
if (
!Number.isFinite(crop.x) ||
@@ -2249,7 +2238,6 @@ export class ModernVideoExporter {
speedRegions: this.config.speedRegions?.length ?? 0,
audioRegions: this.config.audioRegions?.length ?? 0,
annotationRegions: this.config.annotationRegions?.length ?? 0,
- hasFrame: Boolean(this.config.frame),
backgroundBlur: this.config.backgroundBlur,
hasCursorOverlay:
this.config.showCursor === true &&
diff --git a/src/lib/exporter/videoExporter.ts b/src/lib/exporter/videoExporter.ts
index 11ea3b1e..9349627c 100644
--- a/src/lib/exporter/videoExporter.ts
+++ b/src/lib/exporter/videoExporter.ts
@@ -91,7 +91,6 @@ interface VideoExporterConfig extends ExportConfig {
cursorClickBounceDuration?: number;
cursorSway?: number;
zoomSmoothness?: number;
- frame?: string | null;
audioRegions?: AudioRegion[];
clipRegions?: ClipRegion[];
sourceAudioFallbackPaths?: string[];
@@ -266,7 +265,6 @@ export class VideoExporter {
cursorClickBounceDuration: this.config.cursorClickBounceDuration,
cursorSway: this.config.cursorSway,
zoomSmoothness: this.config.zoomSmoothness,
- frame: this.config.frame,
});
await this.renderer.initialize();
diff --git a/src/lib/extensions/cursorCoordinates.ts b/src/lib/extensions/cursorCoordinates.ts
deleted file mode 100644
index 7df54828..00000000
--- a/src/lib/extensions/cursorCoordinates.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-interface CursorLike {
- cx: number;
- cy: number;
- interactionType?: string;
-}
-
-export interface SmoothedCursorSnapshot {
- cx: number;
- cy: number;
- trail: Array<{ cx: number; cy: number }>;
-}
-
-interface MaskRectLike {
- x: number;
- y: number;
- width: number;
- height: number;
-}
-
-function clamp01(value: number): number {
- if (!Number.isFinite(value)) {
- return 0.5;
- }
-
- return Math.min(1, Math.max(0, value));
-}
-
-export function mapCursorToCanvasNormalized<T extends CursorLike>(
- cursor: T | null,
- params: {
- maskRect?: MaskRectLike | null;
- canvasWidth: number;
- canvasHeight: number;
- },
-): T | null {
- if (!cursor) {
- return null;
- }
-
- const { maskRect, canvasWidth, canvasHeight } = params;
- if (
- !maskRect ||
- maskRect.width <= 0 ||
- maskRect.height <= 0 ||
- canvasWidth <= 0 ||
- canvasHeight <= 0
- ) {
- return {
- ...cursor,
- cx: clamp01(cursor.cx),
- cy: clamp01(cursor.cy),
- };
- }
-
- const pixelX = maskRect.x + clamp01(cursor.cx) * maskRect.width;
- const pixelY = maskRect.y + clamp01(cursor.cy) * maskRect.height;
-
- return {
- ...cursor,
- cx: clamp01(pixelX / canvasWidth),
- cy: clamp01(pixelY / canvasHeight),
- };
-}
-
-export function mapSmoothedCursorToCanvasNormalized(
- cursor: SmoothedCursorSnapshot | null,
- params: {
- maskRect?: MaskRectLike | null;
- canvasWidth: number;
- canvasHeight: number;
- },
-): SmoothedCursorSnapshot | null {
- if (!cursor) {
- return null;
- }
-
- const mappedCursor = mapCursorToCanvasNormalized({ cx: cursor.cx, cy: cursor.cy }, params);
- if (!mappedCursor) {
- return null;
- }
-
- return {
- cx: mappedCursor.cx,
- cy: mappedCursor.cy,
- trail: cursor.trail
- .map((point) => mapCursorToCanvasNormalized(point, params))
- .filter((point): point is { cx: number; cy: number } => point !== null),
- };
-}
diff --git a/src/lib/extensions/extensionHost.ts b/src/lib/extensions/extensionHost.ts
deleted file mode 100644
index f0a69163..00000000
--- a/src/lib/extensions/extensionHost.ts
+++ /dev/null
@@ -1,487 +0,0 @@
-/**
- * Disabled extension-host compatibility surface.
- *
- * The editor still calls several rendering and state methods while legacy
- * extension contributions are phased out. Activation is deliberately blocked,
- * so these methods remain empty unless old in-memory contributions are cleaned up.
- */
-
-import type {
- ContributedCursorStyle,
- ContributedWallpaper,
- CursorEffectContext,
- CursorEffectFn,
- ExtensionEvent,
- ExtensionEventHandler,
- ExtensionEventType,
- ExtensionInfo,
- ExtensionSettingsPanel,
- FrameInstance,
- RecordlyExtensionModule,
- RenderHookContext,
- RenderHookFn,
- RenderHookPhase,
-} from "./types";
-
-const EXTENSION_SETTINGS_STORAGE_KEY = "recordly.extension-settings.v1";
-
-interface RegisteredRenderHook {
- extensionId: string;
- phase: RenderHookPhase;
- hook: RenderHookFn;
-}
-
-interface RegisteredCursorEffect {
- extensionId: string;
- effect: CursorEffectFn;
-}
-
-interface RegisteredSettingsPanel {
- extensionId: string;
- panel: ExtensionSettingsPanel;
-}
-
-interface RegisteredWallpaper {
- id: string;
- extensionId: string;
- wallpaper: ContributedWallpaper;
- /** Resolved absolute URL to the wallpaper file */
- resolvedUrl: string;
- /** Resolved absolute URL to the thumbnail (or resolvedUrl if absent) */
- resolvedThumbnailUrl: string;
-}
-
-interface RegisteredCursorStyle {
- id: string;
- extensionId: string;
- cursorStyle: ContributedCursorStyle;
- /** Resolved absolute URL to the default cursor image */
- resolvedDefaultUrl: string;
- /** Resolved absolute URL to the click image (if provided) */
- resolvedClickUrl?: string;
-}
-
-interface ActiveExtension {
- info: ExtensionInfo;
- module: RecordlyExtensionModule;
- disposables: (() => void)[];
-}
-
-/**
- * The Extension Host manages all loaded extensions and provides
- * access to their registered hooks, effects, and settings.
- */
-export class ExtensionHost {
- private activeExtensions = new Map<string, ActiveExtension>();
- private renderHooks: RegisteredRenderHook[] = [];
- private cursorEffects: RegisteredCursorEffect[] = [];
- private frames: FrameInstance[] = [];
- private eventHandlers = new Map<
- ExtensionEventType,
- { extensionId: string; handler: ExtensionEventHandler }[]
- >();
- private settingsPanels: RegisteredSettingsPanel[] = [];
- private wallpapers: RegisteredWallpaper[] = [];
- private cursorStyles: RegisteredCursorStyle[] = [];
- private extensionSettings = new Map<string, Record<string, unknown>>();
- private settingChangeCallbacks = new Map<
- string,
- Set<(settingId: string, value: unknown) => void>
- >();
- private listeners = new Set<() => void>();
- private fullSettingsStore: Record<string, Record<string, unknown>> | null = null;
- private persistTimeout: ReturnType<typeof setTimeout> | null = null;
-
- // Retained for the editor's existing video-info query path.
- private _videoInfo: { width: number; height: number; durationMs: number; fps: number } | null =
- null;
-
- constructor() {
- if (typeof window !== "undefined") {
- window.addEventListener("beforeunload", () => {
- this.flushPersistedSettings();
- });
- }
- }
-
- /**
- * Activate an extension given its info and resolved module URL.
- */
- async activateExtension(info: ExtensionInfo, moduleUrl: string): Promise<void> {
- void moduleUrl;
- throw new Error(`Extensions are no longer available in Recordly (${info.manifest.id}).`);
- }
-
- /**
- * Deactivate an extension by ID.
- */
- async deactivateExtension(extensionId: string): Promise<void> {
- const active = this.activeExtensions.get(extensionId);
- if (!active) return;
-
- try {
- await active.module.deactivate?.();
- } catch (err) {
- console.warn(`[extensions] Error during deactivate of ${extensionId}:`, err);
- }
-
- // Clean up all disposables (unregister hooks, effects, handlers)
- for (const dispose of active.disposables) {
- try {
- dispose();
- } catch {
- /* ignore */
- }
- }
-
- this.activeExtensions.delete(extensionId);
- this.flushPersistedSettings();
- this.notifyListeners();
- console.log(`[extensions] Deactivated: ${extensionId}`);
- }
-
- /**
- * Deactivate all extensions.
- */
- async deactivateAll(): Promise<void> {
- const ids = Array.from(this.activeExtensions.keys());
- for (const id of ids) {
- await this.deactivateExtension(id);
- }
- this.flushPersistedSettings();
- }
-
- // ---------------------------------------------------------------------------
- // Render Pipeline Integration
- // ---------------------------------------------------------------------------
-
- /**
- * Execute all render hooks for a given phase.
- */
- executeRenderHooks(phase: RenderHookPhase, context: RenderHookContext): void {
- const hooks = this.renderHooks.filter((h) => h.phase === phase);
- for (const hook of hooks) {
- context.ctx.save();
- try {
- hook.hook(context);
- } catch (err) {
- console.warn(
- `[extensions] Render hook error (${hook.extensionId}, ${phase}):`,
- err,
- );
- } finally {
- context.ctx.restore();
- }
- }
- }
-
- /**
- * Execute all cursor effects. Returns true if any effect is still animating.
- */
- executeCursorEffects(context: CursorEffectContext): boolean {
- let anyActive = false;
- for (const effect of this.cursorEffects) {
- context.ctx.save();
- try {
- const stillActive = effect.effect(context);
- if (stillActive) anyActive = true;
- } catch (err) {
- console.warn(`[extensions] Cursor effect error (${effect.extensionId}):`, err);
- } finally {
- context.ctx.restore();
- }
- }
- return anyActive;
- }
-
- /**
- * Emit an event to all registered handlers.
- */
- emitEvent(event: ExtensionEvent): void {
- const handlers = this.eventHandlers.get(event.type);
- if (!handlers) return;
-
- for (const { handler } of handlers) {
- try {
- handler(event);
- } catch (err) {
- console.warn(`[extensions] Event handler error (${event.type}):`, err);
- }
- }
- }
-
- // ---------------------------------------------------------------------------
- // Queries
- // ---------------------------------------------------------------------------
-
- getActiveExtensions(): ExtensionInfo[] {
- return Array.from(this.activeExtensions.values()).map((a) => a.info);
- }
-
- /** Quick snapshot of video info for callers that need durationMs etc. */
- getVideoInfoSnapshot(): {
- width: number;
- height: number;
- durationMs: number;
- fps: number;
- } | null {
- return this._videoInfo;
- }
-
- getSettingsPanels(): RegisteredSettingsPanel[] {
- return [...this.settingsPanels];
- }
-
- hasRenderHooks(phase: RenderHookPhase): boolean {
- return this.renderHooks.some((h) => h.phase === phase);
- }
-
- hasCursorEffects(): boolean {
- return this.cursorEffects.length > 0;
- }
-
- getExtensionSetting(extensionId: string, settingId: string): unknown {
- this.ensureExtensionSettingsLoaded(extensionId);
- return this.extensionSettings.get(extensionId)?.[settingId];
- }
-
- setExtensionSetting(extensionId: string, settingId: string, value: unknown): void {
- this.ensureExtensionSettingsLoaded(extensionId);
- this.extensionSettings.get(extensionId)![settingId] = value;
- this.persistExtensionSettings(extensionId);
- // Notify per-extension setting change listeners
- const cbs = this.settingChangeCallbacks.get(extensionId);
- if (cbs) {
- for (const cb of cbs) {
- try {
- cb(settingId, value);
- } catch {
- /* ignore */
- }
- }
- }
- this.notifyListeners();
- }
-
- /**
- * Get all registered device frames from active extensions.
- */
- getFrames(): FrameInstance[] {
- return [...this.frames];
- }
-
- /**
- * Get all contributed wallpapers from active extensions.
- */
- getContributedWallpapers(): RegisteredWallpaper[] {
- return [...this.wallpapers];
- }
-
- /**
- * Get all contributed cursor styles from active extensions.
- */
- getContributedCursorStyles(): RegisteredCursorStyle[] {
- return [...this.cursorStyles];
- }
-
- /**
- * Subscribe to changes in extensions (activation/deactivation).
- */
- onChange(listener: () => void): () => void {
- this.listeners.add(listener);
- return () => this.listeners.delete(listener);
- }
-
- // ---------------------------------------------------------------------------
- // Legacy shared-state setters retained until their editor call sites are removed.
- // ---------------------------------------------------------------------------
-
- setVideoInfo(
- info: { width: number; height: number; durationMs: number; fps: number } | null,
- ): void {
- this._videoInfo = info;
- }
-
- setVideoLayout(
- layout: {
- maskRect: { x: number; y: number; width: number; height: number };
- canvasWidth: number;
- canvasHeight: number;
- borderRadius: number;
- padding: number | { top: number; right: number; bottom: number; left: number };
- } | null,
- ): void {
- void layout;
- }
-
- setZoomState(
- state: { scale: number; focusX: number; focusY: number; progress: number } | null,
- ): void {
- void state;
- }
-
- setShadowConfig(config: { enabled: boolean; intensity: number }): void {
- void config;
- }
-
- setCursorTelemetry(
- telemetry: Array<{
- timeMs: number;
- cx: number;
- cy: number;
- interactionType?: string;
- pressure?: number;
- }>,
- ): void {
- void telemetry;
- }
-
- setSmoothedCursor(
- cursor: {
- timeMs: number;
- cx: number;
- cy: number;
- trail: Array<{ cx: number; cy: number }>;
- } | null,
- ): void {
- void cursor;
- }
-
- setKeystrokeEvents(events: Array<{ timeMs: number; key: string; modifiers: string[] }>): void {
- void events;
- }
-
- setActiveFrame(frameId: string | null): void {
- void frameId;
- }
-
- setPlaybackState(
- state: { currentTimeMs: number; durationMs: number; isPlaying: boolean } | null,
- ): void {
- void state;
- }
-
- // ---------------------------------------------------------------------------
- // Private
- // ---------------------------------------------------------------------------
-
- private notifyListeners(): void {
- for (const listener of this.listeners) {
- try {
- listener();
- } catch {
- /* ignore */
- }
- }
- }
-
- private readPersistedSettingsStore(): Record<string, Record<string, unknown>> {
- if (typeof window === "undefined" || !window.localStorage) {
- return {};
- }
-
- try {
- const raw = window.localStorage.getItem(EXTENSION_SETTINGS_STORAGE_KEY);
- if (!raw) {
- return {};
- }
-
- const parsed = JSON.parse(raw);
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
- return {};
- }
-
- return parsed as Record<string, Record<string, unknown>>;
- } catch {
- return {};
- }
- }
-
- private writePersistedSettingsStore(store: Record<string, Record<string, unknown>>): void {
- if (typeof window === "undefined" || !window.localStorage) {
- return;
- }
-
- try {
- window.localStorage.setItem(EXTENSION_SETTINGS_STORAGE_KEY, JSON.stringify(store));
- } catch {
- // Ignore storage quota / privacy mode failures.
- }
- }
-
- private getFullSettingsStore(): Record<string, Record<string, unknown>> {
- if (this.fullSettingsStore) {
- return this.fullSettingsStore;
- }
- this.fullSettingsStore = this.readPersistedSettingsStore();
- return this.fullSettingsStore;
- }
-
- private ensureExtensionSettingsLoaded(extensionId: string): void {
- if (this.extensionSettings.has(extensionId)) {
- return;
- }
-
- const store = this.getFullSettingsStore();
- const persisted = store[extensionId];
- const normalized =
- persisted && typeof persisted === "object" && !Array.isArray(persisted)
- ? { ...persisted }
- : {};
-
- this.extensionSettings.set(extensionId, normalized);
- }
-
- private persistExtensionSettings(extensionId: string): void {
- const store = this.getFullSettingsStore();
- const settings = this.extensionSettings.get(extensionId) ?? {};
-
- if (Object.keys(settings).length === 0) {
- delete store[extensionId];
- } else {
- store[extensionId] = { ...settings };
- }
-
- // Debounce the actual write to localStorage to avoid blocking the UI thread during rapid changes
- if (this.persistTimeout) {
- clearTimeout(this.persistTimeout);
- }
- this.persistTimeout = setTimeout(() => {
- this.writePersistedSettingsStore(store);
- this.persistTimeout = null;
- }, 500);
- }
-
- private flushPersistedSettings(): void {
- if (this.persistTimeout) {
- clearTimeout(this.persistTimeout);
- this.persistTimeout = null;
- }
- this.writePersistedSettingsStore(this.getFullSettingsStore());
- }
-
- async syncConfiguredExtensions(discovered: ExtensionInfo[]): Promise<void> {
- void discovered;
- await this.deactivateAll();
- }
-
- // ---------------------------------------------------------------------------
- // Auto-Activation (idempotent — safe to call from multiple places)
- // ---------------------------------------------------------------------------
-
- private _autoActivatePromise: Promise<void> | null = null;
-
- /**
- * Discover and activate all builtin extensions. Idempotent — only runs
- * the discovery/activation sequence once no matter how many callers invoke it.
- */
- autoActivateBuiltins(): Promise<void> {
- this._autoActivatePromise ??= Promise.resolve();
- return this._autoActivatePromise;
- }
-}
-
-/**
- * Singleton extension host instance for the renderer process.
- */
-export const extensionHost = new ExtensionHost();
diff --git a/src/lib/extensions/fileUrls.ts b/src/lib/extensions/fileUrls.ts
deleted file mode 100644
index 9c49dc21..00000000
--- a/src/lib/extensions/fileUrls.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-const WINDOWS_ABSOLUTE_PATH = /^[a-zA-Z]:[\\/]/;
-
-function ensureTrailingSlash(value: string): string {
- return value.endsWith("/") ? value : `${value}/`;
-}
-
-function trimTrailingSlash(value: string): string {
- return value.endsWith("/") ? value.slice(0, -1) : value;
-}
-
-function toDirectoryFileUrl(directoryPath: string): URL {
- const normalized = directoryPath.replace(/\\/g, "/");
-
- if (normalized.startsWith("file://")) {
- return new URL(ensureTrailingSlash(normalized));
- }
-
- if (normalized.startsWith("/")) {
- return new URL(`file://${ensureTrailingSlash(normalized)}`);
- }
-
- if (WINDOWS_ABSOLUTE_PATH.test(normalized)) {
- return new URL(`file:///${ensureTrailingSlash(normalized)}`);
- }
-
- return new URL(`file://${ensureTrailingSlash(normalized)}`);
-}
-
-export function resolveExtensionRelativeFileUrl(
- extensionPath: string,
- relativePath: string,
-): string {
- const baseUrl = toDirectoryFileUrl(extensionPath);
- const basePath = trimTrailingSlash(baseUrl.pathname);
- const resolvedUrl = new URL(relativePath, baseUrl);
- const resolvedPath = trimTrailingSlash(resolvedUrl.pathname);
-
- if (resolvedPath !== basePath && !resolvedPath.startsWith(`${basePath}/`)) {
- throw new Error(`Invalid extension path: ${relativePath}`);
- }
-
- return resolvedUrl.toString();
-}
-
-export function createExtensionModuleUrl(extensionPath: string, entryPoint: string): string {
- const base = resolveExtensionRelativeFileUrl(extensionPath, entryPoint);
- // Cache-bust so re-installs / updates load the fresh module
- return `${base}?v=${Date.now()}`;
-}
diff --git a/src/lib/extensions/iconDraw.ts b/src/lib/extensions/iconDraw.ts
deleted file mode 100644
index dd11574e..00000000
--- a/src/lib/extensions/iconDraw.ts
+++ /dev/null
@@ -1,209 +0,0 @@
-import * as PhosphorIcons from "@phosphor-icons/react";
-
-type IconWeight = "thin" | "light" | "regular" | "bold" | "fill";
-const missingIconPathCache = new Set<string>();
-
-function resolveIconComponent(name: string): {
- iconName: string;
- icon: { render?: (props: { weight: string }, ref: unknown) => unknown };
-} | null {
- const iconLibrary = PhosphorIcons as Record<string, unknown>;
- const iconName =
- typeof iconLibrary[name] !== "undefined"
- ? name
- : typeof iconLibrary[`${name}Icon`] !== "undefined"
- ? `${name}Icon`
- : null;
- if (!iconName) {
- return null;
- }
-
- return {
- iconName,
- icon: iconLibrary[iconName] as {
- render?: (props: { weight: string }, ref: unknown) => unknown;
- },
- };
-}
-
-function toNumber(value: unknown): number | null {
- if (typeof value === "number" && Number.isFinite(value)) return value;
- if (typeof value === "string") {
- const n = Number(value);
- return Number.isFinite(n) ? n : null;
- }
- return null;
-}
-
-function parsePointList(value: unknown): Array<{ x: number; y: number }> {
- if (typeof value !== "string") return [];
- const nums = value
- .trim()
- .split(/[\s,]+/)
- .map((part) => Number(part))
- .filter((n) => Number.isFinite(n));
- const points: Array<{ x: number; y: number }> = [];
- for (let i = 0; i + 1 < nums.length; i += 2) {
- points.push({ x: nums[i], y: nums[i + 1] });
- }
- return points;
-}
-
-function collectPathData(node: unknown, output: Path2D): number {
- if (!node) return 0;
- if (Array.isArray(node)) {
- let added = 0;
- for (const child of node) added += collectPathData(child, output);
- return added;
- }
- if (typeof node !== "object") return 0;
-
- const maybeNode = node as {
- type?: unknown;
- props?: {
- d?: unknown;
- children?: unknown;
- x1?: unknown;
- y1?: unknown;
- x2?: unknown;
- y2?: unknown;
- points?: unknown;
- cx?: unknown;
- cy?: unknown;
- r?: unknown;
- rx?: unknown;
- ry?: unknown;
- x?: unknown;
- y?: unknown;
- width?: unknown;
- height?: unknown;
- };
- };
- const props = maybeNode.props;
-
- let added = 0;
- if (maybeNode.type === "path" && typeof props?.d === "string") {
- output.addPath(new Path2D(props.d));
- added += 1;
- } else if (maybeNode.type === "line") {
- const x1 = toNumber(props?.x1);
- const y1 = toNumber(props?.y1);
- const x2 = toNumber(props?.x2);
- const y2 = toNumber(props?.y2);
- if (x1 !== null && y1 !== null && x2 !== null && y2 !== null) {
- output.moveTo(x1, y1);
- output.lineTo(x2, y2);
- added += 1;
- }
- } else if (maybeNode.type === "polyline" || maybeNode.type === "polygon") {
- const points = parsePointList(props?.points);
- if (points.length > 0) {
- output.moveTo(points[0].x, points[0].y);
- for (let i = 1; i < points.length; i += 1) {
- output.lineTo(points[i].x, points[i].y);
- }
- if (maybeNode.type === "polygon") {
- output.closePath();
- }
- added += 1;
- }
- } else if (maybeNode.type === "circle") {
- const cx = toNumber(props?.cx);
- const cy = toNumber(props?.cy);
- const r = toNumber(props?.r);
- if (cx !== null && cy !== null && r !== null) {
- output.arc(cx, cy, r, 0, Math.PI * 2);
- added += 1;
- }
- } else if (maybeNode.type === "ellipse") {
- const cx = toNumber(props?.cx);
- const cy = toNumber(props?.cy);
- const rx = toNumber(props?.rx);
- const ry = toNumber(props?.ry);
- if (cx !== null && cy !== null && rx !== null && ry !== null) {
- output.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2);
- added += 1;
- }
- } else if (maybeNode.type === "rect") {
- const x = toNumber(props?.x) ?? 0;
- const y = toNumber(props?.y) ?? 0;
- const width = toNumber(props?.width);
- const height = toNumber(props?.height);
- const rxRaw = toNumber(props?.rx);
- const ryRaw = toNumber(props?.ry);
- if (width !== null && height !== null) {
- const resolvedRxRaw = rxRaw ?? ryRaw ?? 0;
- const resolvedRyRaw = ryRaw ?? rxRaw ?? 0;
- const rx = Math.max(0, Math.min(resolvedRxRaw, width / 2));
- const ry = Math.max(0, Math.min(resolvedRyRaw, height / 2));
- if (rx === 0 && ry === 0) {
- output.rect(x, y, width, height);
- } else {
- const right = x + width;
- const bottom = y + height;
- output.moveTo(x + rx, y);
- output.lineTo(right - rx, y);
- output.ellipse(right - rx, y + ry, rx, ry, 0, -Math.PI / 2, 0);
- output.lineTo(right, bottom - ry);
- output.ellipse(right - rx, bottom - ry, rx, ry, 0, 0, Math.PI / 2);
- output.lineTo(x + rx, bottom);
- output.ellipse(x + rx, bottom - ry, rx, ry, 0, Math.PI / 2, Math.PI);
- output.lineTo(x, y + ry);
- output.ellipse(x + rx, y + ry, rx, ry, 0, Math.PI, (3 * Math.PI) / 2);
- output.closePath();
- }
- added += 1;
- }
- }
- added += collectPathData(props?.children, output);
- return added;
-}
-
-export function resolveIconPath(
- name: string,
- weight: IconWeight,
- cache: Map<string, Path2D>,
-): Path2D | null {
- const cacheKey = `${name}:${weight}`;
- if (missingIconPathCache.has(cacheKey)) {
- return null;
- }
- const cached = cache.get(cacheKey);
- if (cached) {
- return cached;
- }
-
- const resolved = resolveIconComponent(name);
- if (!resolved) {
- console.warn(`[extensions] Icon ${name} not found in Phosphor library`);
- missingIconPathCache.add(cacheKey);
- return null;
- }
-
- try {
- const element = resolved.icon.render?.({ weight }, null) as
- | { props?: { weights?: Map<string, { props?: { children?: unknown } }> } }
- | undefined;
- const weights = element?.props?.weights;
- const definition = weights?.get(weight);
- const children = definition?.props?.children;
- const combinedPath = new Path2D();
- const shapeCount = collectPathData(children, combinedPath);
-
- if (shapeCount === 0) {
- console.warn(`[extensions] No path data found for ${name}:${weight}`, {
- iconName: resolved.iconName,
- element,
- children,
- });
- missingIconPathCache.add(cacheKey);
- return null;
- }
- cache.set(cacheKey, combinedPath);
- return combinedPath;
- } catch (err) {
- console.error(`[extensions] Failed to extract path for icon ${name}:`, err);
- missingIconPathCache.add(cacheKey);
- return null;
- }
-}
diff --git a/src/lib/extensions/index.ts b/src/lib/extensions/index.ts
deleted file mode 100644
index efe080cd..00000000
--- a/src/lib/extensions/index.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-export { ExtensionHost, extensionHost } from "./extensionHost";
-export type {
- ContributedCursorStyle,
- ContributedFrame,
- ContributedSound,
- ContributedWallpaper,
- ContributedWebcamFrame,
- CursorEffectContext,
- CursorEffectFn,
- ExtensionContributions,
- ExtensionEvent,
- ExtensionEventType,
- ExtensionInfo,
- ExtensionManifest,
- ExtensionPermission,
- ExtensionReview,
- ExtensionSettingField,
- ExtensionSettingsPanel,
- ExtensionStatus,
- FrameInstance,
- MarketplaceExtension,
- MarketplaceReviewStatus,
- MarketplaceSearchResult,
- RecordlyExtensionAPI,
- RecordlyExtensionModule,
- RenderHookContext,
- RenderHookFn,
- RenderHookPhase,
-} from "./types";
diff --git a/src/lib/extensions/renderHooks.ts b/src/lib/extensions/renderHooks.ts
deleted file mode 100644
index 70c4c88e..00000000
--- a/src/lib/extensions/renderHooks.ts
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Extension Render Hooks — Integration Layer
- *
- * Provides utility functions to call extension render hooks from
- * preview and export canvas pipelines. This is the bridge between
- * app renderers and extension-registered hooks.
- */
-
-import type { CursorEffectContext, RenderHookContext, RenderHookPhase } from "@/lib/extensions";
-import { extensionHost } from "@/lib/extensions";
-
-// ---------------------------------------------------------------------------
-// Scene pixel helpers — created per-context (capture ctx + videoLayout)
-// ---------------------------------------------------------------------------
-
-function makePixelHelpers(
- ctx: CanvasRenderingContext2D,
- videoLayout?: RenderHookContext["videoLayout"],
-) {
- const getPixelColor = (x: number, y: number) => {
- const px = Math.round(x);
- const py = Math.round(y);
- const d = ctx.getImageData(px, py, 1, 1).data;
- return { r: d[0], g: d[1], b: d[2], a: d[3] };
- };
-
- const sampleGrid = (sx: number, sy: number, sw: number, sh: number, step: number) => {
- let rSum = 0,
- gSum = 0,
- bSum = 0,
- aSum = 0,
- count = 0;
- const clampedW = Math.max(1, Math.round(sw));
- const clampedH = Math.max(1, Math.round(sh));
- const data = ctx.getImageData(Math.round(sx), Math.round(sy), clampedW, clampedH).data;
- for (let y = 0; y < clampedH; y += step) {
- for (let x = 0; x < clampedW; x += step) {
- const i = (y * clampedW + x) * 4;
- rSum += data[i];
- gSum += data[i + 1];
- bSum += data[i + 2];
- aSum += data[i + 3];
- count++;
- }
- }
- if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };
- return {
- r: Math.round(rSum / count),
- g: Math.round(gSum / count),
- b: Math.round(bSum / count),
- a: Math.round(aSum / count),
- };
- };
-
- const getMaskRect = () => {
- if (videoLayout) return videoLayout.maskRect;
- return { x: 0, y: 0, width: ctx.canvas.width, height: ctx.canvas.height };
- };
-
- const getAverageSceneColor = () => {
- const m = getMaskRect();
- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 32));
- return sampleGrid(m.x, m.y, m.width, m.height, step);
- };
-
- const getEdgeAverageColor = (edgeWidth = 4) => {
- const m = getMaskRect();
- const ew = Math.max(1, edgeWidth);
- let rSum = 0,
- gSum = 0,
- bSum = 0,
- aSum = 0,
- count = 0;
-
- const bands = [
- { x: m.x, y: m.y, w: m.width, h: ew }, // top
- { x: m.x, y: m.y + m.height - ew, w: m.width, h: ew }, // bottom
- { x: m.x, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // left
- { x: m.x + m.width - ew, y: m.y + ew, w: ew, h: m.height - ew * 2 }, // right
- ];
- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 64));
- for (const b of bands) {
- if (b.w <= 0 || b.h <= 0) continue;
- const avg = sampleGrid(b.x, b.y, b.w, b.h, step);
- const bandSamples = Math.ceil(b.w / step) * Math.ceil(b.h / step);
- rSum += avg.r * bandSamples;
- gSum += avg.g * bandSamples;
- bSum += avg.b * bandSamples;
- aSum += avg.a * bandSamples;
- count += bandSamples;
- }
- if (count === 0) return { r: 0, g: 0, b: 0, a: 0 };
- return {
- r: Math.round(rSum / count),
- g: Math.round(gSum / count),
- b: Math.round(bSum / count),
- a: Math.round(aSum / count),
- };
- };
-
- const getDominantColors = (maxColors = 5) => {
- const m = getMaskRect();
- const step = Math.max(1, Math.round(Math.min(m.width, m.height) / 24));
- const clampedW = Math.max(1, Math.round(m.width));
- const clampedH = Math.max(1, Math.round(m.height));
- const data = ctx.getImageData(Math.round(m.x), Math.round(m.y), clampedW, clampedH).data;
- // Quantize to 5-bit per channel
- const buckets = new Map<number, { r: number; g: number; b: number; count: number }>();
- for (let y = 0; y < clampedH; y += step) {
- for (let x = 0; x < clampedW; x += step) {
- const i = (y * clampedW + x) * 4;
- const qr = data[i] >> 3;
- const qg = data[i + 1] >> 3;
- const qb = data[i + 2] >> 3;
- const key = (qr << 10) | (qg << 5) | qb;
- const existing = buckets.get(key);
- if (existing) {
- existing.r += data[i];
- existing.g += data[i + 1];
- existing.b += data[i + 2];
- existing.count++;
- } else {
- buckets.set(key, { r: data[i], g: data[i + 1], b: data[i + 2], count: 1 });
- }
- }
- }
- const totalSamples = Array.from(buckets.values()).reduce((s, b) => s + b.count, 0) || 1;
- return Array.from(buckets.values())
- .sort((a, b) => b.count - a.count)
- .slice(0, maxColors)
- .map((b) => ({
- r: Math.round(b.r / b.count),
- g: Math.round(b.g / b.count),
- b: Math.round(b.b / b.count),
- frequency: b.count / totalSamples,
- }));
- };
-
- return { getPixelColor, getAverageSceneColor, getEdgeAverageColor, getDominantColors };
-}
-
-/**
- * Execute all extension render hooks for a phase against a canvas context.
- *
- * Call this from FrameRenderer at the appropriate point in the pipeline.
- * The context is saved/restored around each hook call.
- */
-export function executeExtensionRenderHooks(
- phase: RenderHookPhase,
- ctx: CanvasRenderingContext2D,
- params: {
- width: number;
- height: number;
- timeMs: number;
- durationMs: number;
- cursor?: { cx: number; cy: number; interactionType?: string } | null;
- smoothedCursor?: RenderHookContext["smoothedCursor"];
- videoLayout?: RenderHookContext["videoLayout"];
- zoom?: RenderHookContext["zoom"];
- shadow?: RenderHookContext["shadow"];
- sceneTransform?: RenderHookContext["sceneTransform"];
- },
-): void {
- if (!extensionHost.hasRenderHooks(phase)) return;
-
- const helpers = makePixelHelpers(ctx, params.videoLayout);
-
- const context: RenderHookContext = {
- width: params.width,
- height: params.height,
- timeMs: params.timeMs,
- durationMs: params.durationMs,
- cursor: params.cursor ?? null,
- smoothedCursor: params.smoothedCursor ?? null,
- ctx,
- videoLayout: params.videoLayout,
- zoom: params.zoom,
- shadow: params.shadow,
- sceneTransform: params.sceneTransform,
- getPixelColor: helpers.getPixelColor,
- getAverageSceneColor: helpers.getAverageSceneColor,
- getEdgeAverageColor: helpers.getEdgeAverageColor,
- getDominantColors: helpers.getDominantColors,
- };
-
- extensionHost.executeRenderHooks(phase, context);
-}
-
-/**
- * Track active cursor effects (animations that persist across frames).
- */
-interface ActiveCursorEffectInstance {
- interactionTimeMs: number;
- cx: number;
- cy: number;
- interactionType: "click" | "double-click" | "right-click" | "mouseup";
-}
-
-const activeCursorInteractions: ActiveCursorEffectInstance[] = [];
-const MAX_EFFECT_DURATION_MS = 2000;
-
-/**
- * Notify that a cursor interaction occurred (call from cursor telemetry handler).
- */
-export function notifyCursorInteraction(
- timeMs: number,
- cx: number,
- cy: number,
- interactionType: string,
-): void {
- if (!extensionHost.hasCursorEffects()) return;
-
- const validTypes = new Set(["click", "double-click", "right-click", "mouseup"]);
- if (!validTypes.has(interactionType)) return;
-
- activeCursorInteractions.push({
- interactionTimeMs: timeMs,
- cx,
- cy,
- interactionType: interactionType as ActiveCursorEffectInstance["interactionType"],
- });
-}
-
-/**
- * Execute cursor effects for the current frame.
- * Called after the cursor is drawn in the render pipeline.
- */
-export function executeExtensionCursorEffects(
- ctx: CanvasRenderingContext2D,
- timeMs: number,
- width: number,
- height: number,
- extra?: {
- zoom?: CursorEffectContext["zoom"];
- sceneTransform?: CursorEffectContext["sceneTransform"];
- videoLayout?: CursorEffectContext["videoLayout"];
- },
-): void {
- if (!extensionHost.hasCursorEffects() || activeCursorInteractions.length === 0) return;
-
- // Process all active interactions, removing expired ones
- for (let i = activeCursorInteractions.length - 1; i >= 0; i--) {
- const interaction = activeCursorInteractions[i];
- const elapsedMs = timeMs - interaction.interactionTimeMs;
-
- // Remove if too old
- if (elapsedMs > MAX_EFFECT_DURATION_MS || elapsedMs < 0) {
- activeCursorInteractions.splice(i, 1);
- continue;
- }
-
- const effectCtx: CursorEffectContext = {
- timeMs,
- cx: interaction.cx,
- cy: interaction.cy,
- interactionType: interaction.interactionType,
- width,
- height,
- ctx,
- elapsedMs,
- zoom: extra?.zoom,
- sceneTransform: extra?.sceneTransform,
- videoLayout: extra?.videoLayout,
- };
-
- const stillActive = extensionHost.executeCursorEffects(effectCtx);
- if (!stillActive) {
- activeCursorInteractions.splice(i, 1);
- }
- }
-}
-
-/**
- * Clear all active cursor effect animations (e.g., on seek).
- */
-export function clearCursorEffects(): void {
- activeCursorInteractions.length = 0;
-}
diff --git a/src/lib/extensions/sceneTransform.ts b/src/lib/extensions/sceneTransform.ts
deleted file mode 100644
index 1f3edbe1..00000000
--- a/src/lib/extensions/sceneTransform.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-export interface SceneTransform {
- scale: number;
- x: number;
- y: number;
-}
-
-export function applyCanvasSceneTransform(
- ctx: CanvasRenderingContext2D,
- transform: SceneTransform | null | undefined,
-): void {
- if (!transform) {
- return;
- }
-
- ctx.translate(transform.x, transform.y);
- ctx.scale(transform.scale, transform.scale);
-}
diff --git a/src/lib/extensions/types.ts b/src/lib/extensions/types.ts
deleted file mode 100644
index 4b880d8c..00000000
--- a/src/lib/extensions/types.ts
+++ /dev/null
@@ -1,621 +0,0 @@
-/**
- * Recordly Extension System — Core Types
- *
- * Extensions are renderer-loaded modules that can hook into the render pipeline,
- * bundle assets, register UI panels, and respond to playback/timeline events.
- */
-
-// ---------------------------------------------------------------------------
-// Extension Manifest (recordly-extension.json)
-// ---------------------------------------------------------------------------
-
-export interface ExtensionManifest {
- /** Unique identifier, e.g. "com.example.click-sparkles" */
- id: string;
- /** Human-readable name */
- name: string;
- /** Semver version string */
- version: string;
- /** Short one-line description */
- description: string;
- /** Author name or organisation */
- author?: string;
- /** Homepage / repository URL */
- homepage?: string;
- /** License identifier (SPDX) */
- license?: string;
- /** Minimum Recordly version required */
- engine?: string;
- /** Icon path relative to extension root */
- icon?: string;
- /** Entry point file relative to extension root (JS module) */
- main: string;
- /** APIs this extension requires — used for permission gating */
- permissions: ExtensionPermission[];
- /** Asset categories this extension provides */
- contributes?: ExtensionContributions;
-}
-
-export type ExtensionPermission =
- | "render" // Hook into the frame render pipeline
- | "cursor" // Access cursor telemetry & register cursor effects
- | "audio" // Provide or manipulate audio
- | "timeline" // Observe timeline lifecycle events
- | "ui" // Register settings panels and frames
- | "assets" // Resolve bundled asset paths
- | "export"; // Hook into export lifecycle
-
-/**
- * Optional manifest metadata for packaged assets.
- *
- * Recordly does not auto-register these entries at runtime today.
- * Extensions still need to wire behavior from activate() via host APIs like
- * registerFrame(), registerSettingsPanel(), resolveAsset(), and playSound().
- */
-export interface ExtensionContributions {
- /** Cursor style packs: array of cursor style definitions */
- cursorStyles?: ContributedCursorStyle[];
- /** Sound packs: click sounds, transition sounds, etc. */
- sounds?: ContributedSound[];
- /** Wallpaper/background images or videos */
- wallpapers?: ContributedWallpaper[];
- /** Webcam frames/overlays */
- webcamFrames?: ContributedWebcamFrame[];
- /** Device frames (browser chrome, laptop bezels, phone frames, etc.) */
- frames?: ContributedFrame[];
-}
-
-export interface ContributedCursorStyle {
- id: string;
- label: string;
- /** Path to cursor image relative to extension root */
- defaultImage: string;
- /** Optional click state image */
- clickImage?: string;
- /** Hotspot offset from top-left (normalized 0-1) */
- hotspot?: { x: number; y: number };
-}
-
-export interface ContributedSound {
- id: string;
- label: string;
- /** Sound category */
- category: "click" | "transition" | "ambient" | "notification";
- /** Path to audio file relative to extension root */
- file: string;
- /** Duration in ms (auto-detected if omitted) */
- durationMs?: number;
-}
-
-export interface ContributedWallpaper {
- id: string;
- label: string;
- /** Path to image/video file relative to extension root */
- file: string;
- /** Thumbnail for the picker */
- thumbnail?: string;
- /** Whether this is a video wallpaper */
- isVideo?: boolean;
-}
-
-export interface ContributedWebcamFrame {
- id: string;
- label: string;
- /** Path to frame overlay image (PNG with transparency) */
- file: string;
- thumbnail?: string;
-}
-
-export interface ContributedFrame {
- id: string;
- label: string;
- /** Category for grouping in the picker */
- category: "browser" | "laptop" | "phone" | "tablet" | "desktop" | "custom";
- /** Path to frame overlay image (PNG or SVG with transparency) relative to extension root */
- file?: string;
- /** Alternative: a data URL (e.g. from Canvas.toDataURL) for runtime-generated frames */
- dataUrl?: string;
- /** Thumbnail for the picker */
- thumbnail?: string;
- /**
- * Insets defining where the screen content sits inside the frame image,
- * as fractions (0-1) of the frame image dimensions.
- * { top, right, bottom, left }
- */
- screenInsets: { top: number; right: number; bottom: number; left: number };
- /** Whether the frame has a dark or light appearance (for wallpaper matching) */
- appearance?: "light" | "dark";
- /**
- * Resolution-independent draw function. Called at the target dimensions
- * to draw the frame chrome, leaving the screen area transparent.
- * Preferred over file/dataUrl — avoids bitmap scaling artifacts.
- */
- draw?: (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
-}
-
-// ---------------------------------------------------------------------------
-// Extension Runtime State
-// ---------------------------------------------------------------------------
-
-export type ExtensionStatus = "installed" | "active" | "disabled" | "error";
-
-export interface ExtensionInfo {
- manifest: ExtensionManifest;
- status: ExtensionStatus;
- /** Absolute path to extension directory */
- path: string;
- /** Error message if status is 'error' */
- error?: string;
- /** Whether this is a built-in extension */
- builtin?: boolean;
-}
-
-// ---------------------------------------------------------------------------
-// Marketplace Types
-// ---------------------------------------------------------------------------
-
-export type MarketplaceReviewStatus = "pending" | "approved" | "rejected" | "flagged";
-
-export interface MarketplaceExtension {
- /** Same as ExtensionManifest.id */
- id: string;
- name: string;
- version: string;
- description: string;
- author: string;
- /** Download URL for the extension archive (.zip) */
- downloadUrl: string;
- /** Icon URL */
- iconUrl?: string;
- /** Screenshots */
- screenshots?: string[];
- /** Number of downloads */
- downloads: number;
- /** Average rating (0-5) */
- rating: number;
- /** Number of ratings */
- ratingCount: number;
- /** Category tags */
- tags: string[];
- /** Permissions required */
- permissions: ExtensionPermission[];
- /** Whether this extension has been reviewed and approved */
- reviewStatus: MarketplaceReviewStatus;
- /** When the extension was published */
- publishedAt: string;
- /** When last updated */
- updatedAt: string;
- /** Author homepage URL */
- homepage?: string;
- /** Whether this version is already installed locally */
- installed?: boolean;
-}
-
-export interface MarketplaceSearchResult {
- extensions: MarketplaceExtension[];
- total: number;
- page: number;
- pageSize: number;
-}
-
-export interface ExtensionReview {
- id: string;
- extensionId: string;
- extensionName: string;
- version: string;
- author: string;
- submittedAt: string;
- status: MarketplaceReviewStatus;
- reviewNotes?: string;
- manifest: ExtensionManifest;
- downloadUrl: string;
-}
-
-// ---------------------------------------------------------------------------
-// Extension API — Render Hooks
-// ---------------------------------------------------------------------------
-
-/** Context passed to render hooks each frame */
-export interface RenderHookContext {
- /** Output canvas width */
- width: number;
- /** Output canvas height */
- height: number;
- /** Current playback time in ms */
- timeMs: number;
- /** Total video duration in ms */
- durationMs: number;
- /** Current cursor position (normalized 0-1, null if no cursor) */
- cursor: { cx: number; cy: number; interactionType?: string } | null;
- /** Current smoothed cursor state and trailing path (normalized 0-1) */
- smoothedCursor?: {
- cx: number;
- cy: number;
- trail: Array<{ cx: number; cy: number }>;
- } | null;
- /** The 2D rendering context to draw on */
- ctx: CanvasRenderingContext2D;
- /** Current video content layout (position & size inside the canvas) */
- videoLayout?: {
- /** Position & size of the masked video content area (in canvas pixels) */
- maskRect: { x: number; y: number; width: number; height: number };
- /** Border radius applied to the video (in canvas pixels) */
- borderRadius: number;
- /** Padding around the video (in canvas pixels). Can be a number (global) or an object with individual sides. */
- padding: number | { top: number; right: number; bottom: number; left: number };
- };
- /** Current zoom state */
- zoom?: {
- /** 1 = no zoom, >1 = zoomed in */
- scale: number;
- /** Normalized focus point (0-1) */
- focusX: number;
- focusY: number;
- /** 0 = idle, 1 = fully zoomed in */
- progress: number;
- };
- /** Current scene transform (motion animation offset & scale).
- * Hooks that run outside the built-in transform (post-webcam, post-annotations, final)
- * can apply this manually to follow zoom/pan motion:
- * ctx.save(); ctx.translate(t.x, t.y); ctx.scale(t.scale, t.scale); … ctx.restore();
- */
- sceneTransform?: {
- scale: number;
- x: number;
- y: number;
- };
- /** Current shadow settings */
- shadow?: {
- enabled: boolean;
- intensity: number;
- };
-
- // ------------------------------------------------------------------
- // Scene pixel helpers (sample from the current canvas)
- // ------------------------------------------------------------------
-
- /**
- * Get the RGBA color at a specific pixel (canvas coords).
- * Returns { r, g, b, a } with values 0–255.
- */
- getPixelColor(x: number, y: number): { r: number; g: number; b: number; a: number };
-
- /**
- * Average RGBA color across the entire video content area (maskRect).
- * Samples a grid for performance.
- */
- getAverageSceneColor(): { r: number; g: number; b: number; a: number };
-
- /**
- * Average RGBA color along the edges of the video content area.
- * Useful for matching wallpapers/frames to scene content.
- * @param edgeWidth — thickness of edge band in pixels (default 4)
- */
- getEdgeAverageColor(edgeWidth?: number): { r: number; g: number; b: number; a: number };
-
- /**
- * Get dominant colors in the video content area.
- * Returns up to `count` colors sorted by frequency.
- */
- getDominantColors(
- count?: number,
- ): Array<{ r: number; g: number; b: number; frequency: number }>;
-}
-
-/** Render hook phases — extensions draw in the registered phase */
-export type RenderHookPhase =
- | "background" // Before video frame (custom backgrounds)
- | "post-video" // After video frame, before zoom transform
- | "post-zoom" // After zoom transform
- | "post-cursor" // After cursor is drawn (click effects, trails)
- | "post-webcam" // After webcam overlay
- | "post-annotations" // After annotations
- | "final"; // Last pass (watermarks, HUD overlays)
-
-export type RenderHookFn = (ctx: RenderHookContext) => void;
-
-// ---------------------------------------------------------------------------
-// Extension API — Cursor Effect Hooks
-// ---------------------------------------------------------------------------
-
-export interface CursorEffectContext {
- /** Current time in ms */
- timeMs: number;
- /** Cursor position (normalized 0-1) */
- cx: number;
- cy: number;
- /** Interaction type that triggered this effect */
- interactionType: "click" | "double-click" | "right-click" | "mouseup";
- /** Canvas dimensions */
- width: number;
- height: number;
- /** 2D context to draw the effect */
- ctx: CanvasRenderingContext2D;
- /** Milliseconds since the interaction occurred */
- elapsedMs: number;
- /** Current zoom state (same as RenderHookContext.zoom) */
- zoom?: {
- scale: number;
- focusX: number;
- focusY: number;
- progress: number;
- };
- /** Current scene transform applied to the canvas */
- sceneTransform?: {
- scale: number;
- x: number;
- y: number;
- };
- /** Video content layout inside the canvas */
- videoLayout?: {
- maskRect: { x: number; y: number; width: number; height: number };
- borderRadius: number;
- padding: number | { top: number; right: number; bottom: number; left: number };
- };
-}
-
-export type CursorEffectFn = (ctx: CursorEffectContext) => boolean; // return false to stop animation
-
-// ---------------------------------------------------------------------------
-// Extension API — Event System
-// ---------------------------------------------------------------------------
-
-export type ExtensionEventType =
- | "playback:timeupdate"
- | "playback:play"
- | "playback:pause"
- | "cursor:click"
- | "cursor:move"
- | "timeline:region-added"
- | "timeline:region-removed"
- | "export:start"
- | "export:frame"
- | "export:complete";
-
-export interface ExtensionEvent {
- type: ExtensionEventType;
- timeMs?: number;
- data?: unknown;
-}
-
-export type ExtensionEventHandler = (event: ExtensionEvent) => void;
-
-// ---------------------------------------------------------------------------
-// Extension API — Settings UI
-// ---------------------------------------------------------------------------
-
-export interface ExtensionSettingField {
- id: string;
- label: string;
- type: "toggle" | "slider" | "select" | "color" | "text";
- defaultValue: unknown;
- /** For sliders */
- min?: number;
- max?: number;
- step?: number;
- /** For select */
- options?: { label: string; value: string }[];
-}
-
-export interface ExtensionSettingsPanel {
- /** Unique panel ID */
- id: string;
- /** Display label in settings */
- label: string;
- /** Icon name (lucide icon) */
- icon?: string;
- /** If set, renders inside this existing section (e.g. 'cursor', 'scene').
- * Otherwise, creates a new standalone section. */
- parentSection?: string;
- /** Setting fields */
- fields: ExtensionSettingField[];
-}
-
-// ---------------------------------------------------------------------------
-// Extension API — The API object passed to extension activate()
-// ---------------------------------------------------------------------------
-
-export interface RecordlyExtensionAPI {
- /** Register a render hook at a specific pipeline phase */
- registerRenderHook(phase: RenderHookPhase, hook: RenderHookFn): () => void;
-
- /** Register a cursor click effect */
- registerCursorEffect(effect: CursorEffectFn): () => void;
-
- /** Register a device frame (browser chrome, laptop bezel, etc.) */
- registerFrame(frame: ContributedFrame): () => void;
-
- /** Register a wallpaper/background image or video */
- registerWallpaper(wallpaper: ContributedWallpaper): () => void;
-
- /** Register a cursor style pack */
- registerCursorStyle(cursorStyle: ContributedCursorStyle): () => void;
-
- /** Listen to extension events */
- on(event: ExtensionEventType, handler: ExtensionEventHandler): () => void;
-
- /** Register a settings panel for this extension */
- registerSettingsPanel(panel: ExtensionSettingsPanel): () => void;
-
- /** Get the current value of an extension setting */
- getSetting(settingId: string): unknown;
-
- /** Set an extension setting value */
- setSetting(settingId: string, value: unknown): void;
-
- /** Resolve an asset path relative to the extension root */
- resolveAsset(relativePath: string): string;
-
- /**
- * Play a sound from a bundled audio file (relative to extension root).
- * Returns a stop function to cancel playback early.
- * Optional volume (0-1, default 1).
- */
- playSound(relativePath: string, options?: { volume?: number }): () => void;
-
- /** Log a message (visible in dev tools, prefixed with extension ID) */
- log(message: string, ...args: unknown[]): void;
-
- // ------------------------------------------------------------------
- // Query APIs — read-only access to project / playback state
- // ------------------------------------------------------------------
-
- /** Get video info (resolution, duration, fps) */
- getVideoInfo(): {
- width: number;
- height: number;
- durationMs: number;
- fps: number;
- } | null;
-
- /** Get the current video content layout (mask rect, padding, etc.) */
- getVideoLayout(): {
- maskRect: { x: number; y: number; width: number; height: number };
- canvasWidth: number;
- canvasHeight: number;
- borderRadius: number;
- padding: number | { top: number; right: number; bottom: number; left: number };
- } | null;
-
- /**
- * Query cursor telemetry at a given time (nearest point).
- * Returns null if no telemetry is available.
- */
- getCursorAt(timeMs: number): {
- cx: number;
- cy: number;
- timeMs: number;
- interactionType?: string;
- pressure?: number;
- } | null;
-
- /** Get the latest smoothed cursor position and trail for the active renderer. */
- getSmoothedCursor(): {
- cx: number;
- cy: number;
- timeMs: number;
- trail: Array<{ cx: number; cy: number }>;
- } | null;
-
- /** Get the current zoom state */
- getZoomState(): {
- scale: number;
- focusX: number;
- focusY: number;
- progress: number;
- } | null;
-
- /** Get the current shadow configuration */
- getShadowConfig(): {
- enabled: boolean;
- intensity: number;
- };
-
- /**
- * Get keystroke events in a time range.
- * Returns an array of keystroke events within [startMs, endMs].
- */
- getKeystrokesInRange(
- startMs: number,
- endMs: number,
- ): Array<{
- timeMs: number;
- key: string;
- modifiers: string[];
- }>;
-
- /**
- * Get the current aspect ratio of the output canvas (width / height).
- */
- getAspectRatio(): number | null;
-
- /**
- * Get the active device frame ID, or null if none is selected.
- */
- getActiveFrame(): string | null;
-
- /**
- * Check whether a specific extension is currently active.
- */
- isExtensionActive(extensionId: string): boolean;
-
- /**
- * Get the current playback state (time, duration, playing status).
- */
- getPlaybackState(): {
- currentTimeMs: number;
- durationMs: number;
- isPlaying: boolean;
- } | null;
-
- /**
- * Get the output canvas dimensions in pixels.
- */
- getCanvasDimensions(): { width: number; height: number } | null;
-
- /**
- * Subscribe to changes in this extension's settings.
- * The callback receives the setting ID that changed and its new value.
- * Returns a dispose function.
- */
- onSettingChange(callback: (settingId: string, value: unknown) => void): () => void;
-
- /**
- * Get ALL settings for this extension as a key-value map.
- * Useful for bulk-reading initial state on activation.
- */
- getAllSettings(): Record<string, unknown>;
-
- /**
- * Draw a Phosphor icon from the project's library onto the canvas.
- * @param ctx The 2D rendering context
- * @param name The name of the icon (e.g. "CaretLeft", "ArrowClockwise")
- * @param x X coordinate (center)
- * @param y Y coordinate (center)
- * @param size Icon size in pixels
- * @param color Icon color (CSS color string)
- * @param weight Icon weight (optional: 'thin' | 'light' | 'regular' | 'bold' | 'fill', default 'regular')
- */
- drawIcon(
- ctx: CanvasRenderingContext2D,
- name: string,
- x: number,
- y: number,
- size: number,
- color: string,
- weight?: "thin" | "light" | "regular" | "bold" | "fill",
- ): void;
-}
-
-// ---------------------------------------------------------------------------
-// Extension Module — what the extension's main JS file must export
-// ---------------------------------------------------------------------------
-
-export interface RecordlyExtensionModule {
- /** Called when the extension is activated */
- activate(api: RecordlyExtensionAPI): void | Promise<void>;
- /** Called when the extension is deactivated */
- deactivate?(): void | Promise<void>;
-}
-
-// ---------------------------------------------------------------------------
-// Device Frame — Runtime Instance (resolved paths)
-// ---------------------------------------------------------------------------
-
-export interface FrameInstance {
- /** Unique id: extensionId + '/' + frame.id */
- id: string;
- /** Extension that contributed this frame */
- extensionId: string;
- label: string;
- category: ContributedFrame["category"];
- /** Resolved absolute file:// URL to the frame overlay (PNG, SVG, or data URL) */
- filePath: string;
- /** Resolved absolute file:// URL to the thumbnail (or filePath if absent) */
- thumbnailPath: string;
- /** Screen insets (fraction 0-1 of frame image) */
- screenInsets: { top: number; right: number; bottom: number; left: number };
- appearance?: "light" | "dark";
- /** Resolution-independent draw function (if provided by the extension) */
- draw?: (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
-}