|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectfi.hut.tml.xsmiles.gui.media.swing.AudioMedia
General implementation for playing audio media, utilizing the javax.sound-technology. Different audio formats can be added by implementing the correct provider and registering AudioMedia as the contents content handler.
| Field Summary | |
protected static int |
BUFFER_SIZE
Size of the byte buffer used while reading the source. |
| Constructor Summary | |
AudioMedia()
|
|
| Method Summary | |
void |
addMediaListener(MediaListener listener)
Adds a MediaListener for this media. |
void |
close()
This will freeze all memory and references to this media. |
protected void |
finalizeAudio()
Shuts down the audio stream and releases all resources associated with it. |
int |
getOriginalDuration()
Get the duration of media. |
int |
getOriginalHeight()
Get the real height of the media. |
int |
getOriginalWidth()
Get the real width of the media. |
protected void |
initAudio()
Initialized the playback engine by converting the input to an appropriate format and creating an AudioInputStream from the input. |
boolean |
isStatic()
Checks if this media is static or continuous. |
void |
pause()
Pauses the media. |
void |
play()
Plays the media. |
void |
prefetch()
Prefetches media. |
void |
run()
|
void |
setBounds(int x,
int y,
int width,
int height)
Set the coordinates for the media. |
void |
setContainer(java.awt.Container container)
Sets the container the media will be rendered in. |
void |
setMediaTime(int millisecs)
This moves the time position in media. |
void |
setMLFCListener(MLFCListener listener)
All traffic to the browser, such as ComponentFactory, etc goes through this listener. |
void |
setSoundVolume(int percentage)
Set the sound volume for media. |
void |
setUrl(java.net.URL url)
Sets the URL for this media. |
void |
showControls(boolean visible)
Requests the media player to display a control panel for media. |
void |
stop()
Stops the media. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int BUFFER_SIZE
| Constructor Detail |
public AudioMedia()
| Method Detail |
public void setMLFCListener(MLFCListener listener)
Media
setMLFCListener in interface Medialistener - The MLFCListener supplied by the browserMLFCListenerpublic boolean isStatic()
Media
isStatic in interface Mediapublic int getOriginalDuration()
Media
getOriginalDuration in interface Mediapublic int getOriginalWidth()
Media
getOriginalWidth in interface Mediapublic int getOriginalHeight()
Media
getOriginalHeight in interface Mediapublic void setUrl(java.net.URL url)
Media
setUrl in interface Mediaurl - URL for mediapublic void setContainer(java.awt.Container container)
Media
setContainer in interface Mediacontainer - This container will contain the media.
public void setBounds(int x,
int y,
int width,
int height)
Media
setBounds in interface Mediapublic void setSoundVolume(int percentage)
Media
setSoundVolume in interface Mediapercentage - Sound volume, 0-100- (0 is quiet, 100 is original loudness, 200 twice as loud;
dB change in signal level = 20 log10(percentage / 100) )
public void prefetch()
throws java.lang.Exception
Media
prefetch in interface Mediajava.lang.Exception
public void play()
throws java.io.IOException
MediaIf the media is not yet prefetched, it will first be prefetched.
play in interface Mediajava.io.IOExceptionpublic void pause()
Media
pause in interface Mediapublic void stop()
Media
stop in interface Mediapublic void close()
Media
close in interface Mediapublic void setMediaTime(int millisecs)
Media
setMediaTime in interface Mediamillisecs - Time in millisecspublic void addMediaListener(MediaListener listener)
Media
addMediaListener in interface Mediapublic void showControls(boolean visible)
Media
showControls in interface Mediavisible - true=Display controls, false=don't display controls.
protected void initAudio()
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException,
javax.sound.sampled.LineUnavailableException
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
javax.sound.sampled.LineUnavailableExceptionprotected void finalizeAudio()
public void run()
run in interface java.lang.Runnable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||