Annotation
Use annotation to draw over shared content. Both users and hosts can annotate during screen sharing.
Set up annotation
-
Check if the annotation feature is supported.
// Create and initialize your videoSDK object (if not already done) IZoomVideoSDK* video_sdk_obj_ = CreateZoomVideoSDKObj(); ZoomVideoSDKErrors err = video_sdk_obj_->initialize(init_params); // To check if annotation feature is supported video_sdk_obj_->getShareHelper()->isViewerAnnotationDisabled(); // If you are the share owner, you can check if your viewer has annotation rights. video_sdk_obj_->getShareHelper()->isAnnotationFeatureSupport(); // If you are the share owner, you can enable or disable your viewer from annotation rights. video_sdk_obj_->getShareHelper()->disableViewerAnnotation(true/false);If it is supported, continue.
-
Set up screen sharing.
Now you can use annotation in your implementation.
Start and stop annotation
In order to start annotation, the viewer must first have already subscribed to a shared view and input the same view to create a new IZoomVideoSDKAnnotationHelper from the share helper.
// Set the resolution.
ZoomVideoSDKResolution resolution = ZoomVideoSDKResolution_Auto;
// Get the share pipe for the user.
IZoomVideoSDKRawDataPipe* pPipe = NULL;
pPipe = pUser->GetSharePipe();
if (!pPipe) return;
// Render the user's share stream into your view of choice. (This view is required for annotation)
pPipe->subscribe(resolution, this);
// Get name for associated share window
const char* hwndChar = ":0-0(0,0,1920,1080)-34563456";
void* hwnd = reinterpret_cast<void*>(hwndChar);
// hostname:display_number-screen_number(x, y, width, height)-winid " :0-0(0,0,1920,1080)-34563456 "
// format of device_name:
// hostname:display_number-screen_number(x, y, width, height)-winid " :0-0(0,0,1920,1080)-34563456 "
// display_name hostname:display_number
// screen_number use multi X11 virtural device, default is 0
// device_frame (x, y, width, height)
// window_id winid
// Create annotation helper using the same view above and check for permission again
IZoomVideoSDKAnnotationHelper* annotationHelper = video_sdk_obj_->getShareHelper()->createAnnotationHelper(hwnd);
if (annotationHelper) {
annotationHelper.startAnnotation();
// To stop annotation later
annotationHelper.stopAnnotation();
}
Annotation tools
There are a list of annotation tools available. The full list of tools is located under ZoomVideoSDKAnnotationToolType.
// Enum of ZMVideoSDKAnnotationToolType
ZMVideoSDKAnnotationToolType_None,
ZMVideoSDKAnnotationToolType_Pen,
ZMVideoSDKAnnotationToolType_HighLighter,
ZMVideoSDKAnnotationToolType_AutoLine,
ZMVideoSDKAnnotationToolType_AutoRectangle,
ZMVideoSDKAnnotationToolType_AutoEllipse,
ZMVideoSDKAnnotationToolType_AutoArrow,
ZMVideoSDKAnnotationToolType_AutoRectangleFill,
ZMVideoSDKAnnotationToolType_AutoEllipseFill,
ZMVideoSDKAnnotationToolType_SpotLight,
ZMVideoSDKAnnotationToolType_Arrow,
ZMVideoSDKAnnotationToolType_ERASER,
ZMVideoSDKAnnotationToolType_Textbox,
ZMVideoSDKAnnotationToolType_Picker,
ZMVideoSDKAnnotationToolType_AutoRectangleSemiFill,
ZMVideoSDKAnnotationToolType_AutoEllipseSemiFill,
ZMVideoSDKAnnotationToolType_AutoDoubleArrow,
ZMVideoSDKAnnotationToolType_AutoDiamond,
ZMVideoSDKAnnotationToolType_AutoStampArrow,
ZMVideoSDKAnnotationToolType_AutoStampCheck,
ZMVideoSDKAnnotationToolType_AutoStampX,
ZMVideoSDKAnnotationToolType_AutoStampStar,
ZMVideoSDKAnnotationToolType_AutoStampHeart,
ZMVideoSDKAnnotationToolType_AutoStampQm
Upon selecting the tool, the user can also get or set the current tool's color or width.
// Get/set tool type
annotationHelper.getToolType();
annotationHelper.setToolType(ZoomVideoSDKAnnotationToolType_Pen);
// Get/set tool's color - unsigned long
annotationHelper.getToolColor();
annotationHelper.setToolColor(value);
// Get/set tool's width - long
annotationHelper.getToolWidth();
annotationHelper.setToolWidth(value);
Other annotation methods
You can also undo or redo annotations. And you can clear all annotations, just your own, or just others' annotations.
annotationHelper.undo();
annotationHelper.redo();
annotationHelper.clear(ZoomVideoSDKAnnotationClearType_All); // .all, .my, .others
For more information, see the IZoomVideoSDKAnnotationHelper and IZoomVideoSDKShareHelper references.
Destroy annotation
Once annotation is no longer valid or required, you can destroy it by calling the destroyAnnotationHelper method in the IZoomVideoSDKShareHelper interface.
video_sdk_obj_->getShareHelper()->destroyAnnotationHelper(annotationHelper);