|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WSound
public class WSound
A value class to play a sound effect.
This class provides a way to play an MP3 sound asynchonously (if the browser supports this). It is intended as a simple way to play event sounds (not quite for a media center).
This class uses a WMediaPlayer to play the sound (using HTML
<audio> or a flash player).
| Constructor Summary | |
|---|---|
WSound(java.lang.String url)
Constructs a sound object that will play the given URL. |
|
WSound(java.lang.String url,
WObject parent)
Constructs a sound object that will play the given URL. |
|
| Method Summary | |
|---|---|
int |
getLoops()
Returns the configured number of repeats. |
java.lang.String |
getUrl()
Returns the sound url. |
void |
play()
Start asynchronous playback of the sound. |
void |
setLoops(int number)
Sets the amount of times the sound has to be repeated. |
void |
stop()
Stops playback of the sound. |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WSound(java.lang.String url,
WObject parent)
Note: As of JWt 3.1.10, the url must specify an
MP3 file.
public WSound(java.lang.String url)
Calls this(url,
(WObject)null)
| Method Detail |
|---|
public java.lang.String getUrl()
WSound(String url, WObject parent)public void setLoops(int number)
A call to play() will play the sound
number of times. The default value is 1 (no repeats).
public int getLoops()
public void play()
This method returns immediately. It will cause the sound to be played for
the configured amount of getLoops().
The behavior of play() when a sound is already
playing is undefind: it may be intermixed, sequentially queued, or a
current playing sound may be stopped. It is recommended to call
stop() before play() if you
want to avoid mixing multiple instances of a single WSound
object.
public void stop()
This method returns immediately. It causes the current playback (if any) of the sound to be stopped.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||