This commit is contained in:
Fredrik Burmester
2024-09-17 18:49:11 +02:00
parent d716e42c20
commit 65579c88e5
8 changed files with 288 additions and 225 deletions

View File

@@ -273,47 +273,47 @@ export default function index() {
mediaListCollections, mediaListCollections,
]); ]);
// if (isConnected === false) { if (isConnected === false) {
// return ( return (
// <View className="flex flex-col items-center justify-center h-full -mt-6 px-8"> <View className="flex flex-col items-center justify-center h-full -mt-6 px-8">
// <Text className="text-3xl font-bold mb-2">No Internet</Text> <Text className="text-3xl font-bold mb-2">No Internet</Text>
// <Text className="text-center opacity-70"> <Text className="text-center opacity-70">
// No worries, you can still watch{"\n"}downloaded content. No worries, you can still watch{"\n"}downloaded content.
// </Text> </Text>
// <View className="mt-4"> <View className="mt-4">
// <Button <Button
// color="purple" color="purple"
// onPress={() => router.push("/(auth)/downloads")} onPress={() => router.push("/(auth)/downloads")}
// justify="center" justify="center"
// iconRight={ iconRight={
// <Ionicons name="arrow-forward" size={20} color="white" /> <Ionicons name="arrow-forward" size={20} color="white" />
// } }
// > >
// Go to downloads Go to downloads
// </Button> </Button>
// <Button <Button
// color="black" color="black"
// onPress={() => { onPress={() => {
// checkConnection(); checkConnection();
// }} }}
// justify="center" justify="center"
// className="mt-2" className="mt-2"
// iconRight={ iconRight={
// loadingRetry ? null : ( loadingRetry ? null : (
// <Ionicons name="refresh" size={20} color="white" /> <Ionicons name="refresh" size={20} color="white" />
// ) )
// } }
// > >
// {loadingRetry ? ( {loadingRetry ? (
// <ActivityIndicator size={"small"} color={"white"} /> <ActivityIndicator size={"small"} color={"white"} />
// ) : ( ) : (
// "Retry" "Retry"
// )} )}
// </Button> </Button>
// </View> </View>
// </View> </View>
// ); );
// } }
const insets = useSafeAreaInsets(); const insets = useSafeAreaInsets();

View File

@@ -1,4 +1,3 @@
import { CurrentlyPlayingBar } from "@/components/CurrentlyPlayingBar";
import { ItemContent } from "@/components/ItemContent"; import { ItemContent } from "@/components/ItemContent";
import { Stack, useLocalSearchParams } from "expo-router"; import { Stack, useLocalSearchParams } from "expo-router";
import React from "react"; import React from "react";

View File

