public class Camera extends XulElement
Only works for browsers supporting HTML5 video tag
HtmlBasedComponent.ExtraCtrl
AbstractComponent.Children
Modifier and Type | Field and Description |
---|---|
static int |
PAUSE
Represent the pause state
|
static int |
RESUME
Represent the resume state
|
static int |
START
Represent the start state
|
static int |
STOP
Represent the stop state
|
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Camera() |
Modifier and Type | Method and Description |
---|---|
java.util.Map |
getConstraints()
Returns the constraints.
|
java.lang.String |
getConstraintsString()
Returns the constraints in JSON String format.
|
int |
getLengthLimit()
Get the maximum record length limit, unit is "seconds".
|
int |
getMaxsize()
Get the max size setting of upload video and snapshot, unit is "KB".
|
java.lang.String |
getRecordFormat()
Get the record video format, e.g., video/webm, video/mp4, video/ogg.
|
java.lang.String |
getSnapshotFormat()
Get the snapshot image format, e.g., image/png, image/jpeg.
|
boolean |
isAudio()
Return whether to record sound while recording video.
|
boolean |
isPaused()
Return whether camera is paused.
|
boolean |
isPreviewRecord()
Return whether the preview screen is on.
|
boolean |
isRecording()
Return whether camera is recording.
|
boolean |
isStopped()
Return whether camera is stopped.
|
void |
pause()
Pause recording.
|
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
requestCamera()
Ask user for permissions to get media stream from camera and microphone.
|
void |
resume()
Resume recording.
|
void |
service(AuRequest request,
boolean everError)
Processes an AU request.
|
void |
setAudio(boolean audio)
Set whether to record sound while recording video.
|
void |
setConstraints(java.util.Map constraints)
Sets the constraints,
if not specify constraints, it will use {audio:
isAudio() , video: true}. |
void |
setConstraintsString(java.lang.String constraints)
Sets the constraints in JSON String format,
if not specify constraints, it will use {audio:
isAudio() , video: true}. |
void |
setLengthLimit(int lengthLimit)
Set the maximum record length limit, unit is "seconds".
|
void |
setMaxsize(int maxsize)
Set the max size of upload video and snapshot, unit is "KB".
|
void |
setPreviewRecord(boolean previewRecord)
Set whether the preview screen is on.
|
void |
setRecordFormat(java.lang.String recordFormat)
Set the record video format, e.g., video/webm, video/mp4, video/ogg.
|
void |
setRecording(boolean recording)
setRecording(true) means start or resume recording.
|
void |
setSnapshotFormat(java.lang.String snapshotFormat)
Set the snapshot image format, e.g., image/png, image/jpeg.
|
void |
snapshot()
Take a snapshot.
|
void |
snapshot(double delay)
Take a snapshot.
|
void |
start()
Start recording.
|
void |
start(double delay)
Start recording.
|
void |
stop()
Stop recording.
|
void |
stopStreaming()
Stop getting media stream from user's camera and microphone.
|
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
addSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
public static final int STOP
public static final int START
public static final int PAUSE
public static final int RESUME
public void start()
public void start(double delay)
requestCamera()
before),
after calling this method, it will request camera permission from user at first,
the delay parameter indicates the duration between user permission obtaining and record starting in seconds.delay
- the duration between user permission obtaining and record starting in seconds, only meaningful when camera is offpublic void stop()
public void pause()
public void resume()
public void snapshot()
public void snapshot(double delay)
requestCamera()
before),
after calling this method, it will request camera permission from user at first,
the delay parameter indicates the duration between user permission obtaining and taking snapshot in seconds.delay
- the duration between user permission obtaining and taking snapshot in seconds, only meaningful when camera is offpublic void requestCamera()
public void stopStreaming()
public void service(AuRequest request, boolean everError)
HtmlBasedComponent
Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
service
in interface ComponentCtrl
service
in class HtmlBasedComponent
everError
- whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class XulElement
java.io.IOException
public boolean isStopped()
public boolean isPaused()
public boolean isRecording()
public void setRecording(boolean recording)
pause()
.
recording
- whether to start recording.public boolean isAudio()
Default: true
public void setAudio(boolean audio)
audio
- whether to record sound.public int getMaxsize()
setMaxsize(int)
for more details.
Default: Configuration.getMaxUploadSize()
public void setMaxsize(int maxsize)
maxsize
- negative value is unlimited, 0 will use Configuration.getMaxUploadSize()
public int getLengthLimit()
Default: 60
public void setLengthLimit(int lengthLimit)
lengthLimit
- setting maximum record length limit.public boolean isPreviewRecord()
Default: true
public void setPreviewRecord(boolean previewRecord)
previewRecord
- whether to turn on preview screen.public java.lang.String getSnapshotFormat()
Default: null.
public void setSnapshotFormat(java.lang.String snapshotFormat)
snapshotFormat
- snapshot formatpublic java.lang.String getRecordFormat()
Default: null.
public void setRecordFormat(java.lang.String recordFormat)
recordFormat
- recordFormat formatpublic java.util.Map getConstraints()
public void setConstraints(java.util.Map constraints)
isAudio()
, video: true}.
About allowed constraints setting,
see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraintsconstraints
- the constraintspublic java.lang.String getConstraintsString()
Default: null.
public void setConstraintsString(java.lang.String constraints)
isAudio()
, video: true}.
About allowed constraints setting,
see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraintsconstraints
- the constraints in JSON String formatCopyright © 2005-2021 Potix Corporation. All Rights Reserved.