/** * Requests the {@link VideoControls} to become visible. This should only be called after {@link * #setControls(VideoControls)}. */ public void showControls() { if (videoControls != null) { videoControls.show(); if (isPlaying()) { videoControls.hideDelayed(VideoControls.DEFAULT_CONTROL_HIDE_DELAY); } } }
/** * Moves the current video progress to the specified location. * * @param milliSeconds The time to move the playback to */ public void seekTo(int milliSeconds) { if (videoControls != null) { videoControls.showLoading(false); } videoViewImpl.seekTo(milliSeconds); }
/** If a video is currently in playback then the playback will be suspended */ public void suspend() { videoViewImpl.suspend(); setKeepScreenOn(false); if (videoControls != null) { videoControls.updatePlaybackState(false); } }
/** * Starts the playback for the video specified in {@link #setVideoURI(android.net.Uri)} or {@link * #setVideoPath(String)}. This should be called after the VideoView is correctly prepared (see * {@link #setOnPreparedListener(OnPreparedListener)}) */ public void start() { videoViewImpl.start(); setKeepScreenOn(true); if (videoControls != null) { videoControls.updatePlaybackState(true); } }
/** * Sets the Uri location for the video to play * * @param uri The video's Uri * @param renderBuilder RenderBuilder that should be used */ public void setVideoURI(@Nullable Uri uri, @Nullable RenderBuilder renderBuilder) { videoUri = uri; videoViewImpl.setVideoUri(uri, renderBuilder); if (videoControls != null) { videoControls.showLoading(true); } }
/** * Sets the Uri location for the video to play * * @param uri The video's Uri */ public void setVideoURI(@Nullable Uri uri) { videoUri = uri; videoViewImpl.setVideoUri(uri); if (videoControls != null) { videoControls.showLoading(true); } }
/** * If the video has completed playback, calling {@code restart} will seek to the beginning of the * video, and play it. * * @return {@code true} if the video was successfully restarted, otherwise {@code false} */ public boolean restart() { if (videoUri == null) { return false; } if (videoViewImpl.restart()) { if (videoControls != null) { videoControls.showLoading(true); } return true; } else { return false; } }
public void setControls(@Nullable VideoControls controls) { if (videoControls != null && videoControls != controls) { removeView(videoControls); } if (controls != null) { videoControls = controls; controls.setVideoView(this); addView(controls); } // Sets the onTouch listener to show the controls TouchListener listener = new TouchListener(getContext()); setOnTouchListener(videoControls != null ? listener : null); }