videoview - Disable seekforward and seekbackward of mediacontroller android? -
i playing video url , want disable seekbar tracking of video. how can done.
this code:
videourl = "http://download.itcuties.com/teaser/itcuties-teaser-480.mp4"; videoview.setvideopath(videourl); mediacontroller = new mediacontroller(this, false); int topcontainerid = getresources().getidentifier("mediacontroller_progress", "id", "android"); seekbarvideo=(seekbar)mediacontroller.findviewbyid(topcontainerid); seekbarvideo.setenabled(false); mediacontroller.setanchorview(videoview); videoview.setmediacontroller(mediacontroller);
the app crashes: seekbarvideo.setenabled(false);
java.lang.nullpointerexception @ com.vfirst.offers.videobufferactivity.onclick(videobufferactivity.java:93) @ android.view.view.performclick(view.java:4575) @ android.view.view$performclick.run(view.java:18578) @ android.os.handler.handlecallback(handler.java:733) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5127) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:825) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:641) @ dalvik.system.nativestart.main(native method)
you can try creating custom mediacontroller ui without seekbar. check post how create custom ui android mediacontroller
or try out hack, gain access seekbar , set visibility gone
final int progressbarid = getresources().getidentifier("mediacontroller_progress", "id", "android"); final seekbar seekbar = (seekbar) mcontroller.findviewbyid(progressbarid);
edit
try looping through child views inside mediacontroller till find seek bar, hide it
private void stylemediacontroller(view view) { if (view instanceof mediacontroller) { mediacontroller v = (mediacontroller) view; for(int = 0; < v.getchildcount(); i++) { stylemediacontroller(v.getchildat(i)); } } else if (view instanceof linearlayout) { linearlayout ll = (linearlayout) view; for(int = 0; < ll.getchildcount(); i++) { stylemediacontroller(ll.getchildat(i)); } } else if (view instanceof seekbar) { // set progress bar color seekbar seeker = (seekbar) view; //hide seekbar here } }
Comments
Post a Comment