Multiple camera support
Users can use both the front and back cameras of their iOS device simultaneously using the methods provided by the Video SDK for iOS. Multiple cameras can also be used while screen sharing.
First confirm the device supports multiple streams with isMultiStreamSupported.
if let videoHelper = ZoomVideoSDK.shareInstance()?.getVideoHelper(), videoHelper.isMultiStreamSupported() {
// Multiple camera streams are supported.
}
BOOL isMultiStreamSupported = [[[ZoomVideoSDK shareInstance] getVideoHelper] isMultiStreamSupported];
if (isMultiStreamSupported) {
// Multiple camera streams are supported.
}
To enumerate the available cameras and read each camera's deviceId, see Get the camera list.
Enable or disable a multi-camera stream
Pass a deviceId from the camera list to enable or disable that camera as a multi-stream. Enable and disable both fire onMultiCameraStreamStatusChanged. For the callback overloads, see Multi-camera stream status.
let enableResult = videoHelper.enableMultiStreamVideo("cameraDeviceID", customDeviceName: nil)
let disableResult = videoHelper.disableMultiStreamVideo("cameraDeviceID")
BOOL enableResult = [[[ZoomVideoSDK shareInstance] getVideoHelper] enableMultiStreamVideo:@"cameraDeviceID" customDeviceName:nil];
BOOL disableResult = [[[ZoomVideoSDK shareInstance] getVideoHelper] disableMultiStreamVideo:@"cameraDeviceID"];
Mute or unmute a multi-camera stream
Mute or unmute an active multi-camera stream by its deviceId.
let muteResult = videoHelper.muteMultiStreamVideo("cameraDeviceID")
let unmuteResult = videoHelper.unmuteMultiStreamVideo("cameraDeviceID")
BOOL muteResult = [[[ZoomVideoSDK shareInstance] getVideoHelper] muteMultiStreamVideo:@"cameraDeviceID"];
BOOL unmuteResult = [[[ZoomVideoSDK shareInstance] getVideoHelper] unmuteMultiStreamVideo:@"cameraDeviceID"];
Map a pipe or canvas back to a device ID
To find the deviceId for a multi-camera pipe or canvas, use getDeviceIDByMyPipe or getDeviceIDByMyCanvas. For more on handling raw data, see Raw data.
if let localUser = ZoomVideoSDK.shareInstance()?.getSession()?.getMySelf() {
// Get the user's multi-camera streams (ZoomVideoSDKRawDataPipe).
if let pipeList = localUser.getMultiCameraStreamList() {
for pipe in pipeList {
let deviceID = videoHelper.getDeviceID(byMyPipe: pipe)
}
}
// Get the user's multi-camera canvases (ZoomVideoSDKVideoCanvas).
if let canvasList = localUser.getMultiCameraCanvasList() {
for canvas in canvasList {
let deviceID = videoHelper.getDeviceID(byMyCanvas: canvas)
}
}
}
ZoomVideoSDKUser *localUser = [[[ZoomVideoSDK shareInstance] getSession] getMySelf];
// Get the user's multi-camera streams (ZoomVideoSDKRawDataPipe).
NSArray<ZoomVideoSDKRawDataPipe *> *pipeList = localUser.getMultiCameraStreamList;
for (ZoomVideoSDKRawDataPipe *pipe in pipeList) {
NSString *deviceID = [[[ZoomVideoSDK shareInstance] getVideoHelper] getDeviceIDByMyPipe:pipe];
}
// Get the user's multi-camera canvases (ZoomVideoSDKVideoCanvas).
NSArray<ZoomVideoSDKVideoCanvas *> *canvasList = localUser.getMultiCameraCanvasList;
for (ZoomVideoSDKVideoCanvas *canvas in canvasList) {
NSString *deviceID = [[[ZoomVideoSDK shareInstance] getVideoHelper] getDeviceIDByMyCanvas:canvas];
}