private void pauseMainVideo() { this.currentPlayheadTime = this.videoPlayer.getCurrentPosition(); this.checkTimer.cancel(); this.adContext.setVideoState(adConstants.VIDEO_STATE_PAUSED()); this.runOnUiThread( new Runnable() { @Override public void run() { videoPlayer.pause(); videoPlayer.setVisibility(View.GONE); } }); }
@Override public void onPause() { Log.d(CLASSTAG, "onPause"); super.onPause(); if (this.videoPlayer != null) { this.checkTimer.cancel(); this.checkTimer = new Timer(); if (this.adContext != null) { this.adContext.setVideoState(adConstants.VIDEO_STATE_PAUSED()); } if (this.videoPlayer.isPlaying()) { this.currentPlayheadTime = this.videoPlayer.getCurrentPosition(); this.wasPlaying = true; } else { this.wasPlaying = false; } } if (this.adContext != null) { this.adContext.setActivityState(this.adContext.getConstants().ACTIVITY_STATE_PAUSE()); } }