android - Show MediaPlayer Buffering in Seek bar as Secondary Progress -
i'm using video view stream hls stream wowza media server. want show overall buffering in youtube player, did , i'm able access seek-bar object , debugged code it's not null
videoview.setonpreparedlistener(new onpreparedlistener() { @override public void onprepared(mediaplayer mp) { int topcontainerid = getresources().getidentifier("mediacontroller_progress", "id", "android"); seekbar = (seekbar) mediacontroller.findviewbyid(topcontainerid); mp.setonbufferingupdatelistener(new onbufferingupdatelistener() { @override public void onbufferingupdate(mediaplayer mp, int percent) { if (percent<seekbar.getmax()) { seekbar.setsecondaryprogress(percent); } } }); } });
the problem can't see secondary progress in media controller seekbar. if clarification required required please write in comments. help appreciated.
use below code , you're goog go
videoview.setonpreparedlistener(new onpreparedlistener() { @override public void onprepared(mediaplayer mp) { int topcontainerid = getresources().getidentifier("mediacontroller_progress", "id", "android"); seekbar = (seekbar) mediacontroller.findviewbyid(topcontainerid); mp.setonbufferingupdatelistener(new onbufferingupdatelistener() { @override public void onbufferingupdate(mediaplayer mp, int percent) { if (percent<seekbar.getmax()) { seekbar.setsecondaryprogress(percent); seekbar.setsecondaryprogress(percent/100); } } }); } });
android android-mediaplayer
No comments:
Post a Comment