com.tuneology.avm.player
Interface MediaPlayer

All Known Subinterfaces:
AudioPlayer, VideoPlayer

public interface MediaPlayer

An interface to facilities for playing audio and video files.

Version:
$Id: MediaPlayer.java,v 1.7 2003/07/10 19:52:12 xnarf Exp $
Author:
Fran Taylor

Method Summary
 void addStatusListener(PlayerStatusListener ps)
          Adds a listener to be informed when the media player changes status.
 void close()
          Close the player and release its resources.
 void cueFile(MediaData f)
          Loads a file, sets the current position to the beginning, and pauses.
 java.awt.Component getCanvas()
           
 java.lang.String getDevice()
           
 boolean getLoop()
          Returns the value of the loop property.
 java.lang.String getName()
           
 int getSize()
          Returns the maximum size of the current file.
 Volume getVolume()
          Gets the audio output volume.
 VolumeRange getVolumeRange()
           
 void jumpTo(int pos)
          Moves the current position.
 void pause()
          Temporarily stops playing at the current position.
 void play()
          Starts playing after calling stop or cuefile.
 boolean playFile(java.lang.String f)
          Play the file, blocking until it's done.
 void playNextTrack()
           
 void playPrevTrack()
           
 void playStream(java.io.InputStream str)
           
 void removeStatusListener(PlayerStatusListener ps)
          Removes a listener.
 void setArtist(java.lang.String artist)
           
 void setDevice(java.lang.String dev)
           
 void setLoop(boolean l)
          Sets the loop property.
 void setTitle(java.lang.String artist)
           
 void setTotal(int secs)
           
 void setTrack(int track)
           
 void setVolume(Volume vol)
          Sets the audio output volume.
 void stop()
          Stops playing and resets the current position to the beginning.
 void unpause()
          Starts playing after calling pause.
 

Method Detail

playFile

public boolean playFile(java.lang.String f)
                 throws java.lang.Exception
Play the file, blocking until it's done.
Parameters:
f - a string containing an URL to play
Returns:
true if the song ended, false if the user wants to play the previous track
Throws:
java.lang.Exception -  

playStream

public void playStream(java.io.InputStream str)
                throws java.lang.Exception
Parameters:
str -  
Throws:
java.lang.Exception -  

cueFile

public void cueFile(MediaData f)
             throws java.lang.Exception
Loads a file, sets the current position to the beginning, and pauses. Call unpause() to begin playing.
Parameters:
f -  
Throws:
java.lang.Exception -  

getSize

public int getSize()
            throws java.lang.Exception
Returns the maximum size of the current file.
Throws:
java.lang.Exception -  

getDevice

public java.lang.String getDevice()

getCanvas

public java.awt.Component getCanvas()

setDevice

public void setDevice(java.lang.String dev)
               throws java.lang.Exception

setArtist

public void setArtist(java.lang.String artist)

setTitle

public void setTitle(java.lang.String artist)

setTrack

public void setTrack(int track)

jumpTo

public void jumpTo(int pos)
            throws java.lang.Exception
Moves the current position. Valid values are 0 - getSize(). If the player was playing, it will continue playing at the new position. If the player was paused, it will remain paused at the new position.
Parameters:
pos -  
Throws:
java.lang.Exception -  

play

public void play()
          throws java.lang.Exception
Starts playing after calling stop or cuefile.
Throws:
java.lang.Exception -  

playNextTrack

public void playNextTrack()
                   throws java.lang.Exception
Throws:
java.lang.Exception -  

playPrevTrack

public void playPrevTrack()
                   throws java.lang.Exception
Throws:
java.lang.Exception -  

pause

public void pause()
           throws java.lang.Exception
Temporarily stops playing at the current position.
Throws:
java.lang.Exception -  

unpause

public void unpause()
             throws java.lang.Exception
Starts playing after calling pause.
Throws:
java.lang.Exception -  

stop

public void stop()
          throws java.lang.Exception
Stops playing and resets the current position to the beginning.
Throws:
java.lang.Exception -  

getVolumeRange

public VolumeRange getVolumeRange()
                           throws java.lang.Exception

getVolume

public Volume getVolume()
                 throws java.lang.Exception
Gets the audio output volume.
Returns:
volume level.
Throws:
java.lang.Exception -  

setVolume

public void setVolume(Volume vol)
               throws java.io.IOException
Sets the audio output volume.
Parameters:
vol -  
Throws:
java.io.IOException -  

setLoop

public void setLoop(boolean l)
Sets the loop property. If the loop property is true, when the player reaches the end of the media, it will start over again at the beginning. If false, it will stop and reset the current position to the beginning when the player reaches the end.

setTotal

public void setTotal(int secs)

getLoop

public boolean getLoop()
Returns the value of the loop property.
Returns:
the value of the loop property.

addStatusListener

public void addStatusListener(PlayerStatusListener ps)
Adds a listener to be informed when the media player changes status.
Parameters:
ps - the listener to add

removeStatusListener

public void removeStatusListener(PlayerStatusListener ps)
Removes a listener.
Parameters:
ps - the listener to remove

close

public void close()
           throws java.lang.Exception
Close the player and release its resources.
Throws:
java.lang.Exception -  

getName

public java.lang.String getName()