Class sun.audio.AudioPlayer
All Packages Class Hierarchy This Package Previous Next Index
Class sun.audio.AudioPlayer
java.lang.Object
|
+----java.lang.Thread
|
+----sun.audio.AudioPlayer
- public class AudioPlayer
- extends Thread
This class provides an interface to play audio streams.
To play an audio stream use:
AudioPlayer.player.start(audiostream);
To stop playing an audio stream use:
AudioPlayer.player.stop(audiostream);
To play an audio stream from a URL use:
AudioStream audiostream = new AudioStream(url.openStream());
AudioPlayer.player.start(audiostream);
To play a continuous sound you first have to
create an AudioData instance and use it to construct a
ContinuousAudioDataStream.
For example:
AudoData data = new AudioStream(url.openStream()).getData();
ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
AudioPlayer.player.stop(audiostream);
- Version:
- 1.29, 02/03/96
- Author:
- Arthur van Hoff, Thomas Ball
- See Also:
- AudioData, AudioDataStream, AudioDevice, AudioStream
-
player
- The default audio player.
-
run()
- Main mixing loop.
-
start(InputStream)
- Start playing a stream.
-
stop(InputStream)
- Stop playing a stream.
player
public final static AudioPlayer player
- The default audio player. This audio player is initialized
automatically.
start
public synchronized void start(InputStream in)
- Start playing a stream. The stream will continue to play
until the stream runs out of data, or it is stopped.
- See Also:
- stop
stop
public synchronized void stop(InputStream in)
- Stop playing a stream. The stream will stop playing,
nothing happens if the stream wasn't playing in the
first place.
- See Also:
- start
run
public void run()
- Main mixing loop. This is called automatically when the AudioPlayer
is created.
- Overrides:
- run in class Thread
All Packages Class Hierarchy This Package Previous Next Index