feat(player): match the floating bar to the reference
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
- charcoal glass capsule with a circular sleeve and minimal transport - one seek line with current and total time - monochrome like, shuffle, repeat and mute actions on the right; removed the extra queue/device/expand controls
This commit is contained in:
1 parent
94decd674c
commit
5c773841f7
3 files changed
+233
-719
No files matched your search
@@ -1,196 +1,83 @@
|
|||||||
/* Floating glass media bar — 2026 "liquid glass" treatment:
|
/* Floating media bar, matched to the reference:
|
||||||
translucent saturated blur, cover-tinted ambient light, a thin specular rim
|
a single wide charcoal glass capsule, circular sleeve, minimal transport,
|
||||||
and an almost invisible grain layer so the surface reads as material rather
|
one long seek line and four monochrome actions. */
|
||||||
than as a flat translucent box. */
|
|
||||||
|
|
||||||
/* The full audio player is a route; keep the floating bar in the DOM until
|
|
||||||
the view transition has captured the old frame, then hide it. */
|
|
||||||
html.player-full-open .audio-player {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.audio-player {
|
.audio-player {
|
||||||
--player-accent: #{$clr-accent-default};
|
|
||||||
--player-base: #1b0f2e;
|
|
||||||
--player-deep: #09040f;
|
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0.9rem;
|
bottom: 0.85rem;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: min(1460px, calc(100% - 2rem));
|
width: min(1700px, calc(100% - 3rem));
|
||||||
height: 84px;
|
height: 82px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
isolation: isolate;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns:
|
|
||||||
minmax(0, 1fr)
|
|
||||||
minmax(320px, 560px)
|
|
||||||
minmax(0, 1fr);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1.1rem;
|
gap: 1.35rem;
|
||||||
padding: 0 0.75rem 0 0.85rem;
|
padding: 0 1.1rem 0 0.6rem;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 24px;
|
border-radius: 30px;
|
||||||
border: 1px solid rgb(255 255 255 / 0.14);
|
border: 1px solid rgb(255 255 255 / 0.065);
|
||||||
|
background: linear-gradient(
|
||||||
background-color: rgb(14 11 24 / 0.55);
|
180deg,
|
||||||
background-image:
|
rgb(47 47 50 / 0.92),
|
||||||
radial-gradient(
|
rgb(37 37 40 / 0.94)
|
||||||
100% 190% at 0% 50%,
|
|
||||||
rgb(255 255 255 / 0.08),
|
|
||||||
transparent 62%
|
|
||||||
),
|
|
||||||
linear-gradient(
|
|
||||||
120deg,
|
|
||||||
rgb(255 255 255 / 0.11),
|
|
||||||
rgb(255 255 255 / 0.025) 38%,
|
|
||||||
rgb(7 5 14 / 0.38) 100%
|
|
||||||
);
|
);
|
||||||
background-image:
|
-webkit-backdrop-filter: blur(22px) saturate(125%);
|
||||||
radial-gradient(
|
backdrop-filter: blur(22px) saturate(125%);
|
||||||
100% 190% at 0% 50%,
|
|
||||||
color-mix(in srgb, var(--player-accent) 20%, transparent),
|
|
||||||
transparent 62%
|
|
||||||
),
|
|
||||||
radial-gradient(
|
|
||||||
90% 160% at 100% 30%,
|
|
||||||
color-mix(in srgb, var(--player-deep) 42%, transparent),
|
|
||||||
transparent 68%
|
|
||||||
),
|
|
||||||
linear-gradient(
|
|
||||||
120deg,
|
|
||||||
rgb(255 255 255 / 0.11),
|
|
||||||
rgb(255 255 255 / 0.025) 38%,
|
|
||||||
rgb(7 5 14 / 0.38) 100%
|
|
||||||
);
|
|
||||||
-webkit-backdrop-filter: blur(24px) saturate(170%) brightness(1.06);
|
|
||||||
backdrop-filter: blur(24px) saturate(170%) brightness(1.06);
|
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 28px 70px rgb(0 0 0 / 0.55),
|
0 20px 46px rgb(0 0 0 / 0.5),
|
||||||
0 6px 18px rgb(0 0 0 / 0.35),
|
0 4px 14px rgb(0 0 0 / 0.3),
|
||||||
inset 0 1px 0 rgb(255 255 255 / 0.18),
|
inset 0 1px 0 rgb(255 255 255 / 0.07);
|
||||||
inset 0 -1px 0 rgb(0 0 0 / 0.22);
|
|
||||||
box-shadow:
|
|
||||||
0 28px 70px rgb(0 0 0 / 0.55),
|
|
||||||
0 6px 18px rgb(0 0 0 / 0.35),
|
|
||||||
0 0 55px color-mix(in srgb, var(--player-accent) 13%, transparent),
|
|
||||||
inset 0 1px 0 rgb(255 255 255 / 0.18),
|
|
||||||
inset 0 -1px 0 rgb(0 0 0 / 0.22);
|
|
||||||
|
|
||||||
will-change: transform, opacity;
|
will-change: transform, opacity;
|
||||||
transform-origin: 50% 100%;
|
transform-origin: 50% 100%;
|
||||||
|
|
||||||
/* Grain, kept below the content. */
|
|
||||||
&::before {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 0;
|
|
||||||
border-radius: inherit;
|
|
||||||
pointer-events: none;
|
|
||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
|
|
||||||
background-size: 140px 140px;
|
|
||||||
opacity: 0.035;
|
|
||||||
mix-blend-mode: soft-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Specular gradient rim. */
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 1;
|
|
||||||
border-radius: inherit;
|
|
||||||
padding: 1px;
|
|
||||||
pointer-events: none;
|
|
||||||
background: linear-gradient(
|
|
||||||
135deg,
|
|
||||||
rgb(255 255 255 / 0.45),
|
|
||||||
rgb(255 255 255 / 0.06) 30%,
|
|
||||||
rgb(255 255 255 / 0.02) 62%,
|
|
||||||
rgb(255 255 255 / 0.25)
|
|
||||||
);
|
|
||||||
-webkit-mask:
|
|
||||||
linear-gradient(#000 0 0) content-box,
|
|
||||||
linear-gradient(#000 0 0);
|
|
||||||
-webkit-mask-composite: xor;
|
|
||||||
mask:
|
|
||||||
linear-gradient(#000 0 0) content-box,
|
|
||||||
linear-gradient(#000 0 0);
|
|
||||||
mask-composite: exclude;
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
|
|
||||||
> * {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar {
|
.media-bar {
|
||||||
&-left {
|
&-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.8rem;
|
flex: 0 0 285px;
|
||||||
width: 100%;
|
width: 285px;
|
||||||
|
gap: 0.9rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
max-width: 380px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-cover {
|
&-cover {
|
||||||
position: relative;
|
width: 64px;
|
||||||
width: 58px;
|
height: 64px;
|
||||||
height: 58px;
|
flex: 0 0 64px;
|
||||||
flex: 0 0 58px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 1px solid rgb(255 255 255 / 0.16);
|
border: 2px solid #d9d9d9;
|
||||||
border-radius: 16px;
|
border-radius: 50%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: rgb(255 255 255 / 0.08);
|
background: #111;
|
||||||
color: rgb(255 255 255 / 0.55);
|
color: rgb(255 255 255 / 0.55);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 8px 22px rgb(0 0 0 / 0.45),
|
0 0 0 3px rgb(0 0 0 / 0.28),
|
||||||
inset 0 0 0 1px rgb(255 255 255 / 0.06);
|
0 6px 16px rgb(0 0 0 / 0.4);
|
||||||
box-shadow:
|
|
||||||
0 8px 22px rgb(0 0 0 / 0.45),
|
|
||||||
0 0 22px color-mix(in srgb, var(--player-accent) 22%, transparent),
|
|
||||||
inset 0 0 0 1px rgb(255 255 255 / 0.06);
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
border-radius: inherit;
|
|
||||||
pointer-events: none;
|
|
||||||
background: linear-gradient(
|
|
||||||
180deg,
|
|
||||||
rgb(255 255 255 / 0.2),
|
|
||||||
transparent 34%,
|
|
||||||
rgb(0 0 0 / 0.2)
|
|
||||||
);
|
|
||||||
opacity: 0.55;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover img,
|
&:hover img,
|
||||||
&:focus-visible img {
|
&:focus-visible img {
|
||||||
transform: scale(1.06);
|
transform: scale(1.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
@@ -207,71 +94,38 @@ html.player-full-open .audio-player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
font-size: 0.92rem !important;
|
font-size: 1.18rem !important;
|
||||||
font-weight: 650 !important;
|
font-weight: 600 !important;
|
||||||
line-height: 1.2 !important;
|
line-height: 1.2 !important;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-shadow: 0 1px 10px rgb(0 0 0 / 0.25);
|
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
text-decoration-color: rgb(255 255 255 / 0.35);
|
|
||||||
text-underline-offset: 3px;
|
text-underline-offset: 3px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-subtitle {
|
&-subtitle {
|
||||||
font-size: 0.72rem !important;
|
font-size: 0.9rem !important;
|
||||||
line-height: 1.3 !important;
|
line-height: 1.3 !important;
|
||||||
opacity: 0.55;
|
color: rgb(255 255 255 / 0.5) !important;
|
||||||
letter-spacing: 0.01em;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-more {
|
&-transport {
|
||||||
flex-shrink: 0;
|
|
||||||
color: rgb(255 255 255 / 0.55) !important;
|
|
||||||
transition:
|
|
||||||
color 0.15s ease,
|
|
||||||
background-color 0.15s ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #fff !important;
|
|
||||||
background: rgb(255 255 255 / 0.08) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-center {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch;
|
|
||||||
gap: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-controls {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-self: center;
|
flex: 0 0 auto;
|
||||||
gap: 0.05rem;
|
gap: 0.7rem;
|
||||||
padding: 3px;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: rgb(255 255 255 / 0.045);
|
|
||||||
border: 1px solid rgb(255 255 255 / 0.07);
|
|
||||||
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08);
|
|
||||||
|
|
||||||
.MuiIconButton-root {
|
.MuiIconButton-root {
|
||||||
width: 34px;
|
color: rgb(255 255 255 / 0.92);
|
||||||
height: 34px;
|
|
||||||
border-radius: 50%;
|
|
||||||
color: rgb(255 255 255 / 0.68);
|
|
||||||
transition:
|
transition:
|
||||||
color 0.15s ease,
|
color 0.15s ease,
|
||||||
background-color 0.15s ease,
|
background-color 0.15s ease,
|
||||||
@@ -279,188 +133,134 @@ html.player-full-open .audio-player {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: rgb(255 255 255 / 0.09);
|
background: rgb(255 255 255 / 0.06);
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
|
||||||
color: var(--player-accent);
|
|
||||||
background: color-mix(
|
|
||||||
in srgb,
|
|
||||||
var(--player-accent) 13%,
|
|
||||||
transparent
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
font-size: 1.2rem;
|
font-size: 1.45rem;
|
||||||
|
font-variation-settings: "FILL" 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-step {
|
||||||
|
width: 40px !important;
|
||||||
|
height: 40px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-play {
|
&-play {
|
||||||
width: 44px !important;
|
width: 48px !important;
|
||||||
height: 44px !important;
|
height: 48px !important;
|
||||||
margin: 0 0.3rem;
|
margin: 0 0.1rem;
|
||||||
background: #fff !important;
|
background: #fff !important;
|
||||||
color: #100a1b !important;
|
color: #161616 !important;
|
||||||
box-shadow:
|
box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
|
||||||
0 8px 24px rgb(0 0 0 / 0.45),
|
|
||||||
0 0 0 1px rgb(255 255 255 / 0.25);
|
|
||||||
box-shadow:
|
|
||||||
0 8px 24px rgb(0 0 0 / 0.45),
|
|
||||||
0 0 0 1px rgb(255 255 255 / 0.25),
|
|
||||||
0 0 26px color-mix(in srgb, var(--player-accent) 24%, transparent);
|
|
||||||
transition:
|
|
||||||
transform 0.16s ease,
|
|
||||||
box-shadow 0.2s ease;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #fff !important;
|
background: #fff !important;
|
||||||
transform: scale(1.06);
|
transform: scale(1.04);
|
||||||
box-shadow:
|
|
||||||
0 10px 28px rgb(0 0 0 / 0.5),
|
|
||||||
0 0 0 1px rgb(255 255 255 / 0.35),
|
|
||||||
0 0 34px color-mix(
|
|
||||||
in srgb,
|
|
||||||
var(--player-accent) 34%,
|
|
||||||
transparent
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
font-size: 1.55rem !important;
|
font-size: 1.6rem !important;
|
||||||
font-variation-settings: "FILL" 1;
|
font-variation-settings: "FILL" 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-progress {
|
&-progress {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 140px;
|
min-width: 120px;
|
||||||
|
gap: 1rem;
|
||||||
|
padding-right: 0.2rem;
|
||||||
|
|
||||||
.MuiSlider-root {
|
.MuiSlider-root {
|
||||||
padding: 7px 0;
|
flex: 1;
|
||||||
color: var(--player-accent);
|
padding: 8px 0;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiSlider-rail {
|
.MuiSlider-rail {
|
||||||
height: 4px;
|
height: 3px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: rgb(255 255 255 / 0.13);
|
background: rgb(255 255 255 / 0.28);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiSlider-track {
|
.MuiSlider-track {
|
||||||
height: 4px;
|
height: 3px;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: linear-gradient(
|
background: #fff;
|
||||||
90deg,
|
|
||||||
rgb(255 255 255 / 0.95),
|
|
||||||
var(--player-accent)
|
|
||||||
);
|
|
||||||
box-shadow: 0 0 12px
|
|
||||||
color-mix(in srgb, var(--player-accent) 45%, transparent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiSlider-thumb {
|
.MuiSlider-thumb {
|
||||||
width: 12px;
|
width: 13px;
|
||||||
height: 12px;
|
height: 13px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow:
|
box-shadow: 0 0 0 3px rgb(255 255 255 / 0.12);
|
||||||
0 0 0 4px color-mix(
|
|
||||||
in srgb,
|
|
||||||
var(--player-accent) 16%,
|
|
||||||
transparent
|
|
||||||
),
|
|
||||||
0 2px 8px rgb(0 0 0 / 0.5);
|
|
||||||
transition:
|
transition:
|
||||||
transform 0.15s ease,
|
transform 0.15s ease,
|
||||||
box-shadow 0.2s ease;
|
box-shadow 0.15s ease;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&.Mui-focusVisible {
|
&.Mui-focusVisible {
|
||||||
transform: scale(1.15);
|
transform: scale(1.12);
|
||||||
box-shadow:
|
box-shadow: 0 0 0 5px rgb(255 255 255 / 0.14);
|
||||||
0 0 0 6px color-mix(
|
}
|
||||||
in srgb,
|
|
||||||
var(--player-accent) 20%,
|
|
||||||
transparent
|
|
||||||
),
|
|
||||||
0 2px 10px rgb(0 0 0 / 0.55);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiTypography-root {
|
&-time {
|
||||||
min-width: 2.6em !important;
|
flex: 0 0 auto;
|
||||||
font-family: var(--font-mono);
|
font-size: 0.8rem;
|
||||||
font-size: 0.66rem;
|
font-weight: 400;
|
||||||
opacity: 0.5 !important;
|
color: rgb(255 255 255 / 0.48);
|
||||||
font-variant-numeric: tabular-nums;
|
font-variant-numeric: tabular-nums;
|
||||||
}
|
letter-spacing: 0.01em;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-right {
|
&-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
flex: 0 0 auto;
|
||||||
gap: 0.05rem;
|
gap: 0.35rem;
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 3px 4px;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: rgb(255 255 255 / 0.035);
|
|
||||||
border: 1px solid rgb(255 255 255 / 0.055);
|
|
||||||
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
|
|
||||||
|
|
||||||
.MuiIconButton-root {
|
.MuiIconButton-root {
|
||||||
width: 34px;
|
width: 40px;
|
||||||
height: 34px;
|
height: 40px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
color: rgb(255 255 255 / 0.62);
|
color: rgb(255 255 255 / 0.68);
|
||||||
transition:
|
transition:
|
||||||
color 0.15s ease,
|
color 0.15s ease,
|
||||||
background-color 0.15s ease;
|
background-color 0.15s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: rgb(255 255 255 / 0.08);
|
background: rgb(255 255 255 / 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
font-size: 1.2rem;
|
font-size: 1.3rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-volume {
|
&-like {
|
||||||
width: 92px !important;
|
display: flex;
|
||||||
margin: 0 0.25rem 0 0 !important;
|
filter: grayscale(1);
|
||||||
color: var(--player-accent) !important;
|
|
||||||
|
|
||||||
.MuiSlider-rail {
|
.MuiIconButton-root {
|
||||||
height: 3px;
|
width: 40px;
|
||||||
border-radius: 999px;
|
height: 40px;
|
||||||
background: rgb(255 255 255 / 0.14);
|
border-radius: 50%;
|
||||||
opacity: 1;
|
color: rgb(255 255 255 / 0.68);
|
||||||
}
|
|
||||||
|
|
||||||
.MuiSlider-track {
|
|
||||||
height: 3px;
|
|
||||||
border: 0;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: linear-gradient(
|
|
||||||
90deg,
|
|
||||||
rgb(255 255 255 / 0.9),
|
|
||||||
var(--player-accent)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.MuiSlider-thumb {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 0 0 0 3px
|
|
||||||
color-mix(in srgb, var(--player-accent) 16%, transparent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,121 +269,123 @@ html.player-full-open .audio-player {
|
|||||||
(backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))
|
(backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))
|
||||||
) {
|
) {
|
||||||
.audio-player {
|
.audio-player {
|
||||||
background: rgb(14 11 24 / 0.96);
|
background: rgb(38 38 41 / 0.97);
|
||||||
}
|
|
||||||
|
|
||||||
.audio-player::before {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-transparency: reduce) {
|
@media (prefers-reduced-transparency: reduce) {
|
||||||
.audio-player {
|
.audio-player {
|
||||||
background: rgb(14 11 24 / 0.96);
|
background: rgb(38 38 41 / 0.97);
|
||||||
-webkit-backdrop-filter: none;
|
-webkit-backdrop-filter: none;
|
||||||
backdrop-filter: none;
|
backdrop-filter: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-player::before {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1100px) {
|
@media (max-width: 1200px) {
|
||||||
.audio-player {
|
.audio-player {
|
||||||
gap: 0.8rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-left {
|
.media-bar-left {
|
||||||
max-width: 320px;
|
flex: 0 0 240px;
|
||||||
|
width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-volume {
|
.media-bar-title {
|
||||||
width: 72px !important;
|
font-size: 1.06rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-bar-subtitle {
|
||||||
|
font-size: 0.82rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-bar-right {
|
||||||
|
gap: 0.1rem;
|
||||||
|
|
||||||
|
.MuiIconButton-root,
|
||||||
|
.media-bar-like .MuiIconButton-root {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.audio-player {
|
.audio-player {
|
||||||
width: calc(100% - 1.5rem);
|
width: calc(100% - 1.5rem);
|
||||||
|
gap: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-left {
|
.media-bar-left {
|
||||||
min-width: 180px;
|
flex: 0 0 210px;
|
||||||
max-width: none;
|
width: 210px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-volume,
|
.media-bar-cover {
|
||||||
.media-bar-right .MuiSlider-root {
|
width: 54px;
|
||||||
display: none;
|
height: 54px;
|
||||||
|
flex: 0 0 54px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-bar-time {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-bar-right .MuiIconButton-root,
|
||||||
|
.media-bar-like .MuiIconButton-root {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.audio-player {
|
.audio-player {
|
||||||
display: flex;
|
|
||||||
width: calc(100% - 1rem);
|
width: calc(100% - 1rem);
|
||||||
height: 68px;
|
height: 64px;
|
||||||
bottom: 0.55rem;
|
bottom: 0.5rem;
|
||||||
padding: 0 0.55rem;
|
padding: 0 0.55rem;
|
||||||
gap: 0.45rem;
|
gap: 0.5rem;
|
||||||
border-radius: 20px;
|
border-radius: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-left {
|
.media-bar-left {
|
||||||
width: auto;
|
|
||||||
min-width: 0;
|
|
||||||
max-width: none;
|
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
width: auto;
|
||||||
gap: 0.55rem;
|
gap: 0.55rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-cover {
|
.media-bar-cover {
|
||||||
width: 46px;
|
width: 44px;
|
||||||
height: 46px;
|
height: 44px;
|
||||||
flex: 0 0 46px;
|
flex: 0 0 44px;
|
||||||
border-radius: 13px;
|
border-width: 1.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-more {
|
.media-bar-title {
|
||||||
display: none;
|
font-size: 0.92rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-center {
|
.media-bar-subtitle {
|
||||||
|
font-size: 0.72rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-bar-transport {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
}
|
|
||||||
|
|
||||||
.media-bar-controls {
|
.media-bar-step {
|
||||||
padding: 2px;
|
|
||||||
|
|
||||||
> :first-child,
|
|
||||||
> :last-child {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiIconButton-root {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-bar-play {
|
.media-bar-play {
|
||||||
width: 40px !important;
|
width: 40px !important;
|
||||||
height: 40px !important;
|
height: 40px !important;
|
||||||
margin: 0 0.15rem;
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-progress,
|
.media-bar-progress,
|
||||||
.media-bar-right {
|
.media-bar-right {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-bar-title {
|
|
||||||
font-size: 0.86rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-bar-subtitle {
|
|
||||||
font-size: 0.67rem !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,13 +7,7 @@ import {
|
|||||||
PlaystateCommand,
|
PlaystateCommand,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||||
import Divider from "@mui/material/Divider";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
||||||
import ListItemText from "@mui/material/ListItemText";
|
|
||||||
import Menu from "@mui/material/Menu";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
|
||||||
import Slider from "@mui/material/Slider";
|
|
||||||
import Tooltip from "@mui/material/Tooltip";
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -23,29 +17,19 @@ import { useSnackbar } from "notistack";
|
|||||||
import React, {
|
import React, {
|
||||||
type SyntheticEvent,
|
type SyntheticEvent,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import QueueButton from "@/components/buttons/queueButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
import { getCoverPalette } from "@/utils/methods/coverColor";
|
|
||||||
import getImageUrlsApi, {
|
import getImageUrlsApi, {
|
||||||
getPlayerCoverUrl,
|
getPlayerCoverUrl,
|
||||||
} from "@/utils/methods/getImageUrlsApi";
|
} from "@/utils/methods/getImageUrlsApi";
|
||||||
import { startInstantMix } from "@/utils/methods/instantMix";
|
|
||||||
import { rememberAudioPlayerReturn } from "@/utils/methods/audioPlayerReturn";
|
import { rememberAudioPlayerReturn } from "@/utils/methods/audioPlayerReturn";
|
||||||
import {
|
|
||||||
playOnSession,
|
|
||||||
queueStartingWith,
|
|
||||||
transferSessionToLocal,
|
|
||||||
} from "@/utils/methods/transferPlayback";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import {
|
import {
|
||||||
setAudioRef,
|
setAudioRef,
|
||||||
setIsMuted,
|
setIsMuted,
|
||||||
setVolume,
|
|
||||||
stopPlayback,
|
|
||||||
useAudioPlayback,
|
useAudioPlayback,
|
||||||
} from "@/utils/store/audioPlayback";
|
} from "@/utils/store/audioPlayback";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
@@ -56,12 +40,21 @@ import useQueue, {
|
|||||||
shuffleUpcoming,
|
shuffleUpcoming,
|
||||||
} from "@/utils/store/queue";
|
} from "@/utils/store/queue";
|
||||||
import useRemoteControlStore from "@/utils/store/remoteControl";
|
import useRemoteControlStore from "@/utils/store/remoteControl";
|
||||||
import useSyncPlayback from "@/utils/store/syncPlayback";
|
|
||||||
import DeviceMenu from "./components/DeviceMenu";
|
|
||||||
import PlayerProgress from "./components/PlayerProgress";
|
import PlayerProgress from "./components/PlayerProgress";
|
||||||
|
|
||||||
import "./audioPlayer.scss";
|
import "./audioPlayer.scss";
|
||||||
|
|
||||||
|
const formatPlayerTime = (ticks: number) => {
|
||||||
|
const total = Math.max(0, Math.round(ticks / 10_000_000));
|
||||||
|
const hours = Math.floor(total / 3600);
|
||||||
|
const minutes = Math.floor((total % 3600) / 60);
|
||||||
|
const seconds = total % 60;
|
||||||
|
const two = (value: number) => String(value).padStart(2, "0");
|
||||||
|
return hours > 0
|
||||||
|
? `${hours}:${two(minutes)}:${two(seconds)}`
|
||||||
|
: `${two(minutes)}:${two(seconds)}`;
|
||||||
|
};
|
||||||
|
|
||||||
const AudioPlayer = () => {
|
const AudioPlayer = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const user = useCentralStore((s) => s.currentUser);
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
@@ -95,16 +88,7 @@ const AudioPlayer = () => {
|
|||||||
|
|
||||||
const [playing, setPlaying] = useState(false);
|
const [playing, setPlaying] = useState(false);
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [selectedRemoteId, setSelectedRemoteId] = useState<string | null>(null);
|
|
||||||
const remoteActiveRef = useRef(false);
|
const remoteActiveRef = useRef(false);
|
||||||
const [moreAnchor, setMoreAnchor] = useState<HTMLElement | null>(null);
|
|
||||||
const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>(
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
const remoteVolumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
useEffect(() => setRemoteVolumeDraft(null), [selectedRemoteId]);
|
|
||||||
|
|
||||||
const sessions = useQuery({
|
const sessions = useQuery({
|
||||||
queryKey: ["remoteSessions"],
|
queryKey: ["remoteSessions"],
|
||||||
@@ -134,33 +118,11 @@ const AudioPlayer = () => {
|
|||||||
const playingRemote = remoteSessions.find(
|
const playingRemote = remoteSessions.find(
|
||||||
(session: SessionInfoDto) => session.NowPlayingItem,
|
(session: SessionInfoDto) => session.NowPlayingItem,
|
||||||
);
|
);
|
||||||
const selectedRemote = selectedRemoteId
|
// Local playback takes precedence; otherwise follow the active remote
|
||||||
? remoteSessions.find(
|
// session (the bar is a compact remote as well).
|
||||||
(session: SessionInfoDto) => session.Id === selectedRemoteId,
|
const remote = !display ? playingRemote : undefined;
|
||||||
)
|
|
||||||
: undefined;
|
|
||||||
// Local playback takes precedence unless a remote device was selected.
|
|
||||||
const remote = selectedRemote?.NowPlayingItem
|
|
||||||
? selectedRemote
|
|
||||||
: !display
|
|
||||||
? playingRemote
|
|
||||||
: undefined;
|
|
||||||
remoteActiveRef.current = Boolean(remote);
|
remoteActiveRef.current = Boolean(remote);
|
||||||
|
|
||||||
// Keep the picked remote volume until the target reports it back (progress
|
|
||||||
// updates can lag by seconds), then drop the optimistic value.
|
|
||||||
useEffect(() => {
|
|
||||||
if (remoteVolumeDraft == null) return;
|
|
||||||
const server = remote?.PlayState?.VolumeLevel;
|
|
||||||
if (server != null && Math.abs(server / 100 - remoteVolumeDraft) <= 0.02) {
|
|
||||||
setRemoteVolumeDraft(null);
|
|
||||||
if (remoteVolumeTimerRef.current) {
|
|
||||||
clearTimeout(remoteVolumeTimerRef.current);
|
|
||||||
remoteVolumeTimerRef.current = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [remote?.PlayState?.VolumeLevel, remoteVolumeDraft]);
|
|
||||||
|
|
||||||
const activeItem: BaseItemDto | undefined | null =
|
const activeItem: BaseItemDto | undefined | null =
|
||||||
remote?.NowPlayingItem ?? item;
|
remote?.NowPlayingItem ?? item;
|
||||||
const artists = activeItem?.ArtistItems?.length
|
const artists = activeItem?.ArtistItems?.length
|
||||||
@@ -177,7 +139,6 @@ const AudioPlayer = () => {
|
|||||||
: artistNames.join(", ") || activeItem?.Album || "";
|
: artistNames.join(", ") || activeItem?.Album || "";
|
||||||
const coverUrl = getPlayerCoverUrl(api, activeItem, 600);
|
const coverUrl = getPlayerCoverUrl(api, activeItem, 600);
|
||||||
const fullCoverUrl = getPlayerCoverUrl(api, item, 600);
|
const fullCoverUrl = getPlayerCoverUrl(api, item, 600);
|
||||||
const palette = useMemo(() => getCoverPalette(activeItem), [activeItem]);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!fullCoverUrl) return;
|
if (!fullCoverUrl) return;
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
@@ -190,10 +151,9 @@ const AudioPlayer = () => {
|
|||||||
const remoteRepeat = remote?.PlayState?.RepeatMode ?? "RepeatNone";
|
const remoteRepeat = remote?.PlayState?.RepeatMode ?? "RepeatNone";
|
||||||
const remoteShuffled = remote?.PlayState?.PlaybackOrder === "Shuffle";
|
const remoteShuffled = remote?.PlayState?.PlaybackOrder === "Shuffle";
|
||||||
const remoteVolume =
|
const remoteVolume =
|
||||||
remoteVolumeDraft ??
|
remote?.PlayState?.VolumeLevel != null
|
||||||
(remote?.PlayState?.VolumeLevel != null
|
|
||||||
? remote.PlayState.VolumeLevel / 100
|
? remote.PlayState.VolumeLevel / 100
|
||||||
: 1);
|
: 1;
|
||||||
const remoteMuted = remote?.PlayState?.IsMuted ?? false;
|
const remoteMuted = remote?.PlayState?.IsMuted ?? false;
|
||||||
const displayProgress = remote
|
const displayProgress = remote
|
||||||
? (remote.PlayState?.PositionTicks ?? 0)
|
? (remote.PlayState?.PositionTicks ?? 0)
|
||||||
@@ -201,29 +161,6 @@ const AudioPlayer = () => {
|
|||||||
const displayDuration = activeItem?.RunTimeTicks ?? 1;
|
const displayDuration = activeItem?.RunTimeTicks ?? 1;
|
||||||
const barVisible = (display && item) || Boolean(remote);
|
const barVisible = (display && item) || Boolean(remote);
|
||||||
|
|
||||||
const syncEnabled = useSyncPlayback((state) => state.enabled);
|
|
||||||
const syncMaster = useSyncPlayback((state) => state.master);
|
|
||||||
const startSync = useSyncPlayback((state) => state.start);
|
|
||||||
const stopSync = useSyncPlayback((state) => state.stop);
|
|
||||||
const canSync = Boolean(activeItem?.Id) && (display || Boolean(remote));
|
|
||||||
const syncForThisSession =
|
|
||||||
syncEnabled &&
|
|
||||||
(remote?.Id
|
|
||||||
? syncMaster?.sessionId === remote.Id
|
|
||||||
: display && syncMaster?.sessionId === null);
|
|
||||||
const toggleSync = () => {
|
|
||||||
if (syncForThisSession) {
|
|
||||||
stopSync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!activeItem?.Id) return;
|
|
||||||
startSync({ itemId: activeItem.Id, sessionId: remote?.Id ?? null });
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (display) setSelectedRemoteId(null);
|
|
||||||
}, [display, item?.Id]);
|
|
||||||
|
|
||||||
// Layout hooks (home hero rail) reserve space for the bar. Use explicit
|
// Layout hooks (home hero rail) reserve space for the bar. Use explicit
|
||||||
// visibility rather than the DOM: during the exit animation the element is
|
// visibility rather than the DOM: during the exit animation the element is
|
||||||
// still mounted but already off-screen.
|
// still mounted but already off-screen.
|
||||||
@@ -367,18 +304,10 @@ const AudioPlayer = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleVolumeChange = (newVolume: number) => {
|
|
||||||
setVolume(newVolume);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMuteToggle = () => {
|
const handleMuteToggle = () => {
|
||||||
setIsMuted(!isMuted);
|
setIsMuted(!isMuted);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
|
||||||
useAudioPlayback.setState(useAudioPlayback.getInitialState());
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNavigate = () => {
|
const handleNavigate = () => {
|
||||||
if (remote) {
|
if (remote) {
|
||||||
openRemoteDialog(remote.NowPlayingItem);
|
openRemoteDialog(remote.NowPlayingItem);
|
||||||
@@ -422,70 +351,6 @@ const AudioPlayer = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const transferToLocal = async () => {
|
|
||||||
if (!api || !user?.Id || !remote) {
|
|
||||||
setSelectedRemoteId(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const kind = await transferSessionToLocal(api, user.Id, remote);
|
|
||||||
setSelectedRemoteId(null);
|
|
||||||
await sessions.refetch();
|
|
||||||
if (kind === "video") navigate({ to: "/player" });
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Transfer failed", error);
|
|
||||||
enqueueSnackbar("Не удалось перенести воспроизведение", { variant: "error" });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectRemote = async (session: SessionInfoDto) => {
|
|
||||||
if (!session.Id) return;
|
|
||||||
try {
|
|
||||||
// Moving local playback: send the queue/position to the target first.
|
|
||||||
if (display && item?.Id && api && user?.Id) {
|
|
||||||
const queue = useQueue.getState();
|
|
||||||
const ids = queueStartingWith(queue.tracks ?? [], item.Id);
|
|
||||||
await playOnSession(api, user.Id, session.Id, {
|
|
||||||
itemIds: ids.length > 0 ? ids : [item.Id],
|
|
||||||
startIndex: 0,
|
|
||||||
startPositionTicks: progress,
|
|
||||||
mediaSourceId: item.MediaSources?.[0]?.Id ?? undefined,
|
|
||||||
});
|
|
||||||
stopPlayback();
|
|
||||||
} else if (
|
|
||||||
remote?.Id &&
|
|
||||||
remote.Id !== session.Id &&
|
|
||||||
remote.NowPlayingItem?.Id &&
|
|
||||||
api &&
|
|
||||||
user?.Id
|
|
||||||
) {
|
|
||||||
// Moving playback from one remote device to another: hand over the
|
|
||||||
// queue and current position, then stop the old device.
|
|
||||||
const remoteItem = remote.NowPlayingItem;
|
|
||||||
const queueIds = queueStartingWith(
|
|
||||||
remote.NowPlayingQueue ?? [],
|
|
||||||
remoteItem.Id ?? undefined,
|
|
||||||
);
|
|
||||||
await playOnSession(api, user.Id, session.Id, {
|
|
||||||
itemIds: queueIds.length > 0 ? queueIds : [remoteItem.Id as string],
|
|
||||||
startIndex: 0,
|
|
||||||
startPositionTicks: remote.PlayState?.PositionTicks ?? 0,
|
|
||||||
mediaSourceId: remoteItem.MediaSources?.[0]?.Id ?? undefined,
|
|
||||||
});
|
|
||||||
await getSessionApi(api).sendPlaystateCommand({
|
|
||||||
sessionId: remote.Id,
|
|
||||||
command: "Stop",
|
|
||||||
controllingUserId: user.Id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setSelectedRemoteId(session.Id);
|
|
||||||
await sessions.refetch();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Не удалось переключить устройство", error);
|
|
||||||
enqueueSnackbar("Не удалось переключить устройство", { variant: "error" });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
if (remote) remoteCommand(PlaystateCommand.NextTrack);
|
if (remote) remoteCommand(PlaystateCommand.NextTrack);
|
||||||
else if (api && user?.Id) playItemFromQueue("next", user.Id, api);
|
else if (api && user?.Id) playItemFromQueue("next", user.Id, api);
|
||||||
@@ -552,37 +417,6 @@ const AudioPlayer = () => {
|
|||||||
remoteCommand(PlaystateCommand.Seek, Math.round(ticks));
|
remoteCommand(PlaystateCommand.Seek, Math.round(ticks));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMoreOpen = (event: React.MouseEvent<HTMLElement>) =>
|
|
||||||
setMoreAnchor(event.currentTarget);
|
|
||||||
|
|
||||||
const instantMix = async () => {
|
|
||||||
setMoreAnchor(null);
|
|
||||||
if (!api || !user?.Id || !activeItem) return;
|
|
||||||
try {
|
|
||||||
const { count } = await startInstantMix(api, user.Id, activeItem);
|
|
||||||
if (count === 0) {
|
|
||||||
enqueueSnackbar("Нет треков для микса", {
|
|
||||||
variant: "warning",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
enqueueSnackbar("Не удалось запустить микс", { variant: "error" });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openCastForLocal = () => {
|
|
||||||
setMoreAnchor(null);
|
|
||||||
if (!item) return;
|
|
||||||
openRemoteDialog({
|
|
||||||
item,
|
|
||||||
kind: "audio",
|
|
||||||
positionTicks: progress,
|
|
||||||
queue: tracks ?? [],
|
|
||||||
startIndex: currentTrack,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const audioElement = display ? (
|
const audioElement = display ? (
|
||||||
<audio
|
<audio
|
||||||
autoPlay
|
autoPlay
|
||||||
@@ -630,13 +464,6 @@ const AudioPlayer = () => {
|
|||||||
? { duration: 0 }
|
? { duration: 0 }
|
||||||
: { type: "spring", stiffness: 420, damping: 38, mass: 0.9 }
|
: { type: "spring", stiffness: 420, damping: 38, mass: 0.9 }
|
||||||
}
|
}
|
||||||
style={
|
|
||||||
{
|
|
||||||
"--player-accent": palette.accent,
|
|
||||||
"--player-base": palette.base,
|
|
||||||
"--player-deep": palette.deep,
|
|
||||||
} as React.CSSProperties
|
|
||||||
}
|
|
||||||
className="audio-player"
|
className="audio-player"
|
||||||
>
|
>
|
||||||
<div className="media-bar-left">
|
<div className="media-bar-left">
|
||||||
@@ -665,36 +492,16 @@ const AudioPlayer = () => {
|
|||||||
{subtitle || "Blink"}
|
{subtitle || "Blink"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
aria-label="Ещё"
|
|
||||||
className="media-bar-more"
|
|
||||||
onClick={handleMoreOpen}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">more_horiz</span>
|
|
||||||
</IconButton>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="media-bar-center">
|
<div className="media-bar-transport">
|
||||||
<div className="media-bar-controls">
|
|
||||||
<Tooltip title="Перемешать">
|
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
onClick={handleShuffle}
|
|
||||||
className={(remote ? remoteShuffled : false) ? "active" : ""}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">shuffle</span>
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip title="Предыдущий">
|
<Tooltip title="Предыдущий">
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
|
||||||
onClick={handlePrevious}
|
onClick={handlePrevious}
|
||||||
aria-label="Предыдущий"
|
aria-label="Предыдущий"
|
||||||
|
className="media-bar-step"
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">
|
<span className="material-symbols-rounded">skip_previous</span>
|
||||||
skip_previous
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title={isPlaying ? "Пауза" : "Слушать"}>
|
<Tooltip title={isPlaying ? "Пауза" : "Слушать"}>
|
||||||
@@ -713,10 +520,49 @@ const AudioPlayer = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Следующий">
|
<Tooltip title="Следующий">
|
||||||
<IconButton size="small" onClick={handleNext} aria-label="Следующий">
|
<IconButton
|
||||||
|
onClick={handleNext}
|
||||||
|
aria-label="Следующий"
|
||||||
|
className="media-bar-step"
|
||||||
|
>
|
||||||
<span className="material-symbols-rounded">skip_next</span>
|
<span className="material-symbols-rounded">skip_next</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="media-bar-progress">
|
||||||
|
<PlayerProgress
|
||||||
|
layout="bare"
|
||||||
|
className="media-bar-slider"
|
||||||
|
progress={displayProgress}
|
||||||
|
duration={displayDuration}
|
||||||
|
onSeekCommit={remote ? handleRemoteSeek : handleSeekCommit}
|
||||||
|
/>
|
||||||
|
<span className="media-bar-time">
|
||||||
|
{formatPlayerTime(displayProgress)} /{" "}
|
||||||
|
{formatPlayerTime(displayDuration)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="media-bar-right">
|
||||||
|
<span className="media-bar-like">
|
||||||
|
<LikeButton
|
||||||
|
itemId={activeItem?.Id ?? undefined}
|
||||||
|
itemName={activeItem?.Name}
|
||||||
|
isFavorite={activeItem?.UserData?.IsFavorite}
|
||||||
|
queryKey={["item", activeItem?.Id ?? ""]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<Tooltip title="Перемешать">
|
||||||
|
<IconButton
|
||||||
|
onClick={handleShuffle}
|
||||||
|
aria-label="Перемешать"
|
||||||
|
className={(remote ? remoteShuffled : false) ? "active" : ""}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">shuffle</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
remote
|
remote
|
||||||
@@ -733,8 +579,8 @@ const AudioPlayer = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
|
||||||
onClick={handleRepeat}
|
onClick={handleRepeat}
|
||||||
|
aria-label="Повтор"
|
||||||
className={
|
className={
|
||||||
(remote ? remoteRepeat !== "RepeatNone" : repeatMode !== "off")
|
(remote ? remoteRepeat !== "RepeatNone" : repeatMode !== "off")
|
||||||
? "active"
|
? "active"
|
||||||
@@ -748,32 +594,18 @@ const AudioPlayer = () => {
|
|||||||
</span>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
<Tooltip
|
||||||
<PlayerProgress
|
title={
|
||||||
className="media-bar-progress"
|
remote
|
||||||
progress={displayProgress}
|
? remoteMuted
|
||||||
duration={displayDuration}
|
? "Включить звук"
|
||||||
onSeekCommit={remote ? handleRemoteSeek : handleSeekCommit}
|
: "Выключить звук"
|
||||||
/>
|
: isMuted
|
||||||
</div>
|
? "Включить звук"
|
||||||
|
: "Выключить звук"
|
||||||
<div className="media-bar-right">
|
}
|
||||||
{remote && (
|
|
||||||
<Tooltip title="Перенести на это устройство">
|
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
aria-label="Перенести на это устройство"
|
|
||||||
onClick={transferToLocal}
|
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">
|
<IconButton onClick={handleMute} aria-label="Звук">
|
||||||
system_update_alt
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
{!remote && <QueueButton />}
|
|
||||||
<Tooltip title={remote ? (remoteMuted ? "Включить звук" : "Выключить звук") : (isMuted ? "Включить звук" : "Выключить звук")}>
|
|
||||||
<IconButton size="small" onClick={handleMute}>
|
|
||||||
<span className="material-symbols-rounded">
|
<span className="material-symbols-rounded">
|
||||||
{remote
|
{remote
|
||||||
? remoteMuted || remoteVolume === 0
|
? remoteMuted || remoteVolume === 0
|
||||||
@@ -785,120 +617,8 @@ const AudioPlayer = () => {
|
|||||||
</span>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Slider
|
|
||||||
size="small"
|
|
||||||
className="media-bar-volume"
|
|
||||||
value={remote ? (remoteMuted ? 0 : remoteVolume) : isMuted ? 0 : volume}
|
|
||||||
min={0}
|
|
||||||
max={1}
|
|
||||||
step={0.01}
|
|
||||||
aria-label="Громкость"
|
|
||||||
onChange={(_, value) => {
|
|
||||||
const next = Array.isArray(value) ? value[0] : value;
|
|
||||||
if (remote) {
|
|
||||||
setRemoteVolumeDraft(next);
|
|
||||||
} else {
|
|
||||||
handleVolumeChange(next);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onChangeCommitted={(_, value) => {
|
|
||||||
if (!remote) return;
|
|
||||||
const next = Array.isArray(value) ? value[0] : value;
|
|
||||||
setRemoteVolumeDraft(next);
|
|
||||||
if (remoteVolumeTimerRef.current) {
|
|
||||||
clearTimeout(remoteVolumeTimerRef.current);
|
|
||||||
}
|
|
||||||
remoteVolumeTimerRef.current = setTimeout(() => {
|
|
||||||
setRemoteVolumeDraft(null);
|
|
||||||
}, 12000);
|
|
||||||
sendGeneral(GeneralCommandType.SetVolume, {
|
|
||||||
Volume: String(Math.round(next * 100)),
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<DeviceMenu
|
|
||||||
sessions={remoteSessions}
|
|
||||||
activeRemoteId={remote?.Id ?? null}
|
|
||||||
localActive={display && Boolean(item)}
|
|
||||||
localItem={item}
|
|
||||||
onSelectLocal={transferToLocal}
|
|
||||||
onSelectRemote={selectRemote}
|
|
||||||
onOpenRemoteControl={() => openRemoteDialog()}
|
|
||||||
syncEnabled={syncForThisSession}
|
|
||||||
canSync={canSync}
|
|
||||||
onToggleSync={toggleSync}
|
|
||||||
/>
|
|
||||||
<Tooltip title="Открыть плеер">
|
|
||||||
<IconButton size="small" onClick={handleNavigate}>
|
|
||||||
<span className="material-symbols-rounded">open_in_full</span>
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Menu
|
|
||||||
anchorEl={moreAnchor}
|
|
||||||
open={Boolean(moreAnchor)}
|
|
||||||
onClose={() => setMoreAnchor(null)}
|
|
||||||
slotProps={{ paper: { className: "glass-menu-paper" } }}
|
|
||||||
>
|
|
||||||
<MenuItem onClick={instantMix} disabled={!activeItem}>
|
|
||||||
<ListItemIcon>
|
|
||||||
<span className="material-symbols-rounded">radio</span>
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary="Микс" />
|
|
||||||
</MenuItem>
|
|
||||||
{remote ? (
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
setMoreAnchor(null);
|
|
||||||
transferToLocal();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<span className="material-symbols-rounded">
|
|
||||||
system_update_alt
|
|
||||||
</span>
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary="Перенести на это устройство" />
|
|
||||||
</MenuItem>
|
|
||||||
) : (
|
|
||||||
<MenuItem onClick={openCastForLocal}>
|
|
||||||
<ListItemIcon>
|
|
||||||
<span className="material-symbols-rounded">cast</span>
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary="Воспроизвести на другом устройстве…" />
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
setMoreAnchor(null);
|
|
||||||
navigate({ to: "/remote" });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<span className="material-symbols-rounded">settings_remote</span>
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary="Удалённый пульт" />
|
|
||||||
</MenuItem>
|
|
||||||
<Divider />
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
setMoreAnchor(null);
|
|
||||||
if (remote) {
|
|
||||||
remoteCommand(PlaystateCommand.Stop);
|
|
||||||
setSelectedRemoteId(null);
|
|
||||||
} else {
|
|
||||||
handleClose();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<span className="material-symbols-rounded">stop</span>
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary="Остановить" />
|
|
||||||
</MenuItem>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
</motion.div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,11 @@ type Palette = {
|
|||||||
base: string;
|
base: string;
|
||||||
/** Darker end of the vertical gradient. */
|
/** Darker end of the vertical gradient. */
|
||||||
deep: string;
|
deep: string;
|
||||||
/** Saturated cover hue used for glass highlights and controls. */
|
|
||||||
accent: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const FALLBACK: Palette = {
|
const FALLBACK: Palette = {
|
||||||
base: "hsl(266 32% 22%)",
|
base: "hsl(266 32% 22%)",
|
||||||
deep: "hsl(266 40% 9%)",
|
deep: "hsl(266 40% 9%)",
|
||||||
accent: "hsl(337 96% 64%)",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clamp = (value: number, min: number, max: number) =>
|
const clamp = (value: number, min: number, max: number) =>
|
||||||
@@ -83,11 +80,6 @@ export const getCoverPalette = (item?: BaseItemDto | null): Palette => {
|
|||||||
return {
|
return {
|
||||||
base: hsl(h, wallSaturation, wallLightness),
|
base: hsl(h, wallSaturation, wallLightness),
|
||||||
deep: hsl(h, wallSaturation, clamp(wallLightness * 0.45, 0.05, 0.12)),
|
deep: hsl(h, wallSaturation, clamp(wallLightness * 0.45, 0.05, 0.12)),
|
||||||
accent: hsl(
|
|
||||||
h,
|
|
||||||
clamp(s + 0.4, 0.55, 0.9),
|
|
||||||
clamp(l + 0.28, 0.56, 0.7),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return FALLBACK;
|
return FALLBACK;
|
||||||
|
|||||||
Reference in new issue
Block a user