Skip to main content
Version: 2.0.x

On / Off Camera - iOS

This feature enables hosts to turn their cameras on or off to share their video stream with other hosts and audience members during the meeting. Only hosts (in SEND_AND_RECV mode) can broadcast their camera feed, while audience members (in RECV_ONLY mode) can view it in real time.

enableWebcam()​

  • By using enableWebcam() function of Meeting class, the host can publish their video to to other hosts and audience members.

  • You can also pass a 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, the host can stop publishing their video to to other hosts and audience members.

Example​

@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​

Video Permissions​

User Readiness Check - iOS

Before a user can engage with an live stream, the system must ensure that all necessary permissions—such as microphone access—are granted. This prevents technical issues and ensures a seamless interaction over livestream.

  • Step 1: Begin by ensuring that your application has video/audio permission to access user's microphone and camera device. Utilize the getVideoPermissionStatus()method of the VideoSDK class to verify if permissions are granted. If the permissions are not granted, the method will request the required permissions.
note

In case permissions are blocked by the user, the app's permission request dialogue cannot be re-rendered programmatically. In such cases, consider providing guidance to users on manually adjusting their application settings.

let audioPermission = VideoSDK.getVideoPermissionStatus(); // video permission status

Request Permissions (if necessary)​

  • If permission status is notDetermined, use the getVideoPermission() methods of the VideoSDK class to prompt users to grant access to their devices.

  • Calling the above functions will automatically handle the notDetermined state and prompt the user to grant permission.

class LiveStreamViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// UI Setup
setupUI()

// prompt user to grant permission when the app starts
VideoSDK.getVideoPermission()

}

func setupUI() {
// your UI code
}
}

API Reference​

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

-- enableWebcam()

Got a Question? Ask us on discord