Skip to content

Instantly share code, notes, and snippets.

@jpzhu
Last active December 22, 2015 08:30
Show Gist options
  • Save jpzhu/6445134 to your computer and use it in GitHub Desktop.
Save jpzhu/6445134 to your computer and use it in GitHub Desktop.
mp3 player android
import android.media.MediaPlayer;
//Create a MediaPlayer Object
MediaPlayer mMediaPlayer = new MediaPlayer();
//Prepare the data for player
//This take some time, maybe used in an asynctask()
// streami type could be "Uri" or "String"
mMediaPlayer.setDataSource(stream);
mMediaPlayer.prepare();
// start or stop
mMediaPlayer.start();
mMediaPlayer.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment