Claudio Valerio
Claudio Valerio

Reputation: 2342

Why can't I get a MediaStream from back camera when front camera is in use on Android Chrome?

Consider this:

enter image description here

What I'm trying to do here is to get a MediaStream for environment facing camera (back) when another MediaStream for user facing camera (front) is active. This is happening on Android Chrome 94 and Android MS Edge 93, therefore I think it's probably a webview related issue, not sure. I tested this on an Xiaomi phone and on 2 different Samsung tablets.

If I stop the track from the front stream before creating the new stream, I don't have any issue at all.

It's really strange, because same piece of code works perfectly on PC (Windows) Chrome (not tried macOS or iOS at the moment).

Thing is that stopping the first track before creating the second stream will give the user a pretty bad experience (with blank screen for a while), which I'd like to avoid. Also there could be some use cases (e.g. PiP) in which using both cameras at once could be necessary... I can't see why this isn't/shouldn't be working.

Do you guys have any suggestion?

Thanks

Upvotes: 0

Views: 270

Answers (0)

Related Questions