Start Live Streaming

2022-07-19
No Rating

Live Start Push

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.

services

Communication method: MQTT

API interface:

PUB Topic: thing/product/#{remote control/airport SN}/services
SUB Topic: thing/product/#{remote control/airport SN}/services_reply
  • Parameter Description:
  • #{pid}:Refers to the product ID of the gateway device, which is usually expressed by the SN number of the device, and is different for each device. So you need to use a wildcard when the server side subscribes to topic.

Example of parameters for Services

{
    "tid": "1af9204671b24e4fb016e6506380a4e0",
    "bid": "88bcbac59d71447b863c6dac70d30563",
    "method": "live_start_push",
    "data": {
        "url_type": 0,
        "url": "channel=1ZNDH1D0010098_39-0-7\u0026sn=1ZNDH1D0010098\u0026token=006dca67721582a48768ec4d817b7b25a86IADk%2Fcm%2Fdv%2BHY6qT%2FAKM6y7TcUe4lXNvZpycH7vUMAlM6pFALUKF2zyCIgA82pQE8cCoYAQAAQDxwKhgAgDxwKhgAwDxwKhgBADxwKhg\u0026uid=50000",
        "video_id": "1ZNDH1D0010098/39-0-7/normal-0",
        "video_quality": 0
    }
}

Parameter Description:

  • url_type: Live streaming protocol type. Enumeration

    • 0: Agora
    • 1: RTMP
    • 2: RTSP
    • 3: GB28181
  • url: Live streaming parameters. String

    RTMP: (rtmp://xxxxxxx)

    ​ Example: rtmp://192.168.1.1:8080/live

    RTSP:(uerName&password&port)

    ​ Example: userName=dji-cloud-api&password=123456&port=8080

    GB28181:(serverIP&serverPort&serverID&agentID&agentPassword&localPort&channel)

    ​ Example: serverIP=192.168.1.1&serverPort=8080&serverID=34000000000000000000&agentID=300000000010000000000&agentPassword=0000000&localPort=7060&channel=340000000000000000000

    Agora:(channel&sn&token&uid)

    Example: channel=1ZNDH360010162_39-0-7&sn=1ZNDH360010162&token=006dca67721582a48768ec4d817b7b25a86IAB4cw2JgN6iX8BpTPdc3e4S1Iendz94IFJ56aSXKvzAJei27MqF2zyCIgCLIIoBt41+YAQAAQC3jX5gAgC3jX5gAwC3jX5gBAC3jX5g&uid=50000

    Note: The token generated by Agora may have special characters such as "+" and " ", you need to encode it, otherwise the DJI Pilot 2 will have a parsing error.

  • video_id: ID number of the live video stream. String

    video_id has a format requirement, the specific combination format is aircraft SN / payload and enumeration values for mount locations / payload lens number.

    ​ Example: 1ZNDH1D0010098/0-39-7/normal-0

  • video_quality: Live quality.

    • 0: Auto
    • 1: Smooth
    • 2: Standard Definition
    • 3: High Definition
    • 4: Ultra HD

Different types of field requirements

FieldSoundnetRTMPRTSPGB28181
tidRequiredRequiredRequiredRequired
bidRequiredRequiredRequiredRequired
methodRequiredRequiredRequiredRequired
urlRequiredRequiredRequiredRequired
url_typeRequiredRequiredRequiredRequired
video_idRequiredRequiredRequiredRequired
video_qualityRequired when setting the quality.Required when setting the quality.Required when setting the quality.Required when setting the quality.

services_reply

For the message response, the server needs to keep the tid and bid consistent. The client uses these two fields to determine which message the server responds to.

Example:

{
    "tid":"fc55099072324bbba9ee7b014d9637de",
    "bid":"9b748a8e00b94d02879e506160cf7ab5",
    "method":"live_start_push",
    "data":{
        "result":0,
        // The following is the ack for rtsp, which needs to return the live url back.
        "info": "rtsp://${username}:${password}@192.168.1.100:8445/live/1"
    }
}
  • Parameter Description:

    • result: Error code, see the chapter Error Code for specific meaning.
    • info: For the case that you need to bring parameters when replying, you can add them in output. For example, RTSP needs to return the live url of the device.

Note

1. The RTSP is special, and the device's live streaming address needs to be added to the response message for the server to pull the stream.