|MultiMedia in Java|
Multimedia in Java:
public void play(URL url);
public void play(URL url,String name);
public void play(URL url), This method plays an audio clip if the audio clip represented by URL is found.
public void play(URL url,String name) plays an audio clip referred by the URL has many clips and matches with the name specified in the argument.
Once the URL refers the clip and by name it is found,java then loads the file into the memory then play once.
Disadvantages of Audio:
- The first ti,e we call it with a given audio file,it will have to be download the file. Now this is the happy path . For a case where the path is broken due to any factors(the link is not valid,the audio file is not present),User ends up waiting for loading the file and play.
- If it present in an applet package and if we need to use it from other component or form within a thread,we need to have a reference to Applet class.It is not very efficient.
- Play() method sounds only once and must be called again and again to play the same sound multiple times.