Giter Site home page Giter Site logo

Comments (7)

Sec-ant avatar Sec-ant commented on June 2, 2024 1

i dont have spesific reason to serve that in an insecure origin, what should i check ?

Sorry I don't understand your question. I was asking your use case?

  • If you're deploying the service to end users, you'll need an SSL certificate because it's very unsafe to getUserMedia in an insecure context.

  • For local development and testing, localhost is required, or check the README to learn how to test your service on your mobile device without https.

  • If you really want chrome://flags/#unsafely-treat-insecure-origin-as-secure to work. You can fork or patch the vue-qrcode-reader to comment out this piece of detection code:

    // At least in Chrome `navigator.mediaDevices` is undefined when the page is
    // loaded using HTTP rather than HTTPS. Thus `STREAM_API_NOT_SUPPORTED` is
    // initialized with `false` although the API might actually be supported.
    // So although `getUserMedia` already should have a built-in mechanism to
    // detect insecure context (by throwing `NotAllowedError`), we have to do a
    // manual check before even calling `getUserMedia`.
    if (window.isSecureContext !== true) {
    throw new InsecureContextError()
    }
    And set your insecure origin in the chrome flags page.

from vue-qrcode-reader.

apeengggg avatar apeengggg commented on June 2, 2024

iam using vuejs3, with core ui template

from vue-qrcode-reader.

Sec-ant avatar Sec-ant commented on June 2, 2024

You can only use the camera in a secure context (https or localhost): https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

from vue-qrcode-reader.

apeengggg avatar apeengggg commented on June 2, 2024

You can only use the camera in a secure context (https or localhost): https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

so how to allow it in http ?

I have tried entering the url into => chrome://flags/#unsafely-treat-insecure-origin-as-secure

but the camera still isn't showing

from vue-qrcode-reader.

Sec-ant avatar Sec-ant commented on June 2, 2024

The detection of insecure context is hardcoded here:

// At least in Chrome `navigator.mediaDevices` is undefined when the page is
// loaded using HTTP rather than HTTPS. Thus `STREAM_API_NOT_SUPPORTED` is
// initialized with `false` although the API might actually be supported.
// So although `getUserMedia` already should have a built-in mechanism to
// detect insecure context (by throwing `NotAllowedError`), we have to do a
// manual check before even calling `getUserMedia`.
if (window.isSecureContext !== true) {
throw new InsecureContextError()
}

So chrome://flags/#unsafely-treat-insecure-origin-as-secure is not gonna work.

Do you have a reason to serve this in an insecure context?

from vue-qrcode-reader.

apeengggg avatar apeengggg commented on June 2, 2024

The detection of insecure context is hardcoded here:

// At least in Chrome `navigator.mediaDevices` is undefined when the page is
// loaded using HTTP rather than HTTPS. Thus `STREAM_API_NOT_SUPPORTED` is
// initialized with `false` although the API might actually be supported.
// So although `getUserMedia` already should have a built-in mechanism to
// detect insecure context (by throwing `NotAllowedError`), we have to do a
// manual check before even calling `getUserMedia`.
if (window.isSecureContext !== true) {
throw new InsecureContextError()
}

So chrome://flags/#unsafely-treat-insecure-origin-as-secure is not gonna work.

Do you have a reason to serve this in an insecure context?

i dont have spesific reason to serve that in an insecure origin, what should i check ?

from vue-qrcode-reader.

github-actions avatar github-actions commented on June 2, 2024

This issue has been marked as stale. If there is no further activity it will be closed.

from vue-qrcode-reader.

Related Issues (20)

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.