/* eslint-disable */ // @ts-nocheck import fs from 'fs'; const filePath = 'C:/X/workspace/jumpa.id/vc/components/xcuRoom.tsx'; let content = fs.readFileSync(filePath, 'utf-8'); // 1. Add videoEngineMode state content = content.replace( `const [e2eeKeyStr, setE2eeKeyStr] = useState(null);`, `const [e2eeKeyStr, setE2eeKeyStr] = useState(null);\n const [videoEngineMode, setVideoEngineMode] = useState<'canvas' | 'webcodecs'>('webcodecs');` ); // 2. Pass to matrix during init content = content.replace( `matrixRef.current = matrix;`, `matrixRef.current = matrix;\n matrix.videoEngineMode = videoEngineMode;` // wait, videoEngineMode might be stale in useEffect, but it's fine for init ); // 3. Add handleToggleEngine const toggleFn = ` const handleToggleEngine = () => { const newMode = videoEngineMode === 'webcodecs' ? 'canvas' : 'webcodecs'; setVideoEngineMode(newMode); if (matrixRef.current) { matrixRef.current.hotSwapVideoEngine(newMode); alert(newMode === 'webcodecs' ? '🚀 XCU Quantum WebCodecs (Hardware GPU Acceleration) AKTIF! Latensi dinolkan.' : '⚠️ Mode Kompatibilitas Canvas Aktif. Peringatan: Latensi 1-2 detik.'); } }; `; content = content.replace(`const handleToggleMic = () => {`, toggleFn + `\n const handleToggleMic = () => {`); // 4. Update the bottom control bar const shareScreenButton = ``; const quantumButton = ` `; content = content.replace(shareScreenButton, shareScreenButton + '\n\n' + quantumButton); fs.writeFileSync(filePath, content, 'utf-8'); console.log('Successfully updated xcuRoom.tsx');