Skip to content

Commit

Permalink
[videoScrollWheel] Fix issue where time change could be ignored (stas…
Browse files Browse the repository at this point in the history
  • Loading branch information
WeedLordVegeta420 authored Jul 12, 2024
1 parent 0ae8fd3 commit e4f7a8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion plugins/VideoScrollWheel/VideoScrollWheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,21 @@
scrollVelocity *
(pluginSettings.timeScrollSpeed / 100.0);
var newTime = vjsPlayer.currentTime() + timeDelta;
vjsPlayer.currentTime(newTime);

// Make sure that the time delta is big enough that the change is not ignored.
var extraDelta = 0;

if (timeDelta > 0) {
while (vjsPlayer.currentTime() < newTime) {
vjsPlayer.currentTime(newTime + extraDelta);
++extraDelta;
}
} else {
while (vjsPlayer.currentTime() > newTime) {
vjsPlayer.currentTime(newTime - extraDelta);
++extraDelta;
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/VideoScrollWheel/VideoScrollWheel.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: VideoScrollWheel
# requires: CommunityScriptsUILibrary
description: Adds functionality to change volume/time in scene video player by hovering over left/right side of player and scrolling with mouse scrollwheel. Scroll while hovering on left side to adjust volume, scroll on right side to skip forward/back.
version: 0.2
version: 0.3
settings:
allowVolumeChange:
displayName: Volume change via mouse wheel
Expand Down

0 comments on commit e4f7a8c

Please sign in to comment.