Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Letters are reversed #13

Open
thainguyenit opened this issue Jan 13, 2021 · 3 comments
Open

Letters are reversed #13

thainguyenit opened this issue Jan 13, 2021 · 3 comments

Comments

@thainguyenit
Copy link

Hi,
Please help me, how to fix a letters are reversed bug after snap a picture.
Thank you.

@novelnet
Copy link

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;
    }
}

@jayanthymohit6
Copy link

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.

@Jarff
Copy link

Jarff commented Jan 7, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants