Having a strange issue on one android phone for a website using openvidu for streaming.
There is a switch camera function which alternates between front and back cameras. This is accomplished by getting all the available devices say on the back and selecting the last one in the array and then publishing the stream to that device.
I’ve tested this on windows, mac, multiple iPhones in safari and chrome and multiple android phones in chrome and works perfectly.
However one android phone is behaving strange that when switching to the environment camera it says that the device is already in use, but it can’t be in use, the phone literally rebooted and no other app loaded and activated the camera.
Not sure why this is happening? I was thinking maybe the code should stop each device before the switch happens? But why would it say it’s in use when it’s not?
Update
After some investigation this seems like an annoying issue with huawei phones where one of the back cameras has the same device Id as the hands free audio input device, so when my code is selecting a back camera that works everywhere else it thinks it’s in use due to the id being used by the audio input.
So it looks like the only way around this is to bypass the selection of this particular camera if it’s id is the same as an audio input device and select a different back camera instead. Annoying!
Update 2
Actually it seems a bit more than this, the phone has 3 back cameras but 4 devices show up as video input, it looks like there is a bug on the device where it thinks the audio input is the same as the video input so it’s adding an additional camera to the device list, unless this is because somehow on that phone the hands free device includes a camera. Really odd
Update 3
The phone is a p20 pro and I also noticed it actually has 2 audio input that share 2 video input device id instead of all being unique which then causes another problem when try to use a different video device id.