Hi,
I am afraid what you are asking for is not available, not even in the latest Series 40 full touch devices. This is only possible on Symbian devices with the following sample code:
Code:
import java.io.IOException;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.PlayerListener;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import com.nokia.mid.media.AudioOutput;
public class Mp3overHTTP
extends MIDlet
implements CommandListener, Runnable, PlayerListener {
Form mainForm;
Command playCommand = new Command("Play", Command.OK, 0);
Command exitCommand = new Command("Exit", Command.EXIT, 0);
Command stopCommand = new Command("Stop", Command.STOP, 0);
Player player;
Thread thread;
boolean firstTime = true;
boolean isStopped = false;
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
mainForm = new Form("Mp3 over HTTP");
Display.getDisplay(this).setCurrent(mainForm);
mainForm.addCommand(playCommand);
mainForm.addCommand(stopCommand);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
}
public void commandAction(Command c, Displayable arg1) {
if( c == playCommand) {
isStopped = false;
thread = new Thread(this);
thread.start();
}
if(c == exitCommand) {
notifyDestroyed();
}
if(c == stopCommand) {
isStopped = true;
thread = new Thread(this);
thread.start();
}
}
public void run() {
try {
if(firstTime) {
player = Manager.createPlayer("http://tonycuffe.com/mp3/cairnomount_lo.mp3");
player.realize();
player.addPlayerListener(this);
firstTime = false;
}
if(isStopped) {
player.stop();
}
else {
player.start();
}
} catch (IOException e) {
e.printStackTrace();
} catch (MediaException e) {
e.printStackTrace();
}
}
public void playerUpdate(Player player, String event, Object eventData) {
if (event.equals("com.nokia.audiooutputchange.event")){
int mode = ((AudioOutput) eventData).getActiveOutputMode();
mainForm.append("mode is " + mode + "\n");
}
}
}