JQuery UI slider max value as video duration -
i have html5 video.
<video id="video1"> <source src="/media/thevideo.mp4" type="video/mp4"></source> </video>
and have jquery ui slider:
<div id="slider2" style="width:100%;" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"></div>
jquery:
$( "#slider2" ).slider({ value:0, step: 1, animate: true, min: 0, max: 95, slide: function( event, ui ) { $( "#amount2" ).val( ": " + ui.value );
i can video duration, can put <div>
like:
myvid=document.getelementbyid("video1"); function(){vidduration=myvid.duration;}; function(){document.getelementbyid('time').innerhtml=vidduration.tofixed(1)+" seconds";};
what want do, set slider's max attribute duration of video1. can me this? internet did not tell me it, kinda new this..
p.s. max: vidduration.tofixed(0),
did not work.
i have solved problem writing this:
window.onload= $(function() { myvid=document.getelementbyid("video1"); settimeout(function(){vidduration= myvid.duration;},300); settimeout(function(){$("#slider2").slider("option", "max", vidduration.tofixed(0))},330); }
Comments
Post a Comment