java - Playing Online Videos one by one -
i have xml file videoview:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/back" android:orientation="vertical" android:screenorientation="landscape"> <videoview android:id="@+id/videoview_concept" android:layout_width="match_parent" android:layout_height="match_parent" /> </linearlayout>
and java part is:
public class playvideos extends activity implements oncompletionlistener{ public integer index_val=0; @override public void oncompletion(mediaplayer mediaplayer) { index_val++; videoview videoview= (videoview)findviewbyid(r.id.videoview_concept); checkdbconn(); videoview.setvideouri(uri.parse(prepare.txtlecturefilename[index_val])); videoview.setmediacontroller(new mediacontroller(this)); videoview.requestfocus(); videoview.start(); } public void playvideo(view view){ setcontentview(r.layout.playvid); videoview videoview= (videoview)findviewbyid(r.id.videoview_concept); log.i("video url",videourl_array[index_val]); checkdbconn(); videoview.setvideouri(uri.parse(videourl_array[index_val])); videoview.setmediacontroller(new mediacontroller(this)); videoview.requestfocus(); checkdbconn(); videoview.start(); }
the above code button click event. works well. if 1 first video finished, should automatically play second video. want play videos in array continuously. how achieve this? please me out:)
public class mainactivity extends activity implements oncompletionlistener{ @override public void oncompletion(mediaplayer mediaplayer) { // play next video } }
Comments
Post a Comment