List of usage examples for android.widget VideoView seekTo
@Override public void seekTo(int msec)
From source file:com.javierarboleda.visualtilestogether.activities.SignInActivity.java
private void initTutorialView() { mPager = (ViewPager) findViewById(R.id.tutorial_view_pager); mPager.setAdapter(new TutorialImageAdapter(this)); TabLayout tabLayout = (TabLayout) findViewById(R.id.tutorial_tab_layout); tabLayout.setupWithViewPager(mPager, true); mTimer = new Timer(); mTimer.scheduleAtFixedRate(new RemindTask(), 0, 4000); mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override/* w w w . j a va 2s . c o m*/ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { mPage = position; } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); Animation animation = new AlphaAnimation(0f, 1f); animation.setDuration(1400); findViewById(R.id.ivTutorial).startAnimation(animation); findViewById(R.id.tutorial_view_pager).startAnimation(animation); findViewById(R.id.tutorial_tab_layout).startAnimation(animation); findViewById(R.id.view_footer).startAnimation(animation); final VideoView videoView = (VideoView) findViewById(R.id.vvTutorialVideo); videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video_tutorial_1)); videoView.requestFocus(); videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { videoView.seekTo(0); videoView.start(); } }); videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { videoView.seekTo(0); videoView.start(); } }); }