Skip to content

Commit

Permalink
subtitles offset keybinding
Browse files Browse the repository at this point in the history
  • Loading branch information
carlo-colombo committed Jun 9, 2024
1 parent 97d03f3 commit 1ccfdf7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/subtitlesync/subtitlesync.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ class SubtitleSync {
subtitleSyncContainer.classList.add('hide');
}
}

update(offset) {
SubtitleSync.prototype.toggle();

const value = parseFloat(subtitleSyncSlider.value) + offset;
subtitleSyncSlider.updateOffset(value);
}

incrementOffset() {
SubtitleSync.prototype.update(+subtitleSyncSlider.step);
}

decrementOffset() {
SubtitleSync.prototype.update(-subtitleSyncSlider.step);
}
}

export default SubtitleSync;
6 changes: 6 additions & 0 deletions src/controllers/playback/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,12 @@ export default function (view) {
case 'PageDown':
playbackManager.previousChapter(currentPlayer);
break;
case 'g':
SubtitleSync.prototype.decrementOffset();
break;
case 'h':
SubtitleSync.prototype.incrementOffset();
break;
}
}

Expand Down

0 comments on commit 1ccfdf7

Please sign in to comment.