DJI Mobile SDK Documentation

      class VideoFeeder

      class VideoFeeder
      Package:dji.sdk.camera
      Description:

      Class that manages live video feed from DJI products to the mobile device.

      Class Members:
      Get Instance
      method
      method getInstance
      static VideoFeeder getInstance()
      Package:dji.sdk.camera
      Description:

      The instance of VideoFeeder.

      Return:
      static VideoFeederAn object of VideoFeeder.
      Add Listener
      method
      method addPhysicalSourceListener
      void addPhysicalSourceListener(PhysicalSourceListener listener)
      Package:dji.sdk.camera
      Description:

      Add physical source listener.

      Input Parameters:
      PhysicalSourceListener listenerAn interface of PhysicalSourceListener.
      Remove Listener
      method
      method removePhysicalSourceListener
      void removePhysicalSourceListener(PhysicalSourceListener listener)
      Package:dji.sdk.camera
      Description:

      Remove physical source listener.

      Input Parameters:
      PhysicalSourceListener listenerAn interface of PhysicalSourceListener.
      Primary Video Feed
      method
      method getPrimaryVideoFeed
      @NonNull
      VideoFeed getPrimaryVideoFeed()
      Package:dji.sdk.camera
      Description:

      The primary video feed.
      The possible physical sources for the primary video feed include:
      - MAIN_CAM
      - LB
      - HDMI
      - LEFT_CAM
      - RIGHT_CAM
      For M210 and M210 RTK, the physical sources are controlled by the bandwidth allocation between the port (left) and starboard (right) main cameras (setBandwidthAllocationForLeftCamera):
      - When bandwidth is 100% on the left camera, the primary source is LEFT_CAM and the secondary source is FPV_CAM.
      - When bandwidth is 0% on the left camera, the primary source is RIGHT_CAM and the secondary source is FPV_CAM.
      - When bandwidth is neither 0% nor 100% on the left camera, the primary source is LEFT_CAM and the secondary source is RIGHT_CAM.

      Return:
      VideoFeedA VideoFeed object.
      Secondary Video Feed
      method
      method getSecondaryVideoFeed
      @NonNull
      VideoFeed getSecondaryVideoFeed()
      Package:dji.sdk.camera
      Description:

      The secondary video feed.
      The possible physical sources for the secondary video feed include:
      - FPV_CAM
      - EXT
      - AV
      - RIGHT_CAM. For M210 and M210 RTK, the physical sources are controlled by the bandwidth allocation between the port (left) and starboard (right) main cameras (setBandwidthAllocationForLeftCamera):
      - When bandwidth is 100% on the left camera, the primary source is LEFT_CAM and the secondary source is FPV_CAM.
      - When bandwidth is 0% on the left camera, the primary source is RIGHT_CAM and the secondary source is FPV_CAM.
      - When bandwidth is neither 0% nor 100% on the left camera, the primary source is LEFT_CAM and the secondary source is RIGHT_CAM.

      Return:
      VideoFeedA VideoFeed object.
      method provideTranscodedVideoFeed
      VideoFeed provideTranscodedVideoFeed()
      Package:dji.sdk.camera
      Description:

      Returns a new VideoFeed instance to receive the transcoded video feed from the main camera. The original video feed from the main camera is transcoded (using MediaCodec) to generate H.264 video feed for more general usages. The encoder will use the calibrated decoded feed when lens distortion calibration is needed. Setting the callback of VideoFeed to null can stop the transcoding.

      Return:
      VideoFeedA VideoFeed object.
      method setTranscodingDataRate
      void setTranscodingDataRate(float rate)
      Package:dji.sdk.camera
      Description:

      Sets the destination data rate for the transcoded video feed. The valid range is [2, 20] in Mbps. CAUTION: Changing the data rate during transcoding may re-start the internal encoder. The transcoded video feed will get interrupted for a few seconds.

      Input Parameters:
      float rateThe destination data rate for the transcoded video feed.
      method getTranscodingDataRate
      float getTranscodingDataRate()
      Package:dji.sdk.camera
      Description:

      Gets the data rate of all transcoded video feeder, in Mbps.

      Return:
      floatA float value of the data rate of all transcoded video feeder.
      method isLensDistortionCalibrationNeeded
      boolean isLensDistortionCalibrationNeeded()
      Package:dji.sdk.camera
      Description:

      Determines if the original video feed requires lens distortion calibration. When calibration is needed, it is not recommended to use the original video feed with the decoding sample (https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample). Use the transcoded video feed instead and also the module: 'library-anti-distortion' should be included.

      Return:
      booleantrue if the video need anti-distortion feature.
      method isFetchKeyFrameNeeded
      boolean isFetchKeyFrameNeeded()
      Package:dji.sdk.camera
      Description:

      Determines if the original video feed requires SDK to fetch key frame. When fetch key frame is needed, it is not recommended to use the original video feed with the decoding sample (https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample). Use the transcoded video feed instead.

      Return:
      booleantrue if the video need anti-distortion feature.
      State Updates
      interface
      interface VideoDataListener
      interface VideoDataListener
      Package:dji.sdk.camera
      Description:

      Video data listener.

      Interface Methods:

      Callback Method

      State
      method
      method onReceive
      void onReceive(byte[] videoBuffer, int size)
      Package:dji.sdk.camera
      Description:

      Listener that is called when video data is received, but if isLensDistortionCalibrationNeeded return true, the callback will never be called.

      Input Parameters:
      byte[] videoBufferAn array containing video buffer.
      int sizeThe size of the buffer that contains valid data.
      interface
      interface VideoFeed
      interface VideoFeed
      Package:dji.sdk.camera
      Description:

      Video feed. Use it to receive video data from a physical source.

      Interface Methods:
      enum PhysicalSource
      enum PhysicalSource
      Package:dji.sdk.camera
      Description:

      The physical source of a video feed.

      Enum Members:
      MAIN_CAMThe video feed is from the main camera. It is the physical source used by most of DJI products. For M210 and M210 RTK, LEFT_CAM and RIGHT_CAM are used instead.
      FPV_CAMThe video feed is from the FPV camera on Inspire 2 or M200 series.
      EXTThe video feed is from EXT port while EXT port is enabled. It is only used for Lightbridge 2 or aircrafts with Lightbridge 2 (e.g. M600).
      LBThe video feed is from one of the LB ports (AV or HDMI) while EXT Port is enabled. It is only used for stand-alone Lightbridge 2 or aircraft with stand-alone Lightbridge 2 modules (e.g. M600).
      HDMIThe video feed is from the HDMI port while EXT port is disabled. It is only used for stand-alone Lightbridge 2 or aircraft with stand-alone Lightbridge 2 modules.
      AVThe video feed is from AV port while EXT port is disabled. It is only used for stand-alone Lightbridge 2 or aircraft with stand-alone Lightbridge 2 modules.
      LEFT_CAMThe video feed is from the port (left) main camera. It is only used for M210 and M210 RTK.
      RIGHT_CAMThe video feed is from the starboard (right) main camera. It is only used for M210 and M210 RTK.
      UNKNOWNUnknown video physical source.
      Class Members:


      Callback Method

      State
      method
      method getVideoSource
      PhysicalSource getVideoSource()
      Package:dji.sdk.camera
      Description:

      Gets the physical sources of the video data.

      Return:
      PhysicalSourceAn enum value of PhysicalSource.
      method addVideoDataListener
      boolean addVideoDataListener(@NonNull final VideoDataListener listener)
      Package:dji.sdk.camera
      Description:

      Adds a listener to access the video data that is being shown by the VideoFeed.

      Input Parameters:
      @NonNull final VideoDataListener listenerThe listener to be added to the VideoFeed.
      Return:
      booleantrue if listener was added successfully.
      method removeVideoDataListener
      boolean removeVideoDataListener(VideoDataListener listener)
      Package:dji.sdk.camera
      Description:

      Removes the specified listener from the VideoFeed, if it is present (optional operation). If this VideoFeed does not contain the listener, it is unchanged.

      Input Parameters:
      VideoDataListener listenerThe listener to be removed from the VideoFeed.
      Return:
      booleantrue if the listener was removed successfully.
      method getListeners
      Set<VideoDataListener> getListeners()
      Package:dji.sdk.camera
      Description:

      Returns the list of the existing video data listeners.

      Return:
      Set<VideoDataListener>A list of existing VideoDataListener.
      method
      method destroy
      void destroy()
      Package:dji.sdk.camera
      Description:

      Destroy all the listeners associated with this VideoFeed.

      interface PhysicalSourceListener
      interface PhysicalSourceListener
      Package:dji.sdk.camera
      Description:

      Physical source listener.

      Interface Methods:

      Callback Method

      State
      method
      method onChange
      void onChange(VideoFeed videoFeed, PhysicalSource newPhysicalSource)
      Package:dji.sdk.camera
      Description:

      Called when the physical source changes.

      Input Parameters:
      VideoFeed videoFeedAn interface of VideoFeed.
      PhysicalSource newPhysicalSourceAn int value.