diff --git a/client/demo/src/001_globalHooks/100_useWebInfo.ts b/client/demo/src/001_globalHooks/100_useWebInfo.ts index daddb70a..3e058522 100644 --- a/client/demo/src/001_globalHooks/100_useWebInfo.ts +++ b/client/demo/src/001_globalHooks/100_useWebInfo.ts @@ -4,6 +4,7 @@ import { useEffect, useMemo, useRef, useState } from "react"; export type UseWebInfoProps = { clientState: ClientState | null; + webEdition: boolean; }; export const WebModelLoadingState = { @@ -215,6 +216,10 @@ export const useWebInfo = (props: UseWebInfoProps): WebInfoStateAndMethod => { console.warn("[useWebInfo] clientState is not initialized yet"); return; } + if (!props.webEdition) { + console.warn("[useWebInfo] this is not web edition"); + return; + } console.log("loadVoiceChanagerModel1", voiceChangerConfig); setWebModelLoadingState("loading"); voiceChangerJSClient.current = new VoiceChangerJSClient(); diff --git a/client/demo/src/001_provider/001_AppStateProvider.tsx b/client/demo/src/001_provider/001_AppStateProvider.tsx index 0d40b33e..c5e3a58c 100644 --- a/client/demo/src/001_provider/001_AppStateProvider.tsx +++ b/client/demo/src/001_provider/001_AppStateProvider.tsx @@ -15,6 +15,7 @@ type AppStateValue = ClientState & { audioContext: AudioContext; initializedRef: React.MutableRefObject; webInfoState: WebInfoStateAndMethod; + webEdition: boolean; }; const AppStateContext = React.createContext(null); @@ -28,9 +29,10 @@ export const useAppState = (): AppStateValue => { export const AppStateProvider = ({ children }: Props) => { const appRoot = useAppRoot(); + const webEdition = appRoot.appGuiSettingState.edition.indexOf("web") >= 0; const clientState = useVCClient({ audioContext: appRoot.audioContextState.audioContext }); const messageBuilderState = useMessageBuilder(); - const webInfoState = useWebInfo(clientState); + const webInfoState = useWebInfo({ clientState: clientState.clientState, webEdition: webEdition }); // const voiceChangerJSClient = useRef(); useEffect(() => { @@ -70,6 +72,7 @@ export const AppStateProvider = ({ children }: Props) => { ...clientState.clientState, initializedRef, webInfoState, + webEdition, }; return {children};