I want to play a radio stream directly from a url, without downloading
it first into a temporary file on the phone and having MediaPlayer
read it from there.
But if I provide the MediaPlayer with a url it returns this error:
(-10, 0)
Does anybody know what it means or what is the  problem with the code
below?
The stream I want to play is wma:
           mp.setDataSource("http://asx.skypro.ch/radio/internet-64/
drs3.asx");
Thanks a lot,
Lukas

Here's the code:

public class PlayRadio extends Activity implements OnClickListener,
OnPreparedListener, OnErrorListener {

   MediaPlayer mp;
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       Button bt = (Button)findViewById(R.id.Play);
       bt.setOnClickListener(this);
   }

   @Override
   public void onClick(View v)
   {
       try
       {
           mp = new MediaPlayer();
           mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
           mp.setOnPreparedListener(this);
           mp.setOnErrorListener(this);
           mp.setDataSource("http://asx.skypro.ch/radio/internet-64/
drs3.asx");
           mp.prepareAsync();
       }
       catch(Exception e)
       {
           Log.e("radio", e.getMessage());
       }
   }

   @Override
   public void onPrepared(MediaPlayer mp) {
       Log.i("radio", "prepare finished");
       mp.start();

   }

   @Override
   public boolean onError(MediaPlayer mp, int what, int extra) {
       mp.MEDIA_ERROR_UNKNOWN
       Log.e(TAG, "onError--->   what:" + what + "    extra:" +
extra);
       return false;
   }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to