public static interface CameraConfig.Builder
CameraConfig instance.| 限定符和类型 | 方法 | 说明 |
|---|---|---|
CameraConfig.Builder |
addDeferredSurface(Surface surface) |
Adds the deferred surface.
|
<T> CameraConfig.Builder |
addDeferredSurfaceSize(Size surfaceSize,
Class<T> clazz) |
Adds the size and class type of the deferred surface to the camera configuration.
|
CameraConfig.Builder |
addSurface(Surface surface) |
Adds a surface as an output for a camera stream.
|
CameraConfig |
build() |
Builds a secure
CameraConfig object. |
List<Surface> |
getSurfaces() |
Gets all surfaces set for the camera stream in
CameraConfig.Builder. |
CameraConfig.Builder |
removeSurface(Surface surface) |
Removes a surface for a camera stream.
|
CameraConfig.Builder |
setFrameStateCallback(FrameStateCallback callback,
EventHandler handler) |
Sets a callback and handler for frame capture results.
|
CameraConfig.Builder |
setRunningMode(int runningMode) |
Sets a running mode for the camera.
|
CameraConfig.Builder addSurface(Surface surface)
surface - Indicates a surface of streams for preview, taking pictures, and video recording. The surface
cannot be null. Repeatedly adding the same surface is invalid.Builder object.NullPointerException - Throws this exception if surface is null.CameraConfig.Builder removeSurface(Surface surface)
surface - Indicates a surface of streams for preview, taking pictures, and video recording. The surface
cannot be null.Builder object.NullPointerException - Throws this exception if surface is null.List<Surface> getSurfaces()
CameraConfig.Builder.addSurface(Surface)<T> CameraConfig.Builder addDeferredSurfaceSize(Size surfaceSize, Class<T> clazz)
Set the size and class type of the deferred surface when configuring the camera for the first time. After
the surface is ready, add it to the camera configuration by calling CameraConfig.Builder#addDeferredSurface. This reduces camera startup latency caused by UI loading for
complex applications, improving application startup performance.
Only one surface can be used as the deferred surface, which is usually used for preview.
After calling this method, you must call CameraConfig.Builder#addDeferredSurface to add the
surface before requesting frame capture of this surface.
T - Indicates the class type.surfaceSize - Indicates the size to set.clazz - Indicates the surface class.Builder object.NullPointerException - Throws this exception if surfaceSize or clazz is null.IllegalArgumentException - Throws this exception if surfaceSize is invalid.IllegalStateException - Throws this exception if this method is called after the CameraConfig.Builder#addDeferredSurface method.CameraConfig.Builder addDeferredSurface(Surface surface)
This method must be called after CameraConfig.Builder#addDeferredSurfaceSize. Otherwise, an
exception will be thrown for illegal status. Only one surface can be used as the deferred surface.
After CameraConfig.Builder#build is called, the deferred surface becomes a common surface. To
remove the surface, you can call the CameraConfig.Builder#removeSurface method.
surface - Indicates the deferred surface to add.Builder object.NullPointerException - Throws this exception if surface is null.IllegalArgumentException - Throws this exception if the passed surface has been added as the
common surface by CameraConfig.Builder#addSurface, or if the size of surface is different
from that added by CameraConfig.Builder#addDeferredSurface.IllegalStateException - Throws this exception if CameraConfig.Builder#addDeferredSurfaceSize
was not called before addDeferredSurface(Surface) is called.CameraConfig.Builder setFrameStateCallback(FrameStateCallback callback, EventHandler handler)
callback - Indicates the callback for the frame capture results. If the callback is null, the previous
setting will be cleared.handler - Indicates a handler of the callback. The handler must not be null, and the callback will be
invoked in the handler.
The handler must be valid throughout the lifecycle of the camera. If the handler is released before it should be, an exception may be thrown.
Builder object.NullPointerException - Throws this exception if callback is not null but handler is null.CameraConfig.Builder setRunningMode(int runningMode)
You should obtain the supported running modes before setting any mode
via CameraConfig.Builder#setRunningMode(int).
runningMode - Indicates the running mode to set.Builder object.CameraAbility.CameraRunningModeCameraConfig build()
CameraConfig object.
Call Camera#configure(CameraConfig) to complete the camera configuration.CameraConfig object.