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

Variable Index

 o player
The default audio player.

Method Index

 o run()
Main mixing loop.
 o start(InputStream)
Start playing a stream.
 o stop(InputStream)
Stop playing a stream.

Variables

 o player
  public final static AudioPlayer player
The default audio player. This audio player is initialized automatically.

Methods

 o 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
 o 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
 o 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