mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-12 08:50:25 +01:00
Added temporary fix
This commit is contained in:
@@ -38,7 +38,6 @@ import Video, {
|
|||||||
SelectedTrackType,
|
SelectedTrackType,
|
||||||
VideoRef,
|
VideoRef,
|
||||||
} from "react-native-video";
|
} from "react-native-video";
|
||||||
import index from "../(tabs)/(home)";
|
|
||||||
|
|
||||||
const Player = () => {
|
const Player = () => {
|
||||||
const api = useAtomValue(apiAtom);
|
const api = useAtomValue(apiAtom);
|
||||||
@@ -54,6 +53,7 @@ const Player = () => {
|
|||||||
const [ignoreSafeAreas, setIgnoreSafeAreas] = useState(false);
|
const [ignoreSafeAreas, setIgnoreSafeAreas] = useState(false);
|
||||||
const [isPlaying, setIsPlaying] = useState(false);
|
const [isPlaying, setIsPlaying] = useState(false);
|
||||||
const [isBuffering, setIsBuffering] = useState(true);
|
const [isBuffering, setIsBuffering] = useState(true);
|
||||||
|
const [isVideoLoaded, setIsVideoLoaded] = useState(false);
|
||||||
|
|
||||||
const setShowControls = useCallback((show: boolean) => {
|
const setShowControls = useCallback((show: boolean) => {
|
||||||
_setShowControls(show);
|
_setShowControls(show);
|
||||||
@@ -117,7 +117,14 @@ const Player = () => {
|
|||||||
isLoading: isLoadingStreamUrl,
|
isLoading: isLoadingStreamUrl,
|
||||||
isError: isErrorStreamUrl,
|
isError: isErrorStreamUrl,
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["stream-url", itemId, bitrateValue, mediaSourceId],
|
queryKey: [
|
||||||
|
"stream-url",
|
||||||
|
itemId,
|
||||||
|
bitrateValue,
|
||||||
|
mediaSourceId,
|
||||||
|
subtitleIndex,
|
||||||
|
audioIndex,
|
||||||
|
],
|
||||||
|
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ export const Controls: React.FC<Props> = ({
|
|||||||
const minutes = Math.floor((progressInSeconds % 3600) / 60);
|
const minutes = Math.floor((progressInSeconds % 3600) / 60);
|
||||||
const seconds = progressInSeconds % 60;
|
const seconds = progressInSeconds % 60;
|
||||||
setTime({ hours, minutes, seconds });
|
setTime({ hours, minutes, seconds });
|
||||||
}, 10),
|
}, 3),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,15 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
// Either its on a text subtitle or its on not on any subtitle therefore it should show all the embedded HLS subtitles.
|
// Either its on a text subtitle or its on not on any subtitle therefore it should show all the embedded HLS subtitles.
|
||||||
const isOnTextSubtitle =
|
|
||||||
mediaSource?.MediaStreams?.find(
|
const isOnTextSubtitle = useMemo(() => {
|
||||||
(x) => x.Index === parseInt(subtitleIndex) && x.IsTextSubtitleStream
|
const res = Boolean(
|
||||||
) || subtitleIndex === "-1";
|
mediaSource?.MediaStreams?.find(
|
||||||
|
(x) => x.Index === parseInt(subtitleIndex) && x.IsTextSubtitleStream
|
||||||
|
) || subtitleIndex === "-1"
|
||||||
|
);
|
||||||
|
return res;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const allSubs =
|
const allSubs =
|
||||||
mediaSource?.MediaStreams?.filter((x) => x.Type === "Subtitle") ?? [];
|
mediaSource?.MediaStreams?.filter((x) => x.Type === "Subtitle") ?? [];
|
||||||
@@ -76,8 +81,6 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("sortedSubtitles", sortedSubtitles);
|
|
||||||
|
|
||||||
return [disableSubtitle, ...sortedSubtitles];
|
return [disableSubtitle, ...sortedSubtitles];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +93,7 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
return [disableSubtitle, ...transcodedSubtitle];
|
return [disableSubtitle, ...transcodedSubtitle];
|
||||||
}, [item, isVideoLoaded, subtitleTracks, mediaSource?.MediaStreams]);
|
}, [item, isVideoLoaded, subtitleTracks, mediaSource?.MediaStreams]);
|
||||||
|
|
||||||
const ChangeTranscodingSubtitle = useCallback(
|
const changeToImageBasedSub = useCallback(
|
||||||
(subtitleIndex: number) => {
|
(subtitleIndex: number) => {
|
||||||
const queryParams = new URLSearchParams({
|
const queryParams = new URLSearchParams({
|
||||||
itemId: item.Id ?? "", // Ensure itemId is a string
|
itemId: item.Id ?? "", // Ensure itemId is a string
|
||||||
@@ -180,7 +183,7 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
<DropdownMenu.CheckboxItem
|
<DropdownMenu.CheckboxItem
|
||||||
value={
|
value={
|
||||||
subtitleIndex ===
|
subtitleIndex ===
|
||||||
(sub.IsTextSubtitleStream && isOnTextSubtitle
|
(isOnTextSubtitle && sub.IsTextSubtitleStream
|
||||||
? getSourceSubtitleIndex(sub.index).toString()
|
? getSourceSubtitleIndex(sub.index).toString()
|
||||||
: sub?.index.toString())
|
: sub?.index.toString())
|
||||||
}
|
}
|
||||||
@@ -189,7 +192,7 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
console.log("sub", sub);
|
console.log("sub", sub);
|
||||||
if (
|
if (
|
||||||
subtitleIndex ===
|
subtitleIndex ===
|
||||||
(sub.IsTextSubtitleStream && isOnTextSubtitle
|
(isOnTextSubtitle && sub.IsTextSubtitleStream
|
||||||
? getSourceSubtitleIndex(sub.index).toString()
|
? getSourceSubtitleIndex(sub.index).toString()
|
||||||
: sub?.index.toString())
|
: sub?.index.toString())
|
||||||
)
|
)
|
||||||
@@ -206,8 +209,7 @@ const DropdownView: React.FC<DropdownViewProps> = ({ showControls }) => {
|
|||||||
setSubtitleTrack && setSubtitleTrack(sub.index);
|
setSubtitleTrack && setSubtitleTrack(sub.index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("ChangeTranscodingSubtitle", subtitleIndex);
|
changeToImageBasedSub(sub.index);
|
||||||
ChangeTranscodingSubtitle(sub.index);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DropdownMenu.ItemTitle key={`subtitle-item-title-${idx}`}>
|
<DropdownMenu.ItemTitle key={`subtitle-item-title-${idx}`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user