Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-18-2007, 08:34 PM
Member
 
Join Date: May 2007
Posts: 11
luisarca is on a distinguished road
MMAPI sound application
Hi to all,

I'm developing a sound application. I only want to acced to server, download a song and play it on my mobile phone. As a server, I'm using the program "Apache", so I acced to the song by an HTTP connection, which url is http://localhost/song.mp3.
I would like to know what packages or which libaries should I include in my program to use methods like "Player player = Manager.createPlayer(is,"audio/mpeg");" and so on.
The code of the program is as follows:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
import org.kxml.parser.*;
import org.kxml.*;
import org.kxml.io.*; //incluida
import org.kxml.kdom.*;//incluida
import org.kxml.wap.*;//inlcuida


public class musica extends javax.microedition.midlet.MIDlet implements Runnable {
private VolumeControl vc;

public void run()
{
try
{
String url = "http://localhost/luis.mp3";
HttpConnection conn = (HttpConnection)Connector.open(url,
Connector.READ_WRITE);
InputStream is = conn.openInputStream();

Player 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)
{}
}

protected void startApp() throws MIDletStateChangeException {

run();

}

/**
* @see javax.microedition.midlet.MIDlet#destroyApp(boolea n)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}

/**
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp() {
}
}

Thank you very much,

Luisarca
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-playing sound JSK CLDC and MIDP 0 02-06-2008 01:34 PM
applet sound marco Java Applets 1 09-29-2007 12:31 AM
Make sound play in a java application lenny AWT / Swing 2 08-13-2007 01:45 PM
Error: Can't run as an application since it use sound-related methods mathias New To Java 1 08-07-2007 08:45 AM
Applets having sound peiceonly Java Applets 2 03-31-2007 11:55 AM


All times are GMT +3. The time now is 02:56 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org