diff --git a/src/components/buttons/playButton.jsx b/src/components/buttons/playButton.jsx
index 2bac558..7cd2b7c 100644
--- a/src/components/buttons/playButton.jsx
+++ b/src/components/buttons/playButton.jsx
@@ -8,6 +8,7 @@ import LinearProgress from "@mui/material/LinearProgress";
import Typography from "@mui/material/Typography";
import {
+ setItem,
usePlaybackDataLoadStore,
usePlaybackStore,
} from "../../utils/store/playback";
@@ -210,6 +211,7 @@ const PlayButton = ({
setSubtitleStreamIndex(currentSubTrack);
setMediaSourceId(item.Items[0].Id);
+ setItem(item.Items[0]);
switch (item.Items[0].Type) {
case BaseItemKind.Movie:
diff --git a/src/components/card/card.jsx b/src/components/card/card.jsx
index b96b572..15b7c96 100644
--- a/src/components/card/card.jsx
+++ b/src/components/card/card.jsx
@@ -101,7 +101,7 @@ export const Card = ({
aspectRatio: cardImageAspectRatios[cardType],
}}
>
- {/* {!!item.UserData && (
+ {!!item.UserData && (
<>
>
- )} */}
+ )}
{/* {!!imageBlurhash && (
{
setMediaSourceId,
setUserId,
setSeriesId,
+ item,
] = usePlaybackStore((state) => [
state.url,
state.startPosition,
@@ -104,6 +105,7 @@ export const VideoPlayer = () => {
state.setMediaSourceId,
state.setUserId,
state.setSeriesId,
+ state.item,
]);
const mediaInfo = useQuery({
@@ -504,6 +506,17 @@ export const VideoPlayer = () => {
const handleExit = async () => {
// Remove app from fullscreen
await appWindow.setFullscreen(false);
+ // Send playback end report
+ await getPlaystateApi(api).reportPlaybackStopped({
+ playbackStopInfo: {
+ Failed: false,
+ Item: item,
+ ItemId: itemId,
+ MediaSourceId: mediaInfo.data?.MediaSources[0].Id,
+ PlaySessionId: mediaInfo.data?.PlaySessionId,
+ PositionTicks: currentTime,
+ },
+ });
navigate(-1);
// Reset playback store
diff --git a/src/utils/store/playback.js b/src/utils/store/playback.js
index 2fa8702..a0b4f58 100644
--- a/src/utils/store/playback.js
+++ b/src/utils/store/playback.js
@@ -19,6 +19,10 @@ export const usePlaybackStore = create((set) => ({
seriesId: "",
queue: [],
episodeIndex: 0,
+ /**
+ * @type {import("@jellyfin/sdk/lib/generated-client/models/base-item-dto").BaseItemDto}
+ */
+ item: {},
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
@@ -47,6 +51,8 @@ export const usePlaybackStore = create((set) => ({
setEpisodeIndex: (aitem) =>
set((state) => ({ ...state, episodeIndex: aitem })),
}));
+export const setItem = (item) =>
+ usePlaybackStore.setState((state) => ({ ...state, item: item }));
export const usePlaybackDataLoadStore = create((set) => ({
isPending: false,