mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-07 04:53:01 +01:00
Compare commits
1 Commits
fix/tv-aud
...
renovate/s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
440f38315e |
@@ -893,27 +893,6 @@ export default function DirectPlayerPage() {
|
|||||||
// Check if we're transcoding
|
// Check if we're transcoding
|
||||||
const isTranscoding = Boolean(stream?.mediaSource?.TranscodingUrl);
|
const isTranscoding = Boolean(stream?.mediaSource?.TranscodingUrl);
|
||||||
|
|
||||||
// A transcoded stream only carries the audio track the server encoded
|
|
||||||
// into it — switching requires re-negotiating the stream with the new
|
|
||||||
// index (like the mobile menu's replacePlayer), not an mpv aid change.
|
|
||||||
if (isTranscoding) {
|
|
||||||
const queryParams = new URLSearchParams({
|
|
||||||
itemId: item?.Id ?? "",
|
|
||||||
audioIndex: String(index),
|
|
||||||
subtitleIndex: String(currentSubtitleIndex),
|
|
||||||
mediaSourceId: stream?.mediaSource?.Id ?? "",
|
|
||||||
bitrateValue: bitrateValue?.toString() ?? "",
|
|
||||||
playbackPosition: msToTicks(progress.get()).toString(),
|
|
||||||
}).toString();
|
|
||||||
// Destroy the current mpv instance BEFORE navigating, same rationale as
|
|
||||||
// goToNextItem/goToPreviousItem: Expo Router briefly holds two players
|
|
||||||
// during the transition, and two simultaneous decoders OOM-kill low-RAM
|
|
||||||
// devices. Resume is preserved via the playbackPosition param.
|
|
||||||
videoRef.current?.destroy().catch(() => {});
|
|
||||||
router.replace(`player/direct-player?${queryParams}` as any);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert Jellyfin index to MPV track ID
|
// Convert Jellyfin index to MPV track ID
|
||||||
const mpvTrackId = getMpvAudioId(
|
const mpvTrackId = getMpvAudioId(
|
||||||
stream?.mediaSource,
|
stream?.mediaSource,
|
||||||
@@ -925,14 +904,7 @@ export default function DirectPlayerPage() {
|
|||||||
await videoRef.current?.setAudioTrack?.(mpvTrackId);
|
await videoRef.current?.setAudioTrack?.(mpvTrackId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[
|
[stream?.mediaSource],
|
||||||
stream?.mediaSource,
|
|
||||||
item?.Id,
|
|
||||||
currentSubtitleIndex,
|
|
||||||
bitrateValue,
|
|
||||||
router,
|
|
||||||
progress,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// TV subtitle track change handler
|
// TV subtitle track change handler
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
Animated,
|
Animated,
|
||||||
Easing,
|
Easing,
|
||||||
InteractionManager,
|
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TVFocusGuideView,
|
TVFocusGuideView,
|
||||||
@@ -76,20 +75,6 @@ export default function TVOptionModal() {
|
|||||||
}, [isReady]);
|
}, [isReady]);
|
||||||
|
|
||||||
const handleSelect = (value: any) => {
|
const handleSelect = (value: any) => {
|
||||||
if (modalState?.deferApplyUntilDismissed) {
|
|
||||||
// onSelect navigates (the transcode audio switch replacing the player);
|
|
||||||
// a router.replace fired while this modal is the active route would be
|
|
||||||
// swallowed. Close FIRST, apply after dismissal.
|
|
||||||
const onSelect = modalState.onSelect;
|
|
||||||
store.set(tvOptionModalAtom, null);
|
|
||||||
router.back();
|
|
||||||
InteractionManager.runAfterInteractions(() => onSelect?.(value));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// State-only callers (detail page, library filters, settings): run before
|
|
||||||
// closing so the re-render happens while the modal is up. Deferring it until
|
|
||||||
// after dismissal re-renders the page after focus returns and yanks TV
|
|
||||||
// focus, leaving navigation stuck.
|
|
||||||
modalState?.onSelect(value);
|
modalState?.onSelect(value);
|
||||||
store.set(tvOptionModalAtom, null);
|
store.set(tvOptionModalAtom, null);
|
||||||
router.back();
|
router.back();
|
||||||
|
|||||||
4
bun.lock
4
bun.lock
@@ -93,7 +93,7 @@
|
|||||||
"react-native-volume-manager": "^2.0.8",
|
"react-native-volume-manager": "^2.0.8",
|
||||||
"react-native-web": "^0.21.0",
|
"react-native-web": "^0.21.0",
|
||||||
"react-native-worklets": "0.8.3",
|
"react-native-worklets": "0.8.3",
|
||||||
"sonner-native": "0.21.2",
|
"sonner-native": "0.26.4",
|
||||||
"tailwindcss": "3.3.2",
|
"tailwindcss": "3.3.2",
|
||||||
"use-debounce": "^10.0.4",
|
"use-debounce": "^10.0.4",
|
||||||
"zod": "4.4.3",
|
"zod": "4.4.3",
|
||||||
@@ -1765,7 +1765,7 @@
|
|||||||
|
|
||||||
"slugify": ["slugify@1.6.9", "", {}, "sha512-vZ7rfeehZui7wQs438JXBckYLkIIdfHOXsaVEUMyS5fHo1483l1bMdo0EDSWYclY0yZKFOipDy4KHuKs6ssvdg=="],
|
"slugify": ["slugify@1.6.9", "", {}, "sha512-vZ7rfeehZui7wQs438JXBckYLkIIdfHOXsaVEUMyS5fHo1483l1bMdo0EDSWYclY0yZKFOipDy4KHuKs6ssvdg=="],
|
||||||
|
|
||||||
"sonner-native": ["sonner-native@0.21.2", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-gesture-handler": ">=2.16.1", "react-native-reanimated": ">=3.10.1", "react-native-safe-area-context": ">=4.10.5", "react-native-screens": ">=3.31.1", "react-native-svg": ">=15.6.0" } }, "sha512-LnGPmfgzrNIwcc+FvcLJqx8aH1dEHePRzvNR8aIR4kl9spySRkXK160GmQIazjfm6mSMlPqZwRa5eycvrzg/eQ=="],
|
"sonner-native": ["sonner-native@0.26.4", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-gesture-handler": ">=2.28.0", "react-native-reanimated": "^4.1.1", "react-native-safe-area-context": "^5.6.0", "react-native-screens": "^4.16.0", "react-native-svg": "^15.12.1", "react-native-worklets": ">=0.6.1" } }, "sha512-wBE/pctNfz+ieXjpYX7uu5hH38ws8xRmH0AFmEdEgkOS363k6N8QfFoyjGqDmdUDy15m4AAvOjd2Wz/jATukIA=="],
|
||||||
|
|
||||||
"source-map": ["source-map@0.5.7", "", {}, "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ=="],
|
"source-map": ["source-map@0.5.7", "", {}, "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ=="],
|
||||||
|
|
||||||
|
|||||||
@@ -564,9 +564,6 @@ export const Controls: FC<Props> = ({
|
|||||||
title: t("item_card.audio"),
|
title: t("item_card.audio"),
|
||||||
options: audioOptions,
|
options: audioOptions,
|
||||||
onSelect: handleAudioChange,
|
onSelect: handleAudioChange,
|
||||||
// In-player audio selection navigates (replacePlayer while transcoding);
|
|
||||||
// apply it after the modal is dismissed so it isn't swallowed.
|
|
||||||
deferApplyUntilDismissed: true,
|
|
||||||
});
|
});
|
||||||
controlsInteractionRef.current();
|
controlsInteractionRef.current();
|
||||||
}, [showOptions, t, audioOptions, handleAudioChange]);
|
}, [showOptions, t, audioOptions, handleAudioChange]);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ interface ShowOptionsParams<T> {
|
|||||||
onSelect: (value: T) => void;
|
onSelect: (value: T) => void;
|
||||||
cardWidth?: number;
|
cardWidth?: number;
|
||||||
cardHeight?: number;
|
cardHeight?: number;
|
||||||
deferApplyUntilDismissed?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useTVOptionModal = () => {
|
export const useTVOptionModal = () => {
|
||||||
@@ -27,7 +26,6 @@ export const useTVOptionModal = () => {
|
|||||||
onSelect: params.onSelect,
|
onSelect: params.onSelect,
|
||||||
cardWidth: params.cardWidth,
|
cardWidth: params.cardWidth,
|
||||||
cardHeight: params.cardHeight,
|
cardHeight: params.cardHeight,
|
||||||
deferApplyUntilDismissed: params.deferApplyUntilDismissed,
|
|
||||||
});
|
});
|
||||||
router.push("/(auth)/tv-option-modal");
|
router.push("/(auth)/tv-option-modal");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
"react-native-volume-manager": "^2.0.8",
|
"react-native-volume-manager": "^2.0.8",
|
||||||
"react-native-web": "^0.21.0",
|
"react-native-web": "^0.21.0",
|
||||||
"react-native-worklets": "0.8.3",
|
"react-native-worklets": "0.8.3",
|
||||||
"sonner-native": "0.21.2",
|
"sonner-native": "0.26.4",
|
||||||
"tailwindcss": "3.3.2",
|
"tailwindcss": "3.3.2",
|
||||||
"use-debounce": "^10.0.4",
|
"use-debounce": "^10.0.4",
|
||||||
"zod": "4.4.3"
|
"zod": "4.4.3"
|
||||||
|
|||||||
@@ -13,15 +13,6 @@ export type TVOptionModalState = {
|
|||||||
onSelect: (value: any) => void;
|
onSelect: (value: any) => void;
|
||||||
cardWidth?: number;
|
cardWidth?: number;
|
||||||
cardHeight?: number;
|
cardHeight?: number;
|
||||||
/**
|
|
||||||
* Run onSelect AFTER the modal route is dismissed. Needed only when onSelect
|
|
||||||
* navigates (the in-player audio switch replacing the player while
|
|
||||||
* transcoding), which the still-active modal route would otherwise swallow.
|
|
||||||
* Default (false) runs onSelect before closing, so state-only callers (detail
|
|
||||||
* page, library filters, settings) don't re-render after focus returns and
|
|
||||||
* lose TV focus.
|
|
||||||
*/
|
|
||||||
deferApplyUntilDismissed?: boolean;
|
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
export const tvOptionModalAtom = atom<TVOptionModalState>(null);
|
export const tvOptionModalAtom = atom<TVOptionModalState>(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user