You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 776B

12345678910111213141516171819202122232425
  1. // @flow
  2. import { load } from '@tensorflow-models/body-pix';
  3. import JitsiStreamBlurEffect from './JitsiStreamBlurEffect';
  4. /**
  5. * This promise represents the loading of the BodyPix model that is used
  6. * to extract person segmentation. A multiplier of 0.25 is used to for
  7. * improved performance on a larger range of CPUs.
  8. */
  9. const bpModelPromise = load(0.25);
  10. /**
  11. * Creates a new instance of JitsiStreamBlurEffect.
  12. *
  13. * @returns {Promise<JitsiStreamBlurEffect>}
  14. */
  15. export function createBlurEffect() {
  16. if (!MediaStreamTrack.prototype.getSettings && !MediaStreamTrack.prototype.getConstraints) {
  17. return Promise.reject(new Error('JitsiStreamBlurEffect not supported!'));
  18. }
  19. return bpModelPromise.then(bpmodel => new JitsiStreamBlurEffect(bpmodel));
  20. }