public void playMP3() {
try {
InputStream is = getClass().getResourceAsStream("/rr.mp3");
if (p == null) p = Manager.createPlayer(is, "audio/mp3");
//p.addPlayerListener(this);
p.realize();
VolumeControl vc = (VolumeControl)p.getControl("VolumeControl");
if(vc != null)
{
vc.setLevel(100);
}
p.prefetch();
// vc = (VolumeControl)p.getControl("VolumeControl");
p.start();
} catch (IOException ioe) {
this.showError("IOException", ioe.getMessage());
} catch (MediaException me) {
this.showError("MediaException", me.getMessage());
}
I am using this code snippet for playing audio files.
In my app I need to stop and replay the file from starting.By using p.stop() and recalling the above function the files is playing from the position where it is stopped.
Please suggest me any solution.

Reply With Quote



