File size: 1,456 Bytes
b27cb15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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)
}