The Annotation feature allows you to annotate on a Remote Stream. To support Annotations, you need to enable Canvas Streaming during Room Creation by setting: { canvas: true; }} in the JSON payload. To implement Annotation, you need to add Annotation Toolbar before you can start Annotations.

Table of Contents

Add Annotation Toolbar

Initiate Annotation Toolbar using the following code:

EnxToolbarWidget(width:100, height:50); 

Start Annotation

The EnxRoom.startAnnotation() method is used to start Annotation on a given Stream object. To initiate Annotation, you need to setAnnotationObserver after getting connected to the room.

Class: EnxRtc

Method: static Future<void> startAnnotation(String streamId)

Parameter: 

  • streamId: Stream Id of the stream to be annotated.

Callbacks:

  • onStartAnnotationAck  – Acknowledgment to the Annotator when Annotation starts.
  • onAnnotationStarted – Notification to everyone in the Room when Annotation starts.
EnxRtc.startAnnotation(streamId);	// Start Annotation 

// Acknowlegement to Annotator - Annotation started 
EnxRtc.onStartAnnotationAck=(Map<dynamic, dynamic> map) { 

}; 

// Notification to all - Annotation started 
EnxRtc.onAnnotationStarted=(Map<dynamic, dynamic> map) { 

};

Stop Annotation

The EnxRoom.stopAnnotation() method is used to stop Annotations.

Class: EnxRtc

Method: static Future<void> stopAnnotations()

Callbacks:

  • onStoppedAnnotationAck  – Acknowledgment to the Annotator when Annotation stops.
  • onAnnotationStopped – Notification to everyone in the Room when Annotation stops.
EnxRtc.stopAnnotation(); // Stop Annotation 

// Notification to all - Annotation stopped
EnxRtc.onAnnotationStopped=(Map<dynamic, dynamic> map) { 

}; 

// Acknowlegement to Annotator - Annotation stopped 
EnxRtc.onStoppedAnnotationAck=(Map<dynamic, dynamic> map) { 

}; 

Error Codes / Exceptions: 

CodeDescription
5093Annotation Access denied.
5104Repeated startAnnotation() call made while Annotations already active in the Room.
5106Repeated startAnnotation() call made while a previous request is in process.
5108Invalid Stream passed to startAnnotation().
5109Failed to publish Annotation Stream.
5112Annotation support available in Landscape Mode only.
5094Repeated stopAnnotation() call made while a previous request is in process.