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.

functions.js 818B

123456789101112131415161718192021222324252627
  1. // @flow
  2. import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
  3. let loadRnnoisePromise;
  4. /**
  5. * Returns promise that resolves with a RnnoiseProcessor instance.
  6. *
  7. * @returns {Promise<RnnoiseProcessor>} - Resolves with the blur effect instance.
  8. */
  9. export function createRnnoiseProcessorPromise() {
  10. // Subsequent calls should not attempt to load the script multiple times.
  11. if (!loadRnnoisePromise) {
  12. loadRnnoisePromise = loadScript('libs/rnnoise-processor.min.js');
  13. }
  14. return loadRnnoisePromise.then(() => {
  15. const ns = getJitsiMeetGlobalNS();
  16. if (ns?.effects?.rnnoise?.createRnnoiseProcessor) {
  17. return ns.effects.rnnoise.createRnnoiseProcessor();
  18. }
  19. throw new Error('Rnnoise module binding createRnnoiseProcessor not found!');
  20. });
  21. }