Class Audio
- All Implemented Interfaces:
Serializable,Cloneable,Component,Scope,ComponentCtrl,MediaElement
An extension to XUL. Only works for browsers supporting HTML5 audio tag (since ZK 7.0.0).
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA utility class to implementHtmlBasedComponent.getExtraCtrl().Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRepresent the end statestatic final intRepresent the pause statestatic final intRepresent the play statestatic final intRepresent the stop stateFields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeChildAdded(Component child, Component insertBefore) Default: does nothing.Returns the content set bysetContent(org.zkoss.sound.Audio).Returns the client control for this component.Returns whether and how the audio should be loaded.getSrc()Returns the src.booleanReturns whether to auto start playing the audio.booleanReturns whether to display the audio controls.booleanisEnded()Return whether the audio is ended.booleanisLoop()Returns whether to play the audio repeatedly.booleanisMuted()Returns whether to mute the audio.booleanisPaused()Return whether the audio is paused.booleanReturn whether the audio is playing.booleanReturn whether the audio is stopped.voidpause()Pauses the audio at the client.voidplay()Plays the audio at the client.protected voidrenderProperties(ContentRenderer renderer) Renders the content of this component, excluding the enclosing tags and children.voidProcesses an AU request.voidsetAutoplay(boolean autoplay) Sets whether to auto start playing the audio.voidsetContent(Audio audio) Sets the content directly.voidsetControls(boolean controls) Sets whether to display the audio controls.voidsetLoop(boolean loop) Sets whether to play the audio repeatedly.voidsetMuted(boolean muted) Sets whether to mute the audio.voidsetPreload(String preload) Sets whether and how the audio should be loaded.voidSets the src.voidSets the source list.voidstop()Stops the audio at the client, and reset its currentTime to zero.Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, 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, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Field Details
-
STOP
public static final int STOPRepresent the stop state- Since:
- 9.6.0
- See Also:
-
PLAY
public static final int PLAYRepresent the play state- Since:
- 9.6.0
- See Also:
-
PAUSE
public static final int PAUSERepresent the pause state- Since:
- 9.6.0
- See Also:
-
END
public static final int ENDRepresent the end state- Since:
- 9.6.0
- See Also:
-
_src
-
-
Constructor Details
-
Audio
public Audio() -
Audio
-
-
Method Details
-
service
Description copied from class:HtmlBasedComponentProcesses an AU request.Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classHtmlBasedComponenteverError- whether any error ever occurred before processing this request.- See Also:
-
play
public void play()Plays the audio at the client. -
stop
public void stop()Stops the audio at the client, and reset its currentTime to zero. (i.e. reset to begin) -
pause
public void pause()Pauses the audio at the client. -
getSrc
Returns the src.Default: [].
-
setSrc
Sets the src.Calling this method implies setContent(null). In other words, the last invocation of
setSrc(java.lang.String)overrides the previoussetContent(org.zkoss.sound.Audio), if any.- See Also:
-
setSrc
Sets the source list.- Since:
- 7.0.0
-
isAutoplay
public boolean isAutoplay()Returns whether to auto start playing the audio.Default: false.
- Since:
- 7.0.0
-
setAutoplay
public void setAutoplay(boolean autoplay) Sets whether to auto start playing the audio.- Since:
- 7.0.0
-
getPreload
Returns whether and how the audio should be loaded. "none" or "metadata" or "auto" or nullDefault: null.
- Since:
- 7.0.0
-
setPreload
Sets whether and how the audio should be loaded. Refer to Preload Attribute Description for details.- Parameters:
preload- which could be one of "none", "metadata", "auto".- Since:
- 7.0.0
-
isControls
public boolean isControls()Returns whether to display the audio controls.Default: false.
- Since:
- 7.0.0
-
setControls
public void setControls(boolean controls) Sets whether to display the audio controls.- Since:
- 7.0.0
-
isLoop
public boolean isLoop()Returns whether to play the audio repeatedly.Default: false.
- Since:
- 3.6.1
-
setLoop
public void setLoop(boolean loop) Sets whether to play the audio repeatedly.- Since:
- 3.6.1
-
isMuted
public boolean isMuted()Returns whether to mute the audio.Default: false.
- Since:
- 7.0.0
-
setMuted
public void setMuted(boolean muted) Sets whether to mute the audio.- Since:
- 7.0.0
-
isPlaying
public boolean isPlaying()Return whether the audio is playing.- Returns:
- true if audio is playing;
- Since:
- 9.6.0
-
isPaused
public boolean isPaused()Return whether the audio is paused.- Returns:
- true if audio is paused;
- Since:
- 9.6.0
-
isStopped
public boolean isStopped()Return whether the audio is stopped. While the audio is ended, also means it is stopped.- Returns:
- true if audio is stopped or ended;
- Since:
- 9.6.0
-
isEnded
public boolean isEnded()Return whether the audio is ended.- Returns:
- true if audio is ended;
- Since:
- 9.6.0
-
setContent
Sets the content directly.Default: null.
Calling this method implies setSrc(null). In other words, the last invocation of
setContent(org.zkoss.sound.Audio)overrides the previoussetSrc(java.lang.String), if any.- Parameters:
audio- the audio to display.- See Also:
-
getContent
Returns the content set bysetContent(org.zkoss.sound.Audio).Note: it won't fetch what is set thru by
setSrc(java.lang.String). It simply returns what is passed tosetContent(org.zkoss.sound.Audio). -
renderProperties
Description copied from class:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classXulElement- Throws:
IOException
-
beforeChildAdded
Description copied from class:AbstractComponentDefault: does nothing.- Specified by:
beforeChildAddedin interfaceComponentCtrl- Overrides:
beforeChildAddedin classAbstractComponent- Parameters:
child- the child to be added (never null).insertBefore- another child component that the new child will be inserted before it. If null, the new child will be the last child.- See Also:
-
getExtraCtrl
Description copied from class:HtmlBasedComponentReturns the client control for this component. It is used only by component developers.Default: creates an instance of
HtmlBasedComponent.ExtraCtrl.- Specified by:
getExtraCtrlin interfaceComponentCtrl- Overrides:
getExtraCtrlin classHtmlBasedComponent- Returns:
- null if no special handling required. If the component
requires some special controls, it could return an object that
implements one or several interfaces in the org.zkoss.zk.ui.ext.render
package.
For example,
Cropper. - See Also:
-