Code example for MediaPlayer: Playing audio and video

Methods: start

0
  public void onCompletion(MediaPlayer mp) {
    stop(); 
  } 
 
  private void play() { 
    mp.start();
 
    play.setEnabled(false);
    pause.setEnabled(true);
    stop.setEnabled(true);
  } 
 
  private void stop() { 
    mp.stop();
    pause.setEnabled(false);
    stop.setEnabled(false);
 
    try { 
      mp.prepare();
      mp.seekTo(0);
      play.setEnabled(true);