Files
jitsi-meet/react/features/recording/components/AbstractRecordingLabel.ts

97 lines
2.6 KiB
TypeScript
Raw Normal View History

import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import { IReduxState } from '../../app/types';
2024-02-22 15:29:52 -06:00
import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
import { isRecorderTranscriptionsRunning } from '../../transcribing/functions';
import {
getSessionStatusToShow,
isLiveStreamingRunning,
isRecordingRunning,
isRemoteParticipantRecordingLocally
} from '../functions';
2018-09-11 12:16:01 +02:00
export interface IProps extends WithTranslation {
/**
* Whether this is the Jibri recorder participant.
*/
_iAmRecorder: boolean;
/**
* Whether this meeting is being transcribed.
*/
2025-01-10 16:32:25 +01:00
_isTranscribing: boolean;
2025-01-10 16:32:25 +01:00
/**
* Whether the recording/livestreaming/transcriber is currently running.
*/
2025-01-10 16:32:25 +01:00
_isVisible: boolean;
/**
* The status of the higher priority session.
*/
_status?: string;
/**
* The recording mode this indicator should display.
*/
mode: string;
}
/**
* Abstract class for the {@code RecordingLabel} component.
*/
export default class AbstractRecordingLabel<P extends IProps = IProps> extends Component<P> {
2018-06-14 11:15:36 +02:00
/**
* Implements React {@code Component}'s render.
*
* @inheritdoc
*/
override render() {
const { _iAmRecorder, _isVisible } = this.props;
2024-02-22 15:29:52 -06:00
return _isVisible && !_iAmRecorder ? this._renderLabel() : null;
2018-06-14 11:15:36 +02:00
}
/**
* Renders the platform specific label component.
*
* @protected
* @returns {React$Element}
*/
_renderLabel(): React.ReactNode | null {
return null;
}
}
/**
* Maps (parts of) the Redux state to the associated
* {@code AbstractRecordingLabel}'s props.
*
* @param {Object} state - The Redux state.
* @param {IProps} ownProps - The component's own props.
* @private
* @returns {{
2018-09-11 12:16:01 +02:00
* _status: ?string
* }}
*/
export function _mapStateToProps(state: IReduxState, ownProps: any) {
const { mode } = ownProps;
const isLiveStreamingLabel = mode === JitsiRecordingConstants.mode.STREAM;
const _isTranscribing = isRecorderTranscriptionsRunning(state);
const _isLivestreamingRunning = isLiveStreamingRunning(state);
const _isVisible = isLiveStreamingLabel
? _isLivestreamingRunning // this is the livestreaming label
: isRecordingRunning(state) || isRemoteParticipantRecordingLocally(state)
|| _isTranscribing; // this is the recording label
return {
_isVisible,
_iAmRecorder: Boolean(state['features/base/config'].iAmRecorder),
_isTranscribing,
2018-09-11 12:16:01 +02:00
_status: getSessionStatusToShow(state, mode)
};
}