Implement native browser-side audio extraction and server upload

- Update index.html file input to accept audio/*,video/*
- Add engine selection dropdown (Local vs Server) in index.html
- Implement JS bufferToWav WAV encoder in app.js (Float32Array PCM to 16-bit WAV)
- Integrate server-side transcribing route via FormData POST in app.js
- Update DEVELOPMENT_RULES.md to mark browser-side extraction as implemented

Co-Authored-By: Claude Opus 4.8 <noreply@anthreply.com>
This commit is contained in:
Gan, Jimmy
2026-06-03 11:38:51 +08:00
parent f201ef509d
commit 784a67c921
3 changed files with 111 additions and 29 deletions
+4 -9
View File
@@ -22,15 +22,10 @@
- Server-side extraction is NOT acceptable as a workaround
### Current Status
- Browser extraction via ffmpeg.wasm: BLOCKED (CORS/CORB issues)
- ⚠️ Temporary workaround: Guide users to extract audio locally using ffmpeg CLI
- 🔄 TODO: Find working ffmpeg.wasm CDN or alternative solution
### Acceptable Solutions (In Priority Order)
1. ffmpeg.wasm from working CDN (no CORS/CORB issues)
2. Local ffmpeg.wasm with complete wasm binaries
3. Alternative WebAssembly video processing library
4. User-extracted audio files only (with clear instructions)
- Browser extraction via Web Audio API (`AudioContext.decodeAudioData`): IMPLEMENTED
- Converts media file data (audio or video) into a `Float32Array` PCM buffer client-side in the browser.
- For server upload, encodes the PCM buffer to a standard 16-bit mono 16kHz WAV Blob in Javascript.
- Ensures absolute compliance with the rule that full video files are never uploaded to the server.
### NOT Acceptable
- ❌ Uploading full video files to server