From 56594ad5267940062c00d86143913e22007925f1 Mon Sep 17 00:00:00 2001 From: 1xDed Date: Fri, 4 Dec 2026 07:11:19 +0300 Subject: [PATCH] fix(player): draw all timeline metadata on the seek rail 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. --- .../videoPlayer/bubbleSlider/index.tsx | 47 ++++++++++++------- .../playback/videoPlayer/controls.scss | 41 ++-------------- 2 files changed, 35 insertions(+), 53 deletions(-) diff --git a/src/components/playback/videoPlayer/bubbleSlider/index.tsx b/src/components/playback/videoPlayer/bubbleSlider/index.tsx index 7518984..67ef4c7 100644 --- a/src/components/playback/videoPlayer/bubbleSlider/index.tsx +++ b/src/components/playback/videoPlayer/bubbleSlider/index.tsx @@ -199,6 +199,27 @@ const BubbleSlider = () => { }, }); + const segmentGradient = useMemo(() => { + if (!itemDuration) return undefined; + const colors: Record = { + 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 = () => { >