Live Stream

2022-07-19
No Rating

Overview

The live streaming mainly sends the camera payload of the aircraft and the surveillance video stream of the airport to the tripartite cloud platform for broadcasting, and users can conveniently broadcast live on the remote web page.

Supported Live Streaming Types

TypeDescription
AgoraThe DJI public cloud platform is also based on the "Interactive Live Streaming Standard" function of Agora. The overall live broadcast delay is relatively low and the effect is good.
For the third-party cloud privatization deployment, Agora also provides a hybrid cloud deployment model. The data is in the customer's private server, and then a link is opened through the air gap to the Agora's public cloud. This link channel is mainly used to upgrade and operate and maintain the privatized deployed servers.
RTMPReal-Time Messaging Protocol (RTMP) is a communication protocol for streaming audio, video and data over the Internet. This protocol is based on TCP and is a protocol family that includes the RTMP and RTMPT, RTMPS, RTMPE and many other variants.
RTSPRTSP (Real Time Streaming Protocol) is an application layer protocol in the TCP/IP protocol architecture that defines how one-to-many applications can efficiently deliver multimedia data over IP networks. RTSP is on top of RTP and RTCP in architecture, and it uses TCP or UDP to complete data transmission. Compared with RTSP, HTTP transmits HTML, while RTSP transmits multimedia data.
GB28181GB/T 28181-2016 for the "Technical requirements for information transport, switch and control in video surveillance network system for public security", mainly in mainland China for security video equipment access platform for a transmission control specification. For some servers which already have 28181 downlink gateway, the data rate of DJI enterprise devices can be pushed to the server directly through this protocol.

Framework for Live Streaming

image-20220320180829159

As shown above, the aircraft flight platform is not directly connected to the tripartite cloud platform, it needs to be forwarded through the remote control or the airport. The communication between the remote control and the airport and the aircraft is still using DJI private AirLink.

The tripartite cloud platform requires pre-deployment of MQTT and streaming media server. DJI's streaming protocol supports RTMP, RTSP, GB28181 and Agora. MQTT is mainly used for message communication, configuration information setting and reading.

Pilot Interactive Timing Diagram

Load Live Streaming Module

load livestream module.png

Server Side call protocol to start live stream

cloud start livestream.png

verification.png

App Side call JSBridge to start live stream

JSBridge start livestream.png

Introduction to the Interface of the API

Load DJI Pilot 2 Live Module

Before using the live streaming function, you need to pre-load Pilot2's live streaming module via JSBridge in the Webview, developers can consider adding the interface to load the live module directly during the up/down login stage.

Please see the chapter APP API > JSBridge API References for the specific interface.

window.djiBridge.platformLoadComponent(String name, String param)

Live Capacity

The field live_capacity is placed in the object model of the gateway device and is only pushed when there is a state change on the device side.

API: Refer to Server API > MQTT > Live Streaming > Update Live Streaming Capacity

Start Live Streaming

The server sends the command method=live_start_push to the device via MQTT, which uses the service method of the thing model to interact.

API: Refer toServer API > MQTT > Live Streaming > Start Live Streaming

Stop Live Streaming

API: Refer toServer API > MQTT > Live Streaming > Stop Live Streaming

Set Live Streaming Quality

API: Refer toServer API > MQTT > Live Streaming > Set Live Streaming Quality

App Side call JSBridge to start livestream

For scenarios that do not require live viewing in the background, but need to turn on live streaming when the user is using it and send the code stream back to the server for archival analysis. The interface can be combined to allow users to manually trigger the live streaming function in Pilot2, with the following detailed steps.

  1. After logging into the three-party cloud platform in the Webview of Pilot2, you need to request a live streaming server address parameter from the server, which is configured differently by each three-party cloud platform, or you can write it directly in the front-end code.

  2. Send the live streaming parameters to DJI Pilot 2 for setting through the JSBridge interface.

    API: Refer to App API > JSBridge API Reference -window.djiBridge.liveshareSetConfig(type: Int, params: String)

  3. After DJI Pilot 2 receives the live broadcast configuration, it immediately initiates a live stream push, and users can enter the flight interface to view live information, stop the live broadcast, restart the live broadcast, and other operations.

Note: In the manual live streaming mode, the streaming image is always the main image stream of DJI Pilot 2. When DJI Pilot 2 switches the camera image, the streaming image will also change accordingly.