Spaces:
Running
Running
Update scripts/video.js
Browse files- scripts/video.js +42 -0
scripts/video.js
CHANGED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// scripts/video.js
|
2 |
+
|
3 |
+
const getElement = (id) => document.getElementById(id);
|
4 |
+
|
5 |
+
// --- State ---
|
6 |
+
let isRecording = false;
|
7 |
+
let recordedClips = [];
|
8 |
+
// ... (keep all other video/audio/bluetooth related variables here)
|
9 |
+
|
10 |
+
// --- Functions ---
|
11 |
+
// ... (Add all video and bluetooth related functions here, including:)
|
12 |
+
// - startRecording()
|
13 |
+
// - stopRecording()
|
14 |
+
// - updateClipsList()
|
15 |
+
// - clearClips()
|
16 |
+
// - generateShortVideo()
|
17 |
+
// - connectBluetooth()
|
18 |
+
// - shareClipsWithGroup()
|
19 |
+
// - updateSharedClipsList()
|
20 |
+
// - benchmarkClips()
|
21 |
+
// - updateRankings()
|
22 |
+
|
23 |
+
function showNotification(title, message) {
|
24 |
+
// This is a dependency from ui.js. Ideally, you'd use a shared utility or event system.
|
25 |
+
// For now, we assume it's globally available (see app.js).
|
26 |
+
window.showNotification(title, message);
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
// --- Initialization ---
|
31 |
+
export function initVideo() {
|
32 |
+
getElement('start-recording').addEventListener('click', startRecording);
|
33 |
+
getElement('stop-recording').addEventListener('click', stopRecording);
|
34 |
+
getElement('generate-video').addEventListener('click', generateShortVideo);
|
35 |
+
getElement('clear-clips').addEventListener('click', clearClips);
|
36 |
+
getElement('bluetooth-connect').addEventListener('click', connectBluetooth);
|
37 |
+
getElement('share-clips').addEventListener('click', shareClipsWithGroup);
|
38 |
+
|
39 |
+
getElement('ranking-algorithm').addEventListener('change', updateRankings);
|
40 |
+
|
41 |
+
// ... (Add other event listeners for the video section)
|
42 |
+
}
|