Chore: log cleanups, and Vo settings enablement

Added the ability to swap VO options for android only between "GPU" and
"GPU-next"
Removed some console logs from previous debugging
Added the ability to see what VO is being used to render in the video
player

Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
Lance Chant
2026-05-25 14:19:36 +02:00
parent 4253f0d5ab
commit 6b0f8b833f
12 changed files with 200 additions and 40 deletions

View File

@@ -0,0 +1,66 @@
import { Ionicons } from "@expo/vector-icons";
import type React from "react";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Platform, View } from "react-native";
import { PlatformDropdown } from "@/components/PlatformDropdown";
import { type MpvVoDriver, useSettings } from "@/utils/atoms/settings";
import { Text } from "../common/Text";
import { ListGroup } from "../list/ListGroup";
import { ListItem } from "../list/ListItem";
const VO_DRIVER_OPTIONS: { key: string; value: MpvVoDriver }[] = [
{ key: "home.settings.vo_driver.gpu_next", value: "gpu-next" },
{ key: "home.settings.vo_driver.gpu", value: "gpu" },
];
export const MpvVoSettings: React.FC = () => {
const { settings, updateSettings } = useSettings();
const { t } = useTranslation();
const voDriverOptions = useMemo(
() => [
{
options: VO_DRIVER_OPTIONS.map((option) => ({
type: "radio" as const,
label: t(option.key),
value: option.value,
selected: option.value === (settings?.mpvVoDriver ?? "gpu-next"),
onPress: () => updateSettings({ mpvVoDriver: option.value }),
})),
},
],
[settings?.mpvVoDriver, t, updateSettings],
);
const currentVoDriverLabel = useMemo(() => {
const option = VO_DRIVER_OPTIONS.find(
(o) => o.value === (settings?.mpvVoDriver ?? "gpu-next"),
);
return option ? t(option.key) : t("home.settings.vo_driver.gpu_next");
}, [settings?.mpvVoDriver, t]);
// Only show on Android
if (Platform.OS !== "android") return null;
if (!settings) return null;
return (
<ListGroup title={t("home.settings.vo_driver.title")} className='mb-4'>
<ListItem title={t("home.settings.vo_driver.vo_mode")}>
<PlatformDropdown
groups={voDriverOptions}
trigger={
<View className='flex flex-row items-center justify-between py-1.5 pl-3'>
<Text className='mr-1 text-[#8E8D91]'>
{currentVoDriverLabel}
</Text>
<Ionicons name='chevron-expand-sharp' size={18} color='#5A5960' />
</View>
}
title={t("home.settings.vo_driver.vo_mode")}
/>
</ListItem>
</ListGroup>
);
};

View File

@@ -912,20 +912,6 @@ export const Controls: FC<Props> = ({
setFocusPlayButton(false);
}, [setShowControls]);
// On initial mount when controls start visible, focus the play button.
// playButtonRef transitions from null → View on first render; once set,
// this effect won't re-fire (playButtonRef is a stable reference).
const initialFocusDone = useRef(false);
useEffect(() => {
if (!initialFocusDone.current && playButtonRef && showControls) {
initialFocusDone.current = true;
const t = setTimeout(() => {
playButtonRef.focus();
}, 100);
return () => clearTimeout(t);
}
}, [showControls, playButtonRef]);
// When controls hide (and no skip/countdown overlay is visible), move focus
// to the invisible overlay so hidden buttons can't receive select events.
useEffect(() => {
@@ -1226,7 +1212,6 @@ export const Controls: FC<Props> = ({
<Animated.View
style={[styles.bottomContainer, bottomAnimatedStyle]}
pointerEvents={showControls ? "auto" : "none"}
focusable={showControls}
>
<View
style={[

View File

@@ -350,6 +350,12 @@ export const TechnicalInfoOverlay: FC<TechnicalInfoOverlayProps> = memo(
Buffer: {info.cacheSeconds.toFixed(1)}s
</Text>
)}
{info?.voDriver && (
<Text style={textStyle}>
VO: {info.voDriver}
{info.hwdec ? ` / ${info.hwdec}` : ""}
</Text>
)}
{info?.droppedFrames !== undefined && info.droppedFrames > 0 && (
<Text style={[textStyle, styles.warningText]}>
Dropped: {info.droppedFrames} frames