Installation
Optional: Create a New App
Follow these steps to create a new mobile app
If you don't have an existing project, you can create a new Expo app using a template
npx create-expo-app@latest my-video-app
As the next step, you have to generate native files with the expo prebuild
command:
npx expo prebuild
You can also follow more detailed Expo instructions.
Step 1: Install the Package
Install @fishjam-cloud/react-native-client
with your preferred package manager.
- Expo
- Bare workflow
- npm
- Yarn
- pnpm
- Bun
npm install @fishjam-cloud/react-native-client
yarn add @fishjam-cloud/react-native-client
pnpm add @fishjam-cloud/react-native-client
bun add @fishjam-cloud/react-native-client
Install Expo dependencies
Follow instructions from official Expo documentation.
Install Fishjam
npx expo install @fishjam-cloud/react-native-client
Step 2: Configure App Permissions
Your app needs to have permissions configured in order to use the microphone and camera.
Android
Permissions below are required to stream audio and video with Fishjam on Android.
android.permission.CAMERA
android.permission.RECORD_AUDIO
android.permission.MODIFY_AUDIO_SETTINGS
- Expo
- Bare workflow
Add required permissions to the app.json
file.
{ "expo": { ... "android": { ... "permissions": [ "android.permission.CAMERA", "android.permission.RECORD_AUDIO", "android.permission.MODIFY_AUDIO_SETTINGS" ] } } }
Add required permissions to the AndroidManifest.xml
file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> ... <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTING"/> ... </manifest>
iOS
- Expo
- Bare workflow
You don't have to make any changes to run app on iOS.
To update default content of permission alert, you can add these settings to app.json
:
{ "expo": { ... "ios": { ... "infoPlist": { "NSCameraUsageDescription": "Allow $(PRODUCT_NAME) to access your camera.", "NSMicrophoneUsageDescription": "Allow $(PRODUCT_NAME) to access your microphone." } }, } }
Ensure Info.plist
contains camera and microphone usage description entries:
<key>NSCameraUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your camera.</string> <key>NSMicrophoneUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your microphone.</string>
Optional: Request Camera and Microphone Permissions
You don’t need to explicitly request permissions as they’re automatically asked for when your app needs them.
If you want more control, you can use the useCameraPermissions
and useMicrophonePermissions
hooks to manage permissions manually. Both hooks return an array with three elements:
permission
: The current permission statusrequestPermission
: A function to request permissiongetPermission
: A function to get the current permission status
Here's an example of how to use both hooks:
import {
useCameraPermissions ,useMicrophonePermissions , } from "@fishjam-cloud/react-native-client"; import {useEffect } from "react"; const [cameraPermission ,requestCameraPermission ,getCameraPermission ] =useCameraPermissions (); const [microphonePermission ,requestMicrophonePermission ,getMicrophonePermission , ] =useMicrophonePermissions ();useEffect (() => {requestCameraPermission ();requestMicrophonePermission (); }, []);
Permission Response
The permission
object has the following properties:
canAskAgain
: Indicates if the user can be asked again for this permission. Iffalse
, it is recommended to direct the user to Settings app to enable/disable the permission.expires
: When the permission expires.granted
: Indicates if the permission is granted.status
: The current status of the permission.
You can control when and how permissions are requested by passing an options
object to the hook.
Customizing Permission Request Behavior
By default, get
is called automatically (auto fetch is true
), and request
is not (auto request is false
). You can change this behavior:
import {
useCameraPermissions } from "@fishjam-cloud/react-native-client"; // Do not auto-fetch permission status, enable auto-request const [permission ,requestPermission ] =useCameraPermissions ({get : false, // disables auto-fetchrequest : true, // enables auto-request });
Adjust these options to fit your app's needs.