Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
  3. let filterSupport;
  4. /**
  5. * Returns promise that resolves with the blur effect instance.
  6. *
  7. * @returns {Promise<JitsiStreamBlurEffect>} - Resolves with the blur effect instance.
  8. */
  9. export function getBlurEffect() {
  10. const ns = getJitsiMeetGlobalNS();
  11. if (ns.effects && ns.effects.createBlurEffect) {
  12. return ns.effects.createBlurEffect();
  13. }
  14. return loadScript('libs/video-blur-effect.min.js').then(() => ns.effects.createBlurEffect());
  15. }
  16. /**
  17. * Checks context filter support.
  18. *
  19. * @returns {boolean} True if the filter is supported and false if the filter is not supported by the browser.
  20. */
  21. export function checkBlurSupport() {
  22. if (typeof filterSupport === 'undefined') {
  23. const canvas = document.createElement('canvas');
  24. const ctx = canvas.getContext('2d');
  25. filterSupport = typeof ctx.filter !== 'undefined';
  26. canvas.remove();
  27. }
  28. return filterSupport;
  29. }