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.

functions.js 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
  3. /**
  4. * Searches in the passed in redux state for an active recording session of the
  5. * passed in mode.
  6. *
  7. * @param {Object} state - The redux state to search in.
  8. * @param {string} mode - Find an active recording session of the given mode.
  9. * @returns {Object|undefined}
  10. */
  11. export function getActiveSession(state: Object, mode: string) {
  12. const { sessionDatas } = state['features/recording'];
  13. const { status: statusConstants } = JitsiRecordingConstants;
  14. return sessionDatas.find(sessionData => sessionData.mode === mode
  15. && (sessionData.status === statusConstants.ON
  16. || sessionData.status === statusConstants.PENDING));
  17. }
  18. /**
  19. * Searches in the passed in redux state for a recording session that matches
  20. * the passed in recording session ID.
  21. *
  22. * @param {Object} state - The redux state to search in.
  23. * @param {string} id - The ID of the recording session to find.
  24. * @returns {Object|undefined}
  25. */
  26. export function getSessionById(state: Object, id: string) {
  27. return state['features/recording'].sessionDatas.find(
  28. sessionData => sessionData.id === id);
  29. }