videoview oncompletionlistener not called in android? -
videoview oncompletionlistener not called in android? -
i displaying images , video in imageview , videoview issue when video playing onpreparedlistener called when video finish oncompletion listener not called when videoview finish increment next video or images
also gives me error in logcat video playing
10-29 20:12:47.770: e/mediaplayer(3975): error (1, -2147483648)
private void nextvideo(string path){ mimageview.setvisibility(view.gone); if(mvideoview.getvisibility()==view.gone){ mvideoview.setvisibility(view.visible); } controller = new mediacontroller(homeactivitynewviewpager.this); mvideoview.setvideouri(uri.parse(path)); mvideoview.setmediacontroller(null); controller.setmediaplayer(mvideoview); mvideoview.setonpreparedlistener(new onpreparedlistener() { public void onprepared(mediaplayer mp) { mvideoview.start(); long duration = mvideoview.getduration(); second=duration; //handler.removecallbacks(runnable); //handler.postdelayed(runnable,second); } }); mvideoview.setoncompletionlistener(new oncompletionlistener() { @override public void oncompletion(mediaplayer mp) { log.v("video view completed","---"+i); mp.reset(); if(automode){ if(i==myplaylistlocal.size() || i>myplaylistlocal.size()) { string checkcount=spreferences.getstring("roundcount", ""); log.v("roundcount==before integer.parseint","---->"+roundcount); if(roundcount>=integer.parseint(checkcount)) { roundcount=0; log.v("roundcount==after integer.parseint","---->"+roundcount); updateplaylist(); } i=0; indexplus(); imagesautomode(); i++; } else if(i==myplaylistlocal.size()-1) { imagesautomode(); i++; } else{ imagesautomode(); } } else{ i++; images(); } } }); mvideoview.setonerrorlistener(new onerrorlistener() { @override public boolean onerror(mediaplayer mp, int what, int extra) { log.v("error in video playing","----->"+i); homecoming true; } }); }
either way, error referenced above media_error_unknown. if video made app, create sure encoded android. create sure defines endpoint.
http://developer.android.com/reference/android/media/mediaplayer.html#media_error_unknown
this work around possbly work in situation:
@override public boolean onerror(mediaplayer mp, int what, int extra) { if(what == mediaplayer.media_error_unknown) //error unknown - improperly formatted video { //move on next video //do logging } }
android videoview
Comments
Post a Comment