I am using the environment facing camera (back camera) on my android phone in a React widget. The strange thing is that the stream is in black and white and not in color. When I use the user facing camera, it is working correctly. Note: the camera is not broken :)
Here is the code I am using:
async componentDidMount(): Promise<void> {
const constraintsEnvironment = {
video: { facingMode: "environment" },
audio: false
};
if (this.videoReference.current) {
const videoStreamEnvironment: MediaStream = await navigator.mediaDevices.getUserMedia(
constraintsEnvironment
);
this.videoReference.current.srcObject = videoStreamEnvironment;
}
}
Hope you can help!
question from:
https://stackoverflow.com/questions/65860377/react-widget-shows-black-and-white-environment-facing-camera-how-to-solve-this 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…