Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Created November 12, 2013 03:48
Show Gist options
  • Save jpotts18/7425168 to your computer and use it in GitHub Desktop.
Save jpotts18/7425168 to your computer and use it in GitHub Desktop.
AddedToReportsActivity.java
private void toggleAudio(final Report report) {
System.out.println("PLAY CLICKED...");
PlayAudio.play(report.audio_url, new AudioPlayerCallback() {
@Override
public void onCompleted() {
System.out.println("PLAY COMPLETED");
response_audio.setImageResource(R.drawable.response_audio);
}
@Override
public void onStarted() {
System.out.println("PLAY STARTED");
response_audio.setImageResource(R.drawable.response_audio_pause);
}
@Override
public void onError() {
response_audio.setImageResource(R.drawable.response_audio);
problemPlayingAudio();
}
});
}
private void problemPlayingAudio() {
DialogHelper.newInfoDialog(ReportsActivity.this, false, "We are not able to play this audio at the moment. Please try again later.", null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment