Hi, I want to integrate Zoom meeting SDK in my iOS application, I tried and it is working fine, But I wanted to do customisation of meeting SDK UI, MobileRTCCustomizedUIMeetingDelegate is not getting called to move further, Please help me out.
class ZoomCanvasViewController: UIViewController {
@Binding var viewState: VideoConsultationViewModel.ViewState
init(viewState: Binding<VideoConsultationViewModel.ViewState>) {
self._viewState = viewState
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
self.initializeDelegates()
self.checkAVPermission()
}
private func initializeDelegates() {
if let meetingService = MobileRTC.shared().getMeetingService() {
meetingService.delegate = self
if let meetingSettings = MobileRTC.shared().getMeetingSettings(), meetingSettings.enableCustomMeeting {
meetingService.customizedUImeetingDelegate = self
}
}
}
private func checkAVPermission() {
AVCaptureDevice.requestAccess(for: AVMediaType.video) { response in
if response {
self.getMainWindowToShareWithAppDelegate()
} else {
print("Error while requesting permission for accessing camera")
}
}
}
private func getMainWindowToShareWithAppDelegate() {
DispatchQueue.main.async {
if let scene = UIApplication.shared.connectedScenes.first,
let windowSceneDelegate = scene.delegate as? UIWindowSceneDelegate {
UIApplication.shared.delegate = AppDelegate.Shared
if let window = windowSceneDelegate.window,
let delegate = UIApplication.shared.delegate as? AppDelegate {
delegate.window = window
print("finding window to provide to zoom sdk")
self.joinMeeting(meetingId: "73805360785", password: "4vTkxn")
}
}
}
}
// MARK: - ZOOM MEETING
private func joinMeeting(meetingId: String, password: String) {
if let meetingService = MobileRTC.shared().getMeetingService() {
#if false
meetingService.customizeMeetingTitle("Sample Meeting Title")
#endif
let parameters = MobileRTCMeetingJoinParam()
parameters.meetingNumber = meetingId
parameters.password = password
//TODO: - Add Username
parameters.userName = "Xlr8"
DispatchQueue.main.async {
let error = meetingService.joinMeeting(with: parameters)
print(error)
switch error {
case .passwordError:
print("Could not join or start meeting because the meeting password was incorrect.")
default:
print("Could not join or start meeting with MobileRTCMeetError: \(error)")
}
}
}
}
private func getMeetingState(state: MobileRTCMeetingState) {
switch state {
case .idle:
print("idle")
case .connecting:
print("connecting")
case .waitingForHost:
print("waitingForHost")
case .inMeeting:
print("inMeeting")
case .disconnecting:
print("disconnecting")
case .reconnecting:
print("reconnecting")
case .failed:
print("failed")
case .ended:
print("ended")
case .unknow:
print("unknow")
case .locked:
print("locked")
case .unlocked:
print("unlocked")
case .inWaitingRoom:
print("inWaitingRoom")
case .webinarPromote:
print("webinarPromote")
case .webinarDePromote:
print("webinarDePromote")
case .joinBO:
print("joinBO")
case .leaveBO:
print("leaveBO")
case .waitingExternalSessionKey:
print("waitingExternalSessionKey")
@unknown default:
print("Something went wrong")
}
}
}
// MARK: - ZOOM MEETING SDK DELEGATE
extension ZoomCanvasViewController: MobileRTCMeetingServiceDelegate {
func onJoinMeetingConfirmed() {
print(“Join meeting confirmed.”)
print(MobileRTC.shared().getMeetingService()?.customizedUImeetingDelegate)
}
func onMeetingStateChange(_ state: MobileRTCMeetingState) {
print("onMeetingStateChange")
self.getMeetingState(state: state)
}
func onMeetingError(_ error: MobileRTCMeetError, message: String?) {
switch error {
case .passwordError:
print("Could not join or start meeting because the meeting password was incorrect.")
default:
print("Could not join or start meeting with MobileRTCMeetError: \(error) \(message ?? "")")
}
}
func onMeetingEndedReason(_ reason: MobileRTCMeetingEndReason) {
}
func onMeetingReady() {
}
}
extension ZoomCanvasViewController: MobileRTCCustomizedUIMeetingDelegate {
func onInitMeetingView() {
print(“OnInitMeetingView”)
}
func onDestroyMeetingView() {
print("onDestroyMeetingView")
}
}