Skip to content

USB Camera Support on iPad

Akshay Agarwal edited this page Jul 8, 2024 · 1 revision

The Webex iOS SDK has introduced support for USB cameras on iPad devices, enhancing the capabilities for video conferencing and streaming. This feature allows users to utilize higher-quality external cameras in addition to the built-in options, providing a more professional video experience.

Overview

With the v3.12 of Webex iOS SDK, developers can now access a structured list of all available cameras on a device, including both built-in and externally connected USB cameras. This is facilitated through a new Camera struct within the SDK.

Detecting External Camera

The SDK provides callbacks to handle the connectivity events of external USB cameras. Developers can register for these callbacks to receive notifications when an external camera is connected or disconnected.

External Camera Connected

To receive a callback when an external camera is connected, register using the CameraDeviceManager.onExternalCameraDeviceConnected callback:

cameraDeviceManager.onExternalCameraDeviceConnected = { camera in
    // Handle the connected camera instance
    // 'camera' is an instance of the Camera struct with the connected camera's details
}

External Camera Disconnected

Similarly, to receive a callback when an external camera is disconnected, use the CameraDeviceManager.onExternalCameraDeviceDisconnected callback:

cameraDeviceManager.onExternalCameraDeviceDisconnected = {
    // Handle the disconnection event
}

Manually Selecting a Camera

The SDK also allows manual overriding of the system's selected camera. This can be done using the new Phone.updateSystemPreferredCamera API, which takes a Camera instance as a parameter and a completion handler to process the result of the camera switch operation.

Phone.updateSystemPreferredCamera(camera: camera) { result in
    switch result {
    case .success():
        // The camera has been successfully updated
    case .failure(let error):
        // Handle any errors that occurred during the update
    }
}

Requirements

To leverage USB camera support, the iPad must be running iOS 17 and above which supports this functionality. Additionally, developers should ensure they have the necessary permissions to access camera hardware.

Permissions

Make sure to include the required privacy permissions in your app's Info.plist file: • NSCameraUsageDescription: A message that tells the user why the app is requesting access to the camera.

Plug and Play

Once the external USB camera is plugged into the iPad, the Webex iOS SDK's callback mechanism will automatically notify the app. This allows for seamless switching between built-in and external camera sources for video sessions.