video - Issue while trying to handle Mediaplayer exceptions in my android application -


i wanted play different formats(like .3gp,.flv ) of videos in android application stored in sdcard. video files of types 1. mp4 , 2. flv, first playing fine, when trying play flv file application, giving error (1, -4 ). same flv file playing fine through native video application(directly gallery). unable handle exception. showing error message on screen. wanted handle exception. 1 please suggest way these problems.

code :         public class videoplayertest extends activity implements onerrorlistener        {          videoview view;         mediaplayer mp;         /** called when activity first created. */         @override         public void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.main);             view = (videoview) findviewbyid(r.id.videoview);             // view.setvideopath("/sdcard/emisodara.mp4");              try {                 mp = new mediaplayer();                 mp.setonerrorlistener(this);                  string uri = "android.resource://" + getpackagename() + "/"                         + r.raw.valentine;                 view.setvideouri(uri.parse(uri));                 view.start();             } catch (exception e) {                 log.e("exception block", "unable play video");             } {                 log.e("finally block", "unable play video");             }             /*              * if(view.isplaying()){ try { thread.sleep(5000); } catch              * (interruptedexception e) { e.printstacktrace(); } }              */         }          @override         public boolean onerror(mediaplayer mp, int what, int extra) {             log.e("errors","mediaplayer errors...");             return false;         }     }      error messages:      06-05 23:09:04.444: w/mediaplayer(6016): info/warning (1, 26)     06-05 23:09:04.444: i/mediaplayer(6016): info (1,26)     06-05 23:09:04.444: e/mediaplayer(6016): error (1, -4)     06-05 23:09:04.444: e/mediaplayer(6016): error (1,-4)     06-05 23:09:04.444: d/videoview(6016): error: 1,-4 


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -