Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Created October 10, 2010 00:36
Show Gist options
  • Select an option

  • Save pbrisbin/618774 to your computer and use it in GitHub Desktop.

Select an option

Save pbrisbin/618774 to your computer and use it in GitHub Desktop.
// called from the main activity
synchronized public void playPause(Context _c, String _s) {
if (mediaPlayer == null) {
// show progress dialog
pd = ProgressDialog.show(_c, "Raw Audio", "connecting to stream...", true, true);
// not playing -> load stream
STREAM = _s;
loadStream();
}
else if (mediaPlayer.isPlaying()) {
// playing -> pause
mediaPlayer.pause();
}
else {
// paused -> resume
mediaPlayer.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment