public class Video
extends org.zkoss.zul.impl.XulElement
implements org.zkoss.zul.ext.MediaElement
Only works for browsers supporting HTML5 video tag
| Modifier and Type | Class and Description |
|---|---|
protected class |
Video.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl(). |
| Modifier and Type | Field and Description |
|---|---|
static int |
END
Represent the end state
|
static int |
PAUSE
Represent the pause state
|
static int |
PLAY
Represent the play state
|
static int |
STOP
Represent the stop state
|
| Modifier and Type | Method and Description |
|---|---|
void |
beforeChildAdded(org.zkoss.zk.ui.Component child,
org.zkoss.zk.ui.Component insertBefore) |
org.zkoss.video.Video |
getContent()
Note: it won't fetch what is set thru by
setSrc(java.lang.String). |
String |
getCrossorigin()
Returns the crossorigin of this video tag, could be "anonymous", "use-credentials" or null.
|
Object |
getExtraCtrl() |
double |
getPlaybackRate()
Returns the video play speed.
|
String |
getPoster()
Returns the image source, if didn't set the image, return null.
|
String |
getPreload()
Returns "none" or "metadata" or "auto" or null
Default: null.
|
List<String> |
getSrc()
Returns the video source as List.
|
double |
getVolume()
Returns the volume of video.
|
boolean |
isAutoplay()
Returns whether to auto start playing the video.
|
boolean |
isClipToFit()
Return whether to clip video when the source size doesn't fit the tag size setting,
for example: if video source is 1280 * 720, but the video tag is
<video width="1000px" height="720px" />,
it will cut off the sides of the video, preserving the aspect ratio, and also filling in the space. |
boolean |
isControls()
Returns whether to display the video controls.
|
boolean |
isDimBackground()
Returns whether to turn whole page to be covered by translucent black except the Video, also called theater mode.
|
boolean |
isEnded()
Return whether the video is ended.
|
boolean |
isLoop()
Returns whether to play the video repeatedly.
|
boolean |
isMuted()
Returns whether the video is muted.
|
boolean |
isPaused()
Return whether the video is paused.
|
boolean |
isPlaying()
Return whether the video is playing.
|
boolean |
isPlaysinline()
Returns the playsinline of this video tag.
|
boolean |
isStopped()
Return whether the video is stopped.
|
void |
pause()
Pause the video at the client.
|
void |
play()
Play the video at the client.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
service(org.zkoss.zk.au.AuRequest request,
boolean everError) |
void |
setAutoplay(boolean autoplay)
Sets whether to auto start playing the video.
|
void |
setClipToFit(boolean clipToFit)
Set whether to clip video when the source size doesn't fit the tag size setting,
for example: if video source is 1280 * 720, but the video tag is
<video width="1000px" height="720px" />,
it will cut off the sides of the video, preserving the aspect ratio, and also filling in the space. |
void |
setContent(org.zkoss.video.Video content)
Calling this method implies setSrc(null).
|
void |
setControls(boolean controls)
Sets whether to display the video controls.
|
void |
setCrossorigin(String crossorigin)
Could be "anonymous" or "use-credentials", an invalid string and an empty string will be handled as the "anonymous".
|
void |
setCurrentTime(double currentTime)
Sets which part of video to play.
|
void |
setDimBackground(boolean dimBackground)
Sets whether to turn whole page to be covered by translucent black except Video, also called theater mode.
|
void |
setLoop(boolean loop)
Sets whether to play the video repeatedly.
|
void |
setMuted(boolean muted)
Sets whether to mute the video.
|
void |
setPlaybackRate(double playbackRate)
Sets the video play speed, type of value is in double, valid value is depending on browser.
|
void |
setPlaying(boolean playing)
|
void |
setPlaysinline(boolean playsinline)
Sets the playsinline of this video tag.
|
void |
setPoster(String poster)
Sets an image to be shown while the video is downloading, or until the user hits the play button.
|
void |
setPreload(String preload)
Sets whether and how the video should be loaded, which could be one of "none", "metadata", "auto".
|
void |
setSrc(String src)
Calling this method implies setContent(null).
|
void |
setSrcList(List<String> src)
Sets the source list, be invoked by the
setSrc(String). |
void |
setVolume(double volume)
Sets the volume of video.
|
void |
stop()
Stop the video at the client.
|
protected void |
updateByClient(String name,
Object value) |
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesaddSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, 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, setZIndexDirectlyaddAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, 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, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializepublic static final int STOP
public static final int PLAY
public static final int PAUSE
public static final int END
public Video()
public Video(String src)
public void service(org.zkoss.zk.au.AuRequest request,
boolean everError)
service in interface org.zkoss.zk.ui.sys.ComponentCtrlservice in class org.zkoss.zk.ui.HtmlBasedComponentpublic boolean isAutoplay()
Default: false.
public void setAutoplay(boolean autoplay)
autoplay - whether to enable autoplay function.public boolean isControls()
Default: false.
public void setControls(boolean controls)
controls - whether to display the video controls.public boolean isLoop()
Default: false.
public void setLoop(boolean loop)
loop - whether to enable loop function.public boolean isDimBackground()
Default: false.
public void setDimBackground(boolean dimBackground)
dimBackground - whether to enable theater mode.public String getPreload()
Default: null.
public void setPreload(String preload)
preload - which could be one of "none", "metadata", "auto".public String getPoster()
Default: null.
public void setPoster(String poster)
poster - the image source.public List<String> getSrc()
Default: [].
public void setSrc(String src)
Calling this method implies setContent(null).
In other words, the last invocation of setSrc(java.lang.String) overrides
the previous setContent(org.zkoss.video.Video), if any.
src - the video sources separated by ','.setContent(org.zkoss.video.Video)public void setSrcList(List<String> src)
setSrc(String).src - the source list.public String getCrossorigin()
Default: null.
public void setCrossorigin(String crossorigin)
Could be "anonymous" or "use-credentials", an invalid string and an empty string will be handled as the "anonymous". Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
crossorigin - the crossorigin of this video tag.public boolean isPlaysinline()
Default: null.
public void setPlaysinline(boolean playsinline)
Sets the playsinline of this video tag. Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
playsinline - whether to enable the playsinline function.public double getPlaybackRate()
Default: 1.0.
public void setPlaybackRate(double playbackRate)
playbackRate - video play speed.public boolean isClipToFit()
<video width="1000px" height="720px" />,
it will cut off the sides of the video, preserving the aspect ratio, and also filling in the space.
Default: false.
public void setClipToFit(boolean clipToFit)
<video width="1000px" height="720px" />,
it will cut off the sides of the video, preserving the aspect ratio, and also filling in the space.clipToFit - whether to clip video when the source size doesn't fit the tag size setting.public boolean isMuted()
public void setMuted(boolean muted)
muted - whether to mute the video.public void setPlaying(boolean playing)
playing - whether to play the video.public void setCurrentTime(double currentTime)
currentTime - which part of video to play, the value is in seconds.public double getVolume()
public void setVolume(double volume)
volume - the volume of video, type of value is in double, valid value is between 0.0 and 1.0.public org.zkoss.video.Video getContent()
Note: it won't fetch what is set thru by setSrc(java.lang.String).
It simply returns what is passed to setContent(org.zkoss.video.Video).
Default: null.
setContent(org.zkoss.video.Video).public void setContent(org.zkoss.video.Video content)
Calling this method implies setSrc(null).
In other words, the last invocation of setContent(org.zkoss.video.Video) overrides
the previous setSrc(java.lang.String), if any.
content - sets the content directly.setSrc(java.lang.String)public void play()
public void pause()
public void stop()
public boolean isPlaying()
public boolean isPaused()
public boolean isStopped()
public boolean isEnded()
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class org.zkoss.zul.impl.XulElementIOExceptionpublic void beforeChildAdded(org.zkoss.zk.ui.Component child,
org.zkoss.zk.ui.Component insertBefore)
beforeChildAdded in interface org.zkoss.zk.ui.sys.ComponentCtrlbeforeChildAdded in class org.zkoss.zk.ui.AbstractComponentpublic Object getExtraCtrl()
getExtraCtrl in interface org.zkoss.zk.ui.sys.ComponentCtrlgetExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponentCopyright © 2026. All rights reserved.