Hi All, I am trying to play a song that is in remote server and is in this link. You also can check the song. but as per what i have coded the song is not getting played from the remote server.
Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try{
mySong = new MediaPlayer();
mySong.setDataSource("http://www.hrupin.com/wp-content/uploads/mp3/testsong_20_sec.mp3");
mySong.setAudioStreamType(AudioManager.STREAM_MUSIC);
mySong.prepareAsync();
mySong.start();
}
catch(Exception ee){
TextView tv = (TextView) findViewById(R.id.textView1);
tv.setText(ee.getMessage());
}
finally{
mySong.reset();
mySong.release();
}
}
});
0 comments:
Post a Comment