Playing IceCast stream

All your problems with Audio, Video and Images.

Playing IceCast stream

Postby xplodwild » Sun Oct 09, 2011 12:27 pm

Hi everyone,

I'm having an issue with IceCast audio stream, using MediaPlayer. The streams starts and plays for some seconds, then just stops. Here's the code I'm using :

Code: Select all
      MediaPlayer mediaPlayer = new MediaPlayer();
      mediaPlayer.reset();
      mediaPlayer.setOnBufferingUpdateListener(this);
      mediaPlayer.setOnErrorListener(this);
      mediaPlayer.setOnPreparedListener(this);
      mediaPlayer.setOnCompletionListener(this);
      mediaPlayer.setOnInfoListener(this);

      mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
      
      try {
         mediaPlayer.setDataSource((url));
         mediaPlayer.prepare();
      } catch (Exception e) {
         // TODO Auto-generated catch block
         Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
      }

...

@Override
   public void onPrepared(MediaPlayer arg0) {
      arg0.start();
        }


When I press my "Play" button, it buffers then starts playing, but it stops after 10-15s. When I output buffer update, the progress value decrease until reaching -(2^32)/2. The sound just stops then and never starts again.

What could be the issue ?
xplodwild
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Oct 09, 2011 12:17 pm

Top

Re: Playing IceCast stream

Postby ramesh.kec.85 » Sat Oct 15, 2011 5:15 am

Use mediaPlayer.prepareAsync() instead of prepare ,because of you are using stream..
Thanks

Regards
--R@mesh
ramesh.kec.85
Developer
Developer
 
Posts: 27
Joined: Sat Jul 30, 2011 10:05 am
Location: Ahmedabad

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests