VideoView seekTo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for VideoView seekTo method.

This code example shows how to use the following methods:seekTo, setVideoPath
 
  @Override 
  public View onCreateView(LayoutInflater inflater,
                           ViewGroup container,
                           Bundle savedInstanceState) {
    VideoView result=new VideoView(getActivity());
 
    result.setVideoPath(getArguments().getString(ARG_PATH));
 
    if (savedInstanceState != null) {
      result.seekTo(savedInstanceState.getInt(STATE_POSITION));
    } 
 
    return(result);
  } 
 
  @Override 
  public void onResume() { 
    super.onResume(); 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:canSeekForward, getDuration, isPlaying, seekTo, start
              
       // Don't start until ready to play.  The arg of seekTo(arg) is the start point in 
       // milliseconds from the beginning. In this example we start playing 1/5 of 
       // the way through the video if the player can do forward seeks on the video. 
        
       if(videoPlayer.canSeekForward()) videoPlayer.seekTo(videoPlayer.getDuration()/5);
       videoPlayer.start();
       Log.i("IS PLAYING", Boolean.toString(videoPlayer.isPlaying()));
    } 
     
    /** This callback will be invoked when the file is finished playing */ 
    @Override 
    public void onCompletion(MediaPlayer  mp) {
       // Statements to be executed when the video finishes. 
       this.finish();	
    } 
     
    /**  Use screen touches to toggle the video between playing and paused. */ 
    @Override 
    public boolean onTouchEvent (MotionEvent ev){
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDuration, seekTo, setVideoURI
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 
        VideoView view = new VideoView(getActivity());
 
        if (filePath != null){
            view.setVideoURI(Uri.fromFile(new File(filePath)));
//            view.start(); 
            int duration = view.getDuration();
            view.seekTo(duration);
        } 
 
        return view;
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrentPosition, getDuration, isPlaying, pause, seekTo
 
    // This updates the time bar display (if necessary). It is called by 
    // mProgressChecker and also from places where the time bar needs 
    // to be updated immediately. 
    private int setProgress() { 
        mVideoPosition = mVideoView.getCurrentPosition();
        // If the video position is smaller than the starting point of trimming, 
        // correct it. 
        if (mVideoPosition < mTrimStartTime) {
            mVideoView.seekTo(mTrimStartTime);
            mVideoPosition = mTrimStartTime;
        } 
        // If the position is bigger than the end point of trimming, show the 
        // replay button and pause. 
        if (mVideoPosition >= mTrimEndTime && mTrimEndTime > 0) {
            if (mVideoPosition > mTrimEndTime) {
                mVideoView.seekTo(mTrimEndTime);
                mVideoPosition = mTrimEndTime;
            } 
            mController.showEnded();

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:seekTo, setVideoPath, start
		vv.setVideoPath("android.resource://jp.alumican.speechdemo/"+R.raw.m1);
		vv.start();
		vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
			@Override 
			public void onCompletion(MediaPlayer mp) {
				vv.setVideoPath("android.resource://jp.alumican.speechdemo/"+video_src);
				vv.seekTo(0);
				vv.start();
 
			} 
		}); 
		 
		sr = SpeechRecognizer.createSpeechRecognizer(this);
		sr.setRecognitionListener(this);
		Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
		intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
				RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
		intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
				getPackageName());
		sr.startListening(intent);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrentPosition, getDuration, isPlaying, pause, seekTo
 
    // This updates the time bar display (if necessary). It is called by 
    // mProgressChecker and also from places where the time bar needs 
    // to be updated immediately. 
    private int setProgress() { 
        mVideoPosition = mVideoView.getCurrentPosition();
        // If the video position is smaller than the starting point of trimming, 
        // correct it. 
        if (mVideoPosition < mTrimStartTime) {
            mVideoView.seekTo(mTrimStartTime);
            mVideoPosition = mTrimStartTime;
        } 
        // If the position is bigger than the end point of trimming, show the 
        // replay button and pause. 
        if (mVideoPosition >= mTrimEndTime && mTrimEndTime > 0) {
            if (mVideoPosition > mTrimEndTime) {
                mVideoView.seekTo(mTrimEndTime);
                mVideoPosition = mTrimEndTime;
            } 
            mController.showEnded();

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:seekTo, start
                    onCompletion(); 
                }}); 
            builder.setPositiveButton(R.string.resume_playing_resume,
                    new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mVideoView.seekTo(bookmark);
                    mVideoView.start();
                }}); 
            builder.setNegativeButton(R.string.resume_playing_restart,
                    new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mVideoView.start();
                }}); 
            builder.show();
        } else { 
            mVideoView.start();
        } 
    } 
 
    private static boolean uriSupportsBookmarks(Uri uri) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:seekTo, setVideoURI, start
    } 
 
    @Override 
    public void onResume() { 
        if (mPositionWhenPaused >= 0) {
            mVideoView.setVideoURI(mUri);
            mVideoView.seekTo(mPositionWhenPaused);
            if (mWasPlayingWhenPaused) {
                mVideoView.start();
            } 
        } 
 
        super.onResume(); 
    } 
 
    Handler mHandler = new Handler() {
        @Override 
        public void handleMessage(Message msg) { 
        } 
    }; 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:seekTo, setVideoURI
        mVideoView.stopPlayback();
    } 
 
    public void onResume() { 
        if (mPositionWhenPaused >= 0) {
            mVideoView.setVideoURI(mUri);
            mVideoView.seekTo(mPositionWhenPaused);
            mPositionWhenPaused = -1;
        } 
    } 
 
    public void onPrepared(MediaPlayer mp) {
        if (mWasPlayingWhenPaused) {
            mMediaController.show(0);
        } 
    } 
 
    public boolean onError(MediaPlayer player, int arg1, int arg2) {
        mHandler.removeCallbacksAndMessages(null);
        mProgressView.setVisibility(View.GONE);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:seekTo, start
                    onCompletion(); 
                }}); 
            builder.setPositiveButton(R.string.resume_playing_resume,
                    new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mVideoView.seekTo(bookmark);
                    mVideoView.start();
                }}); 
            builder.setNegativeButton(R.string.resume_playing_restart,
                    new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mVideoView.start();
                }}); 
            builder.show();
        } else { 
            mVideoView.start();
        } 
    } 
 
    private static boolean uriSupportsBookmarks(Uri uri) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related VideoView seekTo Questions & Answers: