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 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.
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.
voidputCameraStreamSurface(@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.
Set 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 surfaceWidth
Set the surface width required for video stream display.
int surfaceHeight
Set the surface height required for video stream display.
@NonNull ScaleType scaleType
Set the scale type required for video stream display.
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.
voidaddFrameListener(@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.
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.
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 isKeepALive
true means the decoder continues decoding in the background.