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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // @flow
  2. import {
  3. ENDPOINT_MESSAGE_RECEIVED,
  4. REMOVE_TRANSCRIPT_MESSAGE,
  5. TOGGLE_REQUESTING_SUBTITLES,
  6. UPDATE_TRANSCRIPT_MESSAGE
  7. } from './actionTypes';
  8. /**
  9. * Signals that a participant sent an endpoint message on the data channel.
  10. *
  11. * @param {Object} participant - The participant details sending the message.
  12. * @param {Object} json - The json carried by the endpoint message.
  13. * @returns {{
  14. * type: ENDPOINT_MESSAGE_RECEIVED,
  15. * participant: Object,
  16. * json: Object
  17. * }}
  18. */
  19. export function endpointMessageReceived(participant: Object, json: Object) {
  20. return {
  21. type: ENDPOINT_MESSAGE_RECEIVED,
  22. participant,
  23. json
  24. };
  25. }
  26. /**
  27. * Signals that a transcript has to be removed from the state.
  28. *
  29. * @param {string} transcriptMessageID - The message_id to be removed.
  30. * @returns {{
  31. * type: REMOVE_TRANSCRIPT_MESSAGE,
  32. * transcriptMessageID: string,
  33. * }}
  34. */
  35. export function removeTranscriptMessage(transcriptMessageID: string) {
  36. return {
  37. type: REMOVE_TRANSCRIPT_MESSAGE,
  38. transcriptMessageID
  39. };
  40. }
  41. /**
  42. * Signals that a transcript with the given message_id to be added or updated
  43. * is received.
  44. *
  45. * @param {string} transcriptMessageID -The transcript message_id to be updated.
  46. * @param {Object} newTranscriptMessage - The updated transcript message.
  47. * @returns {{
  48. * type: UPDATE_TRANSCRIPT_MESSAGE,
  49. * transcriptMessageID: string,
  50. * newTranscriptMessage: Object
  51. * }}
  52. */
  53. export function updateTranscriptMessage(transcriptMessageID: string,
  54. newTranscriptMessage: Object) {
  55. return {
  56. type: UPDATE_TRANSCRIPT_MESSAGE,
  57. transcriptMessageID,
  58. newTranscriptMessage
  59. };
  60. }
  61. /**
  62. * Signals that the local user has toggled the ClosedCaption button.
  63. *
  64. * @returns {{
  65. * type: TOGGLE_REQUESTING_SUBTITLES
  66. * }}
  67. */
  68. export function toggleRequestingSubtitles() {
  69. return {
  70. type: TOGGLE_REQUESTING_SUBTITLES
  71. };
  72. }