Results 1 to 1 of 1
Thread: simple mp3 streaming
- 11-22-2008, 05:27 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 1
- Rep Power
- 0
simple mp3 streaming
Hi all,
I have the following code, which is extremely simple but fails to play the audio. I've tried it under 2 emulators and a real device, and with both wav and mp3 files.
Both test files worked (with HTTP streaming) on my PC with VLC player.
Sun's and Sprint's emulators appear to be basically the same. They fail on wav with:Java Code:package testest; import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Form; import javax.microedition.media.Manager; import javax.microedition.media.Player; import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; public class TheMid extends MIDlet implements Runnable { public TheMid() {} protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {} protected void pauseApp() {} protected void startApp() throws MIDletStateChangeException { new Thread(this).start(); } public void run() { try { // sorry for the mangled urls, it complained about me posting links // replace dashes with colon-slash-slash or with slashes. leave underscores alone // and sorry for the weird content of the audio files :rolleyes: String test_wav = "http---www-archive-org-download-BenWillemsTestTestwav-Test.wav"; String test_mp3 = "http---www-archive-org-download-ezraLoudmouthSomethingtoSay7_3-episode_7.mp3"; HttpConnection con = (HttpConnection)Connector.open(test_mp3); // or test_wav InputStream in = con.openInputStream(); Player player = Manager.createPlayer(in, "audio/mpeg"); // or audio/x-wav, or audio/wav, or audio/mp3 to be safe player.realize(); player.prefetch(); player.start(); } catch(Exception e) { Form f = new Form("Exception!"); f.append("e.Type: " + e.getClass().getName()); f.append("e.Msg: " + e.getMessage()); Display.getDisplay(this).setCurrent(f); } } }
And they don't support mp3 so they fail on "audio/mpeg"Java Code:MediaException -- Failed to realize Player: premature end of stream
And my real device, a LG LX550 or Fusic, fails on both files and greets me with:
Java Code:MediaException -- Could not read input stream (empty)
And of course they all failed with the obvious error for the incorrect mime types. I only tested those for the sake of completion.
Hope this is enough info and sorry for the novel. Anyone have any ideas? Thanks in advance :)
Similar Threads
-
video streaming
By anniya0n in forum JDBCReplies: 3Last Post: 05-08-2013, 03:21 PM -
J2ME/Android Video Streaming Project
By mox27 in forum Forum LobbyReplies: 4Last Post: 04-06-2009, 08:48 AM -
Outputstream not streaming.
By dantestein in forum NetworkingReplies: 2Last Post: 03-14-2009, 07:36 AM -
streaming mp3
By arnab321 in forum CLDC and MIDPReplies: 1Last Post: 10-11-2008, 03:08 PM -
PeerStream Audio Video Streaming Server 4.61
By levent in forum Java SoftwareReplies: 0Last Post: 07-31-2007, 07:50 PM


LinkBack URL
About LinkBacks

Bookmarks