🎥 Make videos programmatically with React
make it more obvious
Jonny Burger25452d37052f
diff --git a/packages/docs/docs/whisper-web/can-use-whisper-web.mdx b/packages/docs/docs/whisper-web/can-use-whisper-web.mdxindex ec02f434de..b2bd33f489 100644--- a/packages/docs/docs/whisper-web/can-use-whisper-web.mdx+++ b/packages/docs/docs/whisper-web/can-use-whisper-web.mdx@@ -10,7 +10,12 @@ crumb: '@remotion/whisper-web'# canUseWhisperWeb()-Checks if the current browser environment supports running `@remotion/whisper-web` with a specified model. This function verifies various browser capabilities like `crossOriginIsolated`, `IndexedDB`, `navigator.storage.estimate()`, and available storage space.+Checks if the current browser environment supports running `@remotion/whisper-web` with a specified model.+This function verifies various browser capabilities like `crossOriginIsolated`, `IndexedDB`, `navigator.storage.estimate()`, and available storage space.++## Enabling cross-origin isolation++This package requires a page that is [cross-origin isolated](/docs/miscellaneous/cross-origin-isolation).## Example usagediff --git a/packages/docs/docs/whisper-web/index.mdx b/packages/docs/docs/whisper-web/index.mdxindex 130c024c92..c8c81291b1 100644--- a/packages/docs/docs/whisper-web/index.mdx+++ b/packages/docs/docs/whisper-web/index.mdx@@ -17,55 +17,43 @@ import {TableOfContents} from './whisper-web';<Installation pkg="@remotion/whisper-web" />-## Example usage--:::info-This library is UI-agnostic and can be integrated with any frontend framework.-:::--```tsx twoslash-import {transcribe, canUseWhisperWeb, resampleTo16Khz, downloadWhisperModel} from '@remotion/whisper-web';--// HTML:-// <input type="file" accept="audio/*" id="audio-input" />-// <p id="status"></p>+## Requirements-const input = document.getElementById('audio-input') as HTMLInputElement;+This package requires a page that is [cross-origin isolated](/docs/miscellaneous/cross-origin-isolation).-input.addEventListener('change', async (e) => {- const file = input.files?.[0];- if (!file) return;-- console.log('Processing...');+## Example usage- const modelToUse = 'tiny.en';+```tsx twoslash title="Transcribing with @remotion/whisper-web"+import {transcribe, canUseWhisperWeb, resampleTo16Khz, downloadWhisperModel} from '@remotion/whisper-web';- const {supported, detailedReason} = await canUseWhisperWeb(modelToUse);- if (!supported) {- throw new Error(`Whisper Web is not supported in this environment: ${detailedReason}`);- }+const file = new File([], 'audio.wav');+const modelToUse = 'tiny.en';- console.log('Downloading model...');- await downloadWhisperModel({- model: modelToUse,- onProgress: ({progress}) => console.log(`Downloading model (${Math.round(progress * 100)}%)...`),- });+const {supported, detailedReason} = await canUseWhisperWeb(modelToUse);+if (!supported) {+ throw new Error(`Whisper Web is not supported in this environment: ${detailedReason}`);+}- console.log('Resampling audio...');- const channelWaveform = await resampleTo16Khz({- file,- onProgress: (p) => console.log(`Resampling audio (${Math.round(p * 100)}%)...`),- });+console.log('Downloading model...');+await downloadWhisperModel({+ model: modelToUse,+ onProgress: ({progress}) => console.log(`Downloading model (${Math.round(progress * 100)}%)...`),+});- console.log('Transcribing...');- const {transcription} = await transcribe({- channelWaveform,- model: modelToUse,- onProgress: (p) => console.log(`Transcribing (${Math.round(p * 100)}%)...`),- });+console.log('Resampling audio...');+const channelWaveform = await resampleTo16Khz({+ file,+ onProgress: (p) => console.log(`Resampling audio (${Math.round(p * 100)}%)...`),+});- console.log(transcription.map((t) => t.text).join(' '));+console.log('Transcribing...');+const {transcription} = await transcribe({+ channelWaveform,+ model: modelToUse,+ onProgress: (p) => console.log(`Transcribing (${Math.round(p * 100)}%)...`),});++console.log(transcription.map((t) => t.text).join(' '));```## Functionsdiff --git a/packages/docs/docs/whisper-web/transcribe.mdx b/packages/docs/docs/whisper-web/transcribe.mdxindex 5e327b96d7..4c9c57568e 100644--- a/packages/docs/docs/whisper-web/transcribe.mdx+++ b/packages/docs/docs/whisper-web/transcribe.mdx@@ -14,6 +14,10 @@ Transcribes pre-processed audio data (a `Float32Array` waveform) using WebAssembTo transcribe an audio file, you first need to download a model using [`downloadWhisperModel()`](/docs/whisper-web/download-whisper-model) and turn the file into a 16kHz `Float32Array` using [`resampleTo16Khz()`](/docs/whisper-web/resample-to-16khz).+## Requirements++This package requires a page that is [cross-origin isolated](/docs/miscellaneous/cross-origin-isolation).+## Example```tsx twoslash title="app.ts"