Setting facingMode to environment in createMicrophoneAndCameraTracks() for CameraVideoTrackInitConfig, not switching the camera to back camera in mobile, it still using front camera.
I have added the below configuration in my code:
import IAgoraRTC, {
createMicrophoneAndCameraTracks,
MicrophoneAudioTrackInitConfig,
CameraVideoTrackInitConfig,
} from "agora-rtc-react";
var audioTrackConfig:MicrophoneAudioTrackInitConfig = {
AEC: true, //Enable acoustic echo cancellation
AGC: true, // Enable audio gain control
ANS: true, // Enable automatic noise suppression
}
var videoTrackConfig:CameraVideoTrackInitConfig = {
facingMode: 'environment' // front or rear camera
}
const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks(audioTrackConfig, videoTrackConfig);
const { ready, tracks } = useMicrophoneAndCameraTracks();
Setting
facingMode
toenvironment
increateMicrophoneAndCameraTracks()
forCameraVideoTrackInitConfig
, not switching the camera to back camera in mobile, it still using front camera.I have added the below configuration in my code: