org.zkoss.zul
Class Audio

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Audio
All Implemented Interfaces:
Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

public class Audio
extends XulElement

An audio clip.

An extension to XUL. Only works for browsers supporting HTML5 audio tag (since ZK 7.0.0).

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
protected  class Audio.ExtraCtrl
          A utility class to implement HtmlBasedComponent.getExtraCtrl().
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children
 
Field Summary
protected  List<String> _src
           
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Audio()
           
Audio(String src)
           
 
Method Summary
 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.
protected  boolean isChildable()
          Default: not childable.
 boolean isControls()
          Returns whether to display the audio controls.
 boolean isLoop()
          Returns whether to play the audio repeatedly.
 boolean isMuted()
          Returns whether to mute the audio.
 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 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.
 
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_src

protected List<String> _src
Constructor Detail

Audio

public Audio()

Audio

public Audio(String src)
Method Detail

play

public void play()
Plays the audio at the client.


stop

public void stop()
Stops the audio at the client.


pause

public void pause()
Pauses the audio at the client.


getSrc

public List<String> getSrc()
Returns the src.

Default: [].


setSrc

public void setSrc(String src)
Sets the 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.

See Also:
setContent(org.zkoss.sound.Audio)

setSrc

public void setSrc(List<String> src)
Sets the source list.

Since:
7.0.0

isAutostart

public boolean isAutostart()
Deprecated. As of release 7.0.0, use isAutoplay() instead.

Returns whether to auto start playing the audio.

Default: false;


setAutostart

public void setAutostart(boolean autostart)
Deprecated. As of release 7.0.0, use setAutoplay(boolean) instead.

Sets whether to auto start playing the audio.


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

public String getPreload()
Returns whether and how the audio should be loaded. "none" or "metadata" or "auto" or null

Default: null.

Since:
7.0.0

setPreload

public void setPreload(String preload)
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

setContent

public void setContent(org.zkoss.sound.Audio audio)
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 previous setSrc(java.lang.String), if any. Note: setContent doesn't support in Chrome.

Parameters:
audio - the audio to display.
See Also:
setSrc(java.lang.String)

getContent

public org.zkoss.sound.Audio getContent()
Returns the content set by 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).


renderProperties

protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                         throws IOException
Overrides:
renderProperties in class XulElement
Throws:
IOException

isChildable

protected boolean isChildable()
Default: not childable.

Overrides:
isChildable in class org.zkoss.zk.ui.AbstractComponent

getExtraCtrl

public Object getExtraCtrl()
Specified by:
getExtraCtrl in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
getExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponent


Copyright © 2013. All rights reserved.