mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-09 23:48:41 +01:00
fix: playback stopped dep
This commit is contained in:
@@ -230,16 +230,11 @@ export default function page() {
|
|||||||
videoRef.current?.pause();
|
videoRef.current?.pause();
|
||||||
}, [videoRef]);
|
}, [videoRef]);
|
||||||
|
|
||||||
const stop = useCallback(() => {
|
|
||||||
setIsPlaybackStopped(true);
|
|
||||||
videoRef.current?.stop();
|
|
||||||
reportPlaybackStopped();
|
|
||||||
}, [videoRef]);
|
|
||||||
|
|
||||||
const reportPlaybackStopped = useCallback(async () => {
|
const reportPlaybackStopped = useCallback(async () => {
|
||||||
if (offline) return;
|
if (offline) return;
|
||||||
|
|
||||||
const currentTimeInTicks = msToTicks(progress.value);
|
const currentTimeInTicks = msToTicks(progress.value);
|
||||||
|
|
||||||
await getPlaystateApi(api!).onPlaybackStopped({
|
await getPlaystateApi(api!).onPlaybackStopped({
|
||||||
itemId: item?.Id!,
|
itemId: item?.Id!,
|
||||||
mediaSourceId: mediaSourceId,
|
mediaSourceId: mediaSourceId,
|
||||||
@@ -250,6 +245,12 @@ export default function page() {
|
|||||||
revalidateProgressCache();
|
revalidateProgressCache();
|
||||||
}, [api, item, mediaSourceId, stream]);
|
}, [api, item, mediaSourceId, stream]);
|
||||||
|
|
||||||
|
const stop = useCallback(() => {
|
||||||
|
reportPlaybackStopped();
|
||||||
|
setIsPlaybackStopped(true);
|
||||||
|
videoRef.current?.stop();
|
||||||
|
}, [videoRef, reportPlaybackStopped]);
|
||||||
|
|
||||||
const reportPlaybackStart = useCallback(async () => {
|
const reportPlaybackStart = useCallback(async () => {
|
||||||
if (offline) return;
|
if (offline) return;
|
||||||
|
|
||||||
@@ -340,7 +341,6 @@ export default function page() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
return async () => {
|
return async () => {
|
||||||
await reportPlaybackStopped();
|
|
||||||
videoRef.current?.stop();
|
videoRef.current?.stop();
|
||||||
};
|
};
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user