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.

UserMediaPermissionsGuidanceOverlay.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* global */
  2. import Overlay from '../overlay/Overlay';
  3. /**
  4. * An overlay with guidance how to proceed with gUM prompt.
  5. */
  6. class GUMOverlayImpl extends Overlay {
  7. /**
  8. * Constructs overlay with guidance how to proceed with gUM prompt.
  9. * @param {string} browser - name of browser for which to construct the
  10. * guidance overlay.
  11. * @override
  12. */
  13. constructor(browser) {
  14. super();
  15. this.browser = browser;
  16. }
  17. /**
  18. * @inheritDoc
  19. */
  20. _buildOverlayContent() {
  21. return `
  22. <span class="overlay_icon icon-microphone"></span>
  23. <span class="overlay_icon icon-camera"></span>
  24. <span data-i18n='[html]userMedia.${this.browser}GrantPermissions'
  25. class='overlay_text_small'></span>`;
  26. }
  27. }
  28. /**
  29. * Stores GUM overlay instance.
  30. * @type {GUMOverlayImpl}
  31. */
  32. let overlay;
  33. export default {
  34. /**
  35. * Checks whether the overlay is currently visible.
  36. * @return {boolean} <tt>true</tt> if the overlay is visible
  37. * or <tt>false</tt> otherwise.
  38. */
  39. isVisible () {
  40. return overlay && overlay.isVisible();
  41. },
  42. /**
  43. * Shows browser-specific overlay with guidance how to proceed with
  44. * gUM prompt.
  45. * @param {string} browser - name of browser for which to show the
  46. * guidance overlay.
  47. */
  48. show(browser) {
  49. if (!overlay) {
  50. overlay = new GUMOverlayImpl(browser);
  51. }
  52. overlay.show();
  53. },
  54. /**
  55. * Hides browser-specific overlay with guidance how to proceed with
  56. * gUM prompt.
  57. */
  58. hide() {
  59. overlay && overlay.hide();
  60. }
  61. };