From e292e57a1616443c7fcbe825273851072c652de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gadomski?= Date: Mon, 4 May 2026 11:03:32 +0200 Subject: [PATCH] Update instances of useSandbox to use sandbox api url --- mobile-react-native/blur-example/.env.example | 2 +- mobile-react-native/blur-example/hooks/useConnectFishjam.ts | 2 +- mobile-react-native/fishjam-chat/.env.example | 1 + .../fishjam-chat/app/livestream/screen-sharing.tsx | 4 +++- mobile-react-native/fishjam-chat/app/livestream/streamer.tsx | 4 +++- mobile-react-native/fishjam-chat/app/livestream/viewer.tsx | 4 +++- mobile-react-native/fishjam-chat/app/room/preview.tsx | 4 +++- mobile-react-native/minimal-react-native/.env.example | 1 + .../minimal-react-native/hooks/useConnectFishjam.ts | 2 +- mobile-react-native/text-chat/.env.example | 1 + mobile-react-native/text-chat/hooks/useConnectFishjam.ts | 4 +++- mobile-react-native/video-player/.env.example | 1 + .../video-player/components/FishjamPlayerStreamer.tsx | 4 +++- .../video-player/components/FishjamPlayerViewer.tsx | 4 +++- web-react/audio-only/.env.example | 1 + web-react/audio-only/src/JoinRoomForm.tsx | 4 +++- web-react/fishjam-chat/.env.example | 2 ++ web-react/fishjam-chat/src/components/JoinRoomCard.tsx | 4 +++- web-react/livestreaming/.env.example | 1 + web-react/livestreaming/src/components/LivestreamStreamer.tsx | 4 +++- web-react/livestreaming/src/components/LivestreamViewer.tsx | 4 +++- web-react/minimal-react/.env.example | 1 + web-react/text-chat/.env.example | 1 + web-react/text-chat/src/App.tsx | 4 +++- 24 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 web-react/fishjam-chat/.env.example diff --git a/mobile-react-native/blur-example/.env.example b/mobile-react-native/blur-example/.env.example index 8a2d8c0..6df0290 100644 --- a/mobile-react-native/blur-example/.env.example +++ b/mobile-react-native/blur-example/.env.example @@ -1,2 +1,2 @@ EXPO_PUBLIC_FISHJAM_ID= -EXPO_PUBLIC_FISHJAM_URL= \ No newline at end of file +EXPO_PUBLIC_SANDBOX_API_URL= \ No newline at end of file diff --git a/mobile-react-native/blur-example/hooks/useConnectFishjam.ts b/mobile-react-native/blur-example/hooks/useConnectFishjam.ts index 5274f53..9a68f67 100644 --- a/mobile-react-native/blur-example/hooks/useConnectFishjam.ts +++ b/mobile-react-native/blur-example/hooks/useConnectFishjam.ts @@ -15,7 +15,7 @@ export const useConnectFishjam = () => { const { leaveRoom, joinRoom } = useConnection(); const { getSandboxPeerToken } = useSandbox({ configOverride: { - sandboxApiUrl: process.env.EXPO_PUBLIC_FISHJAM_URL, + sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL, }, }); const { initializeDevices } = useInitializeDevices(); diff --git a/mobile-react-native/fishjam-chat/.env.example b/mobile-react-native/fishjam-chat/.env.example index df93670..588ae06 100644 --- a/mobile-react-native/fishjam-chat/.env.example +++ b/mobile-react-native/fishjam-chat/.env.example @@ -1,2 +1,3 @@ EXPO_PUBLIC_FISHJAM_ID= +EXPO_PUBLIC_SANDBOX_API_URL= EXPO_PUBLIC_VIDEOROOM_STAGING_SANDBOX_URL= \ No newline at end of file diff --git a/mobile-react-native/fishjam-chat/app/livestream/screen-sharing.tsx b/mobile-react-native/fishjam-chat/app/livestream/screen-sharing.tsx index 34fc3c3..d418526 100644 --- a/mobile-react-native/fishjam-chat/app/livestream/screen-sharing.tsx +++ b/mobile-react-native/fishjam-chat/app/livestream/screen-sharing.tsx @@ -19,7 +19,9 @@ export default function LivestreamScreenSharingScreen() { }>(); const { initializeDevices } = useInitializeDevices(); - const { getSandboxLivestream } = useSandbox(); + const { getSandboxLivestream } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { connect, disconnect, isConnected, error } = useLivestreamStreamer(); const { startStreaming: startScreenCapture, diff --git a/mobile-react-native/fishjam-chat/app/livestream/streamer.tsx b/mobile-react-native/fishjam-chat/app/livestream/streamer.tsx index 95c865f..bbfaef3 100644 --- a/mobile-react-native/fishjam-chat/app/livestream/streamer.tsx +++ b/mobile-react-native/fishjam-chat/app/livestream/streamer.tsx @@ -20,7 +20,9 @@ export default function LivestreamStreamerScreen() { roomName: string; }>(); - const { getSandboxLivestream } = useSandbox(); + const { getSandboxLivestream } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { connect, disconnect, isConnected, error } = useLivestreamStreamer(); diff --git a/mobile-react-native/fishjam-chat/app/livestream/viewer.tsx b/mobile-react-native/fishjam-chat/app/livestream/viewer.tsx index 41b6733..8bf98ea 100644 --- a/mobile-react-native/fishjam-chat/app/livestream/viewer.tsx +++ b/mobile-react-native/fishjam-chat/app/livestream/viewer.tsx @@ -16,7 +16,9 @@ export default function LivestreamViewerScreen() { roomName: string; }>(); - const { getSandboxViewerToken } = useSandbox({}); + const { getSandboxViewerToken } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { connect, disconnect, stream, isConnected, error } = useLivestreamViewer(); diff --git a/mobile-react-native/fishjam-chat/app/room/preview.tsx b/mobile-react-native/fishjam-chat/app/room/preview.tsx index 73ab159..7548321 100644 --- a/mobile-react-native/fishjam-chat/app/room/preview.tsx +++ b/mobile-react-native/fishjam-chat/app/room/preview.tsx @@ -21,7 +21,9 @@ export default function PreviewScreen() { userName: string; }>(); - const { getSandboxPeerToken } = useSandbox(); + const { getSandboxPeerToken } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { initializeDevices } = useInitializeDevices(); const { cameraStream, startCamera, stopCamera, isCameraOn, toggleCamera } = diff --git a/mobile-react-native/minimal-react-native/.env.example b/mobile-react-native/minimal-react-native/.env.example index 5c3949f..78d7522 100644 --- a/mobile-react-native/minimal-react-native/.env.example +++ b/mobile-react-native/minimal-react-native/.env.example @@ -1 +1,2 @@ EXPO_PUBLIC_FISHJAM_ID= +EXPO_PUBLIC_SANDBOX_API_URL= diff --git a/mobile-react-native/minimal-react-native/hooks/useConnectFishjam.ts b/mobile-react-native/minimal-react-native/hooks/useConnectFishjam.ts index 5274f53..9a68f67 100644 --- a/mobile-react-native/minimal-react-native/hooks/useConnectFishjam.ts +++ b/mobile-react-native/minimal-react-native/hooks/useConnectFishjam.ts @@ -15,7 +15,7 @@ export const useConnectFishjam = () => { const { leaveRoom, joinRoom } = useConnection(); const { getSandboxPeerToken } = useSandbox({ configOverride: { - sandboxApiUrl: process.env.EXPO_PUBLIC_FISHJAM_URL, + sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL, }, }); const { initializeDevices } = useInitializeDevices(); diff --git a/mobile-react-native/text-chat/.env.example b/mobile-react-native/text-chat/.env.example index 5c3949f..78d7522 100644 --- a/mobile-react-native/text-chat/.env.example +++ b/mobile-react-native/text-chat/.env.example @@ -1 +1,2 @@ EXPO_PUBLIC_FISHJAM_ID= +EXPO_PUBLIC_SANDBOX_API_URL= diff --git a/mobile-react-native/text-chat/hooks/useConnectFishjam.ts b/mobile-react-native/text-chat/hooks/useConnectFishjam.ts index 00a0812..36b23a8 100644 --- a/mobile-react-native/text-chat/hooks/useConnectFishjam.ts +++ b/mobile-react-native/text-chat/hooks/useConnectFishjam.ts @@ -8,7 +8,9 @@ import type { RootStackParamList } from '../navigation/RootNavigation'; export const useConnectFishjam = () => { const navigation = useNavigation>(); const { leaveRoom, joinRoom } = useConnection(); - const { getSandboxPeerToken } = useSandbox(); + const { getSandboxPeerToken } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); diff --git a/mobile-react-native/video-player/.env.example b/mobile-react-native/video-player/.env.example index 5c3949f..78d7522 100644 --- a/mobile-react-native/video-player/.env.example +++ b/mobile-react-native/video-player/.env.example @@ -1 +1,2 @@ EXPO_PUBLIC_FISHJAM_ID= +EXPO_PUBLIC_SANDBOX_API_URL= diff --git a/mobile-react-native/video-player/components/FishjamPlayerStreamer.tsx b/mobile-react-native/video-player/components/FishjamPlayerStreamer.tsx index 086d8dc..31bbcc2 100644 --- a/mobile-react-native/video-player/components/FishjamPlayerStreamer.tsx +++ b/mobile-react-native/video-player/components/FishjamPlayerStreamer.tsx @@ -10,7 +10,9 @@ import { useEffect } from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; export const FishjamPlayerStreamer = ({ roomName }: { roomName: string }) => { - const { getSandboxLivestream } = useSandbox(); + const { getSandboxLivestream } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { toggleCamera, stopCamera, startCamera, isCameraOn, cameraStream } = useCamera(); diff --git a/mobile-react-native/video-player/components/FishjamPlayerViewer.tsx b/mobile-react-native/video-player/components/FishjamPlayerViewer.tsx index 3bc17df..7747305 100644 --- a/mobile-react-native/video-player/components/FishjamPlayerViewer.tsx +++ b/mobile-react-native/video-player/components/FishjamPlayerViewer.tsx @@ -7,7 +7,9 @@ import { useEffect } from 'react'; import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'; export const FishjamPlayerViewer = ({ roomName }: { roomName: string }) => { - const { getSandboxViewerToken } = useSandbox(); + const { getSandboxViewerToken } = useSandbox({ + configOverride: { sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL }, + }); const { connect, disconnect, stream } = useLivestreamViewer(); useEffect(() => { diff --git a/web-react/audio-only/.env.example b/web-react/audio-only/.env.example index a3f2840..8a224a6 100644 --- a/web-react/audio-only/.env.example +++ b/web-react/audio-only/.env.example @@ -1 +1,2 @@ VITE_FISHJAM_ID= +VITE_SANDBOX_API_URL= diff --git a/web-react/audio-only/src/JoinRoomForm.tsx b/web-react/audio-only/src/JoinRoomForm.tsx index abdba36..f159c9c 100644 --- a/web-react/audio-only/src/JoinRoomForm.tsx +++ b/web-react/audio-only/src/JoinRoomForm.tsx @@ -13,7 +13,9 @@ type JoinRoomFormProps = { export const JoinRoomForm: FC = ({ onJoinedRoom }) => { const { joinRoom } = useConnection(); - const { getSandboxPeerToken } = useSandbox(); + const { getSandboxPeerToken } = useSandbox({ + configOverride: { sandboxApiUrl: import.meta.env.VITE_SANDBOX_API_URL }, + }); const onJoinRoom = useCallback( async (params: RoomManagerParams) => { diff --git a/web-react/fishjam-chat/.env.example b/web-react/fishjam-chat/.env.example new file mode 100644 index 0000000..053253f --- /dev/null +++ b/web-react/fishjam-chat/.env.example @@ -0,0 +1,2 @@ +VITE_FISHJAM_ID="your-fishjam-id" # get it at https://fishjam.io/app/ +VITE_SANDBOX_API_URL= diff --git a/web-react/fishjam-chat/src/components/JoinRoomCard.tsx b/web-react/fishjam-chat/src/components/JoinRoomCard.tsx index 5a0bac3..5f0ff04 100644 --- a/web-react/fishjam-chat/src/components/JoinRoomCard.tsx +++ b/web-react/fishjam-chat/src/components/JoinRoomCard.tsx @@ -65,7 +65,9 @@ export const JoinRoomCard: FC = ({ onFishjamIdChange, ...props }) => { onFishjamIdChange(formFishjamId); }, [formFishjamId, onFishjamIdChange]); - const { getSandboxPeerToken } = useSandbox(); + const { getSandboxPeerToken } = useSandbox({ + configOverride: { sandboxApiUrl: import.meta.env.VITE_SANDBOX_API_URL }, + }); const initializeAndReport = useCallback(async () => { const { errors } = await initializeDevices({ diff --git a/web-react/livestreaming/.env.example b/web-react/livestreaming/.env.example index ead9def..b3a8256 100644 --- a/web-react/livestreaming/.env.example +++ b/web-react/livestreaming/.env.example @@ -1 +1,2 @@ VITE_FISHJAM_ID="" +VITE_SANDBOX_API_URL= diff --git a/web-react/livestreaming/src/components/LivestreamStreamer.tsx b/web-react/livestreaming/src/components/LivestreamStreamer.tsx index db69ed4..6c9424c 100644 --- a/web-react/livestreaming/src/components/LivestreamStreamer.tsx +++ b/web-react/livestreaming/src/components/LivestreamStreamer.tsx @@ -53,7 +53,9 @@ const LivestreamStreamer: FC = ({ const [isConnecting, setIsConnecting] = useState(false); - const { getSandboxLivestream } = useSandbox(); + const { getSandboxLivestream } = useSandbox({ + configOverride: { sandboxApiUrl: import.meta.env.VITE_SANDBOX_API_URL }, + }); const { connect, disconnect, isConnected, error } = useLivestreamStreamer(); const initializeAndReport = useCallback(async () => { diff --git a/web-react/livestreaming/src/components/LivestreamViewer.tsx b/web-react/livestreaming/src/components/LivestreamViewer.tsx index 327667e..8a2d65a 100644 --- a/web-react/livestreaming/src/components/LivestreamViewer.tsx +++ b/web-react/livestreaming/src/components/LivestreamViewer.tsx @@ -26,7 +26,9 @@ const LivestreamViewer: FC = ({ roomName: streamerRoomName, }) => { const { connect, disconnect, stream, error } = useLivestreamViewer(); - const { getSandboxViewerToken } = useSandbox(); + const { getSandboxViewerToken } = useSandbox({ + configOverride: { sandboxApiUrl: import.meta.env.VITE_SANDBOX_API_URL }, + }); const [nameOverridden, setNameOverridden] = useState(false); const [roomName, setRoomName] = useState(streamerRoomName); diff --git a/web-react/minimal-react/.env.example b/web-react/minimal-react/.env.example index bc2b1ac..053253f 100644 --- a/web-react/minimal-react/.env.example +++ b/web-react/minimal-react/.env.example @@ -1 +1,2 @@ VITE_FISHJAM_ID="your-fishjam-id" # get it at https://fishjam.io/app/ +VITE_SANDBOX_API_URL= diff --git a/web-react/text-chat/.env.example b/web-react/text-chat/.env.example index bc2b1ac..053253f 100644 --- a/web-react/text-chat/.env.example +++ b/web-react/text-chat/.env.example @@ -1 +1,2 @@ VITE_FISHJAM_ID="your-fishjam-id" # get it at https://fishjam.io/app/ +VITE_SANDBOX_API_URL= diff --git a/web-react/text-chat/src/App.tsx b/web-react/text-chat/src/App.tsx index 768dead..f71b7db 100644 --- a/web-react/text-chat/src/App.tsx +++ b/web-react/text-chat/src/App.tsx @@ -20,7 +20,9 @@ export const App = () => { const messagesEndRef = useRef(null); const { joinRoom, leaveRoom, peerStatus } = useConnection(); - const { getSandboxPeerToken } = useSandbox(); + const { getSandboxPeerToken } = useSandbox({ + configOverride: { sandboxApiUrl: import.meta.env.VITE_SANDBOX_API_URL }, + }); const { publishData, subscribeData,