File audioFile = new File("path/to/audio/file.wav"); Player player = Manager.createPlayer(new MediaLocator(audioFile.toURI().toURL())); player.start();
URL audioURL = new URL("http://example.com/audio.mp3"); Player player = Manager.createPlayer(audioURL); player.start();This code creates a Player object from an MP3 audio stream on the internet and starts playing it. Library Package: javax.media