Interface ICamera
- All Superinterfaces:
IAnyGroup<ICamera>,IComponent<ICamera>,IHtmlBasedComponent<ICamera>,IXulElement<ICamera>
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 ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeICamera.static classBuilds an updater of typeICameraforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns the constraints.default intReturns the maximum record length limit, unit is "seconds".default intReturns the max size setting of upload video and snapshot, unit is "KB".Returns the record video format, e.g.,"video/webm","video/mp4", and"video/ogg".Returns the snapshot image format, e.g., image/png, image/jpeg.default StringReturns the client widget class.default booleanisAudio()Return whether to record sound while recording video.default booleanReturns whether the preview screen is on.static ICameraReturns the instance with the given id.static ICameraReturns the instance with the given size, width and heightwithAudio(boolean audio) Returns a copy ofthisimmutable component with the specifiedaudio.withConstraints(Map<String, ? extends Object> constraints) Returns a copy ofthisimmutable component with the specifiedconstraints.withLengthLimit(int lengthLimit) Returns a copy ofthisimmutable component with the specifiedlengthLimit.withMaxsize(int maxsize) Returns a copy ofthisimmutable component with the specifiedmaxsize.withPreviewRecord(boolean previewRecord) Returns a copy ofthisimmutable component with the specifiedpreviewRecord.withRecordFormat(String recordFormat) Returns a copy ofthisimmutable component with the specifiedrecordFormat.withSnapshotFormat(String snapshotFormat) Returns a copy ofthisimmutable component with the specifiedsnapshotFormat.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, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zkmax.med.Camera"- Specified by:
getWidgetClassin interfaceIComponent<ICamera>
-
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
Returns a copy ofthisimmutable component with the specifiedsnapshotFormat.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 formatDefault:
null.- Returns:
- A modified copy of the
thisobject
-
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
Returns a copy ofthisimmutable component with the specifiedrecordFormat.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 formatDefault:
null.- Returns:
- A modified copy of the
thisobject
-
getConstraints
Returns the constraints. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraintsDefault:
null. -
withConstraints
Returns a copy ofthisimmutable component with the specifiedconstraints.Sets the constraints. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints
- Parameters:
constraints- The constraintsDefault:
null.- Returns:
- A modified copy of the
thisobject
-
getMaxsize
default int getMaxsize()Returns the max size setting of upload video and snapshot, unit is "KB". Refer towithMaxsize(int)for more details.Default:
Configuration.getMaxUploadSize() -
withMaxsize
Returns a copy ofthisimmutable component with the specifiedmaxsize.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
thisobject
-
isAudio
default boolean isAudio()Return whether to record sound while recording video.Default:
true -
withAudio
Returns a copy ofthisimmutable component with the specifiedaudio.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
thisobject
-
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
Returns a copy ofthisimmutable component with the specifiedpreviewRecord.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
thisobject
-
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
Returns a copy ofthisimmutable component with the specifiedlengthLimit.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
thisobject
-
ofSize
Returns the instance with the given size, width and height- Parameters:
width- The width of the componentheight- The height of the component
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component.
-