Conferences
This section explains how to create a conference and call some actions
Create the conference object and a delegate to manage conference updates
class ConferenceDelegateExample: QNConferenceDelegate {
func conferenceUpdated(_ conference: QNConferenceRepository) {}
func conferenceDestroyed(_ conference: QNConferenceRepository) {}
func conference(_ conference: QNConferenceRepository, didCancelInvitation: String) {}
func conference(_ conference: QNConferenceRepository, didAddParticpant: QNConferenceParticipant) {
// New participant
}
func conference(_ conference: QNConferenceRepository, didRemoveParticpant: QNConferenceParticipant) {
// Participant left conference
}
func conferenceDidAddLocalMedia(_ conference: QNConferenceRepository) {
// Local video is available
}
func conference(_ conference: QNConferenceRepository, didAddVideoFromParticipant participant: QNConferenceParticipant) {
// Remote partipant added new video
}
func conference(_ conference: QNConferenceRepository, didRemoveVideoFromParticipant participant: QNConferenceParticipant) {
// Remote participant removed video
}
func conference(_ conference: QNConferenceRepository, didReceiveUnattendedTransfer: QNConferenceTransfer) {}
}
let delegate = ConferenceDelegateExample()
let conferences = try? QNClient.client.conferences.get()
conferences?.createConference(recording: false, delegate: delegate) { result in
switch result {
case let .success(conference):
print("New conference: \(conference)")
conference.join(for: [.video, .audio], configuration: QNConferenceConfiguration()) { result in
switch result {
case .success:
print("Joined to conference")
case let .failure(error)
print("Failure joining to conference: \(error)")
}
}
case let .failure(error):
print("Failure creating conference: \(error)")
}
}
At this point the conference is established and we are sharing video and audio, we can do some actions like:
conference.invite(to: "participant", for: [.video], replyOf: .none) { result in
// Do something with result
}
// When func conference(_ conference: QNConferenceRepository, didAddVideoFromParticipant participant: QNConferenceParticipant) is called then
let remoteVideo = conference.viewFor(remoteParticipant: participant, frame: CGRect.zero)
conference.remoteParticipants { remoteParticipants in
}
conference.leave { complete in
}
}