Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on Screen Sharing for mobile app #14

Merged
merged 14 commits into from
Sep 23, 2024
6 changes: 6 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ js-server-sdk
Docusaurus
pre-configured
TabItem
AndroidManifest.xml
iOS
Xcode
UI
dev
Podfile
38 changes: 6 additions & 32 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const config: Config = {
path: "guide",
routeBasePath: "guide",
editUrl: "https://github.com/fishjam-cloud/documentation/",
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
],
},
blog: {
showReadingTime: true,
Expand All @@ -56,26 +59,7 @@ const config: Config = {
],
],

plugins: [
// [
// "@docusaurus/plugin-content-docs",
// {
// id: "react",
// path: "react-docs",
// routeBasePath: "react",
// sidebarPath: "./sidebars/react.ts",
// },
// ],
// [
// "@docusaurus/plugin-content-docs",
// {
// id: "react-native",
// path: "react-native-docs",
// routeBasePath: "react-native",
// sidebarPath: "./sidebars/react-native.ts",
// },
// ],
],
plugins: [],

themeConfig: {
image: "img/social-card.png",
Expand All @@ -96,18 +80,7 @@ const config: Config = {
position: "left",
sidebarId: "guideSidebar",
},
// {
// to: "/react-native",
// label: "React Native",
// position: "left",
// sidebarId: "reactNativeSidebar",
// },
// {
// to: "/react",
// label: "React",
// position: "left",
// sidebarId: "reactSidebar",
// },

{
href: "https://fishjam.io/app/",
label: "Fishjam Dashboard",
Expand Down Expand Up @@ -159,6 +132,7 @@ const config: Config = {
prism: {
theme: prismThemes.gruvboxMaterialLight,
darkTheme: prismThemes.gruvboxMaterialDark,
additionalLanguages: ["bash"],
},
} satisfies Preset.ThemeConfig,
};
Expand Down
Binary file added guide/react-native/assets/ios-new-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added guide/react-native/assets/ios-new-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added guide/react-native/assets/ios-new-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions guide/react-native/background.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
sidebar_position: 6
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

# Streaming from background

On Android, it is possible to continue streaming when app is in background. Unfortunately this functionality is not available on iOS (due to Apple limitations)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Are you sure this is true? I think it's possible to achieve using CallKit (at least audio, this is what google meets does), however our app does not support it.

Copy link
Member Author

@mironiasty mironiasty Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is investigation done by Angelika. We might work on this in future, to make it work somehow.


Below is configuration required to make it work:

<Tabs groupId="app-type">

<TabItem value="expo" label="Expo">

You need to modify `app.json` file and add our plugin:

```json
{
"expo": {
...
"plugins": {
...
[
"@fishjam-cloud/react-native-client",
{
"android": {
"enableForegroundService": true
}
}
],
...
}
}
}
```

</TabItem>
<TabItem value="rn" label="Bare workflow">

You need to modify `AndroidManifest.xml` file and add below service:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<application ...>
...
<service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
</application>
</manifest>
```

</TabItem>
</Tabs>
20 changes: 17 additions & 3 deletions guide/react-native/connecting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
sidebar_position: 2
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

# Connecting

How to connect to Fishjam Cloud
Expand All @@ -10,7 +13,9 @@ How to connect to Fishjam Cloud

In order to connect, you need to retrieve URL (multimedia server address) and token (token that will authenticate you in your Room)

### Using sandbox app
<Tabs groupId="app-type">

<TabItem value="sandbox" label="Sandbox App">

Once you get your account on [Fishjam Cloud](https://fishjam.io), you will have access to Sandbox App.
This app comes with pre-configured test service called Room Manager. This is basically service that will
Expand All @@ -20,12 +25,21 @@ To use that simply call `fetch`:

```ts
const response = await fetch(
`https://fishjam.io/api/v1/connect/*YOUR_ID*/room-manager/*ROOM_NAME*/users/*USER_NAME*`,
`https://fishjam.io/api/v1/connect/*YOUR_ID*/room-manager?room=*ROOM_NAME&user=*USER_NAME*`,
);

const { url, token } = await response.json();
const { fishjamUrl, participantToken } = await response.json();
```

</TabItem>
<TabItem value="production" label="Production App">

For production app, you need to implement your own backend service that will provide user with `participantToken`.
To do that, follow our [server setup instructions](/guide/server).

</TabItem>
</Tabs>

## Connecting

In order to connect, you just need to call `joinRoom` method with data from previous step:
Expand Down
98 changes: 66 additions & 32 deletions guide/react-native/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,89 @@ import TabItem from "@theme/TabItem";

# Installation

If you don't have an existing project, you can create a new Expo app using a template:
How to install package in your mobile app

<Tabs groupId="package-managers">
<TabItem value="npm" label="NPM">

```
npx create-expo-app@latest my-video-app
```
## Optional: Create new App

</TabItem>
<TabItem value="yarn" label="YARN">
<details>
<summary>Follow these steps to create new mobile app</summary>

```
yarn create expo-app my-video-app
```
If you don't have an existing project, you can create a new Expo app using a template

</TabItem>
</Tabs>
```bash
npx create-expo-app@latest my-video-app
```

As next step, you have to generate native files with `expo prepare` command:

## Installation
```bash
npx expo prebuild
```

### Step 1: Install the package
You can also follow more detailed [expo instructions](https://docs.expo.dev/get-started/introduction/).

</details>

## Step 1: Install the package

Install `@fishjam-cloud/react-native-client` package:

<Tabs groupId="package-managers">
```bash npm2yarn
npm install @fishjam-cloud/react-native-client
```

<TabItem value="npm" label="NPM">
## Step 2: Configure App permissions

```
npm install @fishjam-cloud/react-native-client
```
Your app will need to have configured permissions to use microphone and camera in order to work.

</TabItem>
<TabItem value="yarn" label="YARN">
### Android

For android you need to ask for certain permissions:

```
yarn add @fishjam-cloud/react-native-client
```
- `android.permission.CAMERA`
- `android.permission.RECORD_AUDIO`
- `android.permission.MODIFY_AUDIO_SETTINGS`

<Tabs groupId="app-type">

<TabItem value="expo" label="Expo">

You need to modify `app.json` file and add all permissions:

```json
{
"expo": {
...
"android": {
...
"permissions": {
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
"android.permission.MODIFY_AUDIO_SETTINGS"
}
}
}
}
```

</TabItem>
</Tabs>
<TabItem value="rn" label="Bare workflow">

### Step 2: Configure screen sharing
You need to modify `AndroidManifest.xml` file, and these lines:

If you plan to use Screen Sharing feature, there are few extra steps required to configure it.
```xml
<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>
```

:::warning missing docs
</TabItem>
</Tabs>

This part of docs will be updated
### iOS

:::
No action is required for iOS
Loading
Loading