# Class CameraSessionOptions

java.lang.Object
com.codename1.camera.CameraSessionOptions

public final class CameraSessionOptions extends java.lang.Object

Configuration for a `CameraSession`. Fluent builder.

All sizes are advisory; the platform may snap to its nearest supported resolution.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CameraSessionOptions()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CameraSessionOptions`
  `captureAudio(boolean b)`
  Whether to capture audio for video recording.
  `CameraSessionOptions`
  `enableStabilization(boolean b)`
  Whether to request optical/electronic stabilization when supported.
  `CameraSessionOptions`
  `frameFormat(FrameFormat format)`
  Format for frames delivered to `FrameListener`.
  `CameraSessionOptions`
  `frameMaxFps(int fps)`
  Cap on frame delivery rate to `FrameListener`s.
  `FrameFormat`
  `getFrameFormat()`
  Pixel format requested for `FrameListener` delivery.
  `int`
  `getFrameMaxFps()`
  Cap on frames-per-second delivered to listeners; `0` means uncapped.
  `int`
  `getPhotoHeight()`
  Requested still-photo height, or `0` to use the camera default.
  `int`
  `getPhotoWidth()`
  Requested still-photo width, or `0` to use the camera default.
  `int`
  `getPreviewHeight()`
  Requested preview height, or `0` to let the platform pick.
  `int`
  `getPreviewWidth()`
  Requested preview width, or `0` to let the platform pick.
  `boolean`
  `isCaptureAudio()`
  True if the session should request the microphone for video recording.
  `boolean`
  `isStabilizationEnabled()`
  True if optical/electronic stabilization was requested.
  `CameraSessionOptions`
  `photoSize(int width, int height)`
  Requested still-photo resolution.
  `CameraSessionOptions`
  `previewSize(int width, int height)`
  Requested preview / frame-stream resolution.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CameraSessionOptions

    public CameraSessionOptions()

- ## Method Details

  - ### previewSize

    public CameraSessionOptions previewSize(int width, int height)
    Requested preview / frame-stream resolution. The platform may snap to its nearest supported size. Pass `0` for either dimension to let the platform pick.

  - ### photoSize

    public CameraSessionOptions photoSize(int width, int height)
    Requested still-photo resolution. The platform may snap to its nearest supported size. Pass `0` for either dimension to use the camera's default photo size.

  - ### frameFormat

    public CameraSessionOptions frameFormat(FrameFormat format)
    Format for frames delivered to `FrameListener`. Default `FrameFormat#JPEG`.

  - ### frameMaxFps

    public CameraSessionOptions frameMaxFps(int fps)
    Cap on frame delivery rate to `FrameListener`s. Default 15. Set to 0 to deliver every frame the camera produces.

  - ### captureAudio

    public CameraSessionOptions captureAudio(boolean b)
    Whether to capture audio for video recording. Default true. When false, no microphone permission is requested at session open.

  - ### enableStabilization

    public CameraSessionOptions enableStabilization(boolean b)
    Whether to request optical/electronic stabilization when supported. Default false.

  - ### getPreviewWidth

    public int getPreviewWidth()
    Requested preview width, or `0` to let the platform pick.

  - ### getPreviewHeight

    public int getPreviewHeight()
    Requested preview height, or `0` to let the platform pick.

  - ### getPhotoWidth

    public int getPhotoWidth()
    Requested still-photo width, or `0` to use the camera default.

  - ### getPhotoHeight

    public int getPhotoHeight()
    Requested still-photo height, or `0` to use the camera default.

  - ### getFrameFormat

    public FrameFormat getFrameFormat()
    Pixel format requested for `FrameListener` delivery.

  - ### getFrameMaxFps

    public int getFrameMaxFps()
    Cap on frames-per-second delivered to listeners; `0` means uncapped.

  - ### isCaptureAudio

    public boolean isCaptureAudio()
    True if the session should request the microphone for video recording.

  - ### isStabilizationEnabled

    public boolean isStabilizationEnabled()
    True if optical/electronic stabilization was requested.