AgoraIO / Docs-Source

A repository for the Agora Docs source content.
MIT License
20 stars 11 forks source link

"facingMode: environment" Not Working in agora-rtc-web #1451

Open Samiddha99 opened 1 year ago

Samiddha99 commented 1 year ago

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();