Skip to content

Commit

Permalink
Merge branch 'main' into fix/reusable-call
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko authored Jul 23, 2024
2 parents 126f76b + 6fc2a5b commit 4959fdc
Show file tree
Hide file tree
Showing 53 changed files with 744 additions and 589 deletions.
7 changes: 7 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

### [1.4.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.4...@stream-io/video-client-1.4.5) (2024-07-12)


### Bug Fixes

* report the Plain-JS sdk version to the SFU ([#1438](https://github.com/GetStream/stream-video-js/issues/1438)) ([7ac54e4](https://github.com/GetStream/stream-video-js/commit/7ac54e46c80288debbf99339e861fe7f6cdb0fdf))

### [1.4.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.3...@stream-io/video-client-1.4.4) (2024-07-02)


Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-client",
"version": "1.4.4",
"version": "1.4.5",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
19 changes: 17 additions & 2 deletions packages/client/src/client-details.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import { ClientDetails, Device, OS, Sdk } from './gen/video/sfu/models/models';
import {
ClientDetails,
Device,
OS,
Sdk,
SdkType,
} from './gen/video/sfu/models/models';
import { isReactNative } from './helpers/platforms';
import { UAParser } from 'ua-parser-js';

type WebRTCInfoType = {
version: string;
};

let sdkInfo: Sdk | undefined;
const version = process.env.PKG_VERSION || '0.0.0';
const [major, minor, patch] = version.split('.');

let sdkInfo: Sdk | undefined = {
type: SdkType.PLAIN_JAVASCRIPT,
major,
minor,
patch,
};

let osInfo: OS | undefined;
let deviceInfo: Device | undefined;
let webRtcInfo: WebRTCInfoType | undefined;
Expand Down
8 changes: 8 additions & 0 deletions packages/client/src/gen/video/sfu/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,14 @@ export enum SdkType {
* @generated from protobuf enum value: SDK_TYPE_UNITY = 7;
*/
UNITY = 7,
/**
* @generated from protobuf enum value: SDK_TYPE_GO = 8;
*/
GO = 8,
/**
* @generated from protobuf enum value: SDK_TYPE_PLAIN_JAVASCRIPT = 9;
*/
PLAIN_JAVASCRIPT = 9,
}
/**
* @generated from protobuf enum stream.video.sfu.models.TrackUnpublishReason
Expand Down
5 changes: 5 additions & 0 deletions packages/react-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

### [0.4.49](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.4.48...@stream-io/video-react-bindings-0.4.49) (2024-07-12)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.4.5`
### [0.4.48](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.4.47...@stream-io/video-react-bindings-0.4.48) (2024-07-02)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-bindings",
"version": "0.4.48",
"version": "0.4.49",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
24 changes: 24 additions & 0 deletions packages/react-native-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

### [0.9.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.9.1...@stream-io/video-react-native-sdk-0.9.2) (2024-07-12)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.4.5`
* `@stream-io/video-react-bindings` updated to version `0.4.49`
### [0.9.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.9.0...@stream-io/video-react-native-sdk-0.9.1) (2024-07-05)


### Bug Fixes

* **react-native:** ringing call content component did not handle reconnection state ([#1435](https://github.com/GetStream/stream-video-js/issues/1435)) ([a4a50b7](https://github.com/GetStream/stream-video-js/commit/a4a50b74e525324618681b273df998c4478068c6))

## [0.9.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.8.9...@stream-io/video-react-native-sdk-0.9.0) (2024-07-05)


### ⚠ BREAKING CHANGES

* **react-native:** support targetSdk android 14 (#1432)

### Features

* **react-native:** support targetSdk android 14 ([#1432](https://github.com/GetStream/stream-video-js/issues/1432)) ([2e98fbe](https://github.com/GetStream/stream-video-js/commit/2e98fbe5000161088030d553fc38cd5243327dd1))

### [0.8.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.8.8...@stream-io/video-react-native-sdk-0.8.9) (2024-07-02)

### Dependency Updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Installation and usage of our React Native SDK is simple and involves the follow
First things first, make sure you have set up the development environment for React Native.
You can find the official guide [here](https://reactnative.dev/docs/environment-setup).

### Add Stream's Video SDK and its peer dependencies
## SDK Installation

In order to install the Stream Video React Native SDK, run the following command in your terminal of choice:

Expand Down Expand Up @@ -40,7 +40,7 @@ So what did we install precisely?
### Android Specific installation

<!-- vale off -->
#### Update the compileSdk, targetSdk and minSdk versions
#### Update the minSdk version

In `android/build.gradle` add the following inside the `buildscript` section:

Expand All @@ -49,16 +49,10 @@ buildscript {
ext {
...
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 33
}
...
}
```

:::infoINFO
We have to temporarily use targetSdkVersion 33 due to a lack of support for [dynamically setting foreground service types](https://github.com/invertase/notifee/issues/997#issuecomment-2036781216) in the notifee library. We are aware of the [August 31, 2024 deadline](https://apilevels.com/) for updating to targetSdkVersion 34 and we are actively working on adding support in the notifee library.
:::
<!-- vale on -->

#### Enable Java 8 Support
Expand Down Expand Up @@ -121,19 +115,23 @@ If you plan to also support Bluetooth devices then also add the following.
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
```

### Optional peer dependencies
:::infoINFO
Permissions need to be granted by the user as well. Requests for Camera and Microphone usage are automatically asked when the stream is first requested by the app. But other permissions like `BLUETOOTH_CONNECT` in Android need to be requested manually. However, we recommend that all necessary permissions be manually asked at an appropriate place in your app for the best user experience.

Some of the optional features we provide require additional dependencies to be installed in order to work properly.
We recommend the usage of [`react-native-permissions`](https://github.com/zoontek/react-native-permissions) library to request permissions in the app.

#### Ringing flow
:::

The ringing flow is a feature that allows you to render a native ringer when the app is in background/dead mode.
To enable this feature you need to install the following dependencies:
### Run on device

#### iOS

In iOS simulators, recording audio or video is not supported. So always test your app on an actual device for the best experience.

#### Android

- `react-native-callkeep` utilises CallKit (iOS) and ConnectionService (Android). SVRN's uses this dependency to render native ringers and handle accepting/declining a call when the app is in background/dead mode.
- `@react-native-firebase/app` and `@react-native-firebase/messaging` to receive notifications on Android.
- `@react-native-voip-push-notification` to receive notifications on iOS.
In Android emulators, a static video stream can be sent and so it can be used for testing. However, we recommend that you always test your app on an actual device for the best experience.

More about how to enable this feature can be found [in our push notification guide](../../../advanced/push-notifications/overview).
## Troubleshooting

<Troubleshooting isExpo={false} />
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import Troubleshooting from "../../common-content/setup/installation/troubleshoo

Our SDK is not available on Expo Go due to native code being required, but you can use the [expo-dev-client](https://docs.expo.dev/development/create-development-builds/) library to run your Expo app with a development build.

## Development Build
### Development Build

If you haven't already, prepare your project for [expo development builds](https://docs.expo.dev/develop/development-builds/installation/).

## SDK Installation

Add the SDK and its required dependencies to your project:
Add the Stream Video React Native SDK and its required dependencies to your project:

```bash title=Terminal
npx expo install @stream-io/video-react-native-sdk
Expand All @@ -35,10 +35,10 @@ So what did we install precisely?
- `@react-native-community/netinfo` - is used to detect the device's connectivity state, type and quality.
- `@notifee/react-native` - is used to keep calls alive in the background on Android.

## Android Specific installation
### Android Specific installation

<!-- vale off -->
### Update the compileSdk, targetSdk and minSdk versions
#### Update the minSdk version

In your `app.json` file add the following to the `expo-build-properties` plugin:

Expand All @@ -51,23 +51,17 @@ In your `app.json` file add the following to the `expo-build-properties` plugin:
"expo-build-properties",
{
"android": {
"minSdkVersion": 24,
"compileSdkVersion": 34,
"targetSdkVersion": 33
"minSdkVersion": 24
}
}
// highlight-end
]
}
}
```

:::infoINFO
We have to temporarily use targetSdkVersion 33 due to a lack of support for [dynamically setting foreground service types](https://github.com/invertase/notifee/issues/997#issuecomment-2036781216) in the notifee library. We are aware of the [August 31, 2024 deadline](https://apilevels.com/) for updating to targetSdkVersion 34 and we are actively working on adding support in the notifee library.
:::
<!-- vale on -->

## Add config plugin
### Add config plugin

Add the config plugin for [`@stream-io/video-react-native-sdk`](https://github.com/GetStream/stream-video-js/tree/main/packages/react-native-sdk/expo-config-plugin/README.md) and [`react-native-webrtc`](https://www.npmjs.com/package/@config-plugins/react-native-webrtc) to your `app.json` file:

Expand All @@ -92,28 +86,23 @@ Add the config plugin for [`@stream-io/video-react-native-sdk`](https://github.c
}
```

:::note
The `POST_NOTIFICATIONS` and `BLUETOOTH_CONNECT` permissions need to be requested and granted by the user as well. [PermissionsAndroid](https://reactnative.dev/docs/permissionsandroid) module can be used to request permissions in Android. For example, below is a way to request permissions in Android:

```js
import { useEffect } from 'react';
import { PermissionsAndroid, Platform } from 'react-native';
:::infoINFO
Permissions need to be granted by the user as well. Requests for Camera and Microphone usage are automatically asked when the stream is first requested by the app. But other permissions like `BLUETOOTH_CONNECT` in Android need to be requested manually. However, we recommend that all necessary permissions be manually asked at an appropriate place in your app for the best user experience.

useEffect(() => {
const run = async () => {
if (Platform.OS === 'android') {
// highlight-start
await PermissionsAndroid.requestMultiple([
'android.permission.POST_NOTIFICATIONS',
'android.permission.BLUETOOTH_CONNECT',
]);
// highlight-end
}
};
run();
}, []);
```
We recommend the usage of [`react-native-permissions`](https://github.com/zoontek/react-native-permissions) library to request permissions in the app.

:::

### Run on device

#### iOS

In iOS simulators, recording audio or video is not supported. So always test your app on an actual device for the best experience.

#### Android

In Android emulators, a static video stream can be sent and so it can be used for testing. However, we recommend that you always test your app on an actual device for the best experience.

## Troubleshooting

<Troubleshooting isExpo={true} />
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,53 @@
id: keeping-call-alive
title: Keeping The Call Alive In Background
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

One of the crucial functionalities of a video or audio calling application is to keep the call alive in the background. On this page, we focus on what must be added to your app to support this. After enabling, the user of your app will notice that the call is kept alive even if the app goes to the background as they will still hear the remote audio streams while the app is kept in the background.

## Android Setup

In Android, we use a [foreground service](https://developer.android.com/guide/components/foreground-services) to keep the call alive. The SDK will manage the foreground service. But in order to be able to use the foreground service, some declarations need to be added in the `AndroidManifest.xml`:
### Android 8 and above

```xml
Starting in Android 8.0 (API level 26), Android allows activities to launch in picture-in-picture (PiP) mode. This means that we can keep the call alive in the background by opening PiP mode.

Head over to the documentation [here](../../advanced/pip/) on how to picture-in-picture (PiP) mode for Android.

### Android 7

There is no support for Picture-in-picture (PiP) mode below Android 8. Hence in those platforms, we use a [foreground service](https://developer.android.com/guide/components/foreground-services) to keep the call alive. The SDK will manage the foreground service. In Expo, the config plugin adds it up. But if Expo is not used, be sure add the following:

#### Add declarations in AndroidManifest

<Tabs groupId="current-platform" queryString>
<TabItem value="expo" label="Expo">

In Expo, declarations in Android Manifest are automatically done by the expo config plugin of the SDK, so nothing needs to be added manually.

</TabItem>
<TabItem value="reactnative" label="React Native">

Add the following in `AndroidManifest.xml`:

```xml title="AndroidManifest.xml"
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- We declare the permissions to for using foreground service -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<!-- We specify to notifee that we will use microphone in the background -->
<service
android:name="app.notifee.core.ForegroundService"
tools:replace="android:foregroundServiceType"
android:stopWithTask="true"
android:foregroundServiceType="microphone" />
android:foregroundServiceType="dataSync" />
```

<!-- vale off -->
### Check the compileSdk, targetSdk and minSdk versions

In `android/build.gradle` make sure that the following is inside the `buildscript` section:

```java
buildscript {
ext {
...
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 33
}
...
}
```
</TabItem>
</Tabs>

:::infoINFO
We have to temporarily use targetSdkVersion 33 due to a lack of support for [dynamically setting foreground service types](https://github.com/invertase/notifee/issues/997#issuecomment-2036781216) in the notifee library. We are aware of the [August 31, 2024 deadline](https://apilevels.com/) for updating to targetSdkVersion 34 and we are actively working on adding support in the notifee library.
:::
<!-- vale on -->

### Optional: override the default configuration of the notifications
#### Optional: override the default configuration of the notifications

You can also optionally override the default configuration of the notification used by the SDK. Below we give an example of that:

Expand All @@ -55,15 +59,6 @@ import { AndroidImportance } from '@notifee/react-native';
StreamVideoRN.updateConfig({
foregroundService: {
android: {
// see https://notifee.app/react-native/reference/nativeandroidchannel
// for the various properties that can be used
channel: {
id: 'stream_call_foreground_service',
name: 'Service to keep call alive',
lights: false,
vibration: false,
importance: AndroidImportance.DEFAULT,
},
// you can edit the title and body of the notification here
notificationTexts: {
title: 'Video call is in progress',
Expand Down
Loading

0 comments on commit 4959fdc

Please sign in to comment.