@@ -1,4 +1,4 @@
import { CurrentlyPlayingBar } from "@/components/CurrentlyPlayingBar"; import { FullScreenVideoPlayer } from "@/components/FullScreenVideoPlayer";
import { JellyfinProvider } from "@/providers/JellyfinProvider"; import { JellyfinProvider } from "@/providers/JellyfinProvider";
import { JobQueueProvider } from "@/providers/JobQueueProvider"; import { JobQueueProvider } from "@/providers/JobQueueProvider";
import { PlaybackProvider } from "@/providers/PlaybackProvider"; import { PlaybackProvider } from "@/providers/PlaybackProvider";
@@ -126,7 +126,7 @@ function Layout() {
/> />
<Stack.Screen name="+not-found" /> <Stack.Screen name="+not-found" />
</Stack> </Stack>
<CurrentlyPlayingBar /> <FullScreenVideoPlayer />
<Toaster /> <Toaster />
</ThemeProvider> </ThemeProvider>
</PlaybackProvider> </PlaybackProvider>

View File

@@ -18,6 +18,8 @@ import { useAtom } from "jotai";
import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { import {
Alert, Alert,
AppState,
AppStateStatus,
Dimensions, Dimensions,
Pressable, Pressable,
TouchableOpacity, TouchableOpacity,
@@ -26,6 +28,7 @@ import {
import { Slider } from "react-native-awesome-slider"; import { Slider } from "react-native-awesome-slider";
import "react-native-gesture-handler"; import "react-native-gesture-handler";
import Animated, { import Animated, {
runOnJS,
useAnimatedStyle, useAnimatedStyle,
useSharedValue, useSharedValue,
withTiming, withTiming,
@@ -35,6 +38,7 @@ import Video, { OnProgressData } from "react-native-video";
import { Text } from "./common/Text"; import { Text } from "./common/Text";
import { itemRouter } from "./common/TouchableItemRouter"; import { itemRouter } from "./common/TouchableItemRouter";
import { Loader } from "./Loader"; import { Loader } from "./Loader";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
async function setOrientation(orientation: ScreenOrientation.OrientationLock) { async function setOrientation(orientation: ScreenOrientation.OrientationLock) {
await ScreenOrientation.lockAsync(orientation); await ScreenOrientation.lockAsync(orientation);
@@ -44,7 +48,7 @@ async function resetOrientation() {
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.DEFAULT); await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.DEFAULT);
} }
export const CurrentlyPlayingBar: React.FC = () => { export const FullScreenVideoPlayer: React.FC = () => {
const { const {
currentlyPlaying, currentlyPlaying,
pauseVideo, pauseVideo,
@@ -68,7 +72,8 @@ export const CurrentlyPlayingBar: React.FC = () => {
const { trickPlayUrl, calculateTrickplayUrl, trickplayInfo } = const { trickPlayUrl, calculateTrickplayUrl, trickplayInfo } =
useTrickplay(currentlyPlaying); useTrickplay(currentlyPlaying);
const { previousItem, nextItem } = useAdjacentEpisodes({ currentlyPlaying }); const { previousItem, nextItem } = useAdjacentEpisodes({ currentlyPlaying });
const { isVisible, showControls, hideControls } = useControlsVisibility(3000); const { showControls, hideControls, opacity } = useControlsVisibility(3000);
const [isInteractive, setIsInteractive] = useState(true);
const [ignoreSafeArea, setIgnoreSafeArea] = useState(false); const [ignoreSafeArea, setIgnoreSafeArea] = useState(false);
const from = useMemo(() => segments[2], [segments]); const from = useMemo(() => segments[2], [segments]);
@@ -82,14 +87,6 @@ export const CurrentlyPlayingBar: React.FC = () => {
const { width: screenWidth, height: screenHeight } = Dimensions.get("window"); const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
const toggleIgnoreSafeArea = useCallback(() => {
setIgnoreSafeArea((prev) => !prev);
}, []);
const handleToggleControlsPress = useCallback(() => {
isVisible ? hideControls() : showControls();
}, [isVisible, hideControls, showControls]);
const poster = useMemo(() => { const poster = useMemo(() => {
if (!currentlyPlaying?.item || !api) return ""; if (!currentlyPlaying?.item || !api) return "";
return currentlyPlaying.item.Type === "Audio" return currentlyPlaying.item.Type === "Audio"
@@ -122,6 +119,26 @@ export const CurrentlyPlayingBar: React.FC = () => {
}; };
}, [currentlyPlaying, api, poster]); }, [currentlyPlaying, api, poster]);
useEffect(() => {
const handleAppStateChange = (nextAppState: AppStateStatus) => {
if (nextAppState === "active") {
setIsInteractive(true);
showControls();
} else {
setIsInteractive(false);
}
};
const subscription = AppState.addEventListener(
"change",
handleAppStateChange
);
return () => {
subscription.remove();
};
}, [showControls]);
useEffect(() => { useEffect(() => {
max.value = currentlyPlaying?.item.RunTimeTicks || 0; max.value = currentlyPlaying?.item.RunTimeTicks || 0;
}, [currentlyPlaying?.item.RunTimeTicks]); }, [currentlyPlaying?.item.RunTimeTicks]);
@@ -150,12 +167,15 @@ export const CurrentlyPlayingBar: React.FC = () => {
const animatedStyles = { const animatedStyles = {
controls: useAnimatedStyle(() => ({ controls: useAnimatedStyle(() => ({
opacity: withTiming(isVisible ? 1 : 0, { duration: 300 }), opacity: withTiming(opacity.value, { duration: 300 }),
})), })),
videoContainer: useAnimatedStyle(() => ({ videoContainer: useAnimatedStyle(() => ({
opacity: withTiming(isVisible || localIsBuffering.value ? 0.5 : 1, { opacity: withTiming(
duration: 300, opacity.value === 1 || localIsBuffering.value ? 0.5 : 1,
}), {
duration: 300,
}
),
})), })),
loader: useAnimatedStyle(() => ({ loader: useAnimatedStyle(() => ({
opacity: withTiming(localIsBuffering.value ? 1 : 0, { duration: 300 }), opacity: withTiming(localIsBuffering.value ? 1 : 0, { duration: 300 }),
@@ -200,7 +220,9 @@ export const CurrentlyPlayingBar: React.FC = () => {
progress.value > showButtonAt && progress.value < hideButtonAt; progress.value > showButtonAt && progress.value < hideButtonAt;
return { return {
opacity: withTiming( opacity: withTiming(
localIsBuffering.value === false && isVisible && showButton ? 1 : 0, localIsBuffering.value === false && opacity.value === 1 && showButton
? 1
: 0,
{ {
duration: 300, duration: 300,
} }
@@ -208,6 +230,18 @@ export const CurrentlyPlayingBar: React.FC = () => {
}; };
}); });
const toggleIgnoreSafeArea = useCallback(() => {
setIgnoreSafeArea((prev) => !prev);
}, []);
const handleToggleControlsPress = useCallback(() => {
if (opacity.value === 1) {
hideControls();
} else {
showControls();
}
}, [opacity.value, hideControls, showControls]);
const skipIntro = useCallback(async () => { const skipIntro = useCallback(async () => {
if (!introTimestamps || !videoRef.current) return; if (!introTimestamps || !videoRef.current) return;
try { try {
@@ -298,7 +332,67 @@ export const CurrentlyPlayingBar: React.FC = () => {
[progress, calculateTrickplayUrl, showControls] [progress, calculateTrickplayUrl, showControls]
); );
if (!api || !currentlyPlaying) return null; const handleGoToPreviousItem = useCallback(() => {
if (!previousItem || !from) return;
const url = itemRouter(previousItem, from);
stopPlayback();
// @ts-ignore
router.push(url);
}, [previousItem, from, stopPlayback, router]);
const handleGoToNextItem = useCallback(() => {
if (!nextItem || !from) return;
const url = itemRouter(nextItem, from);
stopPlayback();
// @ts-ignore
router.push(url);
}, [nextItem, from, stopPlayback, router]);
const videoTap = Gesture.Tap().onBegin(() => {
runOnJS(handleToggleControlsPress)();
});
const toggleIgnoreSafeAreaGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(toggleIgnoreSafeArea)();
});
const playPauseGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(handlePlayPause)();
});
const goToPreviouItemGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(handleGoToPreviousItem)();
});
const goToNextItemGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(handleGoToNextItem)();
});
const skipBackwardGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(handleSkipBackward)();
});
const skipForwardGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(handleSkipForward)();
});
const skipIntroGesture = Gesture.Tap()
.enabled(opacity.value !== 0)
.onStart(() => {
runOnJS(skipIntro)();
});
if (!api || !currentlyPlaying) return null; if (!api || !currentlyPlaying) return null;
@@ -310,72 +404,74 @@ export const CurrentlyPlayingBar: React.FC = () => {
backgroundColor: "black", backgroundColor: "black",
}} }}
> >
<Animated.View <GestureDetector gesture={videoTap}>
style={[ <Animated.View
{ style={[
position: "absolute", {
top: 0, position: "absolute",
bottom: 0, top: 0,
left: ignoreSafeArea ? 0 : insets.left, bottom: 0,
right: ignoreSafeArea ? 0 : insets.right, left: ignoreSafeArea ? 0 : insets.left,
width: ignoreSafeArea right: ignoreSafeArea ? 0 : insets.right,
? screenWidth width: ignoreSafeArea
: screenWidth - (insets.left + insets.right), ? screenWidth
}, : screenWidth - (insets.left + insets.right),
animatedStyles.videoContainer, },
]} animatedStyles.videoContainer,
> ]}
<Pressable
onPress={handleToggleControlsPress}
style={{
width: "100%",
height: "100%",
}}
> >
{videoSource && ( <View
<Video style={{
ref={videoRef} width: "100%",
allowsExternalPlayback height: "100%",
style={{ }}
width: "100%", >
height: "100%", {videoSource && (
}} <Video
resizeMode="contain" ref={videoRef}
playWhenInactive={true} allowsExternalPlayback
playInBackground={true} style={{
showNotificationControls={true} width: "100%",
ignoreSilentSwitch="ignore" height: "100%",
controls={false} }}
pictureInPicture={true} resizeMode="contain"
onProgress={handleVideoProgress} playWhenInactive={true}
subtitleStyle={{ playInBackground={true}
fontSize: 16, showNotificationControls={true}
}} ignoreSilentSwitch="ignore"
source={videoSource} controls={false}
onPlaybackStateChanged={(e) => { pictureInPicture={true}
if (e.isPlaying === true) { onProgress={handleVideoProgress}
playVideo(false); subtitleStyle={{
} else if (e.isPlaying === false) { fontSize: 16,
pauseVideo(false); }}
} source={videoSource}
}} onPlaybackStateChanged={(e) => {
onVolumeChange={(e) => { if (e.isPlaying === true) {
setVolume(e.volume); playVideo(false);
}} } else if (e.isPlaying === false) {
progressUpdateInterval={1000} pauseVideo(false);
onError={handleVideoError} }
renderLoader={ }}
<View onBuffer={(e) => {
pointerEvents="none" if (e.isBuffering) {
className="absolute w-screen h-screen top-0 left-0 items-center justify-center" setIsBuffering(true);
> localIsBuffering.value = true;
<Loader /> }
</View> }}
} onRestoreUserInterfaceForPictureInPictureStop={() => {
/> showControls();
)} }}
</Pressable> onVolumeChange={(e) => {
</Animated.View> setVolume(e.volume);
}}
progressUpdateInterval={1000}
onError={handleVideoError}
/>
)}
</View>
</Animated.View>
</GestureDetector>
<Animated.View <Animated.View
pointerEvents="none" pointerEvents="none"
@@ -402,21 +498,18 @@ export const CurrentlyPlayingBar: React.FC = () => {
style={[ style={[
{ {
position: "absolute", position: "absolute",
bottom: insets.bottom + 8 * 7, bottom: insets.bottom + 8 * 8,
right: insets.right + 32, right: insets.right + 32,
zIndex: 10,
}, },
animatedIntroSkipperStyle, animatedIntroSkipperStyle,
]} ]}
> >
<View className="flex flex-row items-center h-full"> <View className="flex flex-row items-center h-full">
<TouchableOpacity <TouchableOpacity className="flex flex-col items-center justify-center px-2 py-1.5 bg-purple-600 rounded-full">
disabled={!isVisible} <GestureDetector gesture={skipIntroGesture}>
onPress={() => { <Text>Skip intro</Text>
skipIntro(); </GestureDetector>
}}
className="flex flex-col items-center justify-center px-2 py-1.5 bg-purple-600 rounded-full"
>
<Text>Skip intro</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</Animated.View> </Animated.View>
@@ -433,21 +526,17 @@ export const CurrentlyPlayingBar: React.FC = () => {
]} ]}
> >
<View className="flex flex-row items-center h-full"> <View className="flex flex-row items-center h-full">
<GestureDetector gesture={toggleIgnoreSafeAreaGesture}>
<TouchableOpacity className="aspect-square rounded flex flex-col items-center justify-center p-2">
<Ionicons
name={ignoreSafeArea ? "contract-outline" : "expand"}
size={24}
color="white"
/>
</TouchableOpacity>
</GestureDetector>
<TouchableOpacity <TouchableOpacity
disabled={!isVisible}
onPress={() => {
toggleIgnoreSafeArea();
}}
className="aspect-square rounded flex flex-col items-center justify-center p-2"
>
<Ionicons
name={ignoreSafeArea ? "contract-outline" : "expand"}
size={24}
color="white"
/>
</TouchableOpacity>
<TouchableOpacity
disabled={!isVisible}
onPress={() => { onPress={() => {
stopPlayback(); stopPlayback();
}} }}
@@ -488,65 +577,56 @@ export const CurrentlyPlayingBar: React.FC = () => {
</Text> </Text>
)} )}
</View> </View>
<View className="flex flex-row items-center space-x-6 rounded-full py-1.5 pl-4 pr-4 bg-neutral-800"> <View className="flex flex-row items-center space-x-6 rounded-full py-2 pl-4 pr-4 bg-neutral-800">
<View className="flex flex-row items-center space-x-2"> <View className="flex flex-row items-center space-x-2">
<TouchableOpacity <TouchableOpacity
disabled={!previousItem || !isVisible || !from}
style={{ style={{
opacity: !previousItem ? 0.5 : 1, opacity: !previousItem ? 0.5 : 1,
}} }}
onPress={() => {
if (!previousItem || !from) return;
const url = itemRouter(previousItem, from);
stopPlayback();
// @ts-ignore
router.push(url);
}}
> >
<Ionicons name="play-skip-back" size={18} color="white" /> <GestureDetector gesture={goToPreviouItemGesture}>
<Ionicons name="play-skip-back" size={20} color="white" />
</GestureDetector>
</TouchableOpacity>
<TouchableOpacity>
<GestureDetector gesture={skipBackwardGesture}>
<Ionicons
name="refresh-outline"
size={24}
color="white"
style={{
transform: [{ scaleY: -1 }, { rotate: "180deg" }],
}}
/>
</GestureDetector>
</TouchableOpacity>
<TouchableOpacity>
<GestureDetector gesture={playPauseGesture}>
<Ionicons
name={isPlaying ? "pause" : "play"}
size={26}
color="white"
/>
</GestureDetector>
</TouchableOpacity>
<TouchableOpacity>
<GestureDetector gesture={skipForwardGesture}>
<Ionicons name="refresh-outline" size={24} color="white" />
</GestureDetector>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
disabled={!isVisible}
onPress={handleSkipBackward}
>
<Ionicons
name="refresh-outline"
size={22}
color="white"
style={{
transform: [{ scaleY: -1 }, { rotate: "180deg" }],
}}
/>
</TouchableOpacity>
<TouchableOpacity disabled={!isVisible} onPress={handlePlayPause}>
<Ionicons
name={isPlaying ? "pause" : "play"}
size={24}
color="white"
/>
</TouchableOpacity>
<TouchableOpacity disabled={!isVisible} onPress={handleSkipForward}>
<Ionicons name="refresh-outline" size={22} color="white" />
</TouchableOpacity>
<TouchableOpacity
disabled={!nextItem || !isVisible || !from}
style={{ style={{
opacity: !nextItem ? 0.5 : 1, opacity: !nextItem ? 0.5 : 1,
}} }}
onPress={() => {
if (!nextItem || !from) return;
const url = itemRouter(nextItem, from);
stopPlayback();
// @ts-ignore
router.push(url);
}}
> >
<Ionicons name="play-skip-forward" size={18} color="white" /> <GestureDetector gesture={goToNextItemGesture}>
<Ionicons name="play-skip-forward" size={20} color="white" />
</GestureDetector>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View className="flex flex-col w-full shrink"> <View className="flex flex-col w-full shrink">
<Slider <Slider
disable={!isVisible} disable={opacity.value === 0}
theme={{ theme={{
maximumTrackTintColor: "rgba(255,255,255,0.2)", maximumTrackTintColor: "rgba(255,255,255,0.2)",
minimumTrackTintColor: "#fff", minimumTrackTintColor: "#fff",
@@ -577,6 +657,7 @@ export const CurrentlyPlayingBar: React.FC = () => {
height: tileHeight, height: tileHeight,
marginLeft: -tileWidth / 4, marginLeft: -tileWidth / 4,
marginTop: -tileHeight / 4 - 60, marginTop: -tileHeight / 4 - 60,
marginBottom: 10,
}} }}
className=" bg-neutral-800 overflow-hidden" className=" bg-neutral-800 overflow-hidden"
> >
@@ -597,17 +678,17 @@ export const CurrentlyPlayingBar: React.FC = () => {
</View> </View>
); );
}} }}
sliderHeight={8} sliderHeight={10}
thumbWidth={0} thumbWidth={0}
progress={progress} progress={progress}
minimumValue={min} minimumValue={min}
maximumValue={max} maximumValue={max}
/> />
<View className="flex flex-row items-center justify-between"> <View className="flex flex-row items-center justify-between -mb-0.5">
<Text className="text-[10px] text-neutral-400"> <Text className="text-[12px] text-neutral-400">
{runtimeTicksToSeconds(progress.value)} {runtimeTicksToSeconds(progress.value)}
</Text> </Text>
<Text className="text-[10px] text-neutral-400"> <Text className="text-[12px] text-neutral-400">
-{runtimeTicksToSeconds(max.value - progress.value)} -{runtimeTicksToSeconds(max.value - progress.value)}
</Text> </Text>
</View> </View>

