Live Video Assistance with Annotation for Field Support Using EnableX APIs
In a world that’s fast inclining towards live video communication, one of the high-demand use cases is the technical support for field service agents. When a field service agent is seeking guidance from a domain expert, a visual aid comes in handy. The tool can be used to pinpoint the issue or demonstrate the error, and this is where Annotations fit in. Annotations allow you to graphically point out and provide inputs over a live video stream.
In this tutorial, let us learn how to build a live video conferencing application with annotation capability. We will be making use of EnableX — a cloud-based communications platform that provides all the necessary toolkits/APIs — to implement video calling capability with annotations in your Android application.
The EnableX Annotation features allow you to conduct the following:
- Annotates over a shared video stream
- Screen capture
- Predefined drawing tools and custom shapes
- On-the-fly customisation of the Annotations e.g. thickness and color
Now, let me show you how to implement video conferencing with annotations in an Android application using EnableX SDK for Android.
Implement one-to-one video conferencing using EnableX
Before we jump on the Annotations part, we should have an Android application with video conferencing capability. Please follow our blog “How to build a video conference app in android with EnableX” on how to implement video conferencing in your Android application.
Add Annotations in a one-to-one video-conferencing application
Now that we have an Android application with video calling, let’s Annotate!
Add annotation toolbar
To initiate Annotation Toolbar, use the following code snippet in XML:
Start Annotations
- Set AnnotationObserver after getting connected to a Room.
2. Pick The Media Stream
GetActiveTalkers() would return you a list of media Streams connected to the Room. You can pick the EnxStream out of this list to annotate. It is almost customary to pick from the first index in the list which implies the most recently active media Stream. Annotations are typically implemented on a one-to-one basis in the conference to avoid any alignment or scaling issues.
3. Start Annotations by calling the enxRoom.startAnnotation() on the picked video Stream.
4. Handle Events
After EnxRoom.startAnnotation() is successfully executed, it sends the following event notifications:
OnStartAnnotationAck: Notifies the Annotator (the user who started the annotations) that she can now start annotating. You can start the process by making the toolbar visible.
OnAnnotationStarted: Notifies the other users connected to the Room that the Annotator shall now start annotating.
To support the visibility of annotations in the Room, the annotation’s view must be added to the frame layout.
MAnnotationViewContainer — Frame layout view initialized in XML.
EnxStream.MEnxPlayerView — Annotation’s view added in the frame layout
This is how the Annotation screen will look like:
Stop Annotations
You can Stop Annotations by calling the EnxRoom.stopAnnotations() method.
The successful execution of stopAnnotations() would trigger the following event notifications:
OnStoppedAnnotationAck: Notifies the Annotator that the annotations have been stopped. The annotator can now hide the toolbar.
Build and Test on Device
Go to Android Studio, plug in your Android device, and click on Run to build the application on your device. Remember to build the application on two devices so you can initiate a video call between the two devices.
Congratulations! You just built a video conferencing application with annotations.
Refer to the complete sample application code for video calling on Android with Annotations.
If you are excited to try out more of these interesting, then do check out the EnableX Android Toolkit.