diff --git a/package.json b/package.json index fe94100..858abec 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "@million/lint": "^1.0.13", "@mui/lab": "6.0.0-beta.17", "@mui/material": "6.1.9", + "@popperjs/core": "^2.11.8", "@react-spring/web": "^9.7.5", "@tanem/react-nprogress": "^5.0.53", "@tanstack/react-query": "^5.62.0", @@ -64,6 +65,7 @@ "react-markdown": "^9.0.1", "react-multi-carousel": "^2.8.5", "react-player": "^2.16.0", + "react-popper": "^2.3.0", "react-use-konami": "^1.1.0", "remark-gfm": "^4.0.0", "typescript": "^5.7.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 028bebe..c7fe2ff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,6 +50,9 @@ importers: '@mui/material': specifier: 6.1.9 version: 6.1.9(@emotion/react@11.13.5(@types/react@18.3.12)(react@18.3.1))(@emotion/styled@11.13.5(@emotion/react@11.13.5(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@popperjs/core': + specifier: ^2.11.8 + version: 2.11.8 '@react-spring/web': specifier: ^9.7.5 version: 9.7.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -161,6 +164,9 @@ importers: react-player: specifier: ^2.16.0 version: 2.16.0(react@18.3.1) + react-popper: + specifier: ^2.3.0 + version: 2.3.0(@popperjs/core@2.11.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-use-konami: specifier: ^1.1.0 version: 1.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -2762,6 +2768,13 @@ packages: peerDependencies: react: '>=16.6.0' + react-popper@2.3.0: + resolution: {integrity: sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==} + peerDependencies: + '@popperjs/core': ^2.0.0 + react: ^16.8.0 || ^17 || ^18 + react-dom: ^16.8.0 || ^17 || ^18 + react-refresh@0.14.2: resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} engines: {node: '>=0.10.0'} @@ -3107,6 +3120,9 @@ packages: yaml: optional: true + warning@4.0.3: + resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==} + wavesurfer.js@7.8.10: resolution: {integrity: sha512-fQtMENm5uPvB7GGZtWj61W82IighH2Jx6nbW6ciL1uITU6Ea9i3rvp+Z2CTJaau5dMwAD6pCALkNvTkIXIIeYw==} @@ -5783,6 +5799,14 @@ snapshots: react: 18.3.1 react-fast-compare: 3.2.2 + react-popper@2.3.0(@popperjs/core@2.11.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + dependencies: + '@popperjs/core': 2.11.8 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-fast-compare: 3.2.2 + warning: 4.0.3 + react-refresh@0.14.2: {} react-scan@0.0.31: @@ -6195,6 +6219,10 @@ snapshots: tsx: 4.19.2 yaml: 2.6.1 + warning@4.0.3: + dependencies: + loose-envify: 1.4.0 + wavesurfer.js@7.8.10: {} webidl-conversions@3.0.1: {} diff --git a/src/routes/_api/player/index.tsx b/src/routes/_api/player/index.tsx index 19c675b..91f5577 100644 --- a/src/routes/_api/player/index.tsx +++ b/src/routes/_api/player/index.tsx @@ -41,7 +41,13 @@ import { AnimatePresence, motion } from "framer-motion"; import { useBackdropStore } from "@/utils/store/backdrop"; -import { Button, LinearProgress, Popover, TextField } from "@mui/material"; +import { + Button, + LinearProgress, + Popover, + TextField, + Tooltip, +} from "@mui/material"; import JASSUB from "jassub"; //@ts-ignore import workerUrl from "jassub/dist/jassub-worker.js?url"; @@ -60,6 +66,7 @@ import { toNumber } from "lodash"; import type { OnProgressProps } from "react-player/base"; import type subtitlePlaybackInfo from "@/utils/types/subtitlePlaybackInfo"; +import type { Instance } from "@popperjs/core"; //@ts-ignore import font from "./Noto-Sans-Indosphere.ttf?url"; @@ -493,24 +500,12 @@ function VideoPlayer() { if (index + 1 === item.Chapters?.length) { return chapter; } - if (isSeeking) { - if ( - (item.Chapters?.[index + 1]?.StartPositionTicks ?? sliderProgress) - - sliderProgress >= - 0 && - (chapter.StartPositionTicks ?? sliderProgress) - sliderProgress < 0 - ) { - return chapter; - } - } else { - if ( - (item.Chapters?.[index + 1]?.StartPositionTicks ?? progress) - - progress >= - 0 && - (chapter.StartPositionTicks ?? progress) - progress < 0 - ) { - return chapter; - } + if ( + (item.Chapters?.[index + 1]?.StartPositionTicks ?? value) - value >= + 0 && + (chapter.StartPositionTicks ?? value) - value < 0 + ) { + return chapter; } }); @@ -564,41 +559,43 @@ function VideoPlayer() { }; const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString(); + const imageAspectRatio = trickplayResolution.Width / trickplayResolution.Height; + if (currentChapter?.[0]?.Name) { return ( -