I'm building a web app using Agora.io. I'd like to be able to switch from the front-facing to the rear-facing camera on a client's smartphone. I've seen agora docs for switchCamera
. I've tried the following:
switchCamera();
myAgoraClient.switchCamera();
localStream.switchCamera();
All of them throw a no such function
error.
What is the correct way to switch the camera in agora.io for web?
You can do this with switchDevice method in 2.5 SDK
switchDevice(type: string, deviceId: string, onSuccess: function, onFailure: function): void
For example;
localStream.switchDevice("video", "<deviceid>", console.log,console.log)
Should do the work. I was trying same thing but examples contains old 2.4 js sdk, you need to specifically download ^2.5