View File

@@ -97,22 +97,6 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
/> />
</View> </View>
<View className="flex flex-row items-center justify-between bg-neutral-900 p-4">
<View className="shrink">
<Text className="font-semibold">Start videos in fullscreen</Text>
<Text className="text-xs opacity-50">
Clicking a video will start it in fullscreen mode, instead of
inline.
</Text>
</View>
<Switch
value={settings.openFullScreenVideoPlayerByDefault}
onValueChange={(value) =>
updateSettings({ openFullScreenVideoPlayerByDefault: value })
}
/>
</View>
<View className="flex flex-row space-x-2 items-center justify-between bg-neutral-900 p-4"> <View className="flex flex-row space-x-2 items-center justify-between bg-neutral-900 p-4">
<View className="flex flex-col shrink"> <View className="flex flex-col shrink">
<Text className="font-semibold">Use external player (VLC)</Text> <Text className="font-semibold">Use external player (VLC)</Text>

View File

@@ -1,23 +1,29 @@
import { useRef, useCallback, useState, useEffect } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import {
runOnJS,
useAnimatedReaction,
useSharedValue,
} from "react-native-reanimated";
export const useControlsVisibility = (timeout: number = 3000) => { export const useControlsVisibility = (timeout: number = 3000) => {
const [isVisible, setIsVisible] = useState(true); const opacity = useSharedValue(1);
const hideControlsTimerRef = useRef<ReturnType<typeof setTimeout> | null>( const hideControlsTimerRef = useRef<ReturnType<typeof setTimeout> | null>(
null null
); );
const showControls = useCallback(() => { const showControls = useCallback(() => {
setIsVisible(true); opacity.value = 1;
if (hideControlsTimerRef.current) { if (hideControlsTimerRef.current) {
clearTimeout(hideControlsTimerRef.current); clearTimeout(hideControlsTimerRef.current);
} }
hideControlsTimerRef.current = setTimeout(() => { hideControlsTimerRef.current = setTimeout(() => {
setIsVisible(false); opacity.value = 0;
}, timeout); }, timeout);
}, [timeout]); }, [timeout]);
const hideControls = useCallback(() => { const hideControls = useCallback(() => {
setIsVisible(false); opacity.value = 0;
if (hideControlsTimerRef.current) { if (hideControlsTimerRef.current) {
clearTimeout(hideControlsTimerRef.current); clearTimeout(hideControlsTimerRef.current);
} }
@@ -31,5 +37,5 @@ export const useControlsVisibility = (timeout: number = 3000) => {
}; };
}, []); }, []);
return { isVisible, showControls, hideControls }; return { opacity, showControls, hideControls };
}; };

