Player

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javazoom.jl.player
Class Player

    java.lang.Object
      javazoom.jl.player.Player

public class Player
extends java.lang.Object

The `Player` class implements a simple player for playback of an MPEG audio stream.

Since:
  0.0.8

Constructor Summary
`Player(java.io.InputStream stream)` Creates a new `Player` instance.
`Player(java.io.InputStream stream, AudioDevice device)`

Method Summary
`void` | `close()` Cloases this player.
`protected boolean` | `decodeFrame()` Decodes a single frame.
`int` | `getPosition()` Retrieves the position in milliseconds of the current audio sample being played.
`boolean` | `isComplete()` Returns the completed status of this player.
`void` | `play()`
`boolean` | `play(int frames)` Plays a number of MPEG audio frames.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Player

    public Player(java.io.InputStream stream)
           throws JavaLayerException

  Creates a new `Player` instance.

### Player

    public Player(java.io.InputStream stream,
                  AudioDevice device)
           throws JavaLayerException

Method Detail

### play

    public void play()
              throws JavaLayerException

  Throws:
    `JavaLayerException`

### play

    public boolean play(int frames)
                 throws JavaLayerException

  Plays a number of MPEG audio frames.

  Parameters:
    `frames` - The number of frames to play.
  Returns:
    true if the last frame was played, or false if there are more frames.
  Throws:
    `JavaLayerException`

### close

    public void close()

  Cloases this player. Any audio currently playing is stopped immediately.

### isComplete

    public boolean isComplete()

  Returns the completed status of this player.

  Returns:
    true if all available MPEG audio frames have been decoded, or false otherwise.

### getPosition

    public int getPosition()

  Retrieves the position in milliseconds of the current audio sample being played. This method delegates to the `AudioDevice` that is used by this player to sound the decoded audio samples.

### decodeFrame

    protected boolean decodeFrame()
                           throws JavaLayerException

  Decodes a single frame.

  Returns:
    true if there are no more frames to decode, false otherwise.
  Throws:
    `JavaLayerException`

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

JavaZOOM 1999-2005