Skip to content

Commit

Permalink
Merge pull request #2270 from 100mslive/qa
Browse files Browse the repository at this point in the history
Release PR
  • Loading branch information
ygit authored Jun 12, 2024
2 parents 3a1ee80 + caf12d3 commit c912c48
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default redirect('/v3/100ms-v3/basics');

This is needed because we need it to route somewhere if someone hits `/v3` this would redirect it to `/v3/100ms-v3/basics` i.e the MDX file `/v3/100ms-v3/basics.mdx`

Then follow the Steps in 1. to add docs to it.
Then follow the steps in 1 to add docs to it.

### 3. Aliasing Repeating Content

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var audioTrackSetting = HMSAudioTrackSetting(
/// Create Instance of `HMSTrackSetting`
var trackSettings = HMSTrackSetting(
audioTrackSetting: HMSAudioTrackSetting(
enableNoiseCancellation: isNoiseCancellationEnabled),
enableNoiseCancellation: true),
videoTrackSetting: HMSVideoTrackSetting(
trackInitialState: joinWithMutedVideo
? HMSTrackInitState.MUTED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
---
title: Virtual Background Plugin (Beta)
nav: 13.4
---

Virtual Background plugin helps customise one’s background by replacing the background with a static image or blurring the background. This guide provides an overview of using 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 />

## Supported Versions/Resolutions

- Minimum 100ms SDK version it can work with is `1.10.3`

## Limitations

- Has poor fps on older android phones
- 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.

## Add dependency

To add virtual background to your application add `hms_video_plugin` to your application's `pubspec.yaml` file.

```yaml
hms_video_plugin:
```
## How to Integrate Virtual Background Plugin:
> 🔑 Note: `hms_video_plugin` cannot be used independently. Always call the virtual background APIs after `onJoin` or `onPreview`.

<div className="steps-container">

### Step 1: Set the isVirtualBackgroundEnabled property in HMSVideoTrackSetting as true

```dart
var videoTrackSetting = HMSVideoTrackSetting(
trackInitialState: joinWithMutedVideo
? HMSTrackInitState.MUTED
: HMSTrackInitState.UNMUTED,
isVirtualBackgroundEnabled: true);
```

### Step 2: Pass the Track Settings to the HMSSDK constructor

```dart
/// Create Instance of `HMSTrackSetting`
var trackSettings = HMSTrackSetting(
audioTrackSetting: HMSAudioTrackSetting(),
videoTrackSetting: videoTrackSetting);

/// Set the track settings to HMSSDK
var hmsSDK = HMSSDK(
hmsTrackSetting: trackSettings);
```
### Step 3: Check for Virtual Background availability
```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{

...

bool isVirtualBackgroundSupported = false;

/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}

...
}
```

### Step 4: If Virtual Background is available, enable it

To enable virtual background, call the `enable` method.

```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{
...
bool isVirtualBackgroundSupported = false;
/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}
void enableVirtualBackground(Uint8List? image) async{
///[image] is the image to be set as background
if(isVirtualBackgroundSupported){
HMSException? isEnabled = await HMSVideoPlugin.enable(image: image);
if(isEnabled == null){
///Virtual background started successfully
}else{
///Error enabling virtual background
}
}
}
...
}
```

To enabled background blur, call the `enableBlur` method.

```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{
...
bool isVirtualBackgroundSupported = false;
/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}
void enableBackgroundBlur(int blurRadius) async{
///[blurRadius] is the radius of the blur effect
if(isVirtualBackgroundSupported){
HMSException? isEnabled = await HMSVideoPlugin.enableBlur(blurRadius: blurRadius);
if(isEnabled == null){
///Background blur started successfully
}else{
///Error enabling blur
}
}
}
...
}
```

### Step 5: To change virtual background image use changeVirtualBackground method

```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{
...
bool isVirtualBackgroundSupported = false;
/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}
///If virtual background is enabled, then we can change the virtual background image
void changeVirtualBackground(Uint8List? image) {
///[image] is the image new image to be set as background
///[isVirtualBackgroundSupported] is the flag to check if virtual background is supported
///[isVirtualBackgroundEnabled] is the flag to check if virtual background is enabled
if(isVirtualBackgroundSupported && isVirtualBackgroundEnabled){
HMSVideoPlugin.changeVirtualBackground(image: image);
}
}
...
}
```

### Step 6: To disable Virtual Background use disable methods

To disable virtual background, call the `disable` method.

```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{
...
bool isVirtualBackgroundSupported = false;
/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}
void disableVirtualBackground() async{
if(isVirtualBackgroundSupported){
HMSException? isDisabled = await HMSVideoPlugin.disable();
if(isDisabled == null){
///Virtual Background disabled successfully
}else{
///Error disabling virtual background
}
}
}
...
}
```

To disable background blur use `disableBlur` method

```dart
class Meeting implements HMSUpdateListener, HMSActionResultListener{
...
bool isVirtualBackgroundSupported = false;
/// This method checks the virtual background availability
void checkIsVirtualBackgroundSupported() async {
isVirtualBackgroundSupported = await HMSVideoPlugin.isSupported();
}
void disableBackgroundBlur() async{
if(isVirtualBackgroundSupported){
HMSException? isDisabled = await HMSVideoPlugin.disableBlur();
if(isDisabled == null){
///Background blur disabled successfully
}else{
///Error disabling blur
}
}
}
...
}
```

</div>
27 changes: 27 additions & 0 deletions docs/flutter/v2/release-notes/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ nav: 99
| -------------- | ------------------------------------------------------------------------------------------------------ |
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |
| hms_video_plugin | [![Pub Version](https://img.shields.io/pub/v/hms_video_plugin)](https://pub.dev/packages/hms_video_plugin) |

## 1.10.3 - 2024-06-12

| Package | Version |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| hms_room_kit | 1.1.3 |
| hmssdk_flutter | 1.10.3 |
| hms_video_plugin | 0.0.1 |


### hms_room_kit

- Hand Raise can now be controlled from dashboard

Hand Raise feature can now be enabled or disabled from the dashboard prebuilt customiser.

### hms_video_plugin

- Introducing support for Virtual Background and Blur

Users can now use virtual background and blur features in their video calls using the `hms_video_plugin`.
Learn more about the feature [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/extend-capabilities/virtual-background)

Uses Android SDK 2.9.59 & iOS SDK 1.12.0

**Full Changelog**: [1.10.2...1.10.3](https://github.com/100mslive/100ms-flutter/compare/1.10.2...1.10.3)

## 1.10.2 - 2024-05-15

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This guide provides an overview of usage of the Virtual Background plugin of 100

## Minimum Requirements

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


Expand Down

0 comments on commit c912c48

Please sign in to comment.