com.google.gwt.libideas.resources.client
Interface SoundResource

All Superinterfaces:
ResourcePrototype

public interface SoundResource
extends ResourcePrototype

A sound sample.

Currently supported formats are:

The browser must support playing SWF files of version 8 or better.


Nested Class Summary
static interface SoundResource.Handle
          Represents a sound that is currently playing.
 
Method Summary
 long getDuration()
          The duration in milliseconds of the SoundResource.
 boolean isReady()
          Indicates that a particular SoundResource is ready for immediate playback.
 SoundResource.Handle play()
          Play the sound.
 SoundResource.Handle play(int volume, int pan)
          Play the sound.
 SoundResource.Handle play(SoundResourceCallback callback)
          Play the sound.
 SoundResource.Handle play(SoundResourceCallback callback, int volume, int pan)
          Play the sound.
 void prepare(SoundResourceCallback callback)
          Request that a demand-loaded sound resource is loaded and receive a callback when the SoundResource can be played.
 
Methods inherited from interface com.google.gwt.libideas.resources.client.ResourcePrototype
getName
 

Method Detail

getDuration

long getDuration()
The duration in milliseconds of the SoundResource.


isReady

boolean isReady()
Indicates that a particular SoundResource is ready for immediate playback.


play

SoundResource.Handle play()
Play the sound. If the SoundResource is not ready, this will implicitly invoke #prepare(ResourceCallback) and play the sound when the resource is ready.


play

SoundResource.Handle play(int volume,
                          int pan)
Play the sound. If the SoundResource is not ready, this will implicitly invoke #prepare(ResourceCallback) and play the sound when the resource is ready.

Parameters:
volume - A number from 0 to 100. Out-of-range values will be coerced into the acceptable range.
pan - A number from -100 (far left) to 100 (far right). Out-of-range values will be coerced into the acceptable range.

play

SoundResource.Handle play(SoundResourceCallback callback)
Play the sound. If the SoundResource is not ready, this will implicitly invoke #prepare(ResourceCallback) and play the sound when the resource is ready.

Parameters:
callback - A callback to be notified when the sound has finished playing.

play

SoundResource.Handle play(SoundResourceCallback callback,
                          int volume,
                          int pan)
Play the sound. If the SoundResource is not ready, this will implicitly invoke #prepare(ResourceCallback) and play the sound when the resource is ready.

Parameters:
callback - A callback to be notified when the sound has finished playing.
volume - A number from 0 to 100. Out-of-range values will be coerced into the acceptable range.
pan - A number from -100 (far left) to 100 (far right). Out-of-range values will be coerced into the acceptable range.

prepare

void prepare(SoundResourceCallback callback)
Request that a demand-loaded sound resource is loaded and receive a callback when the SoundResource can be played. This method allows latency-sensitive sounds to be preloaded without having to play the sound.