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: SippoConferenceDelegate {
    func conferenceUpdated(_ conference: SippoConference) {}

    func conferenceDestroyed() {}

    func conference(_ conference: SippoConference, didCancelInvitation: String) {}

    func conference(_ conference: SippoConference, didAddParticpant: Participant) {
        // New participant
    }

    func conference(_ conference: SippoConference, didRemoveParticpant: Participant) {
        // Participant left conference
    }

    func conferenceDidAddLocalMedia(_ conference: SippoConference) {
        // Local video is available
    }

    func conference(_ conference: SippoConference, didAddVideoFromParticipant participant: Participant) {
        // Remote partipant added new video
    }

    func conference(_ conference: SippoConference, didRemoveVideoFromParticipant participant: Participant) {
        // Remote participant removed video
    }

    func conference(_ conference: SippoConference, didReceiveUnattendedTransfer: SippoTransfer) {}
}

let delegate = ConferenceDelegateExample()
let conferences = try? SippoClient.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: ConferenceConfiguration()) { 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: SippoConference, didAddVideoFromParticipant participant: Participant) is called then
    let remoteVideo = conference.viewFor(remoteParticipant: participant, frame: CGRect.zero)

    conference.remoteParticipants { remoteParticipants in

    }

    conference.leave { complete in

    }
}