Giter Club home page Giter Club logo

Comments (5)

Jeija avatar Jeija commented on June 30, 2024

Thanks for reporting. However, currently chrome also doesn't seem to support any different API (e.g. it doesn't support facingMode in mediaDevices.getUserMedia and it doesn't have a full implementation of the new mediaDevices.getUserMedia). Considering these circumstances, I don't think I can update just yet, I have to keep using the deprecated API.

I uploaded my experimental changes to the update_mediadevices branch. It works fine in firefox for me, but doesn't properly select the back camera on chrome on android (which is just what the code is supposed to do).

from qrscanjs.

gokulkrishh avatar gokulkrishh commented on June 30, 2024

Hi @Jeija I am using QRScan in my PWA application. https://qrcodescan.in.

navigator.mediaDevices.enumerateDevices() is working fine in firefox, chrome, opera.

from qrscanjs.

Jeija avatar Jeija commented on June 30, 2024

There still is the problem of camera selection on mobile devices though. Chrome on Android still doesn't support the facingMode constraint, which is what we need to tell Chrome to use the rear, environment-facing camera (similar to what the W3C specification says in https://w3c.github.io/mediacapture-main/getusermedia.html#interface-definition, Example 9).

If I understand the code for https://qrcodescan.in correctly, you always assume that the second camera listed by navigator.mediaDevices.enumerateDevices() is the environment-facing camera. That may work in most cases, but it doesn't cover all devices. Even webrtc-adapter hasn't solved this issue completely, they also need to fall back to using the last camera in the list (see https://github.com/webrtc/adapter/blob/master/src/js/chrome/getusermedia.js).

This means I can only remove MediaStreamTrack.getSources() without loosing functionality when https://bugs.chromium.org/p/chromium/issues/detail?id=290161 is resolved. Otherwise, I'd much rather use a deprecated API than dropping functionality.

As soon as the Chromium bug is resolved and clients are updated, I will upgrade to the code on the https://github.com/Jeija/QRScanJS/tree/update_mediadevices branch and switch to the new API.

from qrscanjs.

abagh0703 avatar abagh0703 commented on June 30, 2024

It seems like the "deprecated" status has finally turned into removed and the example no longer works on Chrome, with a console error saying that MediaStreamTrack is not a function. @gokulkrishh perhaps you could make a pull request with the way that worked in your PWA?

from qrscanjs.

gokulkrishh avatar gokulkrishh commented on June 30, 2024

@abagh0703 Sure. let me see what i can do.

from qrscanjs.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.