Spaces:
Running
Running
| // scripts/video.js | |
| const getElement = (id) => document.getElementById(id); | |
| // --- State --- | |
| let isRecording = false; | |
| let recordedClips = []; | |
| // ... (keep all other video/audio/bluetooth related variables here) | |
| // --- Functions --- | |
| // ... (Add all video and bluetooth related functions here, including:) | |
| // - startRecording() | |
| // - stopRecording() | |
| // - updateClipsList() | |
| // - clearClips() | |
| // - generateShortVideo() | |
| // - connectBluetooth() | |
| // - shareClipsWithGroup() | |
| // - updateSharedClipsList() | |
| // - benchmarkClips() | |
| // - updateRankings() | |
| function showNotification(title, message) { | |
| // This is a dependency from ui.js. Ideally, you'd use a shared utility or event system. | |
| // For now, we assume it's globally available (see app.js). | |
| window.showNotification(title, message); | |
| } | |
| // --- Initialization --- | |
| export function initVideo() { | |
| getElement('start-recording').addEventListener('click', startRecording); | |
| getElement('stop-recording').addEventListener('click', stopRecording); | |
| getElement('generate-video').addEventListener('click', generateShortVideo); | |
| getElement('clear-clips').addEventListener('click', clearClips); | |
| getElement('bluetooth-connect').addEventListener('click', connectBluetooth); | |
| getElement('share-clips').addEventListener('click', shareClipsWithGroup); | |
| getElement('ranking-algorithm').addEventListener('change', updateRankings); | |
| // ... (Add other event listeners for the video section) | |
| } |