The implementation of a rails application involves the following code snippet:
<div id="sourceSelectPanel" style="display:none">
<label for="sourceSelect"& gt;Change video source:& lt;/label>
<select id="sourceSelect" style="max-width:400px"& gt;
</select>
</div>
<a class="button" id="resetButton"& gt;Stop</a>
<a class="button" id="startButton"& gt;Go</a>
It utilizes a JavaScript library to initialize the interface. However, error messages are being encountered, such as:
Error: Can't enumerate devices, method not supported.
listVideoInputDevices
getVideoInputDevices
This code was primarily inspired by a suggested example. Despite making necessary changes from
codeReader.getVideoInputDevices()
to codeReader.listVideoInputDevices()
, the errors persist.
Interestingly, the functionality sometimes works and displays the list of devices (cameras). Occasionally, upon clicking the "startButton", the camera content appears in the video div:
<video id="video" width="320" height="180" style="border: 1px solid gray"></video>
The provided JavaScript code for this scenario is as follows:
<script type="text/javascript">
window.addEventListener('load', function () {
let selectedDeviceId;
const codeReader = new ZXing.BrowserMultiFormatReader()
console.log('ZXing code reader initialized')
codeReader.getVideoInputDevices()
.then((videoInputDevices) => {...}