fix(player): draw all timeline metadata on the seek rail
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

Paint intro/recap/outro ranges into the MUI rail and keep chapter/dialogue ticks vertical, so the timeline is a single line instead of stacked lanes.
This commit is contained in:
1xDed committed 2026-12-04 07:11:19 +03:00
1 parent f1d3fd63ad
commit 56594ad526
2 files changed
+35 -53

No files matched your search

@@ -199,6 +199,27 @@ const BubbleSlider = () => {
},
});
const segmentGradient = useMemo(() => {
if (!itemDuration) return undefined;
const colors: Record<string, string> = {
Intro: "rgba(94, 227, 154, 0.9)",
Recap: "rgba(124, 184, 255, 0.9)",
Outro: "rgba(255, 196, 107, 0.9)",
Preview: "rgba(180, 140, 255, 0.9)",
Commercial: "rgba(255, 107, 107, 0.9)",
Unknown: "rgba(255, 255, 255, 0.4)",
};
const layers = (mediaSegments?.Items ?? [])
.filter((segment) => (segment.EndTicks ?? 0) > (segment.StartTicks ?? 0))
.map((segment) => {
const start = ((segment.StartTicks ?? 0) / itemDuration) * 100;
const end = ((segment.EndTicks ?? 0) / itemDuration) * 100;
const color = colors[segment.Type ?? "Unknown"];
return `linear-gradient(90deg, transparent ${start}%, ${color} ${start}%, ${color} ${end}%, transparent ${end}%)`;
});
return layers.length > 0 ? layers.join(", ") : undefined;
}, [itemDuration, mediaSegments]);
const sliderDisplayFormat = (value: number) => {
const currentChapter = itemChapters?.filter((chapter, index) => {
if (index + 1 === itemChapters?.length) {
@@ -386,21 +407,6 @@ const BubbleSlider = () => {
>
<div className="video-player-timeline">
<div className="video-player-timeline-track" aria-hidden="true">
{mediaSegments?.Items?.map((segment) => {
const start = segment.StartTicks ?? 0;
const end = segment.EndTicks ?? start;
if (!itemDuration || end <= start) return null;
return (
<span
key={segment.Id ?? `${segment.Type}-${start}`}
className={`video-player-timeline-segment is-${(segment.Type ?? "unknown").toLowerCase()}`}
style={{
left: `${(start / itemDuration) * 100}%`,
width: `${((end - start) / itemDuration) * 100}%`,
}}
/>
);
})}
{dialogueBuckets?.map((density, index) =>
density > 0 ? (
<span
@@ -463,8 +469,15 @@ const BubbleSlider = () => {
opacity: 1,
},
"& .MuiSlider-rail": {
opacity: 0.28,
background: "white",
opacity: 1,
height: 4,
borderRadius: 999,
background: "rgba(255,255,255,0.16)",
backgroundImage: segmentGradient,
},
"& .MuiSlider-track": {
height: 4,
border: 0,
},
}}
valueLabelDisplay="off"
@@ -192,8 +192,8 @@ html.is-macos .video-player-titlebar.is-fullscreen {
}
}
/* Timeline metadata: chapter ticks, intro/recap/credits bands and a thin
dialogue-density barcode under the rail. */
/* Timeline metadata: chapter ticks and dialogue density on the same rail.
Intro/recap/credits colours are painted into the MUI rail itself. */
.video-player-timeline {
position: relative;
width: 100%;
@@ -209,42 +209,15 @@ html.is-macos .video-player-titlebar.is-fullscreen {
left: 0;
right: 0;
top: 50%;
height: 4px;
height: 8px;
transform: translateY(-50%);
pointer-events: none;
border-radius: 999px;
background: rgb(255 255 255 / 0.16);
overflow: visible;
}
.video-player-timeline-segment {
position: absolute;
top: 0;
height: 4px;
border-radius: 2px;
opacity: 0.9;
background: rgb(255 255 255 / 0.4);
&.is-intro {
background: #5ee39a;
}
&.is-recap {
background: #7cb8ff;
}
&.is-outro {
background: #ffc46b;
}
&.is-preview {
background: #b48cff;
}
&.is-commercial {
background: #ff6b6b;
}
}
.video-player-timeline-dialogue {
position: absolute;
top: 0;
top: 2px;
width: 1px;
height: 4px;
border-radius: 1px;
@@ -254,14 +227,10 @@ html.is-macos .video-player-titlebar.is-fullscreen {
.video-player-timeline-chapter {
position: absolute;
top: -2px;
top: 0;
width: 1px;
height: 8px;
background: rgb(255 255 255 / 0.7);
box-shadow: 0 0 4px rgb(0 0 0 / 0.45);
z-index: 3;
}
.video-player-timeline .MuiSlider-rail {
opacity: 0;
}