HuyPV
Tuesday, January 11, 2011
MMAPI supports mp3 files. Depending upon the device capabilities and the size of the mp3 files, an mp3 player can be created on J2ME phones.
The method below creates an mp3 player and plays an mp3 file from Media URL.
public void run()
{
try
{
String url = "http://server/audio.mp3";
HttpConnection conn = (HttpConnection)Connector.open(url,
Connector.READ_WRITE);
InputStream is = conn.openInputStream();
player = Manager.createPlayer(is,"audio/mpeg");
player.realize();
// get volume control for player and set volume to max
vc = (VolumeControl) player.getControl("VolumeControl");
if(vc != null)
{
vc.setLevel(100);
}
player.prefetch();
player.start();
}
catch(Exception e)
{}
}
Title:
Playing MP3 files from your server on J2ME devices
Description:
MMAPI supports mp3 files. Depending upon the device capabilities and the size of the mp3 files, an mp3 player can be created on J2ME phones....
...
Rating:
4