View File

@@ -114,13 +114,8 @@ export const PlaybackProvider: React.FC<{ children: ReactNode }> = ({
setCurrentlyPlaying(state); setCurrentlyPlaying(state);
setIsPlaying(true); setIsPlaying(true);
if (settings?.openFullScreenVideoPlayerByDefault) {
setTimeout(() => {
presentFullscreenPlayer();
}, 300);
}
}, },
[settings?.openFullScreenVideoPlayerByDefault] []
); );
const setCurrentlyPlayingState = useCallback( const setCurrentlyPlayingState = useCallback(

View File

@@ -57,7 +57,6 @@ export type DefaultLanguageOption = {
type Settings = { type Settings = {
autoRotate?: boolean; autoRotate?: boolean;
forceLandscapeInVideoPlayer?: boolean; forceLandscapeInVideoPlayer?: boolean;
openFullScreenVideoPlayerByDefault?: boolean;
usePopularPlugin?: boolean; usePopularPlugin?: boolean;
deviceProfile?: "Expo" | "Native" | "Old"; deviceProfile?: "Expo" | "Native" | "Old";
forceDirectPlay?: boolean; forceDirectPlay?: boolean;
@@ -85,7 +84,6 @@ const loadSettings = async (): Promise<Settings> => {
const defaultValues: Settings = { const defaultValues: Settings = {
autoRotate: true, autoRotate: true,
forceLandscapeInVideoPlayer: false, forceLandscapeInVideoPlayer: false,
openFullScreenVideoPlayerByDefault: false,
usePopularPlugin: false, usePopularPlugin: false,
deviceProfile: "Expo", deviceProfile: "Expo",
forceDirectPlay: false, forceDirectPlay: false,