Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

AbstractRecordingLabel.ts 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import React, { Component } from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { IReduxState } from '../../app/types';
  4. import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
  5. import { isRecorderTranscriptionsRunning } from '../../transcribing/functions';
  6. import {
  7. getSessionStatusToShow,
  8. isLiveStreamingRunning,
  9. isRecordingRunning,
  10. isRemoteParticipantRecordingLocally
  11. } from '../functions';
  12. export interface IProps extends WithTranslation {
  13. /**
  14. * Whether this is the Jibri recorder participant.
  15. */
  16. _iAmRecorder: boolean;
  17. /**
  18. * Whether this meeting is being transcribed.
  19. */
  20. _isTranscribing: boolean;
  21. /**
  22. * Whether the recording/livestreaming/transcriber is currently running.
  23. */
  24. _isVisible: boolean;
  25. /**
  26. * The status of the higher priority session.
  27. */
  28. _status?: string;
  29. /**
  30. * The recording mode this indicator should display.
  31. */
  32. mode: string;
  33. }
  34. /**
  35. * Abstract class for the {@code RecordingLabel} component.
  36. */
  37. export default class AbstractRecordingLabel<P extends IProps = IProps> extends Component<P> {
  38. /**
  39. * Implements React {@code Component}'s render.
  40. *
  41. * @inheritdoc
  42. */
  43. render() {
  44. const { _iAmRecorder, _isVisible } = this.props;
  45. return _isVisible && !_iAmRecorder ? this._renderLabel() : null;
  46. }
  47. /**
  48. * Renders the platform specific label component.
  49. *
  50. * @protected
  51. * @returns {React$Element}
  52. */
  53. _renderLabel(): React.ReactNode | null {
  54. return null;
  55. }
  56. }
  57. /**
  58. * Maps (parts of) the Redux state to the associated
  59. * {@code AbstractRecordingLabel}'s props.
  60. *
  61. * @param {Object} state - The Redux state.
  62. * @param {IProps} ownProps - The component's own props.
  63. * @private
  64. * @returns {{
  65. * _status: ?string
  66. * }}
  67. */
  68. export function _mapStateToProps(state: IReduxState, ownProps: any) {
  69. const { mode } = ownProps;
  70. const isLiveStreamingLabel = mode === JitsiRecordingConstants.mode.STREAM;
  71. const _isTranscribing = isRecorderTranscriptionsRunning(state);
  72. const _isLivestreamingRunning = isLiveStreamingRunning(state);
  73. const _isVisible = isLiveStreamingLabel
  74. ? _isLivestreamingRunning // this is the livestreaming label
  75. : isRecordingRunning(state) || isRemoteParticipantRecordingLocally(state)
  76. || _isTranscribing; // this is the recording label
  77. return {
  78. _isVisible,
  79. _iAmRecorder: Boolean(state['features/base/config'].iAmRecorder),
  80. _isTranscribing,
  81. _status: getSessionStatusToShow(state, mode)
  82. };
  83. }