Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mobile-react-native/blur-example/hooks/useConnectFishjam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default function LivestreamScreenSharingScreen() {
}>();

const { initializeDevices } = useInitializeDevices();
const { getSandboxLivestream } = useSandbox();
const { getSandboxLivestream } = useSandbox({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});
const { connect, disconnect, isConnected, error } = useLivestreamStreamer();
const {
startStreaming: startScreenCapture,
Expand Down
4 changes: 3 additions & 1 deletion mobile-react-native/fishjam-chat/app/livestream/streamer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default function LivestreamStreamerScreen() {
roomName: string;
}>();

const { getSandboxLivestream } = useSandbox();
const { getSandboxLivestream } = useSandbox({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});

const { connect, disconnect, isConnected, error } = useLivestreamStreamer();

Expand Down
4 changes: 3 additions & 1 deletion mobile-react-native/fishjam-chat/app/livestream/viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default function LivestreamViewerScreen() {
roomName: string;
}>();

const { getSandboxViewerToken } = useSandbox({});
const { getSandboxViewerToken } = useSandbox({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});

const { connect, disconnect, stream, isConnected, error } =
useLivestreamViewer();
Expand Down
4 changes: 3 additions & 1 deletion mobile-react-native/fishjam-chat/app/room/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default function PreviewScreen() {
userName: string;
}>();

const { getSandboxPeerToken } = useSandbox();
const { getSandboxPeerToken } = useSandbox({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});

const { initializeDevices } = useInitializeDevices();
const { cameraStream, startCamera, stopCamera, isCameraOn, toggleCamera } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,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 ?? '',
});
Comment on lines 15 to 18
const { initializeDevices } = useInitializeDevices();

Expand Down
4 changes: 3 additions & 1 deletion mobile-react-native/text-chat/hooks/useConnectFishjam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type { RootStackParamList } from '../navigation/RootNavigation';
export const useConnectFishjam = () => {
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
const { leaveRoom, joinRoom } = useConnection();
const { getSandboxPeerToken } = useSandbox();
const { getSandboxPeerToken } = useSandbox({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});

const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});

const { toggleCamera, stopCamera, startCamera, isCameraOn, cameraStream } =
useCamera();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
sandboxApiUrl: process.env.EXPO_PUBLIC_SANDBOX_API_URL ?? '',
});
const { connect, disconnect, stream } = useLivestreamViewer();

useEffect(() => {
Expand Down
9 changes: 8 additions & 1 deletion web-react/audio-only/src/JoinRoomForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { useConnection, useSandbox } from "@fishjam-cloud/react-client";
import type { FC } from "react";
import { useCallback } from "react";

const SANDBOX_API_URL =
new URLSearchParams(window.location.search).get("sandboxApiUrl") ??
import.meta.env.VITE_SANDBOX_API_URL ??
"";
Comment on lines +5 to +8

export type RoomManagerParams = {
roomName: string;
peerName: string;
Expand All @@ -13,7 +18,9 @@ type JoinRoomFormProps = {

export const JoinRoomForm: FC<JoinRoomFormProps> = ({ onJoinedRoom }) => {
const { joinRoom } = useConnection();
const { getSandboxPeerToken } = useSandbox();
const { getSandboxPeerToken } = useSandbox({
sandboxApiUrl: SANDBOX_API_URL,
});

const onJoinRoom = useCallback(
async (params: RoomManagerParams) => {
Expand Down
6 changes: 4 additions & 2 deletions web-react/fishjam-chat/src/components/JoinRoomCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useCallback, useEffect } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";

import { DEFAULT_FISHJAM_ID } from "@/lib/consts";
import { DEFAULT_FISHJAM_ID, SANDBOX_API_URL } from "@/lib/consts";
import { getPersistedFormValues, persistFormValues } from "@/lib/utils";
import type { RoomForm } from "@/types";

Expand Down Expand Up @@ -65,7 +65,9 @@ export const JoinRoomCard: FC<Props> = ({ onFishjamIdChange, ...props }) => {
onFishjamIdChange(formFishjamId);
}, [formFishjamId, onFishjamIdChange]);

const { getSandboxPeerToken } = useSandbox();
const { getSandboxPeerToken } = useSandbox({
sandboxApiUrl: SANDBOX_API_URL,
});

const initializeAndReport = useCallback(async () => {
const { errors } = await initializeDevices({
Expand Down
5 changes: 5 additions & 0 deletions web-react/fishjam-chat/src/lib/consts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export const DEFAULT_FISHJAM_ID =
new URLSearchParams(window.location.search).get("fishjamId") ??
import.meta.env.VITE_FISHJAM_ID;

export const SANDBOX_API_URL =
new URLSearchParams(window.location.search).get("sandboxApiUrl") ??
import.meta.env.VITE_SANDBOX_API_URL ??
"";
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type { FC } from "react";
import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";

import { SANDBOX_API_URL } from "@/lib/consts";

import { Alert, AlertDescription, AlertTitle } from "./ui/alert";
import { Button } from "./ui/button";
import {
Expand Down Expand Up @@ -53,7 +55,9 @@ const LivestreamStreamer: FC<LivestreamStreamerProps> = ({

const [isConnecting, setIsConnecting] = useState(false);

const { getSandboxLivestream } = useSandbox();
const { getSandboxLivestream } = useSandbox({
sandboxApiUrl: SANDBOX_API_URL,
});
const { connect, disconnect, isConnected, error } = useLivestreamStreamer();

const initializeAndReport = useCallback(async () => {
Expand Down
6 changes: 5 additions & 1 deletion web-react/livestreaming/src/components/LivestreamViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { FC } from "react";
import { useEffect, useState } from "react";
import { toast } from "sonner";

import { SANDBOX_API_URL } from "@/lib/consts";

import { Alert, AlertDescription, AlertTitle } from "./ui/alert";
import { Button } from "./ui/button";
import {
Expand All @@ -26,7 +28,9 @@ const LivestreamViewer: FC<LivestreamViewerProps> = ({
roomName: streamerRoomName,
}) => {
const { connect, disconnect, stream, error } = useLivestreamViewer();
const { getSandboxViewerToken } = useSandbox();
const { getSandboxViewerToken } = useSandbox({
sandboxApiUrl: SANDBOX_API_URL,
});
const [nameOverridden, setNameOverridden] = useState(false);
const [roomName, setRoomName] = useState(streamerRoomName);

Expand Down
5 changes: 5 additions & 0 deletions web-react/livestreaming/src/lib/consts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export const DEFAULT_FISHJAM_ID =
new URLSearchParams(window.location.search).get("fishjamId") ??
import.meta.env.VITE_FISHJAM_ID;

export const SANDBOX_API_URL =
new URLSearchParams(window.location.search).get("sandboxApiUrl") ??
import.meta.env.VITE_SANDBOX_API_URL ??
"";
Comment on lines +5 to +8
9 changes: 8 additions & 1 deletion web-react/text-chat/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import {
} from "@fishjam-cloud/react-client";
import { useCallback, useEffect, useRef, useState } from "react";

const SANDBOX_API_URL =
new URLSearchParams(window.location.search).get("sandboxApiUrl") ??
import.meta.env.VITE_SANDBOX_API_URL ??
"";

Comment on lines +8 to +12
type ChatMessage = {
timestamp: number;
sender: string;
Expand All @@ -20,7 +25,9 @@ export const App = () => {
const messagesEndRef = useRef<HTMLDivElement>(null);

const { joinRoom, leaveRoom, peerStatus } = useConnection();
const { getSandboxPeerToken } = useSandbox();
const { getSandboxPeerToken } = useSandbox({
sandboxApiUrl: SANDBOX_API_URL,
});
const {
publishData,
subscribeData,
Expand Down