File size: 608 Bytes
6f26d39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script>
    // ... other JavaScript code
    async function init() {
        try {
            localStream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
            localVideo.srcObject = localStream;
            roomId = uuid.v4();
            clientId = uuid.v4();
            socket = new WebSocket(`ws://${window.location.host}/ws/${roomId}/${clientId}`); // Relative url.
            // ... rest of the init function
        }
        catch(error) {
            console.error('Initialization error:', error);
        }
    }
    // ... rest of the JavaScript code
</script>