Skip to content

Commit

Permalink
Merge branch 'qa' into android-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AniketSK authored Jun 10, 2024
2 parents 060004c + 76ab560 commit ebefdcd
Show file tree
Hide file tree
Showing 24 changed files with 575 additions and 52 deletions.
2 changes: 1 addition & 1 deletion docs/android/v2/how-to-guides/install-the-sdk/size.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Each library has its own size impact that can vary been ABIs (x86, arm64-v8a etc

You can take a look at the reference project [here](https://github.com/100mslive/Android-Size-Reference-App/)

These are accuarate for sdk version `2.9.59` and room-kit version `1.2.13`.
These are accurate for sdk version `2.9.59` and room-kit version `1.2.13`.

## Increase in Android APK size:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nav: 12.2

## Introduction

Virtual Background plugin helps in customising one’s background that replacing the background with a static image or blurring the background.
Virtual Background plugin helps in customising one’s background by replacing the background with a static image or blurring the background.
This guide provides an overview of usage of the Virtual Background plugin of 100ms.

<div style={{textAlign: 'center'}}>
Expand Down Expand Up @@ -98,7 +98,7 @@ You can use backgroundImage property on HMSVirtualBackgroundPlugin to set a new
## Recommendations for supporting older devices

Built-in Virtual background plugin uses Apple's segementation APIs and is supported on iOS 15 and onwards.
In out testing, the built-in Virtual background plugin that uses Apple's segementation API performs well on iPhone 13, 12, 11, and XS. It may not perform well on iPhone X, 8, 7, 6 and older devices.
In our testing, the built-in Virtual background plugin that uses Apple's segementation API performs well on iPhone 13, 12, 11, and XS. It may not perform well on iPhone X, 8, 7, 6 and older devices.

If you would like to support iOS version lower than iOS 15 or want to support older devices, you can write a custom virtual background video plugin. For example you can use Google's MLKit's segementer for replcing background. Below is an example of writing a custom video plugin called 'GoogleSegementor'

Expand Down
11 changes: 11 additions & 0 deletions docs/javascript/v2/release-notes/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ description: Release Notes for 100ms JavaScript SDK
| @100mslive/hms-noise-cancellation | [![npm version](https://badge.fury.io/js/%40100mslive%2Fhms-noise-cancellation.svg)](https://badge.fury.io/js/%40100mslive%2Fhms-noise-cancellation) |
| @100mslive/hms-video-react(deprecated) | [![npm version](https://badge.fury.io/js/%40100mslive%2Fhms-video-react.svg)](https://badge.fury.io/js/%40100mslive%2Fhms-video-react) |

## 2024-06-05
Released: `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`

### Added:
- Roomkit Prebuilt: Closed captions
- `findPeerByName` API for large rooms

### Fixed:
- Average jitter buffer delay calculation
- Roomkit Prebuilt: peers able to submit quiz attempts multiple times by rejoining

## 2024-05-24
Released: `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`, `@100mslive/[email protected]`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
---
title: Virtual Background Plugin (Beta)
nav: 13.3
---

Virtual Background plugin helps in customising one’s background that replacing the background with a static image or blurring the background.
This guide provides an overview of usage of the Virtual Background plugin of 100ms.

<video loop="true" autoplay="autoplay" controls="controls" id="vid" muted height="700" width="300">
<source src="/docs/guides/virtual-background-ui-demo.mov" type="video/mp4" />
</video>
<br />

## Minimum Requirements

- Minimum `@100mslive/react-native-hms` SDK verison is `^1.10.6`
- `@100mslive/react-native-video-plugin` library is required


## Limitations

### Android
- Has poor fps on older android phones

### iOS
- Minimum iOS version required to support Virtual Background plugin is `iOS 15`
- Virtual background plugin is in beta stage and may have performance issues on iPhone X, 8, 7, 6 and other older devices. We recommend that you use this feature on a high performance device for smooth experience.


## Usage

<div className="steps-container">

### Step 1: Add required dependency

Install `@100mslive/react-native-video-plugin` library

```bash
npm install @100mslive/react-native-video-plugin
```

### Step 2: Create instance of HMSVirtualBackgroundPlugin

```js{2,6}
// Import from `@100mslive/react-native-video-plugin` library
import { HMSVirtualBackgroundPlugin } from '@100mslive/react-native-video-plugin';
...
const virtualBackgroundPlugin = new HMSVirtualBackgroundPlugin();
```

### Step 3: Create instance of HMSVideoTrackSettings

```js{4}
let videoSettings = new HMSVideoTrackSettings({
initialState: HMSTrackSettingsInitState.MUTED
// The virtual background plugin to use for the video track. @type {HMSVirtualBackgroundPlugin}
videoPlugin: virtualBackgroundPlugin,
});
let trackSettings = new HMSTrackSettings({
video: videoSettings,
});
```

### Step 4: Pass the Track Settings to the HMSSDK

```js{2}
const hmsInstance = await HMSSDK.build({
trackSettings,
});
```

### Step 5: How to enable and disable virtual background

Hold on to a reference to the instance of HMSVirtualBackgroundPlugin and use `enable` and `disable` methods on it to enable/disable the virtual background.

```js
const virtualBackgroundPlugin = new HMSVirtualBackgroundPlugin();

...

let isVBEnabled = false;

// Enable VB
await virtualBackgroundPlugin.enable();
isVBEnabled = true;

// Disable VB
await virtualBackgroundPlugin.disable();
isVBEnabled = false;
```

> Always call `enable` method after `ON_JOIN` and `ON_PREVIEW` event
> Enabling Virtual Background and applying effect can take some time, you should add a loader in UI.
### Step 6: How to apply Blur as virtual background

Enable the blur background using the `setBlur` method. You should pass blur percentage ranging from 0-100

```js
const virtualBackgroundPlugin = new HMSVirtualBackgroundPlugin();

...
// state for tracking if VB is enabled
let isVBEnabled = false;

// If VB is disabled, first enable it before calling `setBlur` method
if (isVBEnabled === false) {
await virtualBackgroundPlugin.enable();
isVBEnabled = true;
}

await virtualBackgroundPlugin.setBlur(100);
```

> You should only call `setBlur` method only after enabling the virtual background
### Step 7: How to apply Image as virtual background

Enable the background image using the `setBackground` method. It accepts image source (either a object with height, width and uri properties or a static image file).

Here is how to use a static image file -

```js
const virtualBackgroundPlugin = new HMSVirtualBackgroundPlugin();

...
// state for tracking if VB is enabled
let isVBEnabled = false;

// If VB is disabled, first enable it before calling `setBlur` method
if (isVBEnabled === false) {
await virtualBackgroundPlugin.enable();
isVBEnabled = true;
}

const image = require('<PATH_TO_IMAGE_HERE>'); // ex: require('../assets/VB-1.jpg')
await virtualBackgroundPlugin.setBackground(image);
```

Here is how to use remote image file, `setBackground` method accepts object of following type -

```js
export interface ImageURISource {
width: number;

height: number;

/**
* `uri` is a string representing the resource identifier for the image, which
* could be an http address, a local file path, or the name of a static image
* resource (which should be wrapped in the `require('./path/to/image.png')`
* function).
*/
uri:
}

...

await virtualBackgroundPlugin.setBackground({
width,
height,
uri: 'file://...', // path of image stored in device
});
```

Using library like [react-native-image-picker](https://www.npmjs.com/package/react-native-image-picker) -

```js
import { launchImageLibrary } from 'react-native-image-picker';

...

// You can use result from library like `react-native-image-picker` to use images from photo library
const result = await launchImageLibrary({ mediaType: 'photo', selectionLimit: 1 });

// getting first image
const imageObject = response.assets?.[0];

// If image is selected, use it as background
if (imageObject) {
await virtualBackgroundPlugin.setBackground(imageObject);
}
```
> You should only call `setBackground` method only after enabling the virtual background
</div>
40 changes: 40 additions & 0 deletions docs/react-native/v2/release-notes/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,46 @@ nav: 4.1
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| @100mslive/react-native-room-kit | [![npm](https://img.shields.io/npm/v/@100mslive/react-native-room-kit)](https://www.npmjs.com/package/@100mslive/react-native-room-kit) |
| @100mslive/react-native-hms | [![npm](https://img.shields.io/npm/v/@100mslive/react-native-hms)](https://www.npmjs.com/package/@100mslive/react-native-hms) |
| @100mslive/react-native-video-plugin | [![npm](https://img.shields.io/npm/v/@100mslive/react-native-video-plugin)](https://www.npmjs.com/package/@100mslive/react-native-video-plugin) |

## 1.10.6 - 2024-06-10

| Package | Version |
| -------------------------------- | ------- |
| @100mslive/react-native-room-kit | 1.1.9 |
| @100mslive/react-native-hms | 1.10.6 |
| @100mslive/react-native-video-plugin | 0.1.2 |

### react-native-hms

- Introducing Virtual Background support in 100ms

HMSSDK now provides support for Virtual Background using [`@100mslive/react-native-video-plugin`](https://github.com/100mslive/react-native-video-plugin).
It allows users to change their background during a call. Users can choose from a variety of backgrounds or upload their own custom background.
It also provides a feature to blur the background. Read more about it [here](https://www.100ms.live/docs/react-native/v2/how-to-guides/extend-capabilities/virtual-background).

- Resolved warnings on Android & iOS when using HMSSDK in development mode

### react-native-room-kit

- Added support for Virtual Background in Prebuilt UI

By just adding [`@100mslive/react-native-video-plugin`](https://github.com/100mslive/react-native-video-plugin) package, users can now change their background during a call using the Virtual Background feature in the Prebuilt UI.

- Added support for Hyperlinks in Chat Messages on Prebuilt UI

Users can now click on hyperlinks in chat messages to open them in a browser.

### react-native-video-plugin

- The first version of the plugin is released. It provides support for Virtual Background in 100ms. Read more about it [here](https://www.100ms.live/docs/react-native/v2/how-to-guides/extend-capabilities/virtual-background).


Uses Android SDK 2.9.59 & iOS SDK 1.11.0

**Full Changelog**: [1.10.5...1.10.6](https://github.com/100mslive/react-native-hms/compare/1.10.5...1.10.6)



## 1.10.5 - 2024-05-15

Expand Down
15 changes: 10 additions & 5 deletions public/api-reference/android/v2/hls-player/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3292,21 +3292,26 @@
<a href="../virtualBackground/live.hms.video.virtualbackground/init.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon function"></span><span class="nav-link-child"><span><span>init()</span></span></span></span></a>
</div>
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-4" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode///PointingToDeclaration//1871642348">
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-4" pageid="virtualBackground::live.hms.video.virtualbackground/VideoFrameInfoListener///PointingToDeclaration//1871642348">
<div class="overview">
<span class="navButton" onclick="document.getElementById(&quot;virtualBackground-nav-submenu-0-4&quot;).classList.toggle(&quot;hidden&quot;);"><span class="navButtonContent"></span></span><a href="../virtualBackground/live.hms.video.virtualbackground/-video-plugin-mode/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon enum-class-kt"></span><span class="nav-link-child"><span>Video</span><wbr><span>Plugin</span><wbr><span><span>Mode</span></span></span></span></a>
<a href="../virtualBackground/live.hms.video.virtualbackground/-video-frame-info-listener/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon interface-kt"></span><span class="nav-link-child"><span>Video</span><wbr><span>Frame</span><wbr><span>Info</span><wbr><span><span>Listener</span></span></span></span></a>
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-4-0" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.REPLACE_BACKGROUND///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-5" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode///PointingToDeclaration//1871642348">
<div class="overview">
<span class="navButton" onclick="document.getElementById(&quot;virtualBackground-nav-submenu-0-5&quot;).classList.toggle(&quot;hidden&quot;);"><span class="navButtonContent"></span></span><a href="../virtualBackground/live.hms.video.virtualbackground/-video-plugin-mode/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon enum-class-kt"></span><span class="nav-link-child"><span>Video</span><wbr><span>Plugin</span><wbr><span><span>Mode</span></span></span></span></a>
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-5-0" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.REPLACE_BACKGROUND///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
<div class="overview">
<a href="../virtualBackground/live.hms.video.virtualbackground/-video-plugin-mode/-r-e-p-l-a-c-e_-b-a-c-k-g-r-o-u-n-d/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon enum-class-kt"></span><span class="nav-link-child"><span><span>REPLACE_BACKGROUND</span></span></span></span></a>
</div>
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-4-1" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.BLUR_BACKGROUND///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-5-1" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.BLUR_BACKGROUND///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
<div class="overview">
<a href="../virtualBackground/live.hms.video.virtualbackground/-video-plugin-mode/-b-l-u-r_-b-a-c-k-g-r-o-u-n-d/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon enum-class-kt"></span><span class="nav-link-child"><span><span>BLUR_BACKGROUND</span></span></span></span></a>
</div>
</div>
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-4-2" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.NONE///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
<div class="sideMenuPart" id="virtualBackground-nav-submenu-0-5-2" pageid="virtualBackground::live.hms.video.virtualbackground/VideoPluginMode.NONE///PointingToDeclaration/{&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;:{&quot;key&quot;:&quot;org.jetbrains.dokka.links.EnumEntryDRIExtra&quot;}}/1871642348">
<div class="overview">
<a href="../virtualBackground/live.hms.video.virtualbackground/-video-plugin-mode/-n-o-n-e/index.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon enum-class-kt"></span><span class="nav-link-child"><span><span>NONE</span></span></span></span></a>
</div>
Expand Down
Loading

0 comments on commit ebefdcd

Please sign in to comment.