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.

actions.web.tsx 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React from 'react';
  2. import { batch } from 'react-redux';
  3. import { IStore } from '../app/types';
  4. import { hideDialog, openDialog } from '../base/dialog/actions';
  5. import JitsiMeetJS from '../base/lib-jitsi-meet';
  6. import {
  7. setAudioMuted,
  8. setAudioUnmutePermissions,
  9. setVideoMuted,
  10. setVideoUnmutePermissions
  11. } from '../base/media/actions';
  12. import { VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
  13. import { showNotification } from '../notifications/actions';
  14. import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
  15. import { showStartRecordingNotificationWithCallback } from './actions.any';
  16. import { StartRecordingDialog } from './components/Recording';
  17. import RecordingLimitNotificationDescription from './components/web/RecordingLimitNotificationDescription';
  18. export * from './actions.any';
  19. /**
  20. * Grants recording consent by setting audio and video unmute permissions.
  21. *
  22. * @returns {Function}
  23. */
  24. export function grantRecordingConsent() {
  25. return (dispatch: IStore['dispatch']) => {
  26. batch(() => {
  27. dispatch(setAudioUnmutePermissions(false, true));
  28. dispatch(setVideoUnmutePermissions(false, true));
  29. dispatch(hideDialog());
  30. });
  31. };
  32. }
  33. /**
  34. * Grants recording consent, unmutes audio/video, and closes the dialog.
  35. *
  36. * @returns {Function}
  37. */
  38. export function grantRecordingConsentAndUnmute() {
  39. return (dispatch: IStore['dispatch']) => {
  40. batch(() => {
  41. dispatch(setAudioUnmutePermissions(false, true));
  42. dispatch(setVideoUnmutePermissions(false, true));
  43. dispatch(setAudioMuted(false, true));
  44. dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
  45. dispatch(hideDialog());
  46. });
  47. };
  48. }
  49. /**
  50. * Signals that a started recording notification should be shown on the
  51. * screen for a given period.
  52. *
  53. * @param {string} streamType - The type of the stream ({@code file} or
  54. * {@code stream}).
  55. * @returns {showNotification}
  56. */
  57. export function showRecordingLimitNotification(streamType: string) {
  58. const isLiveStreaming = streamType === JitsiMeetJS.constants.recording.mode.STREAM;
  59. return showNotification({
  60. description: <RecordingLimitNotificationDescription isLiveStreaming = { isLiveStreaming } />,
  61. titleKey: isLiveStreaming ? 'dialog.liveStreaming' : 'dialog.recording'
  62. }, NOTIFICATION_TIMEOUT_TYPE.LONG);
  63. }
  64. /**
  65. * Displays the notification suggesting to start the recording.
  66. *
  67. * @returns {void}
  68. */
  69. export function showStartRecordingNotification() {
  70. return (dispatch: IStore['dispatch']) => {
  71. const openDialogCallback = () => dispatch(openDialog(StartRecordingDialog));
  72. dispatch(showStartRecordingNotificationWithCallback(openDialogCallback));
  73. };
  74. }