mirror of
https://github.com/TeamPiped/Piped.git
synced 2026-08-20 20:51:26 +00:00
Fix chapters on player.
This commit is contained in:
@@ -554,6 +554,19 @@ async function setPlayerAttrs(localPlayer, el, uri, mime, shaka) {
|
||||
uiInstance.getControls().toggleFullScreen();
|
||||
|
||||
const seekbar = container.value.querySelector(".shaka-seek-bar");
|
||||
|
||||
// Shaka overlays two marker divs inside .shaka-seek-bar-container:
|
||||
// .shaka-ad-markers and .shaka-chapter-markers, both sized to the 5px
|
||||
// container. Paint chapter boundaries on the dedicated overlay instead of
|
||||
// on .shaka-seek-bar, which is a 40px-tall <input> whose background would
|
||||
// render the markers at the input's full touch-target height.
|
||||
const chapterMarkers = container.value.querySelector(".shaka-chapter-markers");
|
||||
window.__chapterDebug = {
|
||||
found: !!chapterMarkers,
|
||||
chapters: props.video.chapters?.length,
|
||||
duration: props.video.duration,
|
||||
};
|
||||
if (chapterMarkers) {
|
||||
const array = ["to right"];
|
||||
for (const chapter of props.video.chapters) {
|
||||
const start = (chapter.start / props.video.duration) * 100;
|
||||
@@ -565,7 +578,9 @@ async function setPlayerAttrs(localPlayer, el, uri, mime, shaka) {
|
||||
array.push(`black calc(${start}% + 1px)`);
|
||||
array.push(`transparent calc(${start}% + 1px)`);
|
||||
}
|
||||
seekbar.style.background = `linear-gradient(${array.join(",")})`;
|
||||
chapterMarkers.style.background = `linear-gradient(${array.join(",")})`;
|
||||
window.__chapterDebug.painted = chapterMarkers.style.background;
|
||||
}
|
||||
|
||||
seekbar.addEventListener("mouseup", () => {
|
||||
videoEl.value.focus();
|
||||
|
||||
Reference in New Issue
Block a user