ngx-scanner
                                
                                 ngx-scanner copied to clipboard
                                
                                    ngx-scanner copied to clipboard
                            
                            
                            
                        "MediaDeviceInfo not defined" on startup when no SSL is used
I am using Angular v12.2.2. ngx-scanner v3.0.0. Chrome browser under Android 9
The main.js throws an error when being loaded by index.html
Uncaught ReferenceError: MediaDeviceInfo is not defined
Although the barcode scanner is only a small part of my app and gets activated in another route, it prevents the whole app from being loaded into the browser. It works when SSL is used.
I understand that access to the webcamera can only be granted when SSL is active, but why is the whole app not useable even for users that dont use the barcode scanner?
This is the part of the main.js where MediaDeviceInfo is not defined.
        ...
        vl([(0,
        e.r_U)(), rl("design:type", e.vpe)], n.prototype, "permissionResponse", void 0),
        vl([(0,
        e.r_U)(), rl("design:type", e.vpe)], n.prototype, "hasDevices", void 0),
        vl([(0,
   >   e.IIB)(), rl("design:type", MediaDeviceInfo), rl("design:paramtypes", [MediaDeviceInfo])], n.prototype, "device", null),
        vl([(0,
        e.r_U)(), rl("design:type", e.vpe)], n.prototype, "deviceChange", void 0),
        vl([(0,
        e.IIB)(), rl("design:type", Array), rl("design:paramtypes", [Array])], n.prototype, "formats", null),
        ...
I have just found the solution in another Bug-Report:
If I put
      <script>if (!window.MediaDeviceInfo) window.MediaDeviceInfo = {};</script>
in
index.html
then the app loads fine.