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 11-22-2008, 07:27 AM
Member
 
Join Date: Nov 2008
Posts: 1
zildjohn01 is on a distinguished road
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.

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); } } }
Sun's and Sprint's emulators appear to be basically the same. They fail on wav with:
Code:
MediaException -- Failed to realize Player: premature end of stream
And they don't support mp3 so they fail on "audio/mpeg"


And my real device, a LG LX550 or Fusic, fails on both files and greets me with:
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
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
J2ME/Android Video Streaming Project mox27 Forum Lobby 2 12-06-2008 12:14 AM
streaming mp3 arnab321 CLDC and MIDP 1 10-11-2008 05:08 PM
Outputstream not streaming. dantestein Networking 0 10-11-2008 12:57 AM
video streaming anniya0n Database 1 01-24-2008 07:35 PM
PeerStream Audio Video Streaming Server 4.61 levent Java Announcements 0 07-31-2007 09:50 PM


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


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