Skip to content

Commit abad93c

Browse files
authored
Migrate examples from web-client-sdk repo (#61)
* Migrate examples from web-client-sdk repo * Add .env to gitignore * Fix issues pointed out by copilot * Reorganize examples * Use newest react-native-client package * Fixed issues that were present in monorepo * Run eslint + prettier
1 parent a1f3599 commit abad93c

305 files changed

Lines changed: 66897 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
.aider*
2+
node_modules
3+
dist
4+
build
5+
.env
6+
.vscode

mobile-react-native/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Examples for Fishjam client
2+
3+
- [Minimal React Native](./minimal-react-native/) - minimal example
4+
- joining a video room with a custom room name and user name
5+
- real-time video grid with local and remote participants
6+
- almost no UI
7+
8+
- [Fishjam Chat](./fishjam-chat/) - example video chat app
9+
- connecting to VideoRoom by entering a room name and username
10+
- streaming camera, microphone and screen sharing
11+
- joining and creating livestreams
12+
13+
- [Background Blur](./blur-example/) - example of applying background blur
14+
- toggling camera background blur on/off during a video call
15+
- using a camera track middleware
16+
17+
- [Text Chat](./text-chat/) - example text messaging app
18+
- real-time text messaging between participants
19+
- using WebRTC data channels
20+
21+
- [Video Player](./video-player/) - minimal livestreaming viewer
22+
- joining an existing livestream as a viewer
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPO_PUBLIC_FISHJAM_ID=
2+
EXPO_PUBLIC_FISHJAM_URL=
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
11+
# Native
12+
*.orig.*
13+
*.jks
14+
*.p8
15+
*.p12
16+
*.key
17+
*.mobileprovision
18+
19+
# Metro
20+
.metro-health-check*
21+
22+
# debug
23+
npm-debug.*
24+
yarn-debug.*
25+
yarn-error.*
26+
27+
# macOS
28+
.DS_Store
29+
*.pem
30+
31+
# local env files
32+
.env*.local
33+
34+
# typescript
35+
*.tsbuildinfo
36+
android/*
37+
ios/*
38+
.env
39+
.cursor/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { FishjamProvider } from '@fishjam-cloud/react-native-client';
2+
import { NavigationContainer } from '@react-navigation/native';
3+
import * as React from 'react';
4+
import { SafeAreaProvider } from 'react-native-safe-area-context';
5+
6+
import RootNavigation from './navigation/RootNavigation';
7+
8+
const App = () => {
9+
return (
10+
<FishjamProvider fishjamId={process.env.EXPO_PUBLIC_FISHJAM_ID}>
11+
<SafeAreaProvider>
12+
<NavigationContainer>
13+
<RootNavigation />
14+
</NavigationContainer>
15+
</SafeAreaProvider>
16+
</FishjamProvider>
17+
);
18+
};
19+
20+
export default App;
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Background Blur Example
2+
3+
A mobile video chat demo showcasing **real-time camera background blur** using the [`@fishjam-cloud/react-native-webrtc-background-blur`](https://www.npmjs.com/package/@fishjam-cloud/react-native-webrtc-background-blur) package. Built with [Fishjam Cloud](https://fishjam.io/), [Expo](https://expo.dev/), and [React Native](https://reactnative.dev/).
4+
5+
## Features
6+
7+
- **Background blur toggle** — blur your camera background on/off during a video call using a camera track middleware
8+
- Join a video room with a custom room name and user name
9+
- Real-time video grid with local and remote participants
10+
- Automatic camera and microphone permission handling
11+
12+
## Getting Started
13+
14+
### Prerequisites
15+
16+
- [Node.js](https://nodejs.org/) (v18 or newer recommended)
17+
- [Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/)
18+
- [Expo](https://docs.expo.dev/get-started/installation/): You do **not** need to install Expo CLI globally. Use `npx expo` to run Expo commands.
19+
20+
### Installation
21+
22+
1. **Clone the repository:**
23+
```sh
24+
git clone https://github.com/fishjam-cloud/web-client-sdk.git
25+
cd web-client-sdk
26+
```
27+
2. **Install dependencies and build project:**
28+
```sh
29+
yarn
30+
yarn build
31+
```
32+
3. **Set up environment variables:**
33+
- Create a `.env` file in the `examples/mobile-client/blur-example` directory:
34+
```sh
35+
cp .env.example .env
36+
```
37+
- Fill in your Fishjam ID. _You can find the value for this variable by creating an account on [fishjam.io](https://fishjam.io) and copying it from the sandbox dashboard._
38+
39+
There also exists this additional environment variable, which is used for internal testing purposes:
40+
- `EXPO_PUBLIC_FISHJAM_URL` - Sandbox URL for custom Fishjam environment
41+
42+
4. **Prebuild native files:**
43+
```sh
44+
cd examples/mobile-client/blur-example
45+
npx expo prebuild --clean
46+
```
47+
> [!NOTE]
48+
> Be sure to run `npx expo prebuild` and not `yarn prebuild` as there's an issue with path generation for the `ios/.xcode.env.local` file
49+
50+
### Running the App
51+
52+
- **Run on Android:**
53+
```sh
54+
yarn android
55+
```
56+
- **Run on iOS:**
57+
```sh
58+
yarn ios
59+
```
60+
61+
## Usage
62+
63+
1. Enter a room name and your user name on the Home screen.
64+
2. Tap **Connect** to join the video room.
65+
3. See yourself and other participants in a responsive video grid.
66+
4. Tap **Enable Blur** to apply background blur to your camera feed, or **Disable Blur** to turn it off.
67+
5. Leaving the room or closing the app will disconnect you from the session.
68+
69+
## Architecture Overview
70+
71+
- **React Native + Expo**: Cross-platform mobile app framework.
72+
- **Fishjam Cloud SDK**: Handles all real-time video, audio, and peer management.
73+
- **`@fishjam-cloud/react-native-webrtc-background-blur`**: Provides a `useBackgroundBlur` hook that returns a camera track middleware. The middleware is applied via `setCameraTrackMiddleware` from the Fishjam `useCamera()` hook.
74+
- **TypeScript**: Provides type safety and better developer experience.
75+
76+
## Troubleshooting & FAQ
77+
78+
- **App fails to connect to a room:**
79+
- Ensure your `.env` file is present and `EXPO_PUBLIC_FISHJAM_ID` is set correctly.
80+
- Check your network connection.
81+
- Review logs in the Metro/Expo console for errors.
82+
- **Camera or microphone not working:**
83+
- Make sure you have granted the necessary permissions on your device.
84+
85+
## License
86+
87+
This example is provided under the Apache License 2.0. See [LICENSE](../../../LICENSE) for details.
88+
89+
---
90+
91+
_This project is maintained by the Fishjam team. For questions or support, visit [fishjam.io](https://fishjam.io/) or open an issue on GitHub._
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"expo": {
3+
"name": "blur-example",
4+
"slug": "blur-example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
10+
"splash": {
11+
"image": "./assets/splash-icon.png",
12+
"resizeMode": "contain",
13+
"backgroundColor": "#ffffff"
14+
},
15+
"ios": {
16+
"supportsTablet": true,
17+
"bundleIdentifier": "io.fishjam.mobile.example.blurexample",
18+
"infoPlist": {
19+
"NSCameraUsageDescription": "Allow $(PRODUCT_NAME) to access your camera.",
20+
"NSMicrophoneUsageDescription": "Allow $(PRODUCT_NAME) to access your microphone."
21+
},
22+
"appleTeamId": "J5FM626PE2"
23+
},
24+
"android": {
25+
"adaptiveIcon": {
26+
"foregroundImage": "./assets/adaptive-icon.png",
27+
"backgroundColor": "#ffffff"
28+
},
29+
"edgeToEdgeEnabled": true,
30+
"package": "io.fishjam.mobile.example.blurexample",
31+
"permissions": [
32+
"android.permission.CAMERA",
33+
"android.permission.RECORD_AUDIO",
34+
"android.permission.MODIFY_AUDIO_SETTINGS",
35+
"android.permission.ACCESS_NETWORK_STATE",
36+
"android.permission.ACCESS_WIFI_STATE"
37+
]
38+
},
39+
"web": {
40+
"favicon": "./assets/favicon.png"
41+
},
42+
"plugins": [["@fishjam-cloud/react-native-client"]]
43+
}
44+
}
17.1 KB
Loading
1.43 KB
Loading
21.9 KB
Loading

0 commit comments

Comments
 (0)