Hello!!!
this source code is no problem!
but just only Url is incorrect.
mp.setDataSource("http://asx.skypro.ch/radio/internet-64/
drs3.asx");
you should choice correct Url ( for down load file).
mp.setDataSource("http://amnhac.timnhanh.com/player/getsong/down
/35A5E94E/f255cbf3cd58dfa923867c0b49c784ba/887379/1234163243");
if you correct it, you can run playback!.
OK!
V.Nhan!!
On Jan 26, 4:31 pm, arnouf <[email protected]> wrote:
> Hello,
>
> I tried to do the same thing. I had to implement a buffering file
> system...but it was not easy, two files one reading the stream and
> another readed by player...
>
> But the problem was the first file streaming the content grew without
> stopping...
>
> So wait cupcake...
>
> But how LastFm could provide this type of streaming?
>
> On 12 jan, 15:04, Lukas <[email protected]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---