DJI Mobile SDK Documentation

      class ICameraStreamManager

      interface ICameraStreamManager
      Package:dji.v5.manager.interfaces
      Description:

      Camera stream management class. Supports functions such as camera lens video stream display, video frame data and video stream data acquisition. The following is the interface usage process:

    • Add a listener to obtain the available camera index through addAvailableCameraUpdatedListener.
    • Call putCameraStreamSurface to display the camera video stream to a specific surface.
    • Add the video stream data listener addReceiveStreamListener to receive the video stream data. The video stream data can be used for functions such as self-decoding display and third-party livestreaem.
    • Add the frame data listener addFrameListener to receive frame data. Frame data can be used for algorithm processing of functions such as AI recognition.


    • Supported since MSDK 5.8.0
      Class Members:
      method addAvailableCameraUpdatedListener
      void addAvailableCameraUpdatedListener(@NonNull AvailableCameraUpdatedListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Set available camera listener. This listener allows you to listen for available camera indexes. After obtaining the available camera indexes, you can call putCameraStreamSurface to display the video stream of a specific camera.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull AvailableCameraUpdatedListener listenerAvailable camera listener
      method removeAvailableCameraUpdatedListener
      void removeAvailableCameraUpdatedListener(@NonNull AvailableCameraUpdatedListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Remove the listener of avilable camera.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull AvailableCameraUpdatedListener listenerAvailable camera listener
      method putCameraStreamSurface
      void putCameraStreamSurface(@NonNull ComponentIndexType cameraIndex,
      @NonNull Surface surface,
      int surfaceWidth,
      int surfaceHeight,
      @NonNull ScaleType scaleType)
      Package:dji.v5.manager.interfaces
      Description:

      Display the camera video stream to a specific surface. A single surface can display at most one cameraIndex camera video stream at the same time. If this interface is called multiple times for the same surface, the parameters of the surface will be updated, such as updating the camera index, surface's size or scale type.
      Note:
      If you want to display images from different camera lenses, you can call KeyCameraVideoStreamSource to switch camera lenses.


      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull ComponentIndexType cameraIndexSet the camera index for stream display.
      @NonNull Surface surfaceSet the surface that needs to display the video stream. Supports SurfaceView, TextureView and MediaCodeC Surface, does not support GLSurfaceView surface and any surface bound to OpenGL.
      int surfaceWidthSet the surface width required for video stream display.
      int surfaceHeightSet the surface height required for video stream display.
      @NonNull ScaleType scaleTypeSet the scale type required for video stream display.
      method removeCameraStreamSurface
      void removeCameraStreamSurface(@NonNull Surface surface)
      Package:dji.v5.manager.interfaces
      Description:

      Remove the added surface. When you no longer need to use the surface, please call this interface to remove the added surface, otherwise it will cause memory leaks. After removal, the surface will no longer display the video stream.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull Surface surfaceSet the Surface to be removed.
      method addFrameListener
      void addFrameListener(@NonNull ComponentIndexType cameraIndex,
      @NonNull FrameFormat format,
      @NonNull CameraFrameListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Add video frame data listener. This listener can listen the video frame data of the specified camera. You can use video frame data to implement functions such as AI recognition.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull ComponentIndexType cameraIndexSet the camera index to be listen.
      @NonNull FrameFormat formatSet the frame format to be listen.
      @NonNull CameraFrameListener listenervideo frame data listener
      method removeFrameListener
      void removeFrameListener(@NonNull CameraFrameListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Remove video frame data listener.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull CameraFrameListener listenervideo frame data listener
      method addReceiveStreamListener
      void addReceiveStreamListener(@NonNull ComponentIndexType cameraIndex, @NonNull ReceiveStreamListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Add a video stream data listener. Through this listener, you can receive the raw video stream data of the specified camera. You can use this stream data to decode and display it yourself or implement functions such as third-party live streaming.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull ComponentIndexType cameraIndexSet the camera index to be listen.
      @NonNull ReceiveStreamListener listenervideo stream data listener
      method removeReceiveStreamListener
      void removeReceiveStreamListener(@NonNull ReceiveStreamListener listener)
      Package:dji.v5.manager.interfaces
      Description:

      Remove video stream data listener.

      Supported since MSDK 5.8.0

      Input Parameters:
      @NonNull ReceiveStreamListener listenervideo stream data listener
      method setKeepAliveDecoding
      void setKeepAliveDecoding(boolean isKeepALive)
      Package:dji.v5.manager.interfaces
      Description:

      Whether to let the decoder continue decoding in the background, the default value is false. If it is false, when the manager does not reference any Surface, ReceiveStreamListener, or CameraFrameListener, the decoder will pause decoding to reduce background performance/power consumption, but this will increase the delay in pushing camera video stream data for the first time. If true, the decoder will continue to decode in the background, which will increase performance/power consumption, but can reduce the delay in pushing camera video stream data for the first time.

      Supported since MSDK 5.8.0

      Input Parameters:
      boolean isKeepALivetrue means the decoder continues decoding in the background.
      method getLiveViewLocationWithGPS
      @NonNull
      PinPointInfo getLiveViewLocationWithGPS(@NonNull LocationCoordinate3D pointPos, @NonNull ComponentIndexType type)
      Package:dji.v5.manager.interfaces
      Description:

      Gets the pin point information with GPS which is used to show pin point in the liveview.

      Supported since MSDK 5.9.0

      Input Parameters:
      @NonNull LocationCoordinate3D pointPosThe GPS location, you could get the location from KeyLaserMeasureInformation: getLocation3D or get the location with map.
      @NonNull ComponentIndexType typeSet the camera index displayed by the current stream.
      Return:
      PinPointInfoReturn the pin point information.
      unknown
      unknown
      interface AvailableCameraUpdatedListener
      Package:dji.v5.manager.interfaces
      Description:

      Available camera listener

      Supported since MSDK 5.8.0

      unknown
      unknown
      interface CameraFrameListener
      Package:dji.v5.manager.interfaces
      Description:

      video frame data listener.

      Supported since MSDK 5.8.0

      unknown
      unknown
      interface ReceiveStreamListener
      Package:dji.v5.manager.interfaces
      Description:

      video stream data listener

      Supported since MSDK 5.8.0

      unknown
      unknown
      enum MimeType
      Package:dji.v5.manager.interfaces
      Description:

      Mime type, supports H264 and H265.

      Supported since MSDK 5.8.0

      unknown
      unknown
      enum ScaleType
      Package:dji.v5.manager.interfaces
      Description:

      Scale type.

      Supported since MSDK 5.8.0

      unknown
      unknown
      enum FrameFormat
      Package:dji.v5.manager.interfaces
      Description:

      The format of the video stream data.

      Supported since MSDK 5.8.0


      Members

      enum
      enum Result
      enum Result
      Package:dji.v5.manager.datacenter.camera.view
      Description:

      The result of pin point callback.

      Enum Members:
      SUCCESSSuccess to get the pin point location, the point is insde the liveview.
      SUCCESS_BUT_OUT_OF_SCREENSuccess to get the pin point location, but point is out of liveview, should show as side indicator, please reference to DJI pilot.
      FAILEDFailed to get the pin point location.
      INVALID_DRONE_POSITIONFailed to get the pin point location, because the drone position is invalid.
      INVALID_POINT_POSITIONFailed to get the pin point location, because the input GPS location is invalid.
      GIMBAL_ATTI_ERRORFailed to get the pin point location, because of gimbal attitude error.
      CAMEAR_ERRORFailed to get the pin point location, because of camera error.
      Class Members: