"Media Stream API is not supported" 移动设备 chrome 尝试从移动设备 [vue] 扫描条形码时

"Media Stream API is not supported" mobile chrome when trying to scan barcodes from mobile[vue]

我正在使用这个库,它使用 getUserMedia() api 来获取当前设备摄像头的实时流。

这在 Chrome 桌面设备上运行良好,但在移动设备上运行失败:

---> <StreamBarcodeReader> at node_modules/vue-barcode-reader/src/components/StreamBarcodeReader.vue
       <ScanView> at src/views/ScanView.vue
         <App> at src/App.vue
           <Root>
ERRORException: Media Stream API is not supported

我查看了 caniuse.com 是否支持它,它说是。也许这是一个不同的 api 我看到了?

我做错了什么?

编辑:

Here is a demo of exactly what I am trying to do. 这项工作儿子 Safari 但不是 Chrome

我在 Chrome 和 Android 上使用了该演示。在 iOS、Chrome(和任何非 Safari 浏览器)上可能(我自己无法测试)无法访问它 - 请参阅 https://bugs.chromium.org/p/chromium/issues/detail?id=752458