// 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(); mVideoView.pause(); } int duration = mVideoView.getDuration(); if (duration > 0 && mTrimEndTime == 0) { mTrimEndTime = duration; } mController.setTimes(mVideoPosition, duration, mTrimStartTime, mTrimEndTime); // Enable save if there's modifications mSaveVideoTextView.setEnabled(isModified()); return mVideoPosition; }
@Override protected void onPause() { super.onPause(); state_onpause = true; seekPosition = VideoPlayer.getCurrentPosition(); VideoPlayer.stopPlayback(); }
@Override public void onPause() { mHasPaused = true; mHandler.removeCallbacksAndMessages(null); mVideoPosition = mVideoView.getCurrentPosition(); mVideoView.suspend(); super.onPause(); }
@Override protected void onPause() { super.onPause(); try { progress = videoView.getCurrentPosition(); } catch (Exception e) { } }
public void setTimeText() { if (videoView.getDuration() > 1) { dismissDialog(DIALOG_PREPARING); int remain = videoView.getDuration() - videoView.getCurrentPosition(); int min = remain / 60000; int sec = (remain - (min * 60000)) / 1000; String sMin = (min < 10 ? "0" : "") + min; String sSec = (sec < 10 ? "0" : "") + sec; timeTextView.setText("-" + sMin + ":" + sSec); } }
@Override public void handleMessage(Message msg) { if (mVideoView == null) return; try { if (mVideoView.isPlaying()) { mPlayProgressBar.setProgress(mVideoView.getCurrentPosition()); mProgressHandler2.sendEmptyMessageDelayed(0, 100); } } catch (IllegalStateException e) { } catch (Exception e) { } }
@Override protected void onPause() { super.onPause(); if (notificationState == false) { if (checkNote == false) { mNotificationManager.notify(120, notification); checkResume = 1; } seekPosition = vRadioView.getCurrentPosition(); vRadioView.pause(); resumeState = 1; } else { notificationState = false; } }
public void run() { if (seekBar != null) { int percents = (int) (1000 * (float) videoView.getCurrentPosition() / (float) videoView.getDuration()); seekBar.setProgress(percents); setTimeText(); } if (videoView.isPlaying()) { seekBar.postDelayed(onEveryHalfSecond, 500); } }
@Override public void onPause() { super.onPause(); position = myVideoView.getCurrentPosition(); myVideoView.pause(); }
private boolean shouldBeInteractable() { return !mShowCloseButtonEventFired && mVideoView.getCurrentPosition() >= mShowCloseButtonDelay; }
@Override protected void onPause() { stopProgressChecker(); mSeekerPositionOnPause = mVideoView.getCurrentPosition(); mVideoView.pause(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_plot); String vidPath = getIntent().getStringExtra("vidPath"); scale = getIntent().getDoubleExtra("Scale", 0); String timeTest = String.valueOf(scale); Log.d("MyTag4", timeTest); // Initializing videoView to link this java activity to the .xml layout. myVideoView = (VideoView) findViewById(R.id.plot_video); // Uniform Resource Identifier(Uri) is used as an address to identify things myVideoView.setVideoURI(Uri.parse(vidPath)); // Initializing the MediaController for the video to be played. // myMediaController = new MediaController(this); // myVideoView.setMediaController(myMediaController); // These listeners help to get information about the videoview player // Completion listeners can be used to explaning when video is done, and what to do. myVideoView.setOnCompletionListener(myVideoViewCompletionListener); // Used to display time of still image from frame. myVideoView.setOnPreparedListener(MyVideoViewPreparedListener); // Used to display is any errors went on when video started or was playing. myVideoView.setOnErrorListener(myVideoViewErrorListener); // Sets focus on the widget myVideoView.requestFocus(); TextView runTime = (TextView) findViewById(R.id.time_text); runTime.setText(Integer.toString(myVideoView.getCurrentPosition()) + " (ms)"); myVideoView.seekTo(count); // Initialize seekbutton to be used to go frame-by-frame in video. ImageButton buttonFwdSeek = (ImageButton) findViewById(R.id.seek_fwd); // Set's OnClickListener to know when the button had been clicked, then executes the code. buttonFwdSeek.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { /*Gets the current position of video and makes sure its always less than the total duration of the video so it doesn't over play.*/ if (myVideoView.getCurrentPosition() < myVideoView.getDuration()) { // Keeps a count and seeks video to specified frame.. // Which is 1/10 of a sec or 100 milliseconds. currentTime = count; // count = myVideoView.getCurrentPosition() + 250; TextView runTime = (TextView) findViewById(R.id.time_text); runTime.setText(Integer.toString(myVideoView.getCurrentPosition()) + " (ms)"); myVideoView.seekTo(count); // dnum = dnum + 33.33; // count = (int)Math.round(dnum); } } }); ImageButton buttonBackSeek = (ImageButton) findViewById(R.id.seek_back); buttonBackSeek.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (myVideoView.getCurrentPosition() >= 0) { count = myVideoView.getCurrentPosition() - 250; // currentTime = count; myVideoView.seekTo(count); TextView runTime = (TextView) findViewById(R.id.time_text); runTime.setText(Integer.toString(myVideoView.getCurrentPosition()) + " (ms)"); } } }); ImageButton backButton = (ImageButton) findViewById(R.id.back_button); backButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (myVideoView.getCurrentPosition() >= 0) { count = myVideoView.getCurrentPosition() - 1000; // currentTime = count; myVideoView.seekTo(count); TextView runTime = (TextView) findViewById(R.id.time_text); runTime.setText(Integer.toString(myVideoView.getCurrentPosition()) + " (ms)"); } } }); ImageButton fwdButton = (ImageButton) findViewById(R.id.fwd_button); fwdButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (myVideoView.getCurrentPosition() < myVideoView.getDuration()) { // Keeps a count and seeks video to specified frame.Which is 1 sec, let's user get // through video faster. currentTime = count; myVideoView.seekTo(count); count = myVideoView.getCurrentPosition() + 1000; TextView runTime = (TextView) findViewById(R.id.time_text); runTime.setText(Integer.toString(myVideoView.getCurrentPosition()) + " (ms)"); } } }); // Intent that restarts the current activity. ImageButton deleteButton = (ImageButton) findViewById(R.id.delete_button); deleteButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Intent intent = getIntent(); finish(); startActivity(intent); } }); ImageButton graphButton = (ImageButton) findViewById(R.id.graph_button); graphButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { if (clickCount >= 3) { double tPoints[] = new double[time.size()]; for (int i = 0; i < time.size(); i++) { tPoints[i] = time.get(i); } double xPoints[] = new double[xTap.size()]; for (int i = 0; i < xTap.size(); i++) { xPoints[i] = xTap.get(i); } Intent graphIntent = new Intent(getApplicationContext(), GraphingActivity.class); graphIntent.putExtra("tPoints", tPoints); graphIntent.putExtra("xPoints", xPoints); startActivity(graphIntent); } else { Toast.makeText(PlotActivity.this, "plot more points", Toast.LENGTH_SHORT).show(); } } }); View buttonView = (View) findViewById(R.id.plot_buttons); buttonView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); }