Manage in-meeting annotation

The code on this page works with either the default UI or the custom UI.

When users start sharing their screens, others can annotate on top of the shared video feed. Through the SDK, you can manage many settings related to the appearance and availability of annotation.

Annotation settings

Before starting to annotate, check the meeting settings in the web portal to confirm that it is currently enabled. Check synchronously through the annotation controller, or receive updates asynchronously through the InMeetingAnnotationListener.

val annotationListener = InMeetingAnnotationListener { shareUserId, support ->
    if (support) {
        // Annotation is now supported for the current share content.
    }
    currentShareId = shareUserId // Optionally, store the ID of the user who is currently sharing.
}
val annotationController = ZoomSDK.getInstance().inMeetingService.inMeetingAnnotationController
annotationController.addListener(annotationListener)
if (!annotationController.isViewerAnnotationDisabled && annotationController.canDoAnnotation()) {
    // Annotations can be performed
}
InMeetingAnnotationController annotationController = ZoomSDK.getInstance().getInMeetingService().getInMeetingAnnotationController();
InMeetingAnnotationController.InMeetingAnnotationListener annotationListener = new InMeetingAnnotationController.InMeetingAnnotationListener() {
    @Override
    public void onAnnotationSupportChanaged(int shareUserId, boolean support) {
        if (support) {
            // Annotations are enabled
        }
        currentShareId = shareUserId;
    }
};
annotationController.addListener(annotationListener);
if (!annotationController.isViewerAnnotationDisabled() && annotationController.canDoAnnotation()) {
    // Annotations can be performed
}

If the current user is sharing their screen, they can enable or disable viewers to annotate the shared screen.

if (annotationController.canDisableViewerAnnotation()) {
    annotationController.disableViewerAnnotation(true)
}
if (annotationController.canDisableViewerAnnotation()) {
    annotationController.disableViewerAnnotation(true);
}

Control annotation properties

In some scenarios, the SDK by default shows an annotation toolbar overlay when it is possible for users to annotate. Replace this with your own UI using the concepts described here. Before doing so, you can optionally hide the default overlay.

ZoomSDK.getInstance().meetingSettingsHelper.hideAnnotationInScreenShareToolbar(true)
ZoomSDK.getInstance().getMeetingSettingsHelper().hideAnnotationInScreenShareToolbar(true);

In custom UI mode, the annotation toolbar is only displayed when the current user is sharing their screen. To annotate when another user in the meeting shares their screen, use the InMeetingAnnotationController to manage annotations.

To start annotating, call startAnnotation. When annotation is finished, use stopAnnotation.

val startResult = annotationController.startAnnotation()
if (startResult == MobileRTCSDKError.SDKERR_SUCCESS) {
    // You can begin using the annotation tool
}
annotationController.stopAnnotation()
MobileRTCSDKError startResult = annotationController.startAnnotation();
if (startResult == MobileRTCSDKError.SDKERR_SUCCESS) {
    // You can begin using the annotation tool
}

Optionally, after verifying that annotation started based on the return value of startAnnotation, modify the annotation appearance programmatically.

annotationController.setToolColor(Color.BLUE)
annotationController.setToolType(InMeetingAnnotationController.AnnotationToolType.ANNO_TOOL_TYPE_PEN)
annotationController.setToolWidth(10)
annotationController.setToolColor(Color.BLUE);
annotationController.setToolType(InMeetingAnnotationController.AnnotationToolType.ANNO_TOOL_TYPE_PEN);
annotationController.setToolWidth(10);

Interact with annotations users create by undoing or redoing annotations.

annotationController.undo()
annotationController.redo()
annotationController.undo()
annotationController.redo()

Based on your use case, you may also need to know if the current user is the presenter before updating your annotation UI.

if (annotationController.isPresenter) {
    ...
}
if (annotationController.isPresenter()) {
    …
}

When the meeting no longer needs annotation, remove the listener.

annotationController.removeListener(annotationListener)
annotationController.removeListener(annotationListener);