diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index 17880f310..e24dfbafa 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -541,9 +541,11 @@ settings-osc-router-network-address-placeholder = IPV4 address ## OSC VRChat settings settings-osc-vrchat = VRChat OSC Trackers # This cares about multilines -settings-osc-vrchat-description-v1 = +settings-osc-vrchat-description-v2 = Change settings specific to the OSC Trackers standard used for sending tracking data to applications without SteamVR (ex. Quest standalone). +# This cares about multilines +settings-osc-vrchat-description-guide = Make sure to enable OSC in VRChat via the Action Menu under OSC > Enabled. To allow receiving HMD and controller data from VRChat, go in your main menu's settings under Tracking & IK > Allow Sending Head and Wrist VR Tracking OSC Data. @@ -765,6 +767,9 @@ onboarding-usage-vr-choose-standalone = i use standalone onboarding-usage-vr-choose-standalone-label = for portable vr onboarding-usage-vr-choose-standalone-description = this happens if standalone +onboarding-usage-vr-standalone-title = Setting up VRChat +onboarding-usage-vr-standalone-next = Done! + ## Tracker assignment setup onboarding-assign_trackers-back = Go Back to Wi-Fi Credentials onboarding-assign_trackers-title = Assign trackers diff --git a/gui/public/videos/vrchatosc.webm b/gui/public/videos/vrchatosc.webm new file mode 100644 index 000000000..8a989e340 Binary files /dev/null and b/gui/public/videos/vrchatosc.webm differ diff --git a/gui/src/App.tsx b/gui/src/App.tsx index 8152849da..7ed52a9d4 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -58,6 +58,7 @@ import { useDiscordPresence } from './hooks/discord-presence'; import { AdvancedSettings } from './components/settings/pages/AdvancedSettings'; import { UsageChoose } from './components/onboarding/pages/usage-reason/UsageChoose'; import { VRUsageChoose } from './components/onboarding/pages/usage-reason/VRUsageChoose'; +import { StandaloneUsageSetup } from './components/onboarding/pages/usage-reason/StandaloneUsageSetup'; export const GH_REPO = 'SlimeVR/SlimeVR-Server'; export const VersionContext = createContext(''); @@ -136,6 +137,10 @@ function Layout() { /> } /> } /> + } + /> } /> } /> }> diff --git a/gui/src/components/commons/PausableVideo.tsx b/gui/src/components/commons/PausableVideo.tsx new file mode 100644 index 000000000..ea6a3ff6e --- /dev/null +++ b/gui/src/components/commons/PausableVideo.tsx @@ -0,0 +1,56 @@ +import { useRef, useState } from 'react'; +import { PlayCircleIcon } from './icon/PlayIcon'; +import { useDebouncedEffect } from '@/hooks/timeout'; + +export function PausableVideo({ + src, + poster, +}: { + src?: string; + poster?: string; +}) { + const videoRef = useRef(null); + const [paused, setPaused] = useState(true); + + function toggleVideo() { + if (!videoRef.current) return; + if (videoRef.current.paused) { + videoRef.current.play(); + } else { + videoRef.current.pause(); + videoRef.current.currentTime = 0; + } + setPaused(videoRef.current.paused); + } + + useDebouncedEffect( + () => { + if (paused) videoRef.current?.pause(); + }, + [paused], + 250 + ); + + return ( + + ); +} diff --git a/gui/src/components/onboarding/pages/usage-reason/StandaloneUsageSetup.tsx b/gui/src/components/onboarding/pages/usage-reason/StandaloneUsageSetup.tsx new file mode 100644 index 000000000..3c7fc3ccb --- /dev/null +++ b/gui/src/components/onboarding/pages/usage-reason/StandaloneUsageSetup.tsx @@ -0,0 +1,112 @@ +import { Button } from '@/components/commons/Button'; +import { PausableVideo } from '@/components/commons/PausableVideo'; +import { Typography } from '@/components/commons/Typography'; +import { useOnboarding } from '@/hooks/onboarding'; +import { useWebsocketAPI } from '@/hooks/websocket-api'; +import { VRCHAT_OSC_VIDEO } from '@/utils/tauri'; +import { useLocalization } from '@fluent/react'; +import classNames from 'classnames'; +import { useEffect, useRef } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { + ChangeSettingsRequestT, + OSCSettingsT, + RpcMessage, + SettingsRequestT, + SettingsResponseT, + VRCOSCSettingsT, +} from 'solarxr-protocol'; + +export function StandaloneUsageSetup() { + const { applyProgress, state } = useOnboarding(); + const { l10n } = useLocalization(); + const { sendRPCPacket, useRPCPacket } = useWebsocketAPI(); + const fetchedSettings = useRef(null); + const navigate = useNavigate(); + + useEffect(() => { + sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT()); + }, []); + + const toggleVrc = (bool: boolean) => { + const oldOscSettings = fetchedSettings.current; + + const settings = new ChangeSettingsRequestT(); + const vrcOsc = new VRCOSCSettingsT(); + vrcOsc.oscSettings = new OSCSettingsT( + bool, + oldOscSettings?.portIn, + oldOscSettings?.portOut, + oldOscSettings?.address + ); + + settings.vrcOsc = vrcOsc; + sendRPCPacket(RpcMessage.ChangeSettingsRequest, settings); + }; + + useRPCPacket( + RpcMessage.SettingsResponse, + (oldSettings: SettingsResponseT) => { + fetchedSettings.current = oldSettings.vrcOsc?.oscSettings ?? null; + + toggleVrc(true); + } + ); + + applyProgress(0.6); + + return ( +
+
+
+ + {l10n.getString('onboarding-usage-vr-standalone-title')} + +
+
+
+ {l10n + .getString('settings-osc-vrchat-description-guide') + .split('\n') + .map((line, i) => ( + + {line} + + ))} +
+
+ +
+
+ + +
+
+
+
+ ); +} diff --git a/gui/src/components/onboarding/pages/usage-reason/VRUsageChoose.tsx b/gui/src/components/onboarding/pages/usage-reason/VRUsageChoose.tsx index 03c325184..43a358b1b 100644 --- a/gui/src/components/onboarding/pages/usage-reason/VRUsageChoose.tsx +++ b/gui/src/components/onboarding/pages/usage-reason/VRUsageChoose.tsx @@ -78,7 +78,7 @@ export function VRUsageChoose() {