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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // `<span data-i18n='[html]userMedia.${this.browser}GrantPermissions'
  22. // class='inlay__text'></span>`
  23. let title = 'HipChat Video needs to use your microphone and camera.';
  24. let text;
  25. text = 'Select "Allow" when your browser asks for these permissions.';
  26. return (
  27. `<div class="inlay">
  28. <span class="inlay__icon icon-microphone"></span>
  29. <span class="inlay__icon icon-camera"></span>
  30. <h3 class="inlay__title">${title}</h3>
  31. <span class='inlay__text'>${text}</span>
  32. </div>`
  33. );
  34. }
  35. }
  36. /**
  37. * Stores GUM overlay instance.
  38. * @type {GUMOverlayImpl}
  39. */
  40. let overlay;
  41. export default {
  42. /**
  43. * Checks whether the overlay is currently visible.
  44. * @return {boolean} <tt>true</tt> if the overlay is visible
  45. * or <tt>false</tt> otherwise.
  46. */
  47. isVisible () {
  48. return overlay && overlay.isVisible();
  49. },
  50. /**
  51. * Shows browser-specific overlay with guidance how to proceed with
  52. * gUM prompt.
  53. * @param {string} browser - name of browser for which to show the
  54. * guidance overlay.
  55. */
  56. show(browser) {
  57. if (!overlay) {
  58. overlay = new GUMOverlayImpl(browser);
  59. }
  60. overlay.show();
  61. },
  62. /**
  63. * Hides browser-specific overlay with guidance how to proceed with
  64. * gUM prompt.
  65. */
  66. hide() {
  67. overlay && overlay.hide();
  68. }
  69. };