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 all 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
18 changes: 17 additions & 1 deletion 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');
chapterThumbText = chapterThumbContainer.querySelector('h2.chapterThumbText');
chapterThumbName = chapterThumbContainer.querySelector('div.chapterThumbText');
} else {
doFullUpdate = true;

Expand All @@ -1407,11 +1409,24 @@ export default function (view) {
chapterThumbTextContainer.classList.add('chapterThumbTextContainer');
chapterThumbContainer.appendChild(chapterThumbTextContainer);

chapterThumbName = document.createElement('div');
chapterThumbName.classList.add('chapterThumbText', 'chapterThumbText-dim');
chapterThumbTextContainer.appendChild(chapterThumbName);

chapterThumbText = document.createElement('h2');
chapterThumbText.classList.add('chapterThumbText');
chapterThumbTextContainer.appendChild(chapterThumbText);
}

let chapter;
for (const currentChapter of item.Chapters || []) {
if (positionTicks < currentChapter.StartPositionTicks) {
break;
}

chapter = currentChapter;
}

// Update trickplay values
const currentTimeMs = positionTicks / 10_000;
const currentTile = Math.floor(currentTimeMs / trickplayInfo.Interval);
Expand All @@ -1435,6 +1450,7 @@ export default function (view) {
chapterThumb.style.backgroundPositionY = offsetY + 'px';

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

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