Git Product home page Git Product logo

Comments (3)

Jarff avatar Jarff commented on June 10, 2024 1

hey @novelnet where should I place this block to fix the issue ? I have the webcam-easy.js which has the WebCam class .And in my code I initialize the object like this : const webcam = new Webcam(webcamElement, 'environment', canvasElement, snapSoundElement);

thanks.

Yeah, I can confirm that the suggestion is working. One option is to create that class and export it as default, I like to do it by creating an index.js inside a Folder with the same name as the class has.

import Webcam from 'webcam-easy';
//import b64toBlob from 'b64-to-blob'; I commented it out because I'm not using it

class NoMirrorWebcam extends Webcam {
    // override function as facingMode is set to 'user' when webcamList == 1 -> facingMode decides mirroring
    getVideoInputs(mediaDevices) {
        const webcamList = super.getVideoInputs(mediaDevices)
        this._facingMode = 'environment';
        return webcamList;
    }
}

export default NoMirrorWebcam;

Then in the script you are using the webcam you should import the class NoMirrorWebcam instead of the one installed by npm (Webcam),

import NoMirrorWebcam from './path/to/the/class/NoMirrorWebCam'

Instead of using Webcam you should use NoMirrorWebcam

from webcam-easy.

novelnet avatar novelnet commented on June 10, 2024

Set facingMode to 'environment' and override getVideoInputs like this works for me:

import Webcam from 'webcam-easy';
import b64toBlob from 'b64-to-blob';

class NoMirrorWebcam extends Webcam {
    // override function as facingMode is set to 'user' when webcamList == 1 -> facingMode decides mirroring
    getVideoInputs(mediaDevices) {
        const webcamList = super.getVideoInputs(mediaDevices)
        this._facingMode = 'environment';
        return webcamList;
    }
}

from webcam-easy.

jayanthymohit6 avatar jayanthymohit6 commented on June 10, 2024

hey @novelnet where should I place this block to fix the issue ? I have the webcam-easy.js which has the WebCam class .And in my code I initialize the object like this :
const webcam = new Webcam(webcamElement, 'environment', canvasElement, snapSoundElement);

thanks.

from webcam-easy.

Related Issues (18)

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.