AgoraIO-Extensions / react-native-agora

React Native around the Agora RTC SDKs for Android and iOS agora
https://www.agora.io
MIT License
622 stars 228 forks source link

enableMultiCamera always returns 1. It succeeds even if it returns 1. #634

Closed 345ml closed 1 year ago

345ml commented 1 year ago

Describe the bug enableMultiCamera always returns 1. It succeeds even if it returns 1.

To Reproduce This is my code

react-native-agora@^4.1.2:
  version "4.1.2"
  resolved "https://registry.yarnpkg.com/react-native-agora/-/react-native-agora-4.1.2.tgz#ef2554cd610dfbf52f9ff8c2363db4fcbd03312d"
  integrity sha512-hdI68BXPYOHT9ndzpBr8d9D6iCrJH8NF5y18bvU4Lqmb7khU0HzyhYj01OBn1tlaL8XiJBtCIhsVPsDvpZoxIQ==
  dependencies:
    buffer "^6.0.3"
    json-bigint "^1.0.0"
    ts-interface-checker "^1.0.2"
rtcEngineRef.current = createAgoraRtcEngine();
rtcEngineRef.current.initialize({
  appId: Config.AGORA_APP_ID,
});

const videoEncoderConfiguration = new VideoEncoderConfiguration();
rtcEngineRef.current.setVideoEncoderConfiguration(
  videoEncoderConfiguration,
);
rtcEngineRef.current.setCameraDeviceOrientation(0, 270);

rtcEngineRef.current.addListener(
  'onFirstLocalVideoFrame',
  onFirstLocalVideoFrame,
);

rtcEngineRef.current.setAudioProfile(
  AudioProfileType.AudioProfileSpeechStandard,
  AudioScenarioType.AudioScenarioMeeting,
);

if (Platform.OS === 'ios') {
  createPlugin(rtcEngineRef.current.getNativeHandle());
  enablePlugin();
}

rtcEngineRef.current.enableVideo();

const cameraCapturerConfiguration = new CameraCapturerConfiguration();
cameraCapturerConfiguration.cameraDirection = CameraDirection.CameraRear;
const result = rtcEngineRef.current.enableMultiCamera(true, cameraCapturerConfiguration);
rtcEngineRef.current.startPreview(VideoSourceType.VideoSourceCameraPrimary);
rtcEngineRef.current.startPreview(
  VideoSourceType.VideoSourceCameraSecondary,
);

// This is show 1
alert(result)

rtcEngineRef.current.startSecondaryCameraCapture(
  cameraCapturerConfiguration,
);

Expected behavior Return 0.

Smartphone (please complete the following information):

LichKing-2234 commented 1 year ago

I will take a look.

LichKing-2234 commented 1 year ago

Will be fixed in the next version.

345ml commented 1 year ago

Nice!!!

LichKing-2234 commented 1 year ago

Will be fixed at 4.2.2

345ml commented 1 year ago

Good job. Nice DEV!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.