Example usage for android.widget MediaController setPrevNextListeners

List of usage examples for android.widget MediaController setPrevNextListeners

Introduction

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

Prototype

public void setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) 

Source Link

Usage

From source file:sample.videoview.kevalpatel.com.userawarevideoview.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //set the is tracking indicator
    mTrackingStatusIv = (ImageView) findViewById(R.id.eye_tracking);
    mTrackingStatusIv.setVisibility(View.GONE);

    //set user aware video view
    mVideoView = (UserAwareVideoView) findViewById(R.id.video_view);
    mVideoView.setUserAwarenessListener(this);
    mVideoView.setVideoURI(Uri.parse("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4"));

    //attach tge media controller
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(mVideoView);
    mediaController.setPrevNextListeners(new View.OnClickListener() {
        @Override//ww w . jav  a  2  s.  c  o  m
        public void onClick(View view) {
            mVideoView.stopPlayback();
            mVideoView.start();
        }
    }, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mVideoView.stopPlayback();
            mVideoView.start();
        }
    });

    mVideoView.setMediaController(mediaController);

    //Start video playing. This will start the user eye tracking too.
    //Do not care about permissions. Permissions will check internally.
    //Just handle errors.
    mVideoView.start();
}