Code example for VideoView

Methods: setOnCompletionListenersetOnErrorListenersetOnPreparedListener

0
 
    protected void setupVideoListeners() { 
        if( mVideoView == null )
            return; 
 
        mVideoView.setOnCompletionListener( onCompletionListener );
        mVideoView.setOnErrorListener( onErrorListener );
        mVideoView.setOnPreparedListener( onPreparedListener );
    } 
 
    protected MediaPlayer.OnCompletionListener onCompletionListener = new MediaPlayer.OnCompletionListener() {
        @Override 
        public void onCompletion(MediaPlayer mediaPlayer) { 
            if( mVideoView == null || mMediaController == null ) 
                return; 
 
            mVideoView.seekTo( 0 ); 
            if( mVideoView.isPlaying() ) 
                mVideoView.pause(); 
 
            if( !mMediaController.isShowing() )