Code example for MediaPlayer

Methods: preparesetDataSourcesetOnCompletionListener

0
    stop.setEnabled(true);
  } 
 
  private void loadClip() { 
    try { 
      mp=new MediaPlayer();
      mp.setDataSource(this,
                       PipeProvider.CONTENT_URI.buildUpon() 
                                               .appendPath("clip.ogg") 
                                               .build()); 
      mp.setOnCompletionListener(this);
      mp.prepare();
    } 
    catch (Exception e) {
      goBlooey(e);
    } 
  } 
 
  private void setup() { 
    loadClip(); 
    play.setEnabled(true);