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
  • Field Details

    • DEFAULT

      static final ICamera DEFAULT
      Constant for default attributes of this immutable component.
  • Method Details

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zkmax.med.Camera"

      Specified by:
      getWidgetClass in interface IComponent<ICamera>
    • getSnapshotFormat

      @Nullable 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 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 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 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 Map<String,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 Map<String,? extends 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(String width, 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(String id)
      Returns the instance with the given id.
      Parameters:
      id - The id to identify this component.