Java Code Examples for android.widget.VideoView#seekTo()
The following examples show how to use
android.widget.VideoView#seekTo() .
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: FormEntryActivity.java From commcare-android with Apache License 2.0 | 6 votes |
private void restoreInlineVideoState() { if (indexOfWidgetWithVideoPlaying != -1) { QuestionWidget widgetWithVideoToResume = uiController.questionsView.getWidgets().get(indexOfWidgetWithVideoPlaying); VideoView inlineVideo = widgetWithVideoToResume.findViewById(MediaLayout.INLINE_VIDEO_PANE_ID); if (inlineVideo != null) { inlineVideo.seekTo(positionOfVideoProgress); inlineVideo.start(); } else { Logger.log(LogTypes.SOFT_ASSERT, "No inline video was found at the question widget index for which a " + "video had been playing before the activity was paused"); } // Reset values now that we have restored indexOfWidgetWithVideoPlaying = -1; positionOfVideoProgress = -1; } }
Example 2
Source File: receiverpictureactivity.java From Secure-Photo-Viewer with MIT License | 5 votes |
private void videoSet(VideoView video, Uri urinormal) { video.setVideoURI(urinormal); video.seekTo(1); controller = new MediaController(getActivity()); videow = video; isvideo = true; }
Example 3
Source File: SingleVideoActivity.java From BaldPhone with Apache License 2.0 | 4 votes |
@Override protected void bindView(View v, Cursor cursor, Context context) { final VideoView videoView = v.findViewById(R.id.vid); final ImageView play_stop = v.findViewById(R.id.play_stop); videoView.setOnPreparedListener(mp -> { float videoProportion = (float) mp.getVideoWidth() / (float) mp.getVideoHeight(); ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) videoView.getLayoutParams(); lp.dimensionRatio = String.valueOf(videoProportion); videoView.setLayoutParams(lp); }); final Uri uri = Uri.parse(cursor.getString( cursor.getColumnIndex(MediaStore.Images.Media.DATA) )); videoView.setVideoURI(uri); videoView.requestFocus(); videoView.seekTo(1); videoView.setOnCompletionListener(mp -> { play_stop.setImageResource(R.drawable.replay_on_background); Toggeler.newImageToggeler( play_stop, play_stop, new int[]{R.drawable.stop_on_background, R.drawable.play_on_background}, new View.OnClickListener[]{ view -> videoView.start(), view -> videoView.pause() }); }); Toggeler.newImageToggeler( play_stop, play_stop, new int[]{R.drawable.stop_on_background, R.drawable.play_on_background}, new View.OnClickListener[]{ view -> videoView.start(), view -> videoView.pause() }); ((VideoViewWrapper) v).setOnShowedChangedListener(shown -> { if (shown) { videoView.seekTo(1); Toggeler.newImageToggeler( play_stop, play_stop, new int[]{R.drawable.stop_on_background, R.drawable.play_on_background}, new View.OnClickListener[]{ view -> videoView.start(), view -> videoView.pause() }); play_stop.setImageResource(R.drawable.play_on_background); videoView.start(); videoView.pause(); } else videoView.pause(); }); }
Example 4
Source File: AnimationDialogLayout.java From weMessage with GNU Affero General Public License v3.0 | 4 votes |
public void startAnimation(){ VideoView videoView = findViewById(R.id.animationDialogVideoView); videoView.seekTo(0); videoView.start(); }