We are currently developing a video call feature using Agora on our React Native app. We chose Agora's Swift SDK because it supports pushing a custom video source. Although I managed to run the custom and camera sources successfully on the example app, I'm encountering an issue where the self.agoraKit!.enableVideo() or self.agoraKit!.enableLocalVideo(true) functions return 7, despite the audio working correctly.
I have ensured the engine initialization and video setup are executed on the main thread, and I have obtained the necessary camera permissions on iOS. Below is the relevant code snippet:
Podfile
pod 'AgoraAudio_iOS', '4.3.2'
@objc func startCall(_ resolve: @escaping RCTPromiseResolveBlock,
reject reject: @escaping RCTPromiseRejectBlock) {
AVCaptureDevice.requestAccess(for: .video) { granted in
if granted {
DispatchQueue.main.async {
self.setupEngine()
self.setupVideo()
self.setupAudio()
self.joinChannel()
resolve(nil)
}
} else {
let error = NSError(domain: "VideoCall", code: 1, userInfo: [NSLocalizedDescriptionKey: "Camera access denied"])
reject("CAMERA_ACCESS_DENIED", "Camera access denied", error)
}
}
}
private func setupVideo() {
let success = self.agoraKit!.enableVideo()
print("<Video-Call> is success to enable video: \(success)") // this return -7
}
Is there anything I might be missing during the initialization stage that could be causing this issue?
Hi,
We are currently developing a video call feature using Agora on our React Native app. We chose Agora's Swift SDK because it supports pushing a custom video source. Although I managed to run the custom and camera sources successfully on the example app, I'm encountering an issue where the self.agoraKit!.enableVideo() or self.agoraKit!.enableLocalVideo(true) functions return 7, despite the audio working correctly.
I have ensured the engine initialization and video setup are executed on the main thread, and I have obtained the necessary camera permissions on iOS. Below is the relevant code snippet:
Podfile
Is there anything I might be missing during the initialization stage that could be causing this issue?
Thank you for your assistance.
Here are some api log from agora agoraapi.log