bigbluebutton-Github/bigbluebutton-html5/imports/ui/services/virtual-background
João Victor Nunes fe67566334
[3.0] feat: Accept custom webcamBackgroundURL (#20920)
* [3.0] feat: Accept custom webcamBackgroundURL

* docs: webcamBackgroundURL

* test: Update virtual background thumbnail image

* fix: tweak error logs for the webcamBackgroundURL fetching procedure

* test: Update virtual background thumbnail image

* fix(logging): do not specify null extraInfo object

Co-authored-by: Paulo Lanzarin <4529051+prlanzarin@users.noreply.github.com>

* fix(logging): extract fields from error object for building extraInfo object

Co-authored-by: Paulo Lanzarin <4529051+prlanzarin@users.noreply.github.com>

---------

Co-authored-by: Paulo Lanzarin <4529051+prlanzarin@users.noreply.github.com>
2024-08-23 09:04:56 -03:00
..
index.js Add: useDeduplicatedSubscription hook (#20376) 2024-06-04 10:40:54 -03:00
README.md
service.js [3.0] feat: Accept custom webcamBackgroundURL (#20920) 2024-08-23 09:04:56 -03:00
TimeWorker.js

Virtual Backgrounds for BBB

Inspired from https://ai.googleblog.com/2020/10/background-features-in-google-meet.html, https://github.com/Volcomix/virtual-background.git and https://github.com/jitsi/jitsi-meet/tree/master/react/features/stream-effects/virtual-background/vendor

iOS and macOS

The feature works on macOS, however Safari is not supported. Due to limitations on iOS, it is currently not possible to enable virtual backgrounds feature on iPhones and iPads. The reason behind is documented on Apple Developer Documentation website.

The image object can be an img element, a canvas element, or a video element. Use of the video element is not supported in Safari on iOS, however.

Settings

Virtual backgrounds feature for BBB is turned on by default as long as the version you have comes with the feature included. In case your settings.yml doesn't include the virtual background settings, it will fall back to the default settings, which are identical to having the following parameters in your settings.yml file.

virtualBackgrounds:
 enabled: true
 storedOnBBB: true
 showThumbnails: true
 imagesPath: /resources/images/virtual-backgrounds/
 thumbnailsPath: /resources/images/virtual-backgrounds/thumbnails/
 fileNames:
  - home.jpg
  - coffeeshop.jpg
  - board.jpg

In case you don't have the virtual background settings in your settings.yml, add the above lines under public.app namespace, so it looks like the following.

public:
 app:
  ...
  ...
  virtualBackgrounds:
   (your settings here)

Explanation of settings

Setting Description Type
enabled Enables or disables virtual background feature boolean
storedOnBBB Determines where the images and thumbnails are stored. If set to true, virtual backgrounds and thumbnails will be fetched from /resources/images/virtual-backgrounds/. boolean
showThumbnails Determines whether to show or hide thumbnails. If set to false, a dropdown of fileNames will be shown. boolean
imagesPath Location of virtual background images. If storedOnBBB is set to false, it is possible to give an external location. IMPORTANT: File names must be given explicitly under fileNames if using non-default images. string
thumbnailsPath Location of virtual background image thumbnails. If storedOnBBB is set to false, it is possible to give an external location. IMPORTANT: Thumbnail file names and extensions must match their corresponding virtual background images. If showThumbnails is set to false, this can be ignored. string
fileNames List of file names that will be used as virtual backgrounds. File extensions must also be given. The same values are used for images and thumbnails. array

Canvas 2D + CPU

This rendering pipeline is pretty much the same as for BodyPix. It relies on Canvas compositing properties to blend rendering layers according to the segmentation mask.

Interactions with TFLite inference tool are executed on CPU to convert from UInt8 to Float32 for the model input and to apply softmax on the model output.

The framerate is higher and the quality looks better than BodyPix

SIMD and non-SIMD

How to test on SIMD:

  1. Go to chrome://flags/
  2. Search for SIMD flag
  3. Enable WebAssembly SIMD support(Enables support for the WebAssembly SIMD proposal).
  4. Reopen Google Chrome

More details:

LICENSE

The models vendored here were downloaded early January (they were available as early as the 4th), before Google switched the license away from Apache 2. Thus we understand they are not covered by the new license which according to the model card dates from the 21st of January.

We are not lawyers so do get legal advise if in doubt.

References: