Skip to content

Commit

Permalink
Update storybook to add changeBackgroundReplacementImage (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
dingyishen-amazon authored Aug 8, 2024
1 parent 93c8ead commit 4e54039
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `changeBackgroundReplacementImage` function in the `BackgroundReplacementProvider` to enable the functionality of changing the background replacement image. `changeBackgroundReplacementImage` will take a `Blob` as parameter and return a `Promise`.
- Add `changeBackgroundReplacementImage` function in the `BackgroundReplacementProvider` to enable the functionality of changing the background replacement image. `changeBackgroundReplacementImage` will take a `Blob` as its parameter and return a `Promise`.

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ when mounted, which may impact performance.

// A function to transform a video input device to a `DefaultVideoTransformDevice`.
createBackgroundReplacementDevice: (device: Device) => Promise<DefaultVideoTransformDevice>;

// The current `backgroundBlurProcessor` applied to the video device that is generated when you call `createBackgroundBlurDevice`.

This comment has been minimized.

Copy link
@ziyiz-amzn

ziyiz-amzn Aug 8, 2024

Contributor

Is the comment accurate?

backgroundReplacementProcessor: BackgroundReplacementProcessor | undefined;

// A function to change the background replacement image.
changeBackgroundReplacementImage: (imageBlob: Blob) => Promise<void>;
}

```
Expand All @@ -37,6 +43,8 @@ For more information, refer to [Video Processing APIs](https://github.com/aws/am

You can access the current `backgroundReplacementProcessor` applied to the video device that is generated when you call `createBackgroundBlurDevice`. You can apply observer notifications to the processor. Refer to [the guide for adding observer notifications to a BackgroundReplacementProcessor](https://github.com/aws/amazon-chime-sdk-js/blob/main/guides/15_Background_Filter_Video_Processor.md#observer-notifications)

You can change the background replacement image by `changeBackgroundReplacementImage`. The background can be set to either a custom color or an image, both of which need to be converted into a `Blob`.

One thing to note is that calling `meetingManager.startVideoInputDevice()` with a `Device` type while the current selected video input device is a `VideoTransformDevice`
will automatically stop any processors running within a `DefaultVideoTransformDevice` that was previously running. Lastly, make sure to construct a new `DefaultVideoTransformDevice` using `createBackgroundReplacementDevice`.
if the Props of the provider were changed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Lastly, make sure to construct a new `DefaultVideoTransformDevice` using `create

You can access the current `backgroundReplacementProcessor` applied to the video device that is generated when you call `createBackgroundBlurDevice`. You can apply observer notifications to the processor. Refer to [the guide for adding observer notifications to a BackgroundReplacementProcessor](https://github.com/aws/amazon-chime-sdk-js/blob/main/guides/15_Background_Filter_Video_Processor.md#observer-notifications)

You can change the background replacement image by `changeBackgroundReplacementImage`. The background can be set to either a custom color or an image, both of which need to be converted into a `Blob`.
Background replacement related logs can be found in the browser developer tools when the `BackgroundReplacementProvider` is used within the app component tree.

## Return Value
Expand All @@ -30,6 +31,12 @@ Background replacement related logs can be found in the browser developer tools

// A function to transform a video input device to a `DefaultVideoTransformDevice`.
createBackgroundReplacementDevice: (device: Device) => Promise<DefaultVideoTransformDevice>;

// The current `backgroundBlurProcessor` applied to the video device that is generated when you call `createBackgroundBlurDevice`.
backgroundReplacementProcessor: BackgroundReplacementProcessor | undefined;

// A function to change the background replacement image.
changeBackgroundReplacementImage: (imageBlob: Blob) => Promise<void>;
}

```
Expand Down

0 comments on commit 4e54039

Please sign in to comment.