Merge pull request #2670 from viggy96/chapter-buttons

Add next/previous chapter buttons to video player
This commit is contained in:
Bill Thornton 2021-09-07 12:32:02 -04:00 committed by GitHub
commit 6a2c83c8d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View File

@ -35,6 +35,10 @@
<span class="xlargePaperIconButton material-icons skip_previous"></span> <span class="xlargePaperIconButton material-icons skip_previous"></span>
</button> </button>
<button is="paper-icon-button-light" class="btnPreviousChapter autoSize hide" title="${PreviousChapter}">
<span class="xlargePaperIconButton material-icons undo"></span>
</button>
<button is="paper-icon-button-light" class="btnRewind" title="${Rewind} (j)"> <button is="paper-icon-button-light" class="btnRewind" title="${Rewind} (j)">
<span class="xlargePaperIconButton material-icons fast_rewind"></span> <span class="xlargePaperIconButton material-icons fast_rewind"></span>
</button> </button>
@ -47,6 +51,10 @@
<span class="xlargePaperIconButton material-icons fast_forward"></span> <span class="xlargePaperIconButton material-icons fast_forward"></span>
</button> </button>
<button is="paper-icon-button-light" class="btnNextChapter autoSize hide" title="${NextChapter}">
<span class="xlargePaperIconButton material-icons redo"></span>
</button>
<button is="paper-icon-button-light" class="btnNextTrack autoSize hide" title="${NextTrack}"> <button is="paper-icon-button-light" class="btnNextTrack autoSize hide" title="${NextTrack}">
<span class="xlargePaperIconButton material-icons skip_next"></span> <span class="xlargePaperIconButton material-icons skip_next"></span>
</button> </button>

View File

@ -181,6 +181,14 @@ import { appRouter } from '../../../components/appRouter';
} else { } else {
view.querySelector('.btnAudio').classList.add('hide'); view.querySelector('.btnAudio').classList.add('hide');
} }
if (currentItem.Chapters.length > 1) {
view.querySelector('.btnPreviousChapter').classList.remove('hide');
view.querySelector('.btnNextChapter').classList.remove('hide');
} else {
view.querySelector('.btnPreviousChapter').classList.add('hide');
view.querySelector('.btnNextChapter').classList.add('hide');
}
} }
function setTitle(item, parentName) { function setTitle(item, parentName) {
@ -1513,9 +1521,15 @@ import { appRouter } from '../../../components/appRouter';
view.querySelector('.btnPreviousTrack').addEventListener('click', function () { view.querySelector('.btnPreviousTrack').addEventListener('click', function () {
playbackManager.previousTrack(currentPlayer); playbackManager.previousTrack(currentPlayer);
}); });
view.querySelector('.btnPreviousChapter').addEventListener('click', function () {
playbackManager.previousChapter(currentPlayer);
});
view.querySelector('.btnPause').addEventListener('click', function () { view.querySelector('.btnPause').addEventListener('click', function () {
playbackManager.playPause(currentPlayer); playbackManager.playPause(currentPlayer);
}); });
view.querySelector('.btnNextChapter').addEventListener('click', function () {
playbackManager.nextChapter(currentPlayer);
});
view.querySelector('.btnNextTrack').addEventListener('click', function () { view.querySelector('.btnNextTrack').addEventListener('click', function () {
playbackManager.nextTrack(currentPlayer); playbackManager.nextTrack(currentPlayer);
}); });

View File

@ -1111,6 +1111,7 @@
"NewEpisodesOnly": "New episodes only", "NewEpisodesOnly": "New episodes only",
"News": "News", "News": "News",
"Next": "Next", "Next": "Next",
"NextChapter": "Next chapter",
"NextTrack": "Skip to next", "NextTrack": "Skip to next",
"NextUp": "Next Up", "NextUp": "Next Up",
"No": "No", "No": "No",
@ -1278,6 +1279,7 @@
"Premieres": "Premieres", "Premieres": "Premieres",
"Preview": "Preview", "Preview": "Preview",
"Previous": "Previous", "Previous": "Previous",
"PreviousChapter": "Previous chapter",
"PreviousTrack": "Skip to previous", "PreviousTrack": "Skip to previous",
"Primary": "Primary", "Primary": "Primary",
"Producer": "Producer", "Producer": "Producer",