Skip to main content
Version: 2.0.x

On / Off Camera - iOS

Any participant can turn their camera on or off in the meeting using below methods.

enableWebcam()

  • By using enableWebcam() function of Meeting class, local participant can publish video to other participants.

  • You can call this method when the local participant is not broadcasting any video to others.

  • You can pass customised video track in enableWebcam() by using Custom Video Track.

  • Video stream of the participant can be accessed from the onStreamEnabled event of ParticipantEventListener.

disableWebcam()

  • By using disableWebcam() function of Meeting class, local participant can stop publish video to other participants.

  • You can call this method when the local participant is broadcasting any video to others.

@IBAction func videoButtonTapped(_ sender: Any) {
if !videoEnabled {
// enable webcam/camera
self.meeting?.enableWebcam()
} else {
// disable webcam/camera
self.meeting?.disableWebcam()
}
}

Events associated with enableWebcam

Events associated with disableWebcam

extension MeetingViewController: ParticipantEventListener {
//Callback for when the participant starts a stream
func onStreamEnabled(_ stream: MediaStream, forParticipant participant: Participant) {
if stream.kind = .state(value: .video) {
print("new audio stream enabled")
}
}
//Callback for when the participant stops a stream
func onStreamDisabled(_ stream: MediaStream, forParticipant participant: Participant) {
if stream.kind = .state(value: .video) {
print("new audio stream disabled")
}
}
}

API Reference

The API references for all the methods and events utilised in this guide are provided below.

Got a Question? Ask us on discord