Example usage for android.widget MediaController show

List of usage examples for android.widget MediaController show

Introduction

In this page you can find the example usage for android.widget MediaController show.

Prototype

public void show(int timeout) 

Source Link

Document

Show the controller on screen.

Usage

From source file:com.thadeus.youtube.IntroVideoActivity.java

protected void playVideo(Uri pResult) {
    //        super.onPostExecute(pResult);

    if (pResult == null) {
        throw new RuntimeException("Invalid NULL Url.");
    }/*from  w  ww  .  j a  v a  2  s. c o m*/

    mVideoView.setVideoURI(mVideoURI);

    // TODO:  add listeners for finish of video
    mVideoView.setOnCompletionListener(new OnCompletionListener() {

        @Override
        public void onCompletion(MediaPlayer pMp) {
            IntroVideoActivity.this.finish();
        }

    });

    final MediaController lMediaController = new MediaController(IntroVideoActivity.this);
    mVideoView.setMediaController(lMediaController);
    lMediaController.show(0);
    mVideoView.setKeepScreenOn(true);
    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer pMp) {
            IntroVideoActivity.this.mProgressBar.setVisibility(View.GONE);
            IntroVideoActivity.this.mProgressMessage.setVisibility(View.GONE);
        }

    });

    mVideoView.requestFocus();
    mVideoView.start();
}