DJI Mobile SDK Documentation

      class LiveStreamManager

      class LiveStreamManager implements DJILiveStatusCallback
      Package:dji.sdk.sdkmanager
      Description:

      The manager is used to stream the video to a RTMP server to do live streaming with DJI products.

      Class Members:

      State Updates

      method addLiveErrorStatusListener
      synchronized void addLiveErrorStatusListener(OnLiveErrorStatusListener listener)
      Package:dji.sdk.sdkmanager
      Description:

      Adds the listener for the live video status change events.

      Input Parameters:
      OnLiveErrorStatusListener listenerlive video status change listener.
      method removeLiveErrorStatusListener
      synchronized void removeLiveErrorStatusListener(OnLiveErrorStatusListener listener)
      Package:dji.sdk.sdkmanager
      Description:

      Remove the listener for the live video status change events.

      Input Parameters:
      OnLiveErrorStatusListener listenerlive video status change listener.


      Live Stream Operation

      method isStreaming
      boolean isStreaming()
      Package:dji.sdk.sdkmanager
      Description:

      Determines if the live streaming starts or not. After starting this flag will not be affected by the RTMP server status.

      Return:
      booleantrue if the live stream manager is streaming.
      method setLiveUrl
      void setLiveUrl (String url)
      Package:dji.sdk.sdkmanager
      Description:

      Sets the URL address of the RTMP Server. This method should be called before the calling of startStream.

      Input Parameters:
      String urlThe URL address string of the RTMP Server.
      method getLiveUrl
      String getLiveUrl()
      Package:dji.sdk.sdkmanager
      Description:

      Gets the current URL address of the RTMP Server.

      Return:
      StringA string of the URL address.
      method startStream
      synchronized int startStream()
      Package:dji.sdk.sdkmanager
      Description:

      Starts the live streaming. If the manager starts successfully, isStreaming will return true. The encoder will start to encoding the video frame if it is needed. The video will be streamed to the RTMP server if the server is available. The audio can be streamed along with the video if the audio setting is enabled.

      Return:
      synchronized intAn int value of the error code. 0 means success. 254 means initialization error. -2,means livestream feature is disabled by LDM. -3 means failure to obtain sps/pps.
      method stopStream
      void stopStream()
      Package:dji.sdk.sdkmanager
      Description:

      Stop the live streaming. The operation is asynchronous and isStreaming will return false when the operation is complete.

      method getStartTime
      long getStartTime()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the start time of the live streaming. The start time is updated when startStream is successful.

      Return:
      longA long value of the start time.
      method setAudioStreamingEnabled
      void setAudioStreamingEnabled(boolean enabled)
      Package:dji.sdk.sdkmanager
      Description:

      Enables/disables the audio streaming. When it is enabled, the audio received by the mobile device's microphone will be streamed to the RTMP server along with the video. This setting will take effect before startStream is called. Changing this setting after startStream is called requires restarting the streaming. The audio can be muted during the streaming by calling setAudioMuted.

      Input Parameters:
      boolean enabledPass true to enable the audio streaming, false to disable the audio streaming.
      method setAudioMuted
      void setAudioMuted(boolean enable)
      Package:dji.sdk.sdkmanager
      Description:

      Mutes the audio or unmutes the audio.
      Notes: this method only works when audio function is enabled ( isLiveAudioEnabled returns true).

      Input Parameters:
      boolean enablePass true to mute the audio, false to unmute the audio.
      method isLiveAudioEnabled
      boolean isLiveAudioEnabled()
      Package:dji.sdk.sdkmanager
      Description:

      Returns true if the audio function is enabled, vice versa.

      Return:
      booleanA boolean value to check if the audio function is enabled.
      method isAudioMuted
      boolean isAudioMuted()
      Package:dji.sdk.sdkmanager
      Description:

      Returns true if the audio is muted, vice versa.

      Return:
      booleanA boolean value to check if the audio is muted.
      method setVideoEncodingEnabled
      void setVideoEncodingEnabled(boolean enable)
      Package:dji.sdk.sdkmanager
      Description:

      Enables/disables the video encoding by force for the live streaming. The basic workflow to process the video feed from the aircraft is to decode first and then encode again with a specific bit rate into H.264 stream. Therefore, video encoding is required in default. For some drones like Mavic Pro, the original video feed from Mavic Pro remote controller can be streamed to a RTMP server directly, so the video encoding is disabled for Mavic Pro, however, the bit-rate of the original video is very high, by enabling this flag, the original video will be decoded and encoded to a lower speed video stream.

      Input Parameters:
      boolean enablePass true to enable the Video Encoding, false to disable the Video Encoding.
      method isVideoEncodingEnabled
      boolean isVideoEncodingEnabled()
      Package:dji.sdk.sdkmanager
      Description:

      Returns true if video encoding is enabled, vice versa.

      Return:
      booleantrue if the force encoding flag is enabled.
      method getLiveVideoFps
      float getLiveVideoFps()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the real-time live video fps.

      Return:
      floatA float value of the live video fps.
      method setLiveVideoResolution
      void setLiveVideoResolution(LiveVideoResolution videoResolution)
      Package:dji.sdk.sdkmanager
      Description:

      Sets the live video resolution.

      Input Parameters:
      LiveVideoResolution videoResolutionAn emun value of the live video resolution.
      method getLiveVideoResolution
      LiveVideoResolution getLiveVideoResolution()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the live video resolution.

      Return:
      LiveVideoResolutionAn emun value of the live video resolution.
      method setLiveVideoBitRateMode
      void setLiveVideoBitRateMode(LiveVideoBitRateMode bitRateMode)
      Package:dji.sdk.sdkmanager
      Description:

      Sets the live video bit rate mode.

      Input Parameters:
      LiveVideoBitRateMode bitRateModeAn emun value of the live video bit rate mode.
      method getLiveVideoBitRateMode
      LiveVideoBitRateMode getLiveVideoBitRateMode()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the live video bit rate mode.

      Return:
      LiveVideoBitRateModeAn emun value of the live video bit rate mode.
      method setLiveVideoBitRate
      void setLiveVideoBitRate(float bitRate)
      Package:dji.sdk.sdkmanager
      Description:

      Sets the real-time video stream bit rate in kpbs.

      Input Parameters:
      float bitRateA float value of the live video bit rate. The value should be in the range [0.5*1024, 3.5*1024] kpbs.
      method getLiveVideoBitRate
      int getLiveVideoBitRate()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the real-time video stream bit rate in kpbs.

      Return:
      intAn int value of the live video bit rate.
      method getLiveAudioBitRate
      int getLiveAudioBitRate()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the real-time audio stream bit rate in kpbs.

      Return:
      intAn int value of the live audio bit rate.
      method getLiveVideoCacheSize
      int getLiveVideoCacheSize()
      Package:dji.sdk.sdkmanager
      Description:

      Returns the real-time video cache list size, unit: frame.

      Return:
      intAn int value of the live video cache list size.


      enum LiveVideoBitRateMode
      enum LiveVideoBitRateMode
      Package:dji.sdk.sdkmanager
      Description:

      Enums represent the live video bit rate mode.

      Enum Members:
      AUTOThe live video bit rate mode is auto. In this mode, the live video bit rate will change as the network changes, and smoothness is preferred.
      MANUALThe live video bit rate mode is manual. This is the initialization mode of live video. Initial live video bit rate is 2*1024 kbps.
      Class Members: