Availability: Android SDK v1.5.6+
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 in XML:
<enx_rtc_android.annotations.EnxAnnotationsToolbar android:id="@+id/annotations_bar" android:layout_width="match_parent" android:layout_height="wrap_content"/>
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: EnxRoom
Observer: public void setAnnotationObserver(Annotations-Observer-Instance)
Method: public void startAnnotation(EnxStream)
Parameter:
EnxStream
– Stream Object to be annotated.
Callbacks:
public void onStartAnnotationAck(JSONObject)
– Acknowledgment to the Annotator when Annotation starts.public void onAnnotationStarted(EnxStream)
– Notification to everyone in the Room when Annotation starts.
// Set Observer room.setAnnotationObserver(Annotations-Observer-Instance); // Start Annotation room.startAnnotation(EnxStream enxStream); // Notification to all - Annotation started public void onAnnotationStarted(EnxStream enxStream) { // Add Annotations view to parent view ((ViewGroup) mAnnotationViewContainer).addView(enxStream.EnxPlayerView); } // Acknowlegement to Annotator - Annotation started public void onStartAnnotationAck(JSONobject jsonObject) { // Handdle UI. See info on jsonObject }
Stop Annotation
The EnxRoom.stopAnnotation()
method is used to stop Annotations.
Class: EnxRoom
Method: public void stopAnnotation()
Callbacks:
public void onStoppedAnnotationAck(JSONObject)
– Acknowledgment to the Annotator when Annotation stops.public void onAnnotationStopped(EnxStream)
– Notification to everyone in the Room when Annotation stops.
// Stop Annotation room.stopAnnotation(); // Notification to all - Annotation stopped public void onAnnotationStopped(EnxStream enxStream) { // Remove Annotations view to parent view ((ViewGroup) mAnnotationViewContainer).removeView(enxStream.EnxPlayerView); } // Acknowlegement to Annotator - Annotation stopped public void onStoppedAnnotationAck(JSONobject jsonObject) { // Handdle UI. See info on jsonObject }
Error Codes / Exceptions:
Code | Description |
---|---|
5093 | Annotation Access denied. |
5104 | Repeated startAnnotation() call made while Annotations already active in the Room. |
5106 | Repeated startAnnotation() call made while a previous request is in process. |
5108 | Invalid Stream passed to startAnnotation() . |
5109 | Failed to publish Annotation Stream. |
5112 | Annotation support available in Landscape Mode only. |
5094 | Repeated stopAnnotation() call made while a previous request is in process. |