diff --git a/src/components/backdrop/index.tsx b/src/components/backdrop/index.tsx
index 51914fd..0b1f797 100644
--- a/src/components/backdrop/index.tsx
+++ b/src/components/backdrop/index.tsx
@@ -19,7 +19,6 @@ export default function Backdrop() {
return (
{
if (
!mediaSegments?.Items?.length ||
currentSegmentIndex < 0 ||
- !activeSegmentId
+ !activeSegmentId ||
+ mediaSegments?.Items?.[currentSegmentIndex].Type === "Outro"
) {
return null; // No segments to skip
}
diff --git a/src/components/playback/videoPlayer/upNextFlyout.scss b/src/components/playback/videoPlayer/upNextFlyout.scss
new file mode 100644
index 0000000..cb2a31d
--- /dev/null
+++ b/src/components/playback/videoPlayer/upNextFlyout.scss
@@ -0,0 +1,41 @@
+.video-player-up_next_flyout {
+ position: absolute;
+ bottom: 2em;
+ right: 2em;
+ width: 42em;
+ height: fit-content;
+ display: flex;
+ gap: 10px;
+ align-items: stretch;
+ justify-content: center;
+ background-color: rgba(60, 60, 60,1);
+ padding: 10px;
+ border-radius: $border-radius-default + 10px;
+ z-index: 10;
+ transition: bottom 0.3s ease-in-out;
+
+ &.floating {
+ bottom: 18vh
+ }
+
+ &-thumbnail {
+ max-width: 100%;
+ max-height: 100%;
+ width: 15em;
+ object-fit: cover;
+ border-radius: $border-radius-default;
+ }
+ &-details {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ overflow: hidden;
+ justify-content: flex-start;
+ align-items: flex-start;
+ // height: 100%;
+ }
+ &-button{
+ // justify-self: flex-end;
+ margin-top: auto;
+ }
+}
\ No newline at end of file
diff --git a/src/components/playback/videoPlayer/upNextFlyout.tsx b/src/components/playback/videoPlayer/upNextFlyout.tsx
new file mode 100644
index 0000000..968451a
--- /dev/null
+++ b/src/components/playback/videoPlayer/upNextFlyout.tsx
@@ -0,0 +1,109 @@
+import { Button, Typography } from "@mui/material";
+import { motion } from "motion/react";
+import React, { useMemo } from "react";
+import { useShallow } from "zustand/shallow";
+import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
+import { useApiInContext } from "@/utils/store/api";
+import { usePlaybackStore } from "@/utils/store/playback";
+import useQueue from "@/utils/store/queue";
+
+import "./upNextFlyout.scss";
+
+const UpNextFlyout = () => {
+ const {
+ activeSegmentId,
+ currentSegmemtIndex,
+ mediaSegments,
+ skipSegment,
+ isUserHovering,
+ isUserSeeking,
+ isPlayerPlaying,
+ } = usePlaybackStore(
+ useShallow((state) => ({
+ activeSegmentId: state.activeSegmentId,
+ currentSegmemtIndex: state.nextSegmentIndex - 1,
+ mediaSegments: state.metadata.mediaSegments,
+ skipSegment: state.skipSegment,
+ isUserHovering: state.playerState.isUserHovering,
+ isUserSeeking: state.playerState.isUserSeeking,
+ isPlayerPlaying: state.playerState.isPlayerPlaying,
+ })),
+ );
+
+ const { nextItemIndex, tracks } = useQueue(
+ useShallow((state) => ({
+ nextItemIndex: state.currentItemIndex + 1,
+ tracks: state.tracks,
+ })),
+ );
+ const areControlsVisible = useMemo(() => {
+ return isUserHovering || isUserSeeking || !isPlayerPlaying;
+ }, [isUserHovering, isUserSeeking, isPlayerPlaying]);
+
+ const api = useApiInContext((s) => s.api);
+
+ if (
+ !api ||
+ !activeSegmentId ||
+ mediaSegments?.Items?.[currentSegmemtIndex].Type !== "Outro"
+ ) {
+ return null;
+ }
+
+ const item = tracks?.[nextItemIndex];
+ if (!item || !item.Id) {
+ return null;
+ }
+
+ return (
+
+
+
+
+ {`S${item.ParentIndexNumber}:E${item.IndexNumber} `}
+ {item.Name}
+
+
+ {item.Overview}
+
+
+
+
+ );
+};
+
+export default UpNextFlyout;
diff --git a/src/routes/_api/player/index.tsx b/src/routes/_api/player/index.tsx
index f846944..740faab 100644
--- a/src/routes/_api/player/index.tsx
+++ b/src/routes/_api/player/index.tsx
@@ -23,6 +23,7 @@ import { useShallow } from "zustand/shallow";
import SkipSegmentButton from "@/components/playback/videoPlayer/buttons/SkipSegmentButton";
import VideoPlayerControls from "@/components/playback/videoPlayer/controls";
import LoadingIndicator from "@/components/playback/videoPlayer/LoadingIndicator";
+import UpNextFlyout from "@/components/playback/videoPlayer/upNextFlyout";
import VolumeChangeOverlay from "@/components/playback/videoPlayer/VolumeChangeOverlay";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
@@ -108,6 +109,7 @@ export function VideoPlayer() {
registerPlayerActions,
toggleIsPlayerFullscreen,
setIsUserHovering,
+ handleOnSeek,
} = usePlaybackStore(
useShallow((state) => ({
itemId: state.metadata.item?.Id,
@@ -134,6 +136,7 @@ export function VideoPlayer() {
setIsBuffering: state.setIsBuffering,
registerPlayerActions: state.registerPlayerActions,
setIsUserHovering: state.setIsUserHovering,
+ handleOnSeek: state.handleOnSeek,
})),
);
@@ -446,6 +449,7 @@ export function VideoPlayer() {
/>
+
handleOnSeek(e.currentTarget.currentTime)}
playsInline
/>
diff --git a/src/utils/store/playback.ts b/src/utils/store/playback.ts
index e6833e0..b80dbeb 100644
--- a/src/utils/store/playback.ts
+++ b/src/utils/store/playback.ts
@@ -250,6 +250,7 @@ type PlaybackStoreActions = {
* Skip current media segment
*/
skipSegment: () => void;
+ handleOnSeek: (seconds: number) => void;
};
export const usePlaybackStore = create<
@@ -487,7 +488,7 @@ export const usePlaybackStore = create<
// -- ReactPlayer related actions --
_playerActions: {
- seekTo: (seconds: number) =>
+ seekTo: (_seconds: number) =>
console.warn(
"ReactPlayer has not yet initialized. Please wait until the player is ready to seek.",
),
@@ -581,6 +582,34 @@ export const usePlaybackStore = create<
state.playerState.currentTime = ticks;
});
},
+ handleOnSeek: (seconds) => {
+ const ticks = secToTicks(seconds);
+ const segments = get().metadata.mediaSegments?.Items;
+ if (!segments || segments.length === 0) {
+ console.warn("No segments available for seeking");
+ return;
+ }
+ const segment = segments.find(
+ (s) =>
+ (s.StartTicks ?? ticks) <= ticks && (s.EndTicks ?? ticks) >= ticks,
+ );
+ const nextIndex = segments.findIndex(
+ (s) => (s.StartTicks ?? ticks) > ticks,
+ );
+ if (segment?.Id) {
+ // If the segment is found, set it as active
+ set({
+ activeSegmentId: segment.Id,
+ nextSegmentIndex: nextIndex !== -1 ? nextIndex : segments.length,
+ });
+ } else {
+ // If no segment is found, clear the active segment
+ set({
+ activeSegmentId: null,
+ nextSegmentIndex: nextIndex !== -1 ? nextIndex : segments.length,
+ });
+ }
+ },
})),
);