// if after enumeration we have devices but currentDeviceId not set, sync if (!currentDeviceId && cameraSelect.options.length > 0 && cameraSelect.options[0].value) currentDeviceId = cameraSelect.options[0].value; await startCamera(currentDeviceId);
Recommendation: Use WebRTC for interactive low-latency use; HLS for wide compatibility and simpler scaling; provide MJPEG snapshot fallback. view index shtml camera high quality