|
How to play sound on mobile phone |
|
|
javax.microedition.media package is introduced in MIDP2.0 profile. This package
supports sound and upward compatibility with MultiMedia API.It has Manager,
Player and Control as main objects.Different audio files, from
various locations can be played on mobile.
Simple Media Playback
try
{
Player p = Manager.createPlayer("http://webserver/music.wav");
p.start();
}
catch (IOException ioe) { }
catch (MediaException me) { }
|
Playing Back from Media Stored in JAR
try
{
InputStream is = getClass().getResourceAsStream("music.wav");
Player p = Manager.createPlayer(is, "audio/X-wav");
p.start();
}
catch (IOException ioe) { }
catch (MediaException me) { }
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.