VideoOutput
public interface VideoOutput
Recorder |
An implementation of |
A class that will produce video data from a Surface
.
Implementations will provide a Surface
to a video frame producer via the SurfaceRequest
sent to onSurfaceRequested
.
The type of video data produced by a video output and API for saving or communicating that data is left to the implementation. An implementation commonly used for local video saving is Recorder
. This interface is usually only needs to be implemented by applications for advanced use cases.
Summary
Public methods |
|
---|---|
abstract void |
onSurfaceRequested(@NonNull SurfaceRequest request) Called when a new |
Public methods
onSurfaceRequested
abstract void onSurfaceRequested(@NonNull SurfaceRequest request)
Called when a new Surface
has been requested by a video frame producer.
Users of this class should not call this method directly. It will be called by the video frame producer. Implementors of this class should be aware that this method is called when a video frame producer is ready to receive a surface that it can use to send video frames to the video output. The video frame producer may repeatedly request a surface more than once, but only the latest SurfaceRequest
should be considered active. All previous surface requests will complete by sending a androidx.camera.core.SurfaceRequest.Result
to the consumer passed to provideSurface
.
A request is considered active until it is fulfilled
, marked as 'will not complete'
, or cancelled by the video frame producer
. After one of these conditions occurs, a request is considered completed.
Once a request is successfully completed, it is guaranteed that if a new request is made, the Surface
used to fulfill the previous request will be detached from the video frame producer and the resultListener
provided in provideSurface
will be invoked with a androidx.camera.core.SurfaceRequest.Result
containing RESULT_SURFACE_USED_SUCCESSFULLY
.
Parameters | |
---|---|
@NonNull SurfaceRequest request |
the request for a surface which contains the requirements of the surface and methods for completing the request. |