Class Sound
- All Implemented Interfaces:
- HasAttachHandlers,- HasHandlers,- EventListener,- HasVisibility,- IsWidget,- LogicalStructure,- HasTimeChangedHandlers
- 
Nested Class SummaryNested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObjectUIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
- 
Field SummaryFields inherited from class com.smartgwt.client.widgets.BaseWidgetconfig, configOnly, factoryCreated, factoryProperties, id, nativeObject, scClassNameFields inherited from class com.google.gwt.user.client.ui.UIObjectDEBUG_ID_PREFIX
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddTimeChangedHandler(TimeChangedHandler handler) Add a timeChanged handler.static voidchangeAutoChildDefaults(String autoChildName, Canvas defaults) Changes the defaults for Canvas AutoChildren namedautoChildName.static voidchangeAutoChildDefaults(String autoChildName, FormItem defaults) Changes the defaults for FormItem AutoChildren namedautoChildName.protected JavaScriptObjectcreate()booleanShould the specifiedaudio filebe loaded automatically.booleanShould the specifiedaudio filebe played automatically?Retrieves the current playback time of a playing or paused audio file in seconds.Retrieves the duration of the current audio file in seconds.Getter implementing theLogicalStructureinterface, which supports Eclipse's logical structure debugging facility.static SoundgetOrCreateRef(JavaScriptObject jsObj) getSrc()URL of the audio file to be played by this sound instance.String[]Deprecated.String[]URL of the audio file to be played by this sound instance.static booleanReturns true for browsers which natively support HTML5 Audio, used by the Sound classvoidload()This method will cause thespecified audio fileto be loadedvoidload(CanPlayCallback canPlayCallback) This method will cause thespecified audio fileto be loadedvoidpause()Pause playback of the audio file.voidplay()Play the audio file.voidplay(PlaybackCompleteCallback callback) Play the audio file.static voidConvenience method to load and play a specified audio file.static voidplay(String src, PlaybackCompleteCallback callback) Convenience method to load and play a specified audio file.voidreset()If playback is currently paused, reset the playback position to the start of the audio file so a call toplay()will play from the start, rather than resuming playback from the current position.setAutoLoad(boolean autoLoad) Should the specifiedaudio filebe loaded automatically.setAutoPlay(boolean autoPlay) Should the specifiedaudio filebe played automatically?voidsetCurrentTime(Double time) Move playback to a particular time in a loaded audio file.static voidsetDefaultProperties(Sound soundProperties) Class level method to set the default properties of this class.Setter implementing theLogicalStructureinterface, which supports Eclipse's logical structure debugging facility.URL of the audio file to be played by this sound instance.URL of the audio file to be played by this sound instance.Methods inherited from class com.smartgwt.client.widgets.BaseWidgetaddDrawHandler, 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, toStringMethods inherited from class com.google.gwt.user.client.ui.WidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods inherited from class com.google.gwt.user.client.ui.UIObjectaddStyleDependentName, 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, sinkBitlessEventMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlersfireEvent
- 
Constructor Details- 
Soundpublic Sound()
- 
Sound
 
- 
- 
Method Details- 
getOrCreateRef
- 
changeAutoChildDefaultsChanges the defaults for Canvas AutoChildren namedautoChildName.- Parameters:
- 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.
- See Also:
 
- 
changeAutoChildDefaultsChanges the defaults for FormItem AutoChildren namedautoChildName.- Parameters:
- 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.
- See Also:
 
- 
create- Overrides:
- createin class- BaseWidget
 
- 
setAutoLoadShould the specifiedaudio filebe loaded automatically.If set to falsedevelopers may load the audio explicitly viaload()- Parameters:
- autoLoad- New autoLoad value. Default value is false
- Returns:
- Soundinstance, for chaining setter calls
 
- 
getAutoLoadpublic boolean getAutoLoad()Should the specifiedaudio filebe loaded automatically.If set to falsedevelopers may load the audio explicitly viaload()- Returns:
- Current autoLoad value. Default value is false
 
- 
setAutoPlayShould the specifiedaudio filebe played automatically?If set to falsedevelopers may play the audio explicitly viaplay().- Parameters:
- autoPlay- New autoPlay value. Default value is false
- Returns:
- Soundinstance, for chaining setter calls
 
- 
getAutoPlaypublic boolean getAutoPlay()Should the specifiedaudio filebe played automatically?If set to falsedevelopers may play the audio explicitly viaplay().- Returns:
- Current autoPlay value. Default value is false
 
- 
setSrcURL of the audio file to be played by this sound instance. If multiple file URLs are supplied, the browser will make use of the first file type for which it has support.
 If this method is called after the component has been drawn/initialized: Update thesrcof this sound instance at runtime. Note thatautoLoadandautoPlaygovern whether this media will be loaded or played immediately when the src value is changed.- Parameters:
- src- URL of new audio file to be played by this sound instance. Default value is null
- Returns:
- Soundinstance, for chaining setter calls
 
- 
getSrcURL of the audio file to be played by this sound instance. If multiple file URLs are supplied, the browser will make use of the first file type for which it has support.- Returns:
- Current src value. Default value is null
 
- 
setSrcURL of the audio file to be played by this sound instance. If multiple file URLs are supplied, the browser will make use of the first file type for which it has support.
 If this method is called after the component has been drawn/initialized: Update thesrcof this sound instance at runtime. Note thatautoLoadandautoPlaygovern whether this media will be loaded or played immediately when the src value is changed.- Parameters:
- src- URL of new audio file to be played by this sound instance. Default value is null
- Returns:
- Soundinstance, for chaining setter calls
 
- 
getSrcAsStringArrayURL of the audio file to be played by this sound instance. If multiple file URLs are supplied, the browser will make use of the first file type for which it has support.- Returns:
- Current src value. Default value is null
 
- 
getCurrentTimeRetrieves the current playback time of a playing or paused audio file in seconds.- Returns:
- current playback time audio file in seconds. If the   file has not been loaded, or no srcis defined, this method will return zero.
 
- 
getDurationRetrieves the duration of the current audio file in seconds.- Returns:
- duration of the audio file in seconds. If the   file has not been loaded, or no srcis defined, this method will return null.
 
- 
loadpublic void load()This method will cause thespecified audio fileto be loaded
- 
loadThis method will cause thespecified audio fileto be loaded- Parameters:
- canPlayCallback- notification to fire when the file is ready to play
 
- 
pausepublic void pause()Pause playback of the audio file.
- 
resetpublic void reset()If playback is currently paused, reset the playback position to the start of the audio file so a call toplay()will play from the start, rather than resuming playback from the current position.
- 
setCurrentTimeMove playback to a particular time in a loaded audio file.- Parameters:
- time- time to move to. This method will have no effect if the file has not been loaded or no- srcelement is defined.
 
- 
addTimeChangedHandlerAdd a timeChanged handler.Notification method fired repeatedly to indicate a change in currentTime value while an audio file is playing. - Specified by:
- addTimeChangedHandlerin interface- HasTimeChangedHandlers
- Parameters:
- handler- the timeChanged handler
- Returns:
- HandlerRegistrationused to remove this handler
 
- 
isSupportedpublic static boolean isSupported()Returns true for browsers which natively support HTML5 Audio, used by the Sound class- Returns:
- true if Audio is supported in this browser
 
- 
setDefaultPropertiesClass level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.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. - Parameters:
- soundProperties- properties that should be used as new defaults when instances of this class are created
- See Also:
 
- 
playpublic void play()Play the audio file. If necessary the file will be loaded first.
- 
playPlay the audio file. If necessary the file will be loaded first.- Parameters:
- playbackCompleteCallback- notification fired when playback completes.
 
- 
playConvenience method to load and play a specified audio file.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. - Parameters:
- src- URL of the audio clip to play.
 
- 
playConvenience method to load and play a specified audio file.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. - Parameters:
- src- URL of the audio clip to play.
- callback- callback to execute when the clip playback completes.
 
- 
getSrcAsStringDeprecated.in favor ofgetSrcAsStringArray().
- 
setLogicalStructureSetter implementing theLogicalStructureinterface, which supports Eclipse's logical structure debugging facility.
- 
getLogicalStructureGetter implementing theLogicalStructureinterface, which supports Eclipse's logical structure debugging facility.- Specified by:
- getLogicalStructurein interface- LogicalStructure
- Overrides:
- getLogicalStructurein class- BaseWidget
 
 
- 
getSrcAsStringArray().