🎥 Make videos programmatically with React
progress
Jonny Burger7a0aa3771ae2
diff --git a/packages/studio-server/src/preview-server/start-server.ts b/packages/studio-server/src/preview-server/start-server.tsindex 8d7ade09f8..0330919943 100644--- a/packages/studio-server/src/preview-server/start-server.ts+++ b/packages/studio-server/src/preview-server/start-server.ts@@ -67,7 +67,6 @@ export const startServer = async (options: {const liveEventsServer = makeLiveEventsRouter(options.logLevel);const server = http.createServer((request, response) => {- console.log('Cross-Origin-Opener-Policy', 'same-origin');response.setHeader('Cross-Origin-Opener-Policy', 'same-origin');response.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');diff --git a/packages/whisper-wasm/package.json b/packages/whisper-wasm/package.jsonindex dcd0d45b67..44cac0aa22 100644--- a/packages/whisper-wasm/package.json+++ b/packages/whisper-wasm/package.json@@ -14,9 +14,7 @@},"author": "Hunain Ahmed <[email protected]>","license": "UNLICENSED",- "dependencies": {- "remotion": "workspace:*"- },+ "dependencies": {},"devDependencies": {"@remotion/eslint-config-internal": "workspace:*","eslint": "9.19.0"diff --git a/packages/whisper-wasm/src/check-for-headers.ts b/packages/whisper-wasm/src/check-for-headers.tsindex cfa3a48efe..4628527701 100644--- a/packages/whisper-wasm/src/check-for-headers.ts+++ b/packages/whisper-wasm/src/check-for-headers.ts@@ -1,8 +1,9 @@-let headerWarningPrinted = false;+const headerWarningPrinted = false;export const checkForHeaders = () => {- if (!headerWarningPrinted && !crossOriginIsolated) {- console.warn('please add the required headers, this may cause problems.');- headerWarningPrinted = true;+ if (!headerWarningPrinted && !window.crossOriginIsolated) {+ throw new Error(+ 'The document is not cross-origin isolated (window.crossOriginIsolated = false). This prevents the usage of SharedArrayBuffer, which is required by `@remotion/whisper-wasm`. Make sure the document is served with the HTTP header `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`: https://developer.mozilla.org/en-US/docs/Web/API/Window/crossOriginIsolated',+ );}};diff --git a/packages/whisper-wasm/src/download-whisper-model.ts b/packages/whisper-wasm/src/download-whisper-model.tsindex da7976f64d..10187fa958 100644--- a/packages/whisper-wasm/src/download-whisper-model.ts+++ b/packages/whisper-wasm/src/download-whisper-model.ts@@ -1,6 +1,5 @@/* eslint-disable no-console *//* eslint-disable new-cap */-import type {DownloadWhisperModel} from '.';import {checkForHeaders} from './check-for-headers';import {modelState, Module} from './mod';@@ -8,6 +7,19 @@ const dbName = 'whisper-wasm';const dst = 'whisper.bin';const dbVersion = 1;+export type WhisperModel =+ | 'tiny'+ | 'tiny.en'+ | 'base'+ | 'base.en'+ | 'small'+ | 'small.en';++export interface DownloadWhisperModelParams {+ model: WhisperModel;+ onProgress?: (progress: number) => void;+}+const storeFS = (fname: string, buf: any) => {// write to WASM file using FS_createDataFile// if the file exists, delete it@@ -171,7 +183,7 @@ const loadModel = (url: string, cbProgress?: (arg0: number) => void) => {export const downloadWhisperModel = async ({model,onProgress,-}: DownloadWhisperModel) => {+}: DownloadWhisperModelParams) => {modelState.loading = true;const allowedModels = ['tiny',diff --git a/packages/whisper-wasm/src/index.ts b/packages/whisper-wasm/src/index.tsindex 8f9c6093d1..20fc274a64 100644--- a/packages/whisper-wasm/src/index.ts+++ b/packages/whisper-wasm/src/index.ts@@ -1,28 +1,22 @@-/* eslint-disable @typescript-eslint/no-unused-vars */+import type {+ DownloadWhisperModelParams,+ downloadWhisperModel as originalDownloadWhisperModel,+} from './download-whisper-model';+import type {+ transcribe as originalTranscribe,+ TranscribeParams,+} from './transcribe';-import type {TranscribeParams} from './transcribe';--// Ensures transcribe() returns a Promise that resolves to a string-export const transcribe = async (_args: TranscribeParams): Promise<string> => {- throw new Error('cjs not supported');+export const transcribe: typeof originalTranscribe = () => {+ throw new Error(+ 'Loading this module from CommonJS is not supported. Load the ESM version of @remotion/whisper-wasm.',+ );};-export type WhisperModel =- | 'tiny'- | 'tiny.en'- | 'base'- | 'base.en'- | 'small'- | 'small.en';--export interface DownloadWhisperModel {- model: WhisperModel;- onProgress?: (progress: number) => void;-}--// Ensures downloadWhisperModel() returns a Promise that resolves to a string-export const downloadWhisperModel = async (- _args: DownloadWhisperModel,-): Promise<string> => {- throw new Error('cjs not supported');+export const downloadWhisperModel: typeof originalDownloadWhisperModel = () => {+ throw new Error(+ 'Loading this module from CommonJS is not supported. Load the ESM version of @remotion/whisper-wasm.',+ );};++export type {DownloadWhisperModelParams, TranscribeParams};