Live Stream

2025-02-18
No Rating

Overview

The live streaming mainly sends the camera payload of the aircraft and the video stream of the DJI Dock 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 is a transmission control standard for the access of security video equipment to platforms in Mainland China. 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 DJI Dock. The communication between the remote control and the DJI Dock 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

DJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web PageThe live capability is included in the topic and needs to be resolved by the server after subscription.Resolve the live_capacity structure in the state topic, and save it in the databaseLoading live streaming module JSBridge:platformLoadComponentNote: You need to load live streaming module through JSBridge interface in advance to use live streaming function.Subscribe "thing/product/{gateway_sn}/state" topicSubscribe "thing/product/{gateway_sn}/osd" topicSubscribe "thing/product/{gateway_sn}/services_reply" topicSubscribe "thing/product/{gateway_sn}/services" topicPublish "thing/product/{gateway_sn}/state" topicPublish state topicDJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web Page

Server Side call protocol to start live stream

DJI Pilot 2Pilot PreviewMQTT GatewayCloud ServerThird-party Web PageQuery the local database for device live capabilityParse and verify services topicThe checks include whether the camera is decoding, whether in flight control interface and so onSend a request to query the device live capabilityReturn live capability dataClick to start live streamingSending services topics of method="live_start_push"Publish services topicPublish "service_reply" topicPublish service_reply topicPublish osd topic that contains the live_status fieldPublish osd topicDJI Pilot 2Pilot PreviewMQTT GatewayCloud ServerThird-party Web Page

Verification Succeeded

DJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web PageTurn on the encoderPushing streams to live streaming serversReport opening success through service_reply topicPublish that live streaming was successfully openedStart pulling the streamingDJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web Page

Verification Failed

DJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web PagePublish the failure and the reason for the failure of start the live streaming through the service_reply topicPublish the failure messageDJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web Page

App Side call JSBridge to start live stream

DJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web PageUser chooses to start or stop a live streaming from the flight control screenGo to the DJI Pilot 2 webview page and pull the live streaming configuration parameters in the server-sideReturn live streaming parametersSet manual live streaming parameters, and initiate live streaming immediately after the first setting JSBridge:liveshareSetConfigPush streamingPull the streaming and playDJI Pilot 2Pilot WebviewMQTT GatewayCloud ServerThird-party Web Page

Detailed API Realization

  • JSBridgeopen in new window

    • Load DJI Pilot 2 Live Module window.djiBridge.platformLoadComponent(String name, String param)
      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.

    • App Side call JSBridge to start livestreaming
      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.
      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.

  • Live Stream (MQTT)open in new window

    • 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.

    • 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.

    • Stop Live Streaming

    • Set Live Streaming Quality

If you have any comments or confusion about our documentation, you can click here to give feedback and we will get back to you as soon as possible.