mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-22 02:58:04 +00:00
Compare commits
3 Commits
refactor/s
...
v0.17.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71da79ee6a | ||
|
|
5cff323871 | ||
|
|
39b7c66d34 |
@@ -22,11 +22,9 @@ import { Dimensions, Pressable, StatusBar, View } from "react-native";
|
|||||||
import { useSharedValue } from "react-native-reanimated";
|
import { useSharedValue } from "react-native-reanimated";
|
||||||
import Video, {
|
import Video, {
|
||||||
OnProgressData,
|
OnProgressData,
|
||||||
VideoRef,
|
|
||||||
SelectedTrack,
|
|
||||||
SelectedTrackType,
|
SelectedTrackType,
|
||||||
|
VideoRef,
|
||||||
} from "react-native-video";
|
} from "react-native-video";
|
||||||
import { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
||||||
|
|
||||||
export default function page() {
|
export default function page() {
|
||||||
const { playSettings, playUrl, playSessionId } = usePlaySettings();
|
const { playSettings, playUrl, playSessionId } = usePlaySettings();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { useFocusEffect, useNavigation } from "expo-router";
|
|||||||
import * as ScreenOrientation from "expo-screen-orientation";
|
import * as ScreenOrientation from "expo-screen-orientation";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { View } from "react-native";
|
import { Alert, View } from "react-native";
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { Chromecast } from "./Chromecast";
|
import { Chromecast } from "./Chromecast";
|
||||||
import { ItemHeader } from "./ItemHeader";
|
import { ItemHeader } from "./ItemHeader";
|
||||||
@@ -59,6 +59,11 @@ export const ItemContent: React.FC<{ item: BaseItemDto }> = React.memo(
|
|||||||
audioIndex,
|
audioIndex,
|
||||||
subtitleIndex,
|
subtitleIndex,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!mediaSource) {
|
||||||
|
Alert.alert("Error", "No media source found for this item.");
|
||||||
|
navigation.goBack();
|
||||||
|
}
|
||||||
}, [item, settings])
|
}, [item, settings])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -123,17 +123,6 @@ export const Controls: React.FC<Props> = ({
|
|||||||
|
|
||||||
const wasPlayingRef = useRef(false);
|
const wasPlayingRef = useRef(false);
|
||||||
|
|
||||||
const updateTimes = useCallback(
|
|
||||||
(currentProgress: number, maxValue: number) => {
|
|
||||||
const current = ticksToSeconds(currentProgress);
|
|
||||||
const remaining = ticksToSeconds(maxValue - currentProgress);
|
|
||||||
|
|
||||||
setCurrentTime(current);
|
|
||||||
setRemainingTime(remaining);
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const { showSkipButton, skipIntro } = useIntroSkipper(
|
const { showSkipButton, skipIntro } = useIntroSkipper(
|
||||||
item.Id,
|
item.Id,
|
||||||
currentTime,
|
currentTime,
|
||||||
@@ -180,6 +169,23 @@ export const Controls: React.FC<Props> = ({
|
|||||||
router.replace("/play-video");
|
router.replace("/play-video");
|
||||||
}, [nextItem, settings]);
|
}, [nextItem, settings]);
|
||||||
|
|
||||||
|
const updateTimes = useCallback(
|
||||||
|
(currentProgress: number, maxValue: number) => {
|
||||||
|
const current = ticksToSeconds(currentProgress);
|
||||||
|
const remaining = ticksToSeconds(maxValue - currentProgress);
|
||||||
|
|
||||||
|
setCurrentTime(current);
|
||||||
|
setRemainingTime(remaining);
|
||||||
|
|
||||||
|
if (currentProgress === maxValue) {
|
||||||
|
setShowControls(true);
|
||||||
|
// Automatically play the next item if it exists
|
||||||
|
goToNextItem();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[goToNextItem]
|
||||||
|
);
|
||||||
|
|
||||||
useAnimatedReaction(
|
useAnimatedReaction(
|
||||||
() => ({
|
() => ({
|
||||||
progress: progress.value,
|
progress: progress.value,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Settings } from "../atoms/settings";
|
|||||||
interface PlaySettings {
|
interface PlaySettings {
|
||||||
item: BaseItemDto;
|
item: BaseItemDto;
|
||||||
bitrate: (typeof BITRATES)[0];
|
bitrate: (typeof BITRATES)[0];
|
||||||
mediaSource: MediaSourceInfo | undefined;
|
mediaSource?: MediaSourceInfo | null;
|
||||||
audioIndex?: number | null;
|
audioIndex?: number | null;
|
||||||
subtitleIndex?: number | null;
|
subtitleIndex?: number | null;
|
||||||
}
|
}
|
||||||
@@ -29,9 +29,8 @@ export function getDefaultPlaySettings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. Get first media source
|
// 1. Get first media source
|
||||||
const mediaSource = item.MediaSources?.[0];
|
|
||||||
|
|
||||||
if (!mediaSource) throw new Error("No media source found");
|
const mediaSource = item.MediaSources?.[0];
|
||||||
|
|
||||||
// 2. Get default or preferred audio
|
// 2. Get default or preferred audio
|
||||||
const defaultAudioIndex = mediaSource?.DefaultAudioStreamIndex;
|
const defaultAudioIndex = mediaSource?.DefaultAudioStreamIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user