Home > Mobile >  MediaPlayer playback problems
MediaPlayer playback problems

Time:10-12

I use MediaPlayer play music, code the following
 
Musicplayer=null;
Musicplayer=new MediaPlayer ();
Try {
Musicplayer. SetDataSource (dataUrl);
Musicplayer. Prepare ();
Musicplayer. Start ();
} the catch (IOException e) {
e.printStackTrace();
}

The writing on the current activity pause, a song, a capital, no problem, but if I go back to an activity on the list (music) choose music to play the activity, it will be a few minutes to play the music in the song I chose, for the first time to play the activity is not the problem
Attached upload code value:
 
Intent Intent=new Intent (MainActivity. This, MusicPlayerActivity. Class);
Bundle Bundle=new Bundle ();
Bundle. PutParcelableArrayList (" gates ", musicMessige);
Bundle. PutInt (" id ", I);
Intent. PutExtras (bundle);
startActivity(intent);
  • Related