android - Play a video continuation in another Activity -
i working on playing video task,for purpose using 2 activity classes
,in first activity
playing video videoview
using height , width.here having 1 total screen icon too.if tap icon forwards second activity
show video in total screen mode.in second activity
playing video beginning.what need if tap icon in my first activity
after playing half of video,i need play remaining part of video in full screen
mode. not entire video origin playing now.
public void previewvideo(uri mediauri) { pdialog.setmessage("buffering please wait..."); pdialog.setindeterminate(false); pdialog.setcancelable(true); pdialog.show(); videopreview.setvideouri(mediauri);//setting uri 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(); } }); }
as per nitin misra
's comment have achieved below code.
inside first activity previewvideo(uri mediauri)
method
public void onprepared(mediaplayer mp) { pdialog.dismiss(); int timeinterval = mp.getcurrentposition(); videopreview.start(); }
sending timeinterval
value sec activity intent.putextra("timeduration",timeinterval);
and in sec activity getting value of timeduration
using getintent().getstringextra("timeduration");
, set value previewvideo(uri mediauri)
method
public void onprepared(mediaplayer mp) { pdialog.dismiss(); mp.seekto(integer.parseint(getintent().getstringextra("timeduration"))); videopreview.start(); }
android android-mediaplayer videoview android-video-player
No comments:
Post a Comment