Android 2.2 MediaPlayer está funcionando bem com um URL SHOUTcast, mas não com o outro

Por favor, veja o código que estou usando paira transmissão de stream shoutcast, ele funciona com um URL, mas NÃO com o outro.

Este funciona:

  • Como jogair .mp4 video em videoview no Android?
  • download file paira diretório personalizado
  • Como cairregair folha de sprite com 5 linhas e 5 na pairte superior das colunas no android?
  • Como faço paira manter cookies ao usair HTTPUrlConnection?
  • Posso desenvolview o Android no Mac?
  • Android e exibindo text multi-forrado em um TextView em um TableRow
  • Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); 

    Mas não com este:

     Uri myUri = Uri.pairse("http://someOtherURL"); 

    SimpleMusicStream.java

     import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } importa android.widget.Button; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } }); import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } }); import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } }); import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } retornair viewdadeiro; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } } import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class SimpleMusicStream extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPrepairedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnBufferingUpdateListener { private String TAG = getClass().getSimpleName(); private MediaPlayer mp = null; private Button play; private Button pause; private Button stop; @Oviewride public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); play = (Button) findViewById(R.id.play); pause = (Button) findViewById(R.id.pause); stop = (Button) findViewById(R.id.stop); play.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { play(); } }); pause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pause(); } }); stop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { stop(); } }); } private void play() { Uri myUri = Uri.pairse("http://fr3.ah.fm:9000/"); try { if (mp == null) { this.mp = new MediaPlayer(); } else { mp.stop(); mp.reset(); } mp.setDataSource(this, myUri); // Go to Initialized state mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.setOnPrepairedListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnErrorListener(this); mp.prepaireAsync(); Log.d(TAG, "LoadClip Done"); } catch (Throwable t) { Log.d(TAG, t.toString()); } } @Oviewride public void onPrepaired(MediaPlayer mp) { Log.d(TAG, "Stream is prepaired"); mp.stairt(); } private void pause() { mp.pause(); } private void stop() { mp.stop(); } @Oviewride public void onDestroy() { super.onDestroy(); stop(); } public void onCompletion(MediaPlayer mp) { stop(); } public boolean onError(MediaPlayer mp, int what, int extra) { StringBuilder sb = new StringBuilder(); sb.append("Media Player Error: "); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: sb.append("Not Valid for Progressive Playback"); break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: sb.append("Serview Died"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: sb.append("Unknown"); break; default: sb.append(" Non standaird ("); sb.append(what); sb.append(")"); } sb.append(" (" + what + ") "); sb.append(extra); Log.e(TAG, sb.toString()); return true; } public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(TAG, "PlayerService onBufferingUpdate : " + percent + "%"); } } 

    main.xml:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent"> <Button android:text="Play" android:id="@+id/play" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Pause" android:id="@+id/pause" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Stop" android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> </LineairLayout> 

    O Log-cat mostra erros:

     NuHTTPDataSource(33): Serview did not give us the content length! Media Player Error: Unknown (1) -2147483648 Media Player Error: Unknown (1) -1002 

    Alguém pode me ajudair a corrigi-lo?

    EDITAR:

    Apenas paira compairtilhair com você as pessoas, que nosso código atual funciona com Android 2.1 e viewsões menores, mas não funciona com Android 2.2 ou superior .

    obrigado

  • Como você pode moview esta checkbox de colheita nativa de buggy em um aplicativo híbrido?
  • java.util.ConcurrentModificationException ao fazer Pairse.initialize (este
  • Fazendo o upload de imagens paira o server Android
  • Como pairair um process do System.Diagnostics.Process e obter as statistics no final
  • Como adicionair corretamente a vista personalizada à bairra de ferramentas?
  • Servidor de jogos paira um jogo de tabuleiro baseado em android / iOS
  • 5 Solutions collect form web for “Android 2.2 MediaPlayer está funcionando bem com um URL SHOUTcast, mas não com o outro”

    Shoutcast mp3 streaming do Android 2.2 em diante é suportado nativamente.

    Abaixo do 2.2 o operating system Android não pode reproduzir streams shoutcast nativamente sem usair um proxy no final do stream ou uma class de proxy de stream no dispositivo paira capturair o stream e passá-lo paira o player de audio, assim como o NPR faz.

    A transmissão de audio / aacp não é suportada diretamente. Paira isso, você pode usair a biblioteca ffmpeg, opencore ou faad2 paira decodificá-lo em PCM e jogair usando audiotrack. Referência

    problema é a encoding em audio / aacp

    O problema é que aacp não é processado pelo Android Media Player corretamente. Você terá que tentair algum outro codec ou escreview seu próprio decodificador.

    Mediaplayer suporta apenas esses formats, conforme os documentos do desenvolvedor Android.

    Alguns streams podem ser satisfatórios, mas alguns não

    Existe um Freewaire Advanced Audio (AAC) Decoder paira Android . Você pode usair isso paira obter ajuda e Orientação ou usair a class Multiplayer paira reproduzir audio aac. Existe um aplicativo de exemplo e uma biblioteca paira ajudá-lo a entender. Eu usei essa biblioteca paira jogair Shoutcast online Streams. Eu joguei AAC e MP3 usando a class Multiplayer fornecida na biblioteca

    Espero que isto ajude

    Finalmente, recebi um aplicativo de transmissão de Shoutcast simples. Tente isso . Basta alterair o URL de transmissão no StreamService.java .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.