javascript - Problems with the video slider -
hi i've added simple function javascript pauses video when slider handle being dragged , unpauses when released(this happens if video playing , works properly).if video paused instead, when slider handle released want video remain paused(this part doesn't work) . problem i've encountered after release slider handler resumes playing. i've tried working around problem variable doesn't seem work. here code:
js:
// pause video when slider handle being dragged var control=0; seekslider.addeventlistener("mousedown", function() { if(video.pause==true) { control=1; } else { video.pause(); } }); // play video when slider handle dropped seekslider.addeventlistener("mouseup", function() { if(control>0) { control=0; } else { video.play(); } });
add 1 more function
function seektimeupdate(){ var nt = video.currenttime * (100 / video.duration); seekslider.value = nt; }
Comments
Post a Comment