Remote camera control
The Video SDK for iOS lets one user request control of another user's camera by panning, tilting, and zooming it remotely. This is useful for remote-assistance, inspection, and remote-monitoring workflows where one participant needs to direct what another participant's camera shows.
The control flow is:
- The requester asks for control of a specific user's camera.
- If granted, the requester pans, tilts, or zooms the receiver's camera.
- The requester releases control when done.
Both users must support the PTZ-compatible camera capabilities for the operations to take effect on the receiver's device.
Request control of a remote camera
Get the remote-control helper from the target ZoomVideoSDKUser and call requestControlRemoteCamera.
if let helper = targetUser.getRemoteCameraControlHelper() {
let result = helper.requestControlRemoteCamera()
// result is Errors_Success on success
}
ZoomVideoSDKRemoteCameraControlHelper *helper = [targetUser getRemoteCameraControlHelper];
ZoomVideoSDKError result = [helper requestControlRemoteCamera];
// result is Errors_Success on success
The requester is notified of the outcome via the onCameraControlRequestResult callback on ZoomVideoSDKDelegate. See Camera control requests.
Pan, tilt, and zoom
Once control is granted, the requester can move the remote camera using turnLeft, turnRight, turnUp, turnDown, zoomIn, and zoomOut. Each method takes a range parameter between 10 and 100 that controls how far the camera moves per call.
guard let helper = targetUser.getRemoteCameraControlHelper() else { return }
helper.turnLeft(20)
helper.turnRight(20)
helper.turnUp(20)
helper.turnDown(20)
helper.zoomIn(15)
helper.zoomOut(15)
ZoomVideoSDKRemoteCameraControlHelper *helper = [targetUser getRemoteCameraControlHelper];
[helper turnLeft:20];
[helper turnRight:20];
[helper turnUp:20];
[helper turnDown:20];
[helper zoomIn:15];
[helper zoomOut:15];
Smaller range values produce finer movement, which makes UI controls (such as press-and-hold arrow buttons) feel responsive without overshooting the target.
Give up control
When the requester is finished, call giveUpControlRemoteCamera to release control of the camera.
targetUser.getRemoteCameraControlHelper()?.giveUpControlRemoteCamera()
[[targetUser getRemoteCameraControlHelper] giveUpControlRemoteCamera];