You Are Here:

Community: Wiki

This page was last modified on 3 June 2009, at 13:08.

Como tocar mp3 a partir de um servidor

From Forum Nokia Wiki

Original: How to play mp3 from server in Java ME

O método abaixo mostra como um arquivo mp3 pode ser execudado diretamente de um servidor utilizando o Java ME.

public void playAudio()
{
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/amr");
 
player.realize();
// pega o controle de volume do player e o define para o maximo
vc = (VolumeControl) player.getControl("VolumeControl");
if(vc != null)
{
vc.setLevel(100);
}
player.prefetch();
player.start();
}
catch(Exception e)
{}
}

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia