Results 1 to 1 of 1
Thread: MMAPI sound application
- 06-18-2007, 06:34 PM #1
Member
- Join Date
- May 2007
- Posts
- 11
- Rep Power
- 0
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
Similar Threads
-
Re-playing sound
By JSK in forum CLDC and MIDPReplies: 0Last Post: 02-06-2008, 11:34 AM -
applet sound
By marco in forum Java AppletsReplies: 1Last Post: 09-28-2007, 10:31 PM -
Make sound play in a java application
By lenny in forum AWT / SwingReplies: 2Last Post: 08-13-2007, 11:45 AM -
Error: Can't run as an application since it use sound-related methods
By mathias in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:45 AM -
Applets having sound
By peiceonly in forum Java AppletsReplies: 2Last Post: 03-31-2007, 09:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks