public class Sound extends BaseWidget implements HasTimeChangedHandlers
config, configOnly, factoryCreated, factoryProperties, id, nativeObject, scClassName
Constructor and Description |
---|
Sound() |
Sound(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addTimeChangedHandler(TimeChangedHandler handler)
Add a timeChanged handler.
|
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
Canvas defaults)
Changes the defaults for Canvas AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
FormItem defaults)
Changes the defaults for FormItem AutoChildren named
autoChildName . |
protected com.google.gwt.core.client.JavaScriptObject |
create() |
boolean |
getAutoLoad()
Should the specified
audio file be loaded automatically. |
boolean |
getAutoPlay()
Should the specified
audio file be played automatically? |
java.lang.Double |
getCurrentTime()
Retrieves the current playback time of a playing or paused audio file in seconds.
|
java.lang.Double |
getDuration()
Retrieves the duration of the current audio file in seconds.
|
com.smartgwt.logicalstructure.core.LogicalStructureObject |
getLogicalStructure()
Getter implementing the
LogicalStructure interface,
which supports Eclipse's logical structure debugging facility. |
static Sound |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
java.lang.String |
getSrc()
URL of the audio file to be played by this sound instance.
|
java.lang.String[] |
getSrcAsString()
Deprecated.
in favor of
getSrcAsStringArray() . |
java.lang.String[] |
getSrcAsStringArray()
URL of the audio file to be played by this sound instance.
|
static boolean |
isSupported()
Returns true for browsers which natively support HTML5 Audio, used by the Sound class
|
void |
load()
This method will cause the
specified audio file to be loaded |
void |
load(CanPlayCallback canPlayCallback)
This method will cause the
specified audio file to be loaded |
void |
pause()
Pause playback of the audio file.
|
void |
play()
Play the audio file.
|
void |
play(PlaybackCompleteCallback callback)
Play the audio file.
|
static void |
play(java.lang.String src)
Convenience method to load and play a specified audio file.
|
static void |
play(java.lang.String src,
PlaybackCompleteCallback callback)
Convenience method to load and play a specified audio file.
|
void |
reset()
If playback is currently paused, reset the playback position to the start of the audio file so a call to
play() will play from the start, rather than resuming playback from the current
position. |
Sound |
setAutoLoad(boolean autoLoad)
Should the specified
audio file be loaded automatically. |
Sound |
setAutoPlay(boolean autoPlay)
Should the specified
audio file be played automatically? |
void |
setCurrentTime(java.lang.Double time)
Move playback to a particular time in a loaded audio file.
|
static void |
setDefaultProperties(Sound soundProperties)
Class level method to set the default properties of this class.
|
com.smartgwt.logicalstructure.core.LogicalStructureObject |
setLogicalStructure(com.smartgwt.logicalstructure.widgets.SoundLogicalStructure s)
Setter implementing the
LogicalStructure interface,
which supports Eclipse's logical structure debugging facility. |
Sound |
setSrc(java.lang.String... src)
URL of the audio file to be played by this sound instance.
|
Sound |
setSrc(java.lang.String src)
URL of the audio file to be played by this sound instance.
|
addDrawHandler, addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, completeCreation, destroy, doAddHandler, doInit, doOnRender, draw, equals, error, errorIfNotCreated, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDateArray, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsFloatArray, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getById, getByJSObject, getClassName, getConfig, getDOM, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, getScClassName, getTitle, hasAutoAssignedID, hasDynamicProperty, hashCode, initNativeObject, internalSetID, internalSetID, isConfigOnly, isCreated, isDrawn, isFactoryCreated, onBind, onDestroy, onDraw, onInit, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDefaultProperties, setDragTracker, setFactoryCreated, setHtmlElement, setID, setJavaScriptObject, setLogicalStructure, setLogicalStructure, setNullProperty, setPosition, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setScClassName, setTitle, toString
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent
public Sound()
public Sound(com.google.gwt.core.client.JavaScriptObject jsObj)
public static Sound getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
protected com.google.gwt.core.client.JavaScriptObject create()
create
in class BaseWidget
public Sound setAutoLoad(boolean autoLoad)
audio file
be loaded automatically. If set to
false
developers may load the audio explicitly via load()
autoLoad
- New autoLoad value. Default value is falseSound
instance, for chaining setter callspublic boolean getAutoLoad()
audio file
be loaded automatically. If set to
false
developers may load the audio explicitly via load()
public Sound setAutoPlay(boolean autoPlay)
audio file
be played automatically? If set to
false
developers may play the audio explicitly via play()
.
autoPlay
- New autoPlay value. Default value is falseSound
instance, for chaining setter callspublic boolean getAutoPlay()
audio file
be played automatically? If set to
false
developers may play the audio explicitly via play()
.
public Sound setSrc(java.lang.String src)
src
of this sound instance at runtime. Note that autoLoad
and autoPlay
govern whether this media will be loaded or played immediately when the src value is changed.src
- URL of new audio file to be played by this sound instance. Default value is nullSound
instance, for chaining setter callspublic java.lang.String getSrc()
public Sound setSrc(java.lang.String... src)
src
of this sound instance at runtime. Note that autoLoad
and autoPlay
govern whether this media will be loaded or played immediately when the src value is changed.src
- URL of new audio file to be played by this sound instance. Default value is nullSound
instance, for chaining setter callspublic java.lang.String[] getSrcAsStringArray()
public java.lang.Double getCurrentTime()
src
is defined, this method will return zero.public java.lang.Double getDuration()
src
is defined, this method will return null.public void load()
specified audio file
to be loadedpublic void load(CanPlayCallback canPlayCallback)
specified audio file
to be loadedcanPlayCallback
- notification to fire when the file is ready to playpublic void pause()
public void reset()
play()
will play from the start, rather than resuming playback from the current
position.public void setCurrentTime(java.lang.Double time)
time
- time to move to. This method will have no effect if the file has not been loaded or no src
element is defined.public com.google.gwt.event.shared.HandlerRegistration addTimeChangedHandler(TimeChangedHandler handler)
Notification method fired repeatedly to indicate a change in currentTime value while an audio file is playing.
addTimeChangedHandler
in interface HasTimeChangedHandlers
handler
- the timeChanged handlerHandlerRegistration
used to remove this handlerpublic static boolean isSupported()
public static void setDefaultProperties(Sound soundProperties)
Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.
soundProperties
- properties that should be used as new defaults when instances of this class are createdSGWTProperties
public void play()
public void play(PlaybackCompleteCallback callback)
playbackCompleteCallback
- notification fired when playback completes.public static void play(java.lang.String src)
For more explicit control over loading and playback of audio files, developers may create an instance of Sound and call methods directly on that object.
src
- URL of the audio clip to play.public static void play(java.lang.String src, PlaybackCompleteCallback callback)
For more explicit control over loading and playback of audio files, developers may create an instance of Sound and call methods directly on that object.
src
- URL of the audio clip to play.callback
- callback to execute when the clip playback completes.public java.lang.String[] getSrcAsString()
getSrcAsStringArray()
.public com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.widgets.SoundLogicalStructure s)
LogicalStructure
interface,
which supports Eclipse's logical structure debugging facility.public com.smartgwt.logicalstructure.core.LogicalStructureObject getLogicalStructure()
LogicalStructure
interface,
which supports Eclipse's logical structure debugging facility.getLogicalStructure
in interface LogicalStructure
getLogicalStructure
in class BaseWidget