{facingMode: "environment"} camera switching doesn't work in Mobile Chrome

See original GitHub issue

hi guys, I still have issue that was described in https://github.com/webrtc/adapter/issues/594 Camera don’t switched in Android Chrome (in FF and Safari everything is OK). Seem to this issue was not be fixed ?

Browsers and versions affected

Chrome for Android 66.

Steps to reproduce

var constraints = {video: {facingMode: "environment"}}
navigator.mediaDevices.getUserMedia(constraints)

or

var constraints = {video: {facingMode: {exact: "environment"}}}
navigator.mediaDevices.getUserMedia(constraints)

Expected results

Get the back-facing camera stream.

Actual results

Get the front-facing camera stream (the first code sample) or nothing — the browser does not request the permission (the second code sample).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
getifycommented, Jun 7, 2018

Just wanted to report that I am able to switch to facingMode: { exact: "environment", } in mobile Chrome (Android 7, Chrome 67.0.3396.68). I am using the latest adapter.

0reactions
mamoykocommented, Jul 15, 2019

how can i import the adapter on angular 8?

i tried adding this code on the main.js

import 'webrtc-adapter'

and

import adapter from 'webrtc-adapter';

this is how i add the videoOptions

public videoOptions: MediaTrackConstraints = {
        facingMode: "environment"
};

still no luck, setting the rear camera into default still not working

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML userMedia facingMode: "environment"doesn't work on ...
I have found that the label member of the device object contains the string back for an environment-facing camera and front for a...
Read more >
Use applyConstraints facingMode to switch front/back camera ...
Once a webcam stream has been acquired on Android, it should be possible to switch between front and back camera by changing the...
Read more >
MediaTrackConstraints.facingMode - Web APIs | MDN
The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. "environment". The video source ...
Read more >
How to choose between front and back camera stream
Selecting both size and facing mode​​ In this example, we're asking for the stream that should face the environment (back camera) when possible,...
Read more >
WebRTC facingMode environment not working in Android ...
I can be up to phone vendor to mark video input devices as front/back or maybe Chrome just doesn't support that in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found