Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chapter titles to trickplay popup #5832

Merged
merged 7 commits into from
Aug 1, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/controllers/playback/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1384,11 +1384,13 @@ export default function (view) {
let chapterThumbContainer = bubble.querySelector('.chapterThumbContainer');
let chapterThumb;
let chapterThumbText;
let chapterThumbName;

// Create bubble elements if they don't already exist
if (chapterThumbContainer) {
chapterThumb = chapterThumbContainer.querySelector('.chapterThumbWrapper');
chapterThumbText = chapterThumbContainer.querySelector('.chapterThumbText');
chapterThumbName = chapterThumbContainer.querySelector('.chapterThumbName');
} else {
doFullUpdate = true;

Expand All @@ -1410,6 +1412,20 @@ export default function (view) {
chapterThumbText = document.createElement('h2');
chapterThumbText.classList.add('chapterThumbText');
chapterThumbTextContainer.appendChild(chapterThumbText);
chapterThumbName = document.createElement('span');
chapterThumbName.classList.add('chapterThumbName');
chapterThumbTextContainer.appendChild(chapterThumbName);
}

let chapter;
if (item?.Chapters?.length) {
for (let i = 0, length = item.Chapters.length; i < length; i++) {
const currentChapter = item.Chapters[i];

if (positionTicks >= currentChapter.StartPositionTicks) {
chapter = currentChapter;
}
}
}

// Update trickplay values
Expand All @@ -1435,6 +1451,7 @@ export default function (view) {
chapterThumb.style.backgroundPositionY = offsetY + 'px';

chapterThumbText.textContent = datetime.getDisplayRunningTime(positionTicks);
chapterThumbName.textContent = (chapter ? chapter?.Name : '');

// Set bubble innerHTML if container isn't part of DOM
if (doFullUpdate) {
Expand Down
Loading