Class BasicPlayerTest

java.lang.Object
  extended by BasicPlayerTest
All Implemented Interfaces:
BasicPlayerListener

public class BasicPlayerTest
extends java.lang.Object
implements BasicPlayerListener

This class implements a simple player based on BasicPlayer. BasicPlayer is a threaded class providing most features of a music player. BasicPlayer works with underlying JavaSound SPIs to support multiple audio formats. Basically JavaSound supports WAV, AU, AIFF audio formats. Add MP3 SPI (from JavaZOOM) and Vorbis SPI( from JavaZOOM) in your CLASSPATH to play MP3 and Ogg Vorbis file.


Constructor Summary
BasicPlayerTest()
          Contructor.
 
Method Summary
 void display(java.lang.String msg)
           
static void main(java.lang.String[] args)
          Entry point.
 void opened(java.lang.Object stream, java.util.Map properties)
          Open callback, stream is ready to play.
 void play(java.lang.String filename)
           
 void progress(int bytesread, long microseconds, byte[] pcmdata, java.util.Map properties)
          Progress callback while playing.
 void setController(BasicController controller)
          A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)
 void stateUpdated(BasicPlayerEvent event)
          Notification callback for basicplayer events such as opened, eom ...
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicPlayerTest

public BasicPlayerTest()
Contructor.

Method Detail

main

public static void main(java.lang.String[] args)
Entry point.

Parameters:
args - filename to play.

play

public void play(java.lang.String filename)

opened

public void opened(java.lang.Object stream,
                   java.util.Map properties)
Open callback, stream is ready to play. properties map includes audio format dependant features such as bitrate, duration, frequency, channels, number of frames, vbr flag, id3v2/id3v1 (for MP3 only), comments (for Ogg Vorbis), ...

Specified by:
opened in interface BasicPlayerListener
Parameters:
stream - could be File, URL or InputStream
properties - audio stream properties.

progress

public void progress(int bytesread,
                     long microseconds,
                     byte[] pcmdata,
                     java.util.Map properties)
Progress callback while playing. This method is called severals time per seconds while playing. properties map includes audio format features such as instant bitrate, microseconds position, current frame number, ...

Specified by:
progress in interface BasicPlayerListener
Parameters:
bytesread - from encoded stream.
microseconds - elapsed (reseted after a seek !).
pcmdata - PCM samples.
properties - audio stream parameters.

stateUpdated

public void stateUpdated(BasicPlayerEvent event)
Notification callback for basicplayer events such as opened, eom ...

Specified by:
stateUpdated in interface BasicPlayerListener
Parameters:
event -

setController

public void setController(BasicController controller)
A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)

Specified by:
setController in interface BasicPlayerListener
Parameters:
controller - : a handle to the player

display

public void display(java.lang.String msg)