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
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:
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"
|
||||
|
||||
Reference in new issue
Block a user