Remote control
The remote control feature allows someone to take control of another user's screen in a session when given permission. A user can either request remote control of another user's screen or the other user can give it to them. Once given permission, a user can control the other user's mouse and keyboard, and even copy text from their screen.
Note: Since this enables remote control of a user's screen, it is your responsibility as the developer to inform the user of the permission they're giving to the person who can remote control their screen. This includes all notices, consents, and a well-defined user experience.
Prerequisites
- Set up screen sharing. You must configure screen sharing in order for remote control to work.
- Turn on remote control on the web portal. Go to Account Settings, In Session (Basic), and toggle the Remote control option on. Optionally select the Allow remote controlling user to share clipboard option.
- Before starting, check whether controllers can request (
canRequestControl) and users can start remote control.
Remote Control Flow
-
On the requester side, identify the remote user (
IZoomVideoSDKUser) to have remote control over, check for request access, and request for access.IZoomVideoSDKUser* user; // Get the user you want to remote control of IVideoSDKVector<IZoomVideoSDKShareAction*>* shareActionList = user->getShareActionList(); // The shareActionList can contain 0 to multiple shares coming from the selected user if (shareActionList && shareActionList->GetCount() > 0) { // Get the share you want, for example the first share. IZoomVideoSDKShareAction* shareAction = shareActionList->GetItem(0); IZoomVideoSDKRemoteControlHelper* remoteControlHelper = shareAction->getRemoteControlHelper(); if (remoteControlHelper->canRequestControl()) { remoteControlHelper->requestRemoteControl() } } -
The requester will then get the
onRemoteControlRequestReceivedcallback within theIZoomVideoSDKDelegateclass. From this callback, the approver will get the user requesting for remote control access and also theIZoomVideoSDKRemoteControlRequestHandler, which the SDK will use to either approve or deny the request. If the approver denied the request, the requester can request again.Note: For macOS, the approver must give their application access in the Accessibility tab in the Privacy and Security preferences of their Mac.
void CExampleListener::onRemoteControlRequestReceived (IZoomVideoSDKUser* pUser, IZoomVideoSDKShareAction* pShareAction, IZoomVideoSDKRemoteControlRequestHandler* pRemoteControlRequestHandler) { pRemoteControlRequestHandler->approve(); pRemoteControlRequestHandler->deny(); } -
Both the requestor and approver will receive an
onRemoteControlStatuscallback under theIZoomVideoSDKDelegateclass on the request status. With aCanRequestControlcallback status on the requestor side, check ifcanRemoteControlistrueandisRemoteControllingisfalsebefore starting remote control.IZoomVideoSDKRemoteControlHelper* remoteControlHelper = shareAction->getRemoteControlHelper(); if (remoteControlHelper->canRemoteControl() && !remoteControlHelper->isRemoteControlling()) { remoteControlHelper->enterRemoteControl(); } -
After entering remote control status, the requestor can choose to temporarily pause remote control using
leaveRemoteControland enter again later on withenterRemoteControl, or to end it withendRemoteControl. Whereas the approver can also choose to get the list of approved users usinggetRemoteControlApprovedUserListor to revoke all the approved user usingrevokeRemoteControl.// Requestor remoteControlHelper->leaveRemoteControl(); remoteControlHelper->endRemoteControl(); // Approver - These methods are only available for the local user themselves. shareAction->getRemoteControlApprovedUserList(); shareAction->revokeRemoteControl();
Callbacks
There are 2 callbacks related to remote control access under the IZoomVideoSDKDelegate class.
-
onRemoteControlRequestReceived: Triggered when a remote user requests to remote control the local user.virtual void onRemoteControlRequestReceived(IZoomVideoSDKUser* pUser, IZoomVideoSDKShareAction* pShareAction, IZoomVideoSDKRemoteControlRequestHandler* pRemoteControlRequestHandler ) {} -
onRemoteControlStatus: Triggered when the remote control status changes. This applies to the local user either requesting remote control, controlling the remote user, or is being controlled by a remote user.
ZoomVideoSDKRemoteControlStatus is one of the following values.
ZoomVideoSDKRemoteControlStatus_None // For initialization.
ZoomVideoSDKRemoteControlStatus_CanRequestControl // Local user can enable remote control.
ZoomVideoSDKRemoteControlStatus_RequestDenied // Local user's remote control request was refused.
ZoomVideoSDKRemoteControlStatus_GotControl // Local user got control when remote control begins.
ZoomVideoSDKRemoteControlStatus_LostControl // Local user lost control when remote control ends.
ZoomVideoSDKRemoteControlStatus_ControlStart // Local user started controlling another user remotely.
ZoomVideoSDKRemoteControlStatus_ControlStop // Local user stopped controlling another user remotely.
ZoomVideoSDKRemoteControlStatus_GiveControlTo // Local user gave remote control access to a user.
ZoomVideoSDKRemoteControlStatus_ControlRevoked // Local user revoked remote control access from a user.
ZoomVideoSDKRemoteControlStatus_ControlledBy // Local user is being remotely controlled by a user.
ZoomVideoSDKRemoteControlStatus_NotControlled // Local user is not remotely controlled by a user.
virtual void onRemoteControlStatus(
IZoomVideoSDKUser* pUser,
IZoomVideoSDKShareAction* pShareAction,
ZoomVideoSDKRemoteControlStatus status
) {}