I have imported the Zoom meeting SDK v5.17.6.13115 in my SwiftUI app.
I am facing an issue in this while trying to join a meeting.
Below is my code snippet -
class VideoViewController: UIViewController, MobileRTCAuthDelegate, MobileRTCMeetingServiceDelegate {
override func viewDidLoad() {
super.viewDidLoad()
askPermissionsForCameraFeed()
}
func askPermissionsForCameraFeed() {
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
if response {
//access granted
self.getMainWindowToShareWithAppDelegate()
} else {
print("access not granted")
}
}
}
func getMainWindowToShareWithAppDelegate(){
DispatchQueue.main.async {
let scene = UIApplication.shared.connectedScenes.first
let windowSceneDelegate = scene?.delegate as? UIWindowSceneDelegate
let window = (windowSceneDelegate?.window)!
UIApplication.shared.delegate = AppDelegate.Shared
let delegate = UIApplication.shared.delegate as! AppDelegate
delegate.window = window
print("finding window to provide to zoom sdk")
self.authenticateMobileRTCWith(jwt: "jwt_token")
}
}
func authenticateMobileRTCWith(jwt: String) {
if let authService = MobileRTC.shared().getAuthService() {
authService.jwtToken = jwt
authService.delegate = self
authService.sdkAuth()
}
}
func joinMeeting(meetingNumber: String) {
if let meetingService = MobileRTC.shared().getMeetingService() {
meetingService.delegate = self
let joinMeetingParameters = MobileRTCMeetingJoinParam()
joinMeetingParameters.meetingNumber = meetingNumber
joinMeetingParameters.password = "password"
meetingService.joinMeeting(with: joinMeetingParameters)
}
}
func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) {
switch returnValue {
case .success:
print("SDK successfully initialized.")
joinMeeting(meetingNumber: "meeting_no")
case .tokenWrong:
print("SDK JWT is not valid.")
presentJoinMeetingAlert(errMsg: "Wrong SDK authentication token")
default:
print("SDK Authorization failed with MobileRTCAuthError: \(returnValue).")
presentJoinMeetingAlert(errMsg: "SDK Authorization failed: \(returnValue).")
}
}
func presentJoinMeetingAlert(errMsg: String) {
let alertController = UIAlertController(title: "Join meeting", message: errMsg, preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Ok", style: .default, handler: { (action : UIAlertAction!) -> Void in })
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}
func onMeetingError(_ error: MobileRTCMeetError, message: String?) {
print("Could not join or start meeting with MobileRTCMeetError: \(error) \(message ?? "")")
presentJoinMeetingAlert(errMsg: message ?? "Could not join meeting due to some unknown reason.")
}
// Is called when the user joins a meeting.
func onJoinMeetingConfirmed() {
print("Join meeting confirmed.")
}
// Is called upon meeting state changes.
func onMeetingStateChange(_ state: MobileRTCMeetingState) {
print("Current meeting state: \(state)")
}
}
I am getting the following error in my console -
" Could not join or start meeting with MobileRTCMeetError: MobileRTCMeetError(rawValue: 8) the meeting does not exist".
Any idea how can I fix this issue ?