Don't update the time automatically when the slider is dragged

This commit is contained in:
dave 2014-08-28 22:59:49 -07:00
parent 5688d6f569
commit 1c31a2799c
1 changed files with 10 additions and 7 deletions

View File

@ -152,20 +152,23 @@ var behaviors = {
loadedmetadata: function() { loadedmetadata: function() {
// Create slider with a max val of this track's length // Create slider with a max val of this track's length
$(".time-holder").html('<input class="player-slider" type="text" data-slider-step="1" data-slider-value="0"/>') $(".time-holder").html('<input class="player-slider" type="text" data-slider-step="1" data-slider-value="0"/>')
$(".time-holder .player-slider").slider({min:0,max:parseInt($("#player").data("jPlayer").status.duration+1),tooltip:"hide",slideStart:function(){ $(".time-holder .player-slider").slider({min:0,max:parseInt($("#player").data("jPlayer").status.duration+1),tooltip:"hide"})
$(".time-holder .player-slider").on("slideStart", function(){
// Add a class to the slider on hover // Add a class to the slider on hover
$(this).parent().addClass("dragging") $(this).addClass("dragging")
},slideStop:function(){ }).on("slideStop", function(){
$(this).parent().removeClass("dragging") $(this).removeClass("dragging")
}}) });
}, },
play:function() { play:function() {
}, },
timeupdate:function(event) { timeupdate:function(event) {
// About 4 times a second
// See if we are not sliding // See if we are not sliding
if($(".time-holder .player-slider").hasClass("dragging")) {
return;
}
// Update the slider
$(".time-holder .player-slider").slider('setValue', event.jPlayer.status.currentTime); $(".time-holder .player-slider").slider('setValue', event.jPlayer.status.currentTime);
// And update the time // And update the time
minutes = Math.floor(event.jPlayer.status.currentTime/60) minutes = Math.floor(event.jPlayer.status.currentTime/60)