-
- Downloads
feat: Enhance camera control with device selection and error handling
Summary of changes - Added functionality to enumerate video input devices and switch between cameras if multiple are available. - Included an error message display for cases when no camera is found. - Added styling for the newly introduced error message. Changes - In `camera-capture.mjs`: - Implemented `navigator.mediaDevices.enumerateDevices()` to fetch available cameras and create a dropdown for selection when more than one camera is present. - Modified the `startCameraWithDeviceId` function to initialize the camera based on the selected device ID. - Enhanced error handling by adding a user-facing message if no cameras are detected. Changes - In `camera-capture.pcss`: - Introduced a new class `.camera-not-supported-text` for consistent error message styling. - In `camera-capture.mjs`: - Reformatted code for better readability and consistency in style, including standardizing import statements. These changes improve the user experience by allowing flexibility in camera selection and providing better feedback in the event of errors, ensuring that users aren't left in the dark when things go awry.
Showing
- source/components/content/camera-capture.mjs 40 additions, 2 deletionssource/components/content/camera-capture.mjs
- source/components/content/style/camera-capture.pcss 10 additions, 0 deletionssource/components/content/style/camera-capture.pcss
- source/components/content/stylesheet/camera-capture.mjs 7 additions, 14 deletionssource/components/content/stylesheet/camera-capture.mjs
This diff is collapsed.
Please register or sign in to comment