feat(remote): remote control page for another Jellyfin client
- device list with live sessions, now-playing poster, metadata and overview - five round transport buttons, seek bar, subtitles menu, volume, quality and fullscreen - cover-derived wall colour, app accent and a compact service bar - reachable from the app bar, the drawer and the audio player menu
This commit is contained in:
1 parent
9f314582c0
commit
e93de2beea
5 files changed
+1289
-3
No files matched your search
@@ -29,6 +29,7 @@ const HIDDEN_PATHS = [
|
||||
"/settings",
|
||||
"/library",
|
||||
"/search",
|
||||
"/remote",
|
||||
// The home page draws its own header inside the hero frame.
|
||||
"/home",
|
||||
];
|
||||
@@ -36,9 +37,7 @@ const HIDDEN_PATHS = [
|
||||
/** Whether the global app header is drawn for this route. */
|
||||
export const shouldShowAppBar = (pathname: string) =>
|
||||
!HIDDEN_PATHS.some(
|
||||
(path) =>
|
||||
(pathname.startsWith(path) && pathname !== "/player/audio") ||
|
||||
pathname === "/",
|
||||
(path) => pathname.startsWith(path) || pathname === "/",
|
||||
);
|
||||
|
||||
const AppBarContent = () => {
|
||||
@@ -146,6 +145,14 @@ const AppBarContent = () => {
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Пульт">
|
||||
<IconButton
|
||||
onClick={() => navigate({ to: "/remote" })}
|
||||
aria-label="Пульт"
|
||||
>
|
||||
<span className="material-symbols-rounded">settings_remote</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Избранное">
|
||||
<IconButton
|
||||
onClick={handleNavigateToFavorite}
|
||||
|
||||
@@ -90,6 +90,13 @@ export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
|
||||
primary="Поиск"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
to="/remote"
|
||||
icon="settings_remote"
|
||||
primary="Пульт"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
to="/favorite"
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ApiRouteImport } from './routes/_api'
|
||||
import { Route as ApiLoginRouteImport } from './routes/_api/login'
|
||||
import { Route as ApiRemoteRouteImport } from './routes/_api/remote'
|
||||
import { Route as ApiSettingsRouteImport } from './routes/_api/settings'
|
||||
import { Route as ErrorCodeRouteImport } from './routes/error/$code'
|
||||
import { Route as ApiFavoriteIndexRouteImport } from './routes/_api/favorite/index'
|
||||
@@ -49,6 +50,11 @@ const ApiLoginRoute = ApiLoginRouteImport.update({
|
||||
path: '/login',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiRemoteRoute = ApiRemoteRouteImport.update({
|
||||
id: '/remote',
|
||||
path: '/remote',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiSettingsRoute = ApiSettingsRouteImport.update({
|
||||
id: '/settings',
|
||||
path: '/settings',
|
||||
@@ -164,6 +170,7 @@ const ApiSettingsChangeServerIndexRoute =
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/remote': typeof ApiRemoteRoute
|
||||
'/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/item/$id': typeof ApiItemIdRoute
|
||||
@@ -190,6 +197,7 @@ export interface FileRoutesByFullPath {
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/remote': typeof ApiRemoteRoute
|
||||
'/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/item/$id': typeof ApiItemIdRoute
|
||||
@@ -218,6 +226,7 @@ export interface FileRoutesById {
|
||||
'/': typeof IndexRoute
|
||||
'/_api': typeof ApiRouteWithChildren
|
||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||
'/_api/remote': typeof ApiRemoteRoute
|
||||
'/_api/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/_api/item/$id': typeof ApiItemIdRoute
|
||||
@@ -246,6 +255,7 @@ export interface FileRouteTypes {
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/login'
|
||||
| '/remote'
|
||||
| '/settings'
|
||||
| '/error/$code'
|
||||
| '/item/$id'
|
||||
@@ -272,6 +282,7 @@ export interface FileRouteTypes {
|
||||
to:
|
||||
| '/'
|
||||
| '/login'
|
||||
| '/remote'
|
||||
| '/settings'
|
||||
| '/error/$code'
|
||||
| '/item/$id'
|
||||
@@ -299,6 +310,7 @@ export interface FileRouteTypes {
|
||||
| '/'
|
||||
| '/_api'
|
||||
| '/_api/login'
|
||||
| '/_api/remote'
|
||||
| '/_api/settings'
|
||||
| '/error/$code'
|
||||
| '/_api/item/$id'
|
||||
@@ -355,6 +367,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiLoginRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/remote': {
|
||||
id: '/_api/remote'
|
||||
path: '/remote'
|
||||
fullPath: '/remote'
|
||||
preLoaderRoute: typeof ApiRemoteRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/settings': {
|
||||
id: '/_api/settings'
|
||||
path: '/settings'
|
||||
@@ -546,6 +565,7 @@ const ApiSettingsRouteWithChildren = ApiSettingsRoute._addFileChildren(
|
||||
|
||||
interface ApiRouteChildren {
|
||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||
ApiRemoteRoute: typeof ApiRemoteRoute
|
||||
ApiSettingsRoute: typeof ApiSettingsRouteWithChildren
|
||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
@@ -562,6 +582,7 @@ interface ApiRouteChildren {
|
||||
|
||||
const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||
ApiRemoteRoute: ApiRemoteRoute,
|
||||
ApiSettingsRoute: ApiSettingsRouteWithChildren,
|
||||
ApiItemIdRoute: ApiItemIdRoute,
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
|
||||
@@ -0,0 +1,640 @@
|
||||
/**
|
||||
* Remote control for another Jellyfin client.
|
||||
* Layout follows the reference player: brand bar, poster + details + round
|
||||
* transport, a full-width timeline, and a service bar with subtitles, volume,
|
||||
* quality and fullscreen.
|
||||
*/
|
||||
.remote-page {
|
||||
--remote-accent: #{$clr-accent-default};
|
||||
--remote-panel: #16191f;
|
||||
--remote-chip: #1b1e25;
|
||||
--remote-muted: #a9b0bb;
|
||||
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
var(--remote-base, #1b0f2e),
|
||||
var(--remote-deep, #08001f)
|
||||
);
|
||||
font-family: "Plus Jakarta Sans Variable", "Segoe UI", "Inter", Arial,
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ top */
|
||||
|
||||
.remote-topbar {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
height: 88px;
|
||||
padding: 0 32px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&-left,
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.MuiIconButton-root {
|
||||
color: #dfe3ea;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
&-divider {
|
||||
width: 1px;
|
||||
height: 26px;
|
||||
background: rgb(255 255 255 / 0.12);
|
||||
}
|
||||
}
|
||||
|
||||
.remote-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
|
||||
&-mark {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-default,
|
||||
$clr-secondary-default
|
||||
);
|
||||
color: #fff;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
&-name {
|
||||
font-size: 1.35rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
}
|
||||
|
||||
.remote-device-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px 8px 14px;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: var(--remote-panel);
|
||||
color: #e8ebf1;
|
||||
font: inherit;
|
||||
font-size: 0.88rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: #1d2028;
|
||||
}
|
||||
|
||||
> .material-symbols-rounded {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.remote-chevron {
|
||||
opacity: 0.6;
|
||||
font-size: 1.15rem !important;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- hero */
|
||||
|
||||
.remote-body {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.remote-devices {
|
||||
display: flex;
|
||||
flex: 0 0 clamp(220px, 19vw, 280px);
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding: clamp(0.5rem, 3vh, 2rem) 0 0 clamp(1.5rem, 4vw, 3.5rem);
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.remote-devices-title {
|
||||
margin: 0 0 0.5em 0.6em;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
}
|
||||
|
||||
.remote-device-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-y: auto;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.remote-device {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75em;
|
||||
width: 100%;
|
||||
padding: 0.6em 0.7em;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
font-size: 1.3rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
font-size: 0.9rem;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-meta {
|
||||
font-size: 0.72rem;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
margin-left: auto;
|
||||
border-radius: 50%;
|
||||
background: $clr-accent-default;
|
||||
|
||||
&.is-paused {
|
||||
background: rgb(255 255 255 / 0.35);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remote-hero {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
align-items: center;
|
||||
gap: clamp(2rem, 4vw, 4rem);
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
margin: 0 auto;
|
||||
padding: clamp(0.5rem, 3vh, 2.5rem) clamp(1.5rem, 4vw, 3.5rem) 0;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.remote-poster {
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
height: 100%;
|
||||
max-height: 560px;
|
||||
width: auto;
|
||||
max-width: 340px;
|
||||
aspect-ratio: 2 / 3;
|
||||
|
||||
&-frame {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
background: var(--remote-panel);
|
||||
box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
> .material-symbols-rounded {
|
||||
font-size: 4rem;
|
||||
color: rgb(255 255 255 / 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remote-details {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
max-width: 820px;
|
||||
padding-top: clamp(0.5rem, 4vh, 3rem);
|
||||
}
|
||||
|
||||
.remote-title {
|
||||
margin: 0;
|
||||
font-size: clamp(1.9rem, 3vw, 3rem);
|
||||
font-weight: 700;
|
||||
line-height: 1.1;
|
||||
letter-spacing: -0.02em;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.remote-subtitle {
|
||||
margin: 0.55em 0 0;
|
||||
font-size: clamp(1.1rem, 1.6vw, 1.55rem);
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
color: #d3d8e0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.remote-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: clamp(1.2rem, 3vh, 2rem);
|
||||
}
|
||||
|
||||
.remote-chip {
|
||||
padding: 7px 15px;
|
||||
border-radius: 999px;
|
||||
background: var(--remote-chip);
|
||||
font-size: 0.95rem;
|
||||
color: #dfe3ea;
|
||||
}
|
||||
|
||||
.remote-overview {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 4;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
max-width: 660px;
|
||||
margin: clamp(1rem, 3vh, 1.8rem) 0 0;
|
||||
font-size: 1rem;
|
||||
line-height: 1.6;
|
||||
color: var(--remote-muted);
|
||||
}
|
||||
|
||||
.remote-transport {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: clamp(1rem, 2.4vw, 2rem);
|
||||
margin-top: clamp(2rem, 6vh, 3.5rem);
|
||||
}
|
||||
|
||||
.remote-round {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: clamp(64px, 6vw, 86px);
|
||||
height: clamp(64px, 6vw, 86px);
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: var(--remote-panel);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, transform 0.15s ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: clamp(1.5rem, 2vw, 2rem);
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #1e222b;
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&.remote-round-primary {
|
||||
width: clamp(74px, 7vw, 98px);
|
||||
height: clamp(74px, 7vw, 98px);
|
||||
background: var(--remote-accent);
|
||||
box-shadow: 0 10px 24px rgb(0 0 0 / 0.3);
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: clamp(1.9rem, 2.6vw, 2.6rem);
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #8b70ff;
|
||||
transform: scale(1.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ timeline */
|
||||
|
||||
.remote-timeline {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 22px;
|
||||
padding: clamp(0.5rem, 1.5vh, 1rem) clamp(1.5rem, 4vw, 3.5rem) 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.MuiSlider-root {
|
||||
padding: 12px 0;
|
||||
color: var(--remote-accent);
|
||||
}
|
||||
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.18);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.MuiSlider-thumb {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 0 4px rgb(255 255 255 / 0.14);
|
||||
|
||||
&:hover,
|
||||
&.Mui-focusVisible {
|
||||
box-shadow: 0 0 0 8px rgb(255 255 255 / 0.14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remote-timeline-slider {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.remote-time {
|
||||
flex: 0 0 auto;
|
||||
min-width: 4.5em;
|
||||
font-size: 1.05rem;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #e8ebf1;
|
||||
|
||||
&:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------- bottom bar */
|
||||
|
||||
.remote-bottombar {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
height: 72px;
|
||||
padding: 0 clamp(1.5rem, 4vw, 3rem);
|
||||
box-sizing: border-box;
|
||||
background: rgb(0 0 0 / 0.22);
|
||||
border-top: 1px solid rgb(255 255 255 / 0.06);
|
||||
}
|
||||
|
||||
.remote-bottom-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
padding: 8px 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #dfe3ea;
|
||||
font: inherit;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s ease;
|
||||
|
||||
> .material-symbols-rounded {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.2;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
> span:nth-child(2) {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.remote-bottom-volume {
|
||||
flex: 0 1 320px;
|
||||
gap: 8px;
|
||||
|
||||
.MuiIconButton-root {
|
||||
color: #dfe3ea;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
}
|
||||
}
|
||||
|
||||
.MuiSlider-root {
|
||||
color: var(--remote-accent);
|
||||
}
|
||||
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.18);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.MuiSlider-thumb {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: #fff;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- empty */
|
||||
|
||||
.remote-empty {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.6em;
|
||||
padding: 0 24px;
|
||||
text-align: center;
|
||||
|
||||
> .material-symbols-rounded {
|
||||
font-size: 3.5rem;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
|
||||
p {
|
||||
max-width: 46ch;
|
||||
margin: 0;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.6;
|
||||
color: var(--remote-muted);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ adapt */
|
||||
|
||||
@media (max-height: 780px) {
|
||||
.remote-topbar {
|
||||
height: 72px;
|
||||
}
|
||||
|
||||
.remote-title {
|
||||
font-size: clamp(1.6rem, 2.6vw, 2.3rem);
|
||||
}
|
||||
|
||||
.remote-subtitle {
|
||||
font-size: clamp(1rem, 1.3vw, 1.2rem);
|
||||
}
|
||||
|
||||
.remote-chips {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.remote-overview {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.remote-transport {
|
||||
margin-top: 1.4rem;
|
||||
}
|
||||
|
||||
.remote-round {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
.remote-round.remote-round-primary {
|
||||
width: 78px;
|
||||
height: 78px;
|
||||
}
|
||||
|
||||
.remote-bottombar {
|
||||
height: 64px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.remote-hero {
|
||||
gap: 2.5rem;
|
||||
}
|
||||
|
||||
.remote-poster {
|
||||
width: clamp(200px, 30vw, 280px);
|
||||
}
|
||||
|
||||
.remote-bottombar {
|
||||
height: 90px;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.remote-bottom-item > span:nth-child(2) {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
.remote-topbar {
|
||||
height: 72px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.remote-hero {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.remote-details {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.remote-transport {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.remote-chips {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.remote-overview {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.remote-bottombar {
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
height: auto;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
.remote-bottom-volume {
|
||||
flex-basis: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,611 @@
|
||||
import {
|
||||
GeneralCommandType,
|
||||
PlaystateCommand,
|
||||
type SessionInfoDto,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
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 { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import { getCoverPalette } from "@/utils/methods/coverColor";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
|
||||
import "./remote.scss";
|
||||
|
||||
export const Route = createFileRoute("/_api/remote")({
|
||||
component: RemotePage,
|
||||
});
|
||||
|
||||
const TICKS_PER_SECOND = 10_000_000;
|
||||
|
||||
const formatTime = (ticks: number | null | undefined) => {
|
||||
const total = Math.max(0, Math.round((ticks ?? 0) / TICKS_PER_SECOND));
|
||||
const h = Math.floor(total / 3600);
|
||||
const m = Math.floor((total % 3600) / 60);
|
||||
const s = total % 60;
|
||||
return h > 0
|
||||
? `${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`
|
||||
: `${m}:${String(s).padStart(2, "0")}`;
|
||||
};
|
||||
|
||||
const sessionLabel = (session: SessionInfoDto) =>
|
||||
session.DeviceName ||
|
||||
session.Client ||
|
||||
session.DeviceId ||
|
||||
"Неизвестное устройство";
|
||||
|
||||
const channelLabel = (channels?: number | null) => {
|
||||
if (!channels) return null;
|
||||
if (channels === 1) return "Mono";
|
||||
if (channels === 2) return "Stereo";
|
||||
if (channels === 6) return "5.1";
|
||||
if (channels === 8) return "7.1";
|
||||
return `${channels} ch`;
|
||||
};
|
||||
|
||||
const sessionKind = (session: SessionInfoDto) => {
|
||||
const type = session.NowPlayingItem?.Type;
|
||||
if (type === "TvChannel") return "tv";
|
||||
if (type === "Audio" || type === "MusicAlbum") return "speaker";
|
||||
if (type) return "tv";
|
||||
return session.Client?.toLowerCase().includes("web") ? "computer" : "tv";
|
||||
};
|
||||
|
||||
function RemotePage() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const navigate = useNavigate();
|
||||
const toggleSearchDialog = useSearchStore((s) => s.toggleSearchDialog);
|
||||
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const [subtitleAnchor, setSubtitleAnchor] = useState<HTMLElement | null>(
|
||||
null,
|
||||
);
|
||||
const [qualityAnchor, setQualityAnchor] = useState<HTMLElement | null>(null);
|
||||
const [subtitleIndex, setSubtitleIndex] = useState<number>(-1);
|
||||
const [volumeDraft, setVolumeDraft] = useState<number | null>(null);
|
||||
const volumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const clearVolumeTimer = () => {
|
||||
if (volumeTimerRef.current) {
|
||||
clearTimeout(volumeTimerRef.current);
|
||||
volumeTimerRef.current = null;
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => clearVolumeTimer, []);
|
||||
|
||||
const sessions = useQuery({
|
||||
queryKey: ["remoteSessions"],
|
||||
queryFn: async () => {
|
||||
if (!api || !user?.Id) return [];
|
||||
const result = await getSessionApi(api).getSessions();
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!api && !!user?.Id,
|
||||
refetchInterval: () => {
|
||||
if (document.visibilityState !== "visible") return false;
|
||||
return 2500;
|
||||
},
|
||||
refetchIntervalInBackground: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const remoteSessions = (sessions.data ?? []).filter(
|
||||
(session) =>
|
||||
session.Id &&
|
||||
session.DeviceId !== api?.deviceInfo.id &&
|
||||
session.UserId === user?.Id,
|
||||
);
|
||||
|
||||
const playing = remoteSessions.find((session) => session.NowPlayingItem);
|
||||
const selected =
|
||||
remoteSessions.find((session) => session.Id === selectedId) ??
|
||||
playing ??
|
||||
remoteSessions[0];
|
||||
|
||||
useEffect(() => {
|
||||
setVolumeDraft(null);
|
||||
setSubtitleIndex(-1);
|
||||
clearVolumeTimer();
|
||||
}, [selected?.Id]);
|
||||
|
||||
// Keep the picked volume until the target reports it back (progress updates
|
||||
// can lag), then drop the optimistic value.
|
||||
useEffect(() => {
|
||||
if (volumeDraft == null) return;
|
||||
const server = selected?.PlayState?.VolumeLevel;
|
||||
if (server != null && Math.abs(server / 100 - volumeDraft) <= 0.02) {
|
||||
setVolumeDraft(null);
|
||||
clearVolumeTimer();
|
||||
}
|
||||
}, [selected?.PlayState?.VolumeLevel, volumeDraft]);
|
||||
|
||||
const command = async (
|
||||
session: SessionInfoDto,
|
||||
name: PlaystateCommand,
|
||||
seekPositionTicks?: number,
|
||||
) => {
|
||||
if (!api || !session.Id) return;
|
||||
try {
|
||||
await getSessionApi(api).sendPlaystateCommand({
|
||||
sessionId: session.Id,
|
||||
command: name,
|
||||
seekPositionTicks,
|
||||
controllingUserId: user?.Id,
|
||||
});
|
||||
await sessions.refetch();
|
||||
} catch (error) {
|
||||
console.error("Remote command failed", error);
|
||||
}
|
||||
};
|
||||
|
||||
const general = async (
|
||||
session: SessionInfoDto,
|
||||
name: GeneralCommandType,
|
||||
args?: Record<string, string>,
|
||||
) => {
|
||||
if (!api || !session.Id) return;
|
||||
try {
|
||||
await getSessionApi(api).sendFullGeneralCommand({
|
||||
sessionId: session.Id,
|
||||
generalCommand: {
|
||||
Name: name,
|
||||
Arguments: args,
|
||||
ControllingUserId: user?.Id,
|
||||
},
|
||||
});
|
||||
await sessions.refetch();
|
||||
} catch (error) {
|
||||
console.error("Remote general command failed", error);
|
||||
}
|
||||
};
|
||||
|
||||
const nowPlaying = selected?.NowPlayingItem;
|
||||
const playState = selected?.PlayState;
|
||||
const isPaused = playState?.IsPaused ?? true;
|
||||
const duration = nowPlaying?.RunTimeTicks ?? 0;
|
||||
const position = playState?.PositionTicks ?? 0;
|
||||
const volume = volumeDraft ?? (playState?.VolumeLevel ?? 100) / 100;
|
||||
const isMuted = playState?.IsMuted ?? false;
|
||||
|
||||
const coverUrl = useMemo(() => {
|
||||
if (!api || !nowPlaying) return undefined;
|
||||
const imageItemId = nowPlaying.AlbumId ?? nowPlaying.Id;
|
||||
if (!imageItemId) return undefined;
|
||||
return getImageUrlsApi(api).getItemImageUrlById(imageItemId, "Primary", {
|
||||
quality: 90,
|
||||
fillHeight: 720,
|
||||
fillWidth: 480,
|
||||
});
|
||||
}, [api, nowPlaying?.AlbumId, nowPlaying?.Id]);
|
||||
|
||||
const palette = useMemo(() => getCoverPalette(nowPlaying), [nowPlaying?.Id]);
|
||||
|
||||
const isEpisode = nowPlaying?.Type === "Episode";
|
||||
const title = isEpisode
|
||||
? (nowPlaying?.SeriesName ?? nowPlaying?.Name)
|
||||
: nowPlaying?.Name;
|
||||
const subtitle = isEpisode
|
||||
? `Сезон ${nowPlaying?.ParentIndexNumber ?? 1}, Серия ${
|
||||
nowPlaying?.IndexNumber ?? 1
|
||||
} — «${nowPlaying?.Name}»`
|
||||
: [
|
||||
nowPlaying?.AlbumArtist ?? nowPlaying?.Artists?.join(", "),
|
||||
nowPlaying?.Album,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
const videoStream = nowPlaying?.MediaStreams?.find(
|
||||
(stream) => stream.Type === "Video",
|
||||
);
|
||||
const audioStream = nowPlaying?.MediaStreams?.find(
|
||||
(stream) => stream.Type === "Audio",
|
||||
);
|
||||
const subtitleStreams =
|
||||
nowPlaying?.MediaStreams?.filter((stream) => stream.Type === "Subtitle") ??
|
||||
[];
|
||||
|
||||
const chips = [
|
||||
nowPlaying?.OfficialRating,
|
||||
nowPlaying?.ProductionYear,
|
||||
nowPlaying?.RunTimeTicks
|
||||
? getRuntimeCompact(nowPlaying.RunTimeTicks)
|
||||
: null,
|
||||
videoStream?.Height ? `${videoStream.Height}p` : null,
|
||||
channelLabel(audioStream?.Channels),
|
||||
].filter(Boolean) as string[];
|
||||
|
||||
const qualityLabel = videoStream?.Height
|
||||
? `${videoStream.Height}p`
|
||||
: (nowPlaying?.MediaSources?.[0]?.Name ?? "Авто");
|
||||
const subtitleLabel =
|
||||
subtitleIndex < 0
|
||||
? "Выкл."
|
||||
: (subtitleStreams.find((s) => s.Index === subtitleIndex)?.DisplayTitle ??
|
||||
`Дорожка ${subtitleIndex}`);
|
||||
|
||||
const toggleMute = () => {
|
||||
if (!selected) return;
|
||||
void general(
|
||||
selected,
|
||||
isMuted ? GeneralCommandType.Unmute : GeneralCommandType.Mute,
|
||||
);
|
||||
};
|
||||
|
||||
const chooseSubtitle = (index: number) => {
|
||||
if (!selected) return;
|
||||
setSubtitleIndex(index);
|
||||
setSubtitleAnchor(null);
|
||||
void general(selected, GeneralCommandType.SetSubtitleStreamIndex, {
|
||||
Index: String(index),
|
||||
});
|
||||
};
|
||||
|
||||
const transport = (name: PlaystateCommand) => {
|
||||
if (!selected) return;
|
||||
void command(selected, name);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="remote-page"
|
||||
style={
|
||||
{
|
||||
"--remote-base": palette.base,
|
||||
"--remote-deep": palette.deep,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<header className="remote-topbar" data-tauri-drag-region>
|
||||
<div className="remote-topbar-left">
|
||||
<div className="remote-brand">
|
||||
<span className="remote-brand-mark">
|
||||
<span className="material-symbols-rounded">settings_remote</span>
|
||||
</span>
|
||||
<span className="remote-brand-name">Пульт</span>
|
||||
</div>
|
||||
<span className="remote-topbar-divider" />
|
||||
<IconButton
|
||||
aria-label="Главная"
|
||||
title="Главная"
|
||||
onClick={() => navigate({ to: "/home" })}
|
||||
>
|
||||
<span className="material-symbols-rounded">home</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="remote-topbar-right">
|
||||
<IconButton
|
||||
aria-label="Поиск"
|
||||
title="Поиск"
|
||||
onClick={toggleSearchDialog}
|
||||
>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
<IconButton
|
||||
aria-label="Настройки"
|
||||
title="Настройки"
|
||||
onClick={() => navigate({ to: "/settings/preferences" })}
|
||||
>
|
||||
<span className="material-symbols-rounded">settings</span>
|
||||
</IconButton>
|
||||
<span className="remote-topbar-divider" />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{!selected ? (
|
||||
<div className="remote-empty">
|
||||
<span className="material-symbols-rounded">settings_remote</span>
|
||||
<h1>Нет доступных устройств</h1>
|
||||
<p>
|
||||
Откройте клиент Jellyfin (телевизор, браузер, телефон) под этой
|
||||
учётной записью, и он появится здесь.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="remote-body">
|
||||
<aside className="remote-devices" aria-label="Устройства">
|
||||
<div className="remote-devices-title">Устройства</div>
|
||||
<ul className="remote-device-list">
|
||||
{remoteSessions.map((session) => {
|
||||
const isActive = session.Id === selected?.Id;
|
||||
const sessionItem = session.NowPlayingItem;
|
||||
return (
|
||||
<li key={session.Id}>
|
||||
<button
|
||||
type="button"
|
||||
className={`remote-device${isActive ? " is-active" : ""}`}
|
||||
onClick={() => setSelectedId(session.Id ?? null)}
|
||||
>
|
||||
<span className="material-symbols-rounded remote-device-icon">
|
||||
{sessionKind(session)}
|
||||
</span>
|
||||
<span className="remote-device-info">
|
||||
<span className="remote-device-name">
|
||||
{sessionLabel(session)}
|
||||
</span>
|
||||
<span className="remote-device-meta">
|
||||
{sessionItem?.Name
|
||||
? session.PlayState?.IsPaused
|
||||
? `Пауза · ${sessionItem.Name}`
|
||||
: `Играет · ${sessionItem.Name}`
|
||||
: "Свободно"}
|
||||
</span>
|
||||
</span>
|
||||
{sessionItem && (
|
||||
<span
|
||||
className={`remote-device-dot${
|
||||
session.PlayState?.IsPaused ? " is-paused" : ""
|
||||
}`}
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<main className="remote-hero">
|
||||
<div className="remote-poster">
|
||||
<div className="remote-poster-frame">
|
||||
{coverUrl ? (
|
||||
<img src={coverUrl} alt={title ?? "Постер"} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">live_tv</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section className="remote-details">
|
||||
<h1 className="remote-title">
|
||||
{title ?? sessionLabel(selected)}
|
||||
</h1>
|
||||
{subtitle && <h2 className="remote-subtitle">{subtitle}</h2>}
|
||||
|
||||
{chips.length > 0 && (
|
||||
<div className="remote-chips">
|
||||
{chips.map((chip) => (
|
||||
<span key={chip} className="remote-chip">
|
||||
{chip}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nowPlaying?.Overview && (
|
||||
<p className="remote-overview">{nowPlaying.Overview}</p>
|
||||
)}
|
||||
{!nowPlaying && (
|
||||
<p className="remote-overview">
|
||||
Устройство свободно. Запустите воспроизведение на нём, и
|
||||
здесь появятся название, постер и управление.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="remote-transport">
|
||||
<Tooltip title="Назад">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.Rewind)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Назад"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_rewind
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Предыдущий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() =>
|
||||
transport(PlaystateCommand.PreviousTrack)
|
||||
}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Предыдущий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_previous
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round remote-round-primary"
|
||||
onClick={() => transport(PlaystateCommand.PlayPause)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label={isPaused ? "Играть" : "Пауза"}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{isPaused ? "play_arrow" : "pause"}
|
||||
</span>
|
||||
</button>
|
||||
<Tooltip title="Следующий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.NextTrack)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Следующий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_next
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Вперёд">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.FastForward)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Вперёд"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_forward
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div className="remote-timeline">
|
||||
<span className="remote-time">{formatTime(position)}</span>
|
||||
<Slider
|
||||
className="remote-timeline-slider"
|
||||
value={Math.min(position, duration)}
|
||||
max={duration || 1}
|
||||
step={1}
|
||||
size="small"
|
||||
aria-label="Перемотка"
|
||||
onChangeCommitted={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
if (selected) {
|
||||
void command(
|
||||
selected,
|
||||
PlaystateCommand.Seek,
|
||||
Math.round(next),
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<span className="remote-time">{formatTime(duration)}</span>
|
||||
</div>
|
||||
|
||||
<footer className="remote-bottombar">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-bottom-item"
|
||||
onClick={(event) => setSubtitleAnchor(event.currentTarget)}
|
||||
disabled={!nowPlaying || subtitleStreams.length === 0}
|
||||
>
|
||||
<span className="material-symbols-rounded">subtitles</span>
|
||||
<span>Субтитры: {subtitleLabel}</span>
|
||||
<span className="material-symbols-rounded remote-chevron">
|
||||
expand_more
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div className="remote-bottom-item remote-bottom-volume">
|
||||
<IconButton
|
||||
onClick={toggleMute}
|
||||
aria-label={isMuted ? "Включить звук" : "Выключить звук"}
|
||||
disabled={!nowPlaying}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{isMuted || volume === 0 ? "volume_off" : "volume_up"}
|
||||
</span>
|
||||
</IconButton>
|
||||
<Slider
|
||||
value={isMuted ? 0 : volume}
|
||||
min={0}
|
||||
max={1}
|
||||
step={0.01}
|
||||
size="small"
|
||||
aria-label="Громкость"
|
||||
onChange={(_, value) => {
|
||||
setVolumeDraft(Array.isArray(value) ? value[0] : value);
|
||||
}}
|
||||
onChangeCommitted={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
setVolumeDraft(next);
|
||||
clearVolumeTimer();
|
||||
volumeTimerRef.current = setTimeout(() => {
|
||||
setVolumeDraft(null);
|
||||
}, 12000);
|
||||
if (isMuted) {
|
||||
void general(selected, GeneralCommandType.Unmute);
|
||||
}
|
||||
void general(selected, GeneralCommandType.SetVolume, {
|
||||
Volume: String(Math.round(next * 100)),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="remote-bottom-item"
|
||||
onClick={(event) => setQualityAnchor(event.currentTarget)}
|
||||
disabled={!nowPlaying}
|
||||
>
|
||||
<span className="material-symbols-rounded">monitor</span>
|
||||
<span>Качество: {qualityLabel}</span>
|
||||
<span className="material-symbols-rounded remote-chevron">
|
||||
expand_more
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="remote-bottom-item"
|
||||
onClick={() =>
|
||||
void general(selected, GeneralCommandType.ToggleFullscreen)
|
||||
}
|
||||
disabled={!nowPlaying}
|
||||
>
|
||||
<span className="material-symbols-rounded">fullscreen</span>
|
||||
<span>На весь экран</span>
|
||||
</button>
|
||||
</footer>
|
||||
|
||||
<Menu
|
||||
anchorEl={subtitleAnchor}
|
||||
open={Boolean(subtitleAnchor)}
|
||||
onClose={() => setSubtitleAnchor(null)}
|
||||
>
|
||||
<MenuItem
|
||||
selected={subtitleIndex === -1}
|
||||
onClick={() => chooseSubtitle(-1)}
|
||||
>
|
||||
Выключены
|
||||
</MenuItem>
|
||||
{subtitleStreams.map((stream) => (
|
||||
<MenuItem
|
||||
key={stream.Index}
|
||||
selected={subtitleIndex === stream.Index}
|
||||
onClick={() => chooseSubtitle(stream.Index ?? -1)}
|
||||
>
|
||||
{stream.DisplayTitle ?? stream.Language ?? "Дорожка"}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
|
||||
<Menu
|
||||
anchorEl={qualityAnchor}
|
||||
open={Boolean(qualityAnchor)}
|
||||
onClose={() => setQualityAnchor(null)}
|
||||
>
|
||||
<MenuItem disabled>Качество выбирает сам клиент</MenuItem>
|
||||
{nowPlaying?.MediaSources?.map((source) => (
|
||||
<MenuItem key={source.Id} disabled>
|
||||
{source.Name ?? "Источник"}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user