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 (
ZMVideoSDKUser) 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 - 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 theZMVideoSDKDelegateclass. From this callback, the approver will get the user requesting for remote control access and also theZMVideoSDKRemoteControlRequestHandler, 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 theZMVideoSDKDelegateclass 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 ZMVideoSDKDelegate 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.
ZMVideoSDKRemoteControlStatus Enum
None // For initialization
CanRequestControl // Local user can enable the remote control
RequestDenied // Local user have received a refused of remote control
GotControl // Local user got control when remote control begins
LostControl // Local user lost control when remote control ends
ControlStart // Local user start controlling remotely another user
ControlStop // Local user stop controlling remotely another user
GiveControlTo // Local user gave remote control access to an user
ControlRevoked // Local user revoked remote control access to an user
ControlledBy // Local user is being remotely controlled by an user
NotControlled // Local user is not remotely controlled by an user
virtual void onRemoteControlStatus(
IZoomVideoSDKUser* pUser,
IZoomVideoSDKShareAction* pShareAction,
ZoomVideoSDKRemoteControlStatus status
) {}