Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

actions.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // @flow
  2. import { getConferenceState } from '../base/conference';
  3. import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
  4. import {
  5. DISMISS_PENDING_PARTICIPANT,
  6. DISABLE_MODERATION,
  7. ENABLE_MODERATION,
  8. LOCAL_PARTICIPANT_APPROVED,
  9. LOCAL_PARTICIPANT_MODERATION_NOTIFICATION,
  10. PARTICIPANT_APPROVED,
  11. PARTICIPANT_PENDING_AUDIO,
  12. REQUEST_DISABLE_MODERATION,
  13. REQUEST_ENABLE_MODERATION
  14. } from './actionTypes';
  15. /**
  16. * Action used by moderator to approve audio and video for a participant.
  17. *
  18. * @param {staring} id - The id of the participant to be approved.
  19. * @returns {void}
  20. */
  21. export const approveParticipant = (id: string) => (dispatch: Function, getState: Function) => {
  22. const { conference } = getConferenceState(getState());
  23. conference.avModerationApprove(MEDIA_TYPE.AUDIO, id);
  24. conference.avModerationApprove(MEDIA_TYPE.VIDEO, id);
  25. };
  26. /**
  27. * Audio or video moderation is disabled.
  28. *
  29. * @param {MediaType} mediaType - The media type that was disabled.
  30. * @param {JitsiParticipant} actor - The actor disabling.
  31. * @returns {{
  32. * type: REQUEST_DISABLE_MODERATED_AUDIO
  33. * }}
  34. */
  35. export const disableModeration = (mediaType: MediaType, actor: Object) => {
  36. return {
  37. type: DISABLE_MODERATION,
  38. mediaType,
  39. actor
  40. };
  41. };
  42. /**
  43. * Hides the notification with the participant that asked to unmute audio.
  44. *
  45. * @param {Object} participant - The participant for which the notification to be hidden.
  46. * @returns {Object}
  47. */
  48. export function dismissPendingAudioParticipant(participant: Object) {
  49. return dismissPendingParticipant(participant.id, MEDIA_TYPE.AUDIO);
  50. }
  51. /**
  52. * Hides the notification with the participant that asked to unmute.
  53. *
  54. * @param {string} id - The participant id for which the notification to be hidden.
  55. * @param {MediaType} mediaType - The media type.
  56. * @returns {Object}
  57. */
  58. export function dismissPendingParticipant(id: string, mediaType: MediaType) {
  59. return {
  60. type: DISMISS_PENDING_PARTICIPANT,
  61. id,
  62. mediaType
  63. };
  64. }
  65. /**
  66. * Audio or video moderation is enabled.
  67. *
  68. * @param {MediaType} mediaType - The media type that was enabled.
  69. * @param {JitsiParticipant} actor - The actor enabling.
  70. * @returns {{
  71. * type: REQUEST_ENABLE_MODERATED_AUDIO
  72. * }}
  73. */
  74. export const enableModeration = (mediaType: MediaType, actor: Object) => {
  75. return {
  76. type: ENABLE_MODERATION,
  77. mediaType,
  78. actor
  79. };
  80. };
  81. /**
  82. * Requests disable of audio and video moderation.
  83. *
  84. * @returns {{
  85. * type: REQUEST_DISABLE_MODERATED_AUDIO
  86. * }}
  87. */
  88. export const requestDisableModeration = () => {
  89. return {
  90. type: REQUEST_DISABLE_MODERATION
  91. };
  92. };
  93. /**
  94. * Requests enabled audio & video moderation.
  95. *
  96. * @returns {{
  97. * type: REQUEST_ENABLE_MODERATED_AUDIO
  98. * }}
  99. */
  100. export const requestEnableModeration = () => {
  101. return {
  102. type: REQUEST_ENABLE_MODERATION
  103. };
  104. };
  105. /**
  106. * Local participant was approved to be able to unmute audio and video.
  107. *
  108. * @param {MediaType} mediaType - The media type to disable.
  109. * @returns {{
  110. * type: LOCAL_PARTICIPANT_APPROVED
  111. * }}
  112. */
  113. export const localParticipantApproved = (mediaType: MediaType) => {
  114. return {
  115. type: LOCAL_PARTICIPANT_APPROVED,
  116. mediaType
  117. };
  118. };
  119. /**
  120. * Shows notification when A/V moderation is enabled and local participant is still not approved.
  121. *
  122. * @param {MediaType} mediaType - Audio or video media type.
  123. * @returns {Object}
  124. */
  125. export function showModeratedNotification(mediaType: MediaType) {
  126. return {
  127. type: LOCAL_PARTICIPANT_MODERATION_NOTIFICATION,
  128. mediaType
  129. };
  130. }
  131. /**
  132. * Shows a notification with the participant that asked to audio unmute.
  133. *
  134. * @param {Object} participant - The participant for which is the notification.
  135. * @returns {Object}
  136. */
  137. export function participantPendingAudio(participant: Object) {
  138. return {
  139. type: PARTICIPANT_PENDING_AUDIO,
  140. participant
  141. };
  142. }
  143. /**
  144. * A participant was approved to unmute for a mediaType.
  145. *
  146. * @param {string} id - The id of the approved participant.
  147. * @param {MediaType} mediaType - The media type which was approved.
  148. * @returns {{
  149. * type: PARTICIPANT_APPROVED,
  150. * }}
  151. */
  152. export function participantApproved(id: string, mediaType: MediaType) {
  153. return {
  154. type: PARTICIPANT_APPROVED,
  155. id,
  156. mediaType
  157. };
  158. }