mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-06 20:42:55 +01:00
Compare commits
1 Commits
renovate/r
...
fix/tv-aud
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab90a1a52e |
@@ -893,6 +893,22 @@ 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();
|
||||||
|
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,
|
||||||
@@ -904,7 +920,14 @@ 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,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
Animated,
|
Animated,
|
||||||
Easing,
|
Easing,
|
||||||
|
InteractionManager,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TVFocusGuideView,
|
TVFocusGuideView,
|
||||||
@@ -75,9 +76,13 @@ export default function TVOptionModal() {
|
|||||||
}, [isReady]);
|
}, [isReady]);
|
||||||
|
|
||||||
const handleSelect = (value: any) => {
|
const handleSelect = (value: any) => {
|
||||||
modalState?.onSelect(value);
|
// Close FIRST, run the callback after this modal route is dismissed: an
|
||||||
|
// onSelect that navigates (e.g. the transcode audio switch replacing the
|
||||||
|
// player) would otherwise target the MODAL route and be swallowed.
|
||||||
|
const onSelect = modalState?.onSelect;
|
||||||
store.set(tvOptionModalAtom, null);
|
store.set(tvOptionModalAtom, null);
|
||||||
router.back();
|
router.back();
|
||||||
|
InteractionManager.runAfterInteractions(() => onSelect?.(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = useCallback(() => {
|
const handleClose = useCallback(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user