public class Audio extends XulElement implements MediaElement
An extension to XUL. Only works for browsers supporting HTML5 audio tag (since ZK 7.0.0).
| Modifier and Type | Class and Description |
|---|---|
protected class |
Audio.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl(). |
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
_src |
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.sound.Audio |
getContent()
Returns the content set by
setContent(org.zkoss.sound.Audio). |
Object |
getExtraCtrl() |
String |
getPreload()
Returns whether and how the audio should be loaded.
|
List<String> |
getSrc()
Returns the src.
|
boolean |
isAutoplay()
Returns whether to auto start playing the audio.
|
boolean |
isAutostart()
Deprecated.
As of release 7.0.0, use
isAutoplay() instead. |
boolean |
isControls()
Returns whether to display the audio controls.
|
boolean |
isEnded()
Return whether the audio is ended.
|
boolean |
isLoop()
Returns whether to play the audio repeatedly.
|
boolean |
isMuted()
Returns whether to mute the audio.
|
boolean |
isPaused()
Return whether the audio is paused.
|
boolean |
isPlaying()
Return whether the audio is playing.
|
boolean |
isStopped()
Return whether the audio is stopped.
|
void |
pause()
Pauses the audio at the client.
|
void |
play()
Plays the audio 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 audio.
|
void |
setAutostart(boolean autostart)
Deprecated.
As of release 7.0.0, use
setAutoplay(boolean) instead. |
void |
setContent(org.zkoss.sound.Audio audio)
Sets the content directly.
|
void |
setControls(boolean controls)
Sets whether to display the audio controls.
|
void |
setLoop(boolean loop)
Sets whether to play the audio repeatedly.
|
void |
setMuted(boolean muted)
Sets whether to mute the audio.
|
void |
setPreload(String preload)
Sets whether and how the audio should be loaded.
|
void |
setSrc(List<String> src)
Sets the source list.
|
void |
setSrc(String src)
Sets the src.
|
void |
stop()
Stops the audio at the client.
|
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, updateByClient, 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 Audio()
public Audio(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 void play()
public void stop()
public void pause()
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.sound.Audio), if any.
setContent(org.zkoss.sound.Audio)public boolean isAutostart()
isAutoplay() instead.Default: false;
public void setAutostart(boolean autostart)
setAutoplay(boolean) instead.public boolean isAutoplay()
Default: false.
public void setAutoplay(boolean autoplay)
public String getPreload()
Default: null.
public void setPreload(String preload)
preload - which could be one of "none", "metadata", "auto".public boolean isControls()
Default: false.
public void setControls(boolean controls)
public boolean isLoop()
Default: false.
public void setLoop(boolean loop)
public boolean isMuted()
Default: false.
public void setMuted(boolean muted)
public boolean isPlaying()
public boolean isPaused()
public boolean isStopped()
public boolean isEnded()
public void setContent(org.zkoss.sound.Audio audio)
Default: null.
Calling this method implies setSrc(null).
In other words, the last invocation of setContent(org.zkoss.sound.Audio) overrides
the previous setSrc(java.lang.String), if any.
audio - the audio to display.setSrc(java.lang.String)public org.zkoss.sound.Audio getContent()
setContent(org.zkoss.sound.Audio).
Note: it won't fetch what is set thru by setSrc(java.lang.String).
It simply returns what is passed to setContent(org.zkoss.sound.Audio).
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class 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.