Package org.zkoss.stateless.sul

## Interface ICamera

- All Superinterfaces:
    `IAnyGroup<ICamera>`, `IComponent<ICamera>`, `IHtmlBasedComponent<ICamera>`, `IXulElement<ICamera>`

      public interface ICamera
      extends IXulElement<ICamera>, IAnyGroup<ICamera>

  Immutable `Camera` component

  The Camera component is used to record videos and take snapshots in the browser.

  ### Support @Action

  Name | Action Type
  --- | ---
  onVideoUpload | ActionData: `FileData` Notifies after the video has been uploaded.
  onSnapshotUpload | ActionData: `FileData` Notifies after the snapshot has been uploaded.
  onMaxsizeExceed | Notifies if the recorded size is bigger than the max size.
  onLengthLimitExceed | Notifies if the recorded length exceeds the max length.
  onStateChange | ActionData: `StateChangeData` Notifies when invoking start(), stop(), pause() or resume().
  onCameraUnavailable | ActionData: `DOMExceptionData` Notifies if camera is unavailable after requesting media devices from user.

  Author:
    katherine
  See Also:
    `Camera`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `ICamera.Builder` | Builds instances of type `ICamera`.
    `static class` | `ICamera.Updater` | Builds an updater of type `ICamera` for `UiAgent.smartUpdate(Locator, SmartUpdater)`.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ICamera` | `DEFAULT` | Constant for default attributes of this immutable component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getConstraints()` | Returns the constraints.
    `default int` | `getLengthLimit()` | Returns the maximum record length limit, unit is "seconds".
    `default int` | `getMaxsize()` | Returns the max size setting of upload video and snapshot, unit is "KB".
    `java.lang.String` | `getRecordFormat()` | Returns the record video format, e.g., `"video/webm"`, `"video/mp4"`, and `"video/ogg"`.
    `java.lang.String` | `getSnapshotFormat()` | Returns the snapshot image format, e.g., image/png, image/jpeg.
    `default java.lang.String` | `getWidgetClass()` | Returns the client widget class.
    `default boolean` | `isAudio()` | Return whether to record sound while recording video.
    `default boolean` | `isPreviewRecord()` | Returns whether the preview screen is on.
    `static ICamera` | `ofId​(java.lang.String id)` | Returns the instance with the given id.
    `static ICamera` | `ofSize​(java.lang.String width, java.lang.String height)` | Returns the instance with the given size, width and height
    `ICamera` | `withAudio​(boolean audio)` | Returns a copy of `this` immutable component with the specified `audio`.
    `ICamera` | `withConstraints​(java.util.Map<java.lang.String,​? extends java.lang.Object> constraints)` | Returns a copy of `this` immutable component with the specified `constraints`.
    `ICamera` | `withLengthLimit​(int lengthLimit)` | Returns a copy of `this` immutable component with the specified `lengthLimit`.
    `ICamera` | `withMaxsize​(int maxsize)` | Returns a copy of `this` immutable component with the specified `maxsize`.
    `ICamera` | `withPreviewRecord​(boolean previewRecord)` | Returns a copy of `this` immutable component with the specified `previewRecord`.
    `ICamera` | `withRecordFormat​(java.lang.String recordFormat)` | Returns a copy of `this` immutable component with the specified `recordFormat`.
    `ICamera` | `withSnapshotFormat​(java.lang.String snapshotFormat)` | Returns a copy of `this` immutable component with the specified `snapshotFormat`.

    - ### Methods inherited from interface org.zkoss.stateless.sul.IComponent

      `getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent

      `getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IXulElement

      `getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip`

- - ### Field Detail

    - #### DEFAULT

          static final ICamera DEFAULT

      Constant for default attributes of this immutable component.

  - ### Method Detail

    - #### getWidgetClass

          default java.lang.String getWidgetClass()

      Returns the client widget class.

      Default: `"zkmax.med.Camera"`

      Specified by:
        `getWidgetClass` in interface `IComponent<ICamera>`

    - #### getSnapshotFormat

          @Nullable
          java.lang.String getSnapshotFormat()

      Returns the snapshot image format, e.g., image/png, image/jpeg. If the requested type is invalid or unspecified, it will use image/png.

      Default: `null`.

    - #### withSnapshotFormat

          ICamera withSnapshotFormat​(@Nullable
                                     java.lang.String snapshotFormat)

      Returns a copy of `this` immutable component with the specified `snapshotFormat`.

      Sets the snapshot image format, e.g., `"image/png"`, `"image/jpeg"`. If the requested type is invalid or unspecified, it will use `"image/png"`.

      Parameters:
        `snapshotFormat` - The snapshot image format

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getRecordFormat

          @Nullable
          java.lang.String getRecordFormat()

      Returns the record video format, e.g., `"video/webm"`, `"video/mp4"`, and `"video/ogg"`. If the requested type is invalid or unspecified, it will use `"video/webm"`.

      Default: `null`.

    - #### withRecordFormat

          ICamera withRecordFormat​(@Nullable
                                   java.lang.String recordFormat)

      Returns a copy of `this` immutable component with the specified `recordFormat`.

      Sets the record video format, e.g., `"video/webm"`, `"video/mp4"`, and `"video/ogg"`. If the requested type is invalid or unspecified, it will use `"video/webm"`

      Parameters:
        `recordFormat` - The record video format

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getConstraints

          @Nullable
          java.util.Map<java.lang.String,​java.lang.Object> getConstraints()

      Returns the constraints. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints

      Default: `null`.

    - #### withConstraints

          ICamera withConstraints​(@Nullable
                                  java.util.Map<java.lang.String,​? extends java.lang.Object> constraints)

      Returns a copy of `this` immutable component with the specified `constraints`.

      Sets the constraints. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints

      Parameters:
        `constraints` - The constraints

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getMaxsize

          default int getMaxsize()

      Returns the max size setting of upload video and snapshot, unit is "KB". Refer to `withMaxsize(int)` for more details.

      Default: `Configuration.getMaxUploadSize()`

    - #### withMaxsize

          ICamera withMaxsize​(int maxsize)

      Returns a copy of `this` immutable component with the specified `maxsize`.

      Sets the max size of upload video and snapshot, unit is "KB". Notice: Both video and snapshot files must smaller than max size, or nothing will upload.

      Parameters:
        `maxsize` - The max size of upload video and snapshot, unit is "KB"

        Default: `Configuration.getMaxUploadSize()`.

      Returns:
        A modified copy of the `this` object

    - #### isAudio

          default boolean isAudio()

      Return whether to record sound while recording video.

      Default: `true`

    - #### withAudio

          ICamera withAudio​(boolean audio)

      Returns a copy of `this` immutable component with the specified `audio`.

      Sets whether to record sound while recording video.

      Parameters:
        `audio` - Whether to record sound while recording video.

        Default: `true`.

      Returns:
        A modified copy of the `this` object

    - #### isPreviewRecord

          default boolean isPreviewRecord()

      Returns whether the preview screen is on. If you want to take a snapshot, must turn on preview screen, or nothing will happen.

      Default: `true`

    - #### withPreviewRecord

          ICamera withPreviewRecord​(boolean previewRecord)

      Returns a copy of `this` immutable component with the specified `previewRecord`.

      Sets whether the preview screen is on. If you want to take a snapshot, must turn on preview screen, or nothing will happen.

      Parameters:
        `previewRecord` - Whether the preview screen is on.

        Default: `true`.

      Returns:
        A modified copy of the `this` object

    - #### getLengthLimit

          default int getLengthLimit()

      Returns the maximum record length limit, unit is "seconds". If recording seconds exceed length limit, recording will stop immediately.

      Default: `60`

    - #### withLengthLimit

          ICamera withLengthLimit​(int lengthLimit)

      Returns a copy of `this` immutable component with the specified `lengthLimit`.

      Sets the maximum record length limit, unit is "seconds". If recording seconds exceed length limit, recording will stop immediately.

      Parameters:
        `lengthLimit` - The maximum record length limit, unit is "seconds".

        Default: `60`.

      Returns:
        A modified copy of the `this` object

    - #### ofSize

          static ICamera ofSize​(java.lang.String width,
                                java.lang.String height)

      Returns the instance with the given size, width and height
      Parameters:
        `width` - The width of the component
        `height` - The height of the component

    - #### ofId

          static ICamera ofId​(java.lang.String id)

      Returns the instance with the given id.
      Parameters:
        `id` - The id to identify this component.