org.cafesip.gwtcomp.client.ui
Class Audio

java.lang.Object
  extended by org.cafesip.gwtcomp.client.ui.Audio

public class Audio
extends Object

Adds audio to GWT applications. Before calling any of the methods to play a sound-bite, make sure that the static method - setRoot() has been called. This is a singleton class and instance of this class can be obtained by calling the getInstance() method.

Limitations:

Author:
Amit Chatterjee

Method Summary
static Audio getInstance()
          Returns the Audio singleton object.
 void play(String url)
          Plays an audio file.
 void playError()
          Plays an "error" sound.
 void playWarning()
          Plays a "warning" sound.
static void setRoot(RootPanel root)
          Sets the RootPanel object for the GWT application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Audio getInstance()
Returns the Audio singleton object.

Returns:
the instance of the Audio object

setRoot

public static void setRoot(RootPanel root)
Sets the RootPanel object for the GWT application. This method must be called prior to any play...() methods.

Parameters:
root - the RootPanel object.

playError

public void playError()
Plays an "error" sound.


playWarning

public void playWarning()
Plays a "warning" sound.


play

public void play(String url)
Plays an audio file. The format must be supported by the browser - a WAV file works for all GWT-supported browsers.

Parameters:
url - URL of the audio file.


Copyright © 2010 Cafesip.org. All Rights Reserved.