0

I am working on playing a video task,for this purpose I am using two Activity classes,In my First Activity I am playing a video by VideoView using certain Height and width.Here I am having one full screen icon too.If I tap the icon It will forward to Second Activity which will show the video in Full screen mode.In Second Activity it is playing a video from beginning.what I actually need is if I tap the icon in My First Activity after playing the half of video,I will need to play remaining part of video in Full Screen mode. Not the entire video from beginning which is playing now.

public void previewVideo(Uri mediaUri) {       

        pDialog.setMessage("Buffering Please Wait...");           
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);

            pDialog.show();

            videoPreview.setVideoURI(mediaUri);//setting the uri into VideoView
            MediaController mediaController = new MediaController(SecondActivity.this);
            mediaController.setAnchorView(videoPreview);
            videoPreview.setMediaController(mediaController);
            videoPreview.requestFocus();
            videoPreview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

                public void onPrepared(MediaPlayer mp) {
                    pDialog.dismiss();
                    videoPreview.start();
                }
            });


    }
Jamal
  • 976
  • 2
  • 14
  • 39
  • 1
    It's simple try to capture current playing time in minimized activity and pass as a bundle to Maximized activity, there must be some MediaPlayer API, and in Maximized activity when video is loaded seek to that recorded position and you're done – Nitin Misra Nov 13 '14 at 12:18

1 Answers1

1

As per Nitin Misra's Comment I have achieved it by below code.

inside My First Activity previewVideo(Uri mediaUri) method

public void onPrepared(MediaPlayer mp) {
                    pDialog.dismiss();
                 int timeInterval = mp.getCurrentPosition();
                    videoPreview.start();
                }

sending that timeInterval value into Second Activity by Intent.putExtra("timeDuration",timeInterval);

And in Second Activity I am getting the value of timeDuration using getIntent().getStringExtra("timeDuration"); and set that value into previewVideo(Uri mediaUri) method

 public void onPrepared(MediaPlayer mp) {
                        pDialog.dismiss();
                      mp.seekTo(Integer.parseInt(getIntent().getStringExtra("timeDuration")));
                        videoPreview.start();
                    }
Jamal
  • 976
  • 2
  • 14
  • 39
  • I get into the same response that I'm using. But the video needs to be buffered again and I was wanting to continue using the buffered data. – brunodles Oct 15 '15 at 20:25