jquery - HTML5 video timeupdate function not working onload -
i'm creating custom html5 video player jquery/css, , (almost) works fine.
but in firefox, won't show time (current time , duration). shows after have clicked on play-button. in other browsers, time shown right after site has loaded.
this code:
$(document).ready(function(){ $("video").on("timeupdate", function(event) { var currenttime = this.currenttime; var duration = this.duration; var minutes = math.floor(currenttime / 60); var seconds = math.round(currenttime - minutes * 60); var tminutes = math.floor(duration / 60); var tseconds = math.round(duration - tminutes * 60); if(minutes < 10) { minutes = '0'+minutes; } if(tminutes < 10) { tminutes = '0'+tminutes; } if(seconds < 10) { seconds = '0'+seconds; } if(tseconds < 10) { tseconds = '0'+tseconds; } $("#current").text(minutes+':'+seconds); $("#duration").text(tminutes+':'+tseconds); }); }); i've tried change on readym without luck.
i've read somewhere "timeupdate" should "seeked" , video should <video preload="auto|metadata|none"> same result here.
and in firefox time won't show.
anyone knows do?
i've created simple demo, shows problem:
hope can me :d
thanks - theyaxxe
instead of using $("video").on("timeupdate", function(event) {...}); used:
var $spc = $("video")[0], duration = $spc.duration, currenttime = $spc.currenttime; ..and seems work in browsers including firefox :)
Comments
Post a Comment