top of page
Writer's pictureEdison Fernandez

WebRTCWrapper New Feature: Introducing DataChannel Powered by WebRTC

Updated: Apr 29

Introduction

We are excited to announce the latest addition to our WebRTCWrapper GStreamer element: the Data Channels feature. At RidgeRun, we recognize the growing importance of metadata in modern communication. In an era where data-driven insights, personalization, and context-aware applications are essential, metadata plays a crucial role in enriching communication experiences.


With Data Channels, we are enabling seamless bi-directional data transfer into an already convenient and easy-to-use WebRTC element such as the WebRTCWrapper. In this blog post, we will delve into the details of this exciting feature.


Whether you're a developer working on a real-time video streaming and data sharing application or just interested about the topic, we encourage you to keep reading to explore how simple it is to add metadata into your application with the use of the WebRTCWrapper’s data channel feature.


What is WebRTC?

Before diving deeper into the data channels feature, let's introduce WebRTC (Web Real-Time Communication) for those who may be new to the concept. WebRTC is an open standard that enables real-time peer-to-peer communication between devices, web browsers and/or mobile applications, without the need for plugins or additional software.


WebRTC allows developers to build audio and video communication, and data sharing applications, utilizing a standardized set of protocols and APIs.



What are Data Channels?

A data channel is a component of WebRTC which servers as a dedicated pathway for

real-time bidirectional communication between peers. It uses the Stream Control Transmission Protocol (SCTP), thus, enabling the seamless exchange of information beyond audio and video streams. Furthermore, data is encrypted in a DTLS connection so information is protected against unwanted viewers.


How to use the Data Channel Feature?

The data channel feature in WebRTCWrapper can be enabled by setting the property “data-channel” to “true”. By default, it is set to false. With the property enabled, you can send strings by either setting the property “metadata” and passing the string as an argument or by emitting the signal "send-metadata" with the respective argument. Similarly, to send binary data you can either use the “metadata-binary” property or the "send-metadata-binary" signal.


In case you want to receive metadata from another peer, just connect the signal "on-message-string" to a callback function in which you will receive the string in real time, or "on-message-data" for binary data.


Data Channels Applications

The data channel feature provides a versatile and flexible way to send and receive string data between peers. It can be used to implement a chat or exchange any type of textual information or binary data.


For example, when peer A establishes a connection with peer B, it can receive a string that represents the corresponding connection. This can be used to report the status of the connection or any other relevant information. Similarly, peer B can send messages to the connected peers, which can be printed or displayed on the receiver side.


The data channel is not limited to just chat messages. It can be used to transmit various types of metadata, such as date and time, status updates, client IDs, battery percentage, and more for various use cases, such as the following (these are just examples of what the data channel can be used for, the WebRTCWrapper product does not support them out of the box):


  • Real-Time Telemetry: Data channels can be utilized to transmit real-time telemetry data from drones to a monitoring system. This includes information such as altitude, GPS coordinates, battery status, flight speed, and sensor readings. By establishing a data channel, operators can continuously receive and analyze crucial metadata, enabling them to monitor and control the drone's operations remotely.

  • Alert Notifications: Data channels can be utilized to send alert notifications from a drone to a monitoring system. For instance, if a drone detects a critical event or anomaly during its operations, it can immediately transmit metadata indicating the nature of the situation.

  • Mission Planning and Control: Data channels can serve as a bidirectional communication channel, enabling the transmission of mission-related metadata from the monitoring system to the drone. This includes instructions for waypoint navigation, flight parameters, or mission updates. By utilizing data channels, operators can dynamically update the drone's mission plan or adjust its behavior based on the received metadata.


Any information that can be converted to a string or bytes format can be shared and processed using the data channel feature.


By leveraging the other features of the WebRTCWrapper, you can enhance the functionality and usability of the data channel. For example, you can integrate signaling mechanisms and other WebRTCWrapper capabilities to create a robust and secure communication system.


Exploring Data Channel Demo


In the world of drones, obtaining real-time information about their performance and status is crucial for effective control and monitoring. Simply viewing the live video captured by a drone is not always sufficient. The WebRTCWrapper's data channel feature comes into play to address this need. With this feature, not only can you view the drone's video feed, but you can also receive crucial telemetry data simultaneously, providing a holistic understanding of the drone's performance and status.

The following picture shows an overview of a demo application included with WebRTCWrapper.


This image shows a high level diagram of a typical use case of the WebRTCWrapper data channel support.
Figure 1. WebRTCWrapper’s Data channel demo data flow diagram.

This application demonstrates the transmission of both video and data from WebRTCWrapper to a web browser.

Screenshot that shows the graphical web user interface for the WebRTCWrapper demo application.
Figure 2. Web page of the demo application.

Take, for example, a drone flying high up in the sky. You, not only want to see the live video it captures on a server or webpage, but you also want to know the battery percentage, video recording duration, altitude, and speed (in meters per second). This additional information can be sent by the WebRTCWrapper with the data channel feature alongside the video, to be displayed on a web page, as shown in Figure 2.


By utilizing the data channel feature of WebRTCWrapper, the drone's telemetry data can be transmitted with ease in real-time alongside the video stream allowing the users to have a comprehensive view of the drone's performance and status while remotely piloting it or monitoring its operations.


The battery percentage information lets you keep track of the remaining power level, ensuring that you have a clear understanding of when the drone might need to return for recharging. Video recording duration provides insight into the length of time the drone has been capturing footage, allowing you to manage and organize recordings effectively. Knowing the altitude and speed of the drone enhances situational awareness to determine the drone's height above ground level, aiding in avoiding obstacles or adhering to specific flight regulations. Speed information in meters per second allows you to assess the drone's velocity and adjust its flight path accordingly.


This information provides control of the flight while making the information readable thanks to the web page, and depending on the project, it’s possible to use alarms or any advice for the users whenever the percentage of the battery is low for example.


You have the freedom to customize the data displayed alongside the video according to your specific needs or preferences. This is made possible through the signal previously mentioned, "send-metadata". To achieve this, simply extract the information relevant to your task, convert it into a string or bytes, and send it to the other peer. The following line of code demonstrates this process for the example given where the metadata is formatted as a JSON string or bytes.


send_metadata =
      g_strdup_printf
      ("{\"altitude\":%.2f,\"speed\":%.2f,\"recording_time\":\"%"
      GST_TIME_FORMAT "\",\"battery\":%d}", altitude, speed,
      GST_TIME_ARGS (recording_time), battery);

  g_signal_emit_by_name (wrapper, "send-metadata", send_metadata);

Closing Thoughts

In conclusion, the new data channel feature on RidgeRun’s WebRTCWrapper is a convenient and efficient way to transmit data alongside video streams. It empowers developers to create more versatile applications. With this addition, reducing time to market becomes a reality, enabling developers to deliver cutting-edge solutions with ease. Take advantage of our data channel feature and unlock a world of possibilities for your applications.

What’s Next?

Feel free to check out our demonstration video below:


Find out more in our developer's wiki:

https://developer.ridgerun.com/wiki/index.php/GStreamer_WebRTC_Wrapper


For technical questions or to ask for an evaluation (free of charge) version of the WebRTCWrapper plugin please send an email to support@ridgerun.com or send a message through http://www.ridgerun.com/contact.


189 views
bottom of page