I want to play an AudioClip and the static method Applet.newAudioClip requires a URL. I am stumped as how to make a URL that represents a file on my computer. The API docs are not very usefull. Thanks. Steven Davidson
Srinivas
Greenhorn
Joined: Feb 01, 2002
Posts: 9
posted
0
A code like this should work i guess File f = new File("mysound.au"); AudioClip theSound; try { theSound = Applet.newAudioClip(f.toURL()); } catch (java.net.MalformedURLException e) { theSound = null; } if (theSound != null) { theSound.play(); }