Results 1 to 2 of 2

Thread: streaming mp3

  1. #1
    arnab321 is offline Member
    Join Date
    Oct 2008
    Rep Power

    Question streaming mp3

    how do i stream an mp3 (downloading in chunks and playing)? i first downloaded a part of the file as bytearray, then converted it into inputStream using bytearrayinputstream. and then played it. but the player gives a start exception(it sucessfully realizes and prefetches). im testing my app in sony ericssion emulator, that suports mp3.

    plz help me. point out whats wrong here:

    the download function:
    hcon = ( HttpConnection )"any mp3 file url here");//<---
    if (hcon.getResponseCode( ) == HttpConnection.HTTP_OK) {
    ByteArrayOutputStream star = null;
    byte stdata[]=new byte[500];

    System.out.println("stream "+hcon.getHeaderField("content-type"));
    //the content-type returned is "audio/mpeg"
    int total = 0;
    star = new ByteArrayOutputStream();
    int ch;
    System.out.println("length no");
    while ((ch = != -1){System.out.println(ch);
    System.out.println(stin.available());total++; System.out.println(total+" "+count);

    if(total==500)break;//breaks if the bytearray has 500 entries
    InputStream aa=new ByteArrayInputStream(star.toByteArray());//converting bytearray to inputstream

    craze.PLY(aa);//the player class to plaay the inputstream


  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    Without all the code and the hardware, its very hard to help.
    Are you sure that the data is being sent correctly?
    Can you send a small file, read it and compare it against what was sent to see if the communications is working correctly?
    What is a "start exception"? Can you copy and post the full text of the error message here?

Similar Threads

  1. video streaming
    By anniya0n in forum JDBC
    Replies: 3
    Last Post: 05-08-2013, 03:21 PM
  2. Outputstream not streaming.
    By dantestein in forum Networking
    Replies: 2
    Last Post: 03-14-2009, 08:36 AM
  3. PeerStream Audio Video Streaming Server 4.73
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 05-06-2008, 06:46 PM
  4. PeerStream Audio Video Streaming Server 4.55
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-27-2007, 07:34 PM
  5. PeerStream Audio Video Streaming Server 4.61
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-31-2007, 07:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts