android - HTML5 video buffers backwards -
i implemented buffer bar html5 videos. when watch them via browser, buffers fine, via android app works buffer bar jumping.
percentage goes example 0.10 -> 0.25 -> 0.20 -> 0.30 -> 0.35 -> 0.30 , on. looks twitching reason.
what cause problem?
i using shared hosting pulling out of vps server, same result , via phone's browser. chrome browser on phone or webview on app causes same result...
edited:
as mentioned, have no idea causes on browser works fine..but that's js:
var startbuffer = function(buffer,myvideo) { var maxduration = myvideo.duration; var currentbuffer = myvideo.buffered.end(0); var percentage = 100 * currentbuffer / maxduration; $('.'+buffer).css('width', percentage+'%'); if(currentbuffer == maxduration){ cleartimeout() } else { settimeout(function(){startbuffer(buffer,myvideo);}, 100); } console.log("maxduration:"+maxduration); console.log("buffer:"+currentbuffer); console.log("video:"+buffer); };
the buffer , myvideo values comes piece of code:
$('.play').on('click', function () { var myvideo = $('#' + $(this).data('video-id')).get(0); var buffer = $(this).data('buffer-id'); if (myvideo.paused) { $('video').each(function () { this.pause(); }); myvideo.play(); startbuffer(buffer,myvideo); } else { myvideo.pause(); } });
and thats android code webview:
webview webview = (webview) getactivity().findviewbyid(r.id.webview); websettings websettings = webview.getsettings(); webview.setscrollbarfadingenabled(false); websettings.setjavascriptenabled(true); webview.setwebviewclient(new webviewclient()); webview.loadurl("http://website.com");
Comments
Post a Comment