| <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> |