Java Code Examples for android.widget.VideoView#setOnClickListener()

The following examples show how to use android.widget.VideoView#setOnClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JCameraView.java    From Tok-Android with GNU General Public License v3.0 6 votes vote down vote up
private void initVideoView() {
    /*VideoView 播放视频的界面*/
    mVideoView = new VideoView(mContext);
    LayoutParams videoViewParam =
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    videoViewParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mVideoView.setLayoutParams(videoViewParam);
    this.addView(mVideoView);       //viedoView

    mVideoView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mCamera.autoFocus(JCameraView.this);
        }
    });
}
 
Example 2
Source File: PlayerActivity.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView);
    mStartText = (TextView) findViewById(R.id.startText);
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar);
    mPlayPause = (ImageView) findViewById(R.id.playpause);
    mLoading = (ProgressBar) findViewById(R.id.progressBar);
    mControllers = findViewById(R.id.controllers);

    mVideoView.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if ( mControllers.getVisibility() != View.VISIBLE  ) {
                mControllers.setVisibility( View.VISIBLE );
            }

            if ( mPlaybackState == PlaybackState.PAUSED ) {
                mPlaybackState = PlaybackState.PLAYING;
                updatePlayButton( mPlaybackState );
                mVideoView.start();
                startControllersTimer();
            } else {
                mVideoView.pause();
                mPlaybackState = PlaybackState.PAUSED;
                updatePlayButton( PlaybackState.PAUSED );
                stopControllersTimer();
            }
        }
    });
}
 
Example 3
Source File: PlayerActivity.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void loadViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView);
    mStartText = (TextView) findViewById(R.id.startText);
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar);
    mPlayPause = (ImageView) findViewById(R.id.playpause);
    mLoading = (ProgressBar) findViewById(R.id.progressBar);
    mControllers = findViewById(R.id.controllers);
    mContainer = findViewById(R.id.container);

    mVideoView.setOnClickListener(mPlayPauseHandler);
}
 
Example 4
Source File: PlayerActivity.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void loadViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView);
    mStartText = (TextView) findViewById(R.id.startText);
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar);
    mPlayPause = (ImageView) findViewById(R.id.playpause);
    mLoading = (ProgressBar) findViewById(R.id.progressBar);
    mControllers = findViewById(R.id.controllers);
    mContainer = findViewById(R.id.container);

    mVideoView.setOnClickListener(mPlayPauseHandler);
}
 
Example 5
Source File: PlayerActivity.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void loadViews() {
    mVideoView = (VideoView) findViewById(R.id.videoView);
    mStartText = (TextView) findViewById(R.id.startText);
    mEndText = (TextView) findViewById(R.id.endText);
    mSeekbar = (SeekBar) findViewById(R.id.seekBar);
    mPlayPause = (ImageView) findViewById(R.id.playpause);
    mLoading = (ProgressBar) findViewById(R.id.progressBar);
    mControllers = findViewById(R.id.controllers);
    mContainer = findViewById(R.id.container);

    mVideoView.setOnClickListener(mPlayPauseHandler);
}