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.
      enum MimeType
      enum MimeType
      Package:dji.v5.manager.interfaces
      Description:

      Mime type, supports H264 and H265.

      Supported since MSDK 5.8.0

      Enum Members:
      H264H264
      H265H265
      Class Members:
      enum ScaleType
      enum ScaleType
      Package:dji.v5.manager.interfaces
      Description:

      Scale type.

      Supported since MSDK 5.8.0

      Enum Members:
      FIX_XYFIX_XY
      CENTER_CROPCENTER_CROP
      CENTER_INSIDECENTER_INSIDE
      Class Members:
      enum FrameFormat
      enum FrameFormat
      Package:dji.v5.manager.interfaces
      Description:

      The format of the video stream data.

      Supported since MSDK 5.8.0

      Enum Members:
      YUV420_888YUV420_888
      YUV444_888YUV444_888
      YUY2YUV2
      NV21NV21
      RGBA_8888RGBA_8888
      Class Members: