Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(recording) add isLiveStreamingRunning helper
Saúl Ibarra Corretgéae138c1a1542
diff --git a/react/features/conference/components/native/AlwaysOnLabels.tsx b/react/features/conference/components/native/AlwaysOnLabels.tsxindex cf9832b8fb..4ae76745dd 100644--- a/react/features/conference/components/native/AlwaysOnLabels.tsx+++ b/react/features/conference/components/native/AlwaysOnLabels.tsx@@ -2,12 +2,11 @@ import React, { useCallback } from 'react';import { TouchableOpacity } from 'react-native';import { useDispatch, useSelector } from 'react-redux';-import { IReduxState } from '../../../app/types';import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';import { openHighlightDialog } from '../../../recording/actions.native';import HighlightButton from '../../../recording/components/Recording/native/HighlightButton';import RecordingLabel from '../../../recording/components/native/RecordingLabel';-import { getActiveSession } from '../../../recording/functions';+import { isLiveStreamingRunning } from '../../../recording/functions';import VisitorsCountLabel from '../../../visitors/components/native/VisitorsCountLabel';import RaisedHandsCountLabel from './RaisedHandsCountLabel';@@ -30,8 +29,7 @@ interface IProps {const AlwaysOnLabels = ({ createOnPress }: IProps) => {const dispatch = useDispatch();- const isStreaming = useSelector((state: IReduxState) =>- Boolean(getActiveSession(state, JitsiRecordingConstants.mode.STREAM)));+ const isStreaming = useSelector(isLiveStreamingRunning);const openHighlightDialogCallback = useCallback(() =>dispatch(openHighlightDialog()), [ dispatch ]);diff --git a/react/features/recording/components/AbstractRecordingLabel.ts b/react/features/recording/components/AbstractRecordingLabel.tsindex 74a28a2d7f..42a8b22458 100644--- a/react/features/recording/components/AbstractRecordingLabel.ts+++ b/react/features/recording/components/AbstractRecordingLabel.ts@@ -5,8 +5,8 @@ import { IReduxState } from '../../app/types';import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';import { isRecorderTranscriptionsRunning } from '../../transcribing/functions';import {- getActiveSession,getSessionStatusToShow,+ isLiveStreamingRunning,isRecordingRunning,isRemoteParticipantRecordingLocally} from '../functions';@@ -81,9 +81,9 @@ export function _mapStateToProps(state: IReduxState, ownProps: any) {const { mode } = ownProps;const isLiveStreamingLabel = mode === JitsiRecordingConstants.mode.STREAM;const _isTranscribing = isRecorderTranscriptionsRunning(state);- const isLivestreamingRunning = Boolean(getActiveSession(state, JitsiRecordingConstants.mode.STREAM));+ const _isLivestreamingRunning = isLiveStreamingRunning(state);const _isVisible = isLiveStreamingLabel- ? isLivestreamingRunning // this is the livestreaming label+ ? _isLivestreamingRunning // this is the livestreaming label: isRecordingRunning(state) || isRemoteParticipantRecordingLocally(state)|| _isTranscribing; // this is the recording labeldiff --git a/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts b/react/features/recording/components/LiveStream/AbstractLiveStreamButton.tsindex 14c8918e4f..39c3c12b48 100644--- a/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts+++ b/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts@@ -2,13 +2,12 @@ import { IReduxState } from '../../../app/types';import { IconSites } from '../../../base/icons/svg';import { MEET_FEATURES } from '../../../base/jwt/constants';import { isJwtFeatureEnabled } from '../../../base/jwt/functions';-import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';import { isLocalParticipantModerator } from '../../../base/participants/functions';import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';import { isInBreakoutRoom } from '../../../breakout-rooms/functions';import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';import { isRecorderTranscriptionsRunning } from '../../../transcribing/functions';-import { getActiveSession, isCloudRecordingRunning, isLiveStreamingButtonVisible } from '../../functions';+import { isCloudRecordingRunning, isLiveStreamingButtonVisible, isLiveStreamingRunning } from '../../functions';import { getLiveStreaming } from './functions';@@ -154,7 +153,7 @@ export function _mapStateToProps(state: IReduxState, ownProps: IProps) {return {_disabled,- _isLiveStreamRunning: Boolean(getActiveSession(state, JitsiRecordingConstants.mode.STREAM)),+ _isLiveStreamRunning: isLiveStreamingRunning(state),_tooltip,visible};diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.tsindex 9ccb964a0c..b7adffa3ea 100644--- a/react/features/recording/functions.ts+++ b/react/features/recording/functions.ts@@ -168,6 +168,16 @@ export function isCloudRecordingRunning(state: IReduxState) {return Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE));}+/**+ * Returns true if there is a live streaming running.+ *+ * @param {IReduxState} state - The redux state to search in.+ * @returns {boolean}+ */+export function isLiveStreamingRunning(state: IReduxState) {+ return Boolean(getActiveSession(state, JitsiRecordingConstants.mode.STREAM));+}+/*** Returns true if there is a recording session running.*@@ -262,7 +272,7 @@ export function getRecordButtonProps(state: IReduxState) {}// disable the button if the livestreaming is running.- if (visible && getActiveSession(state, JitsiRecordingConstants.mode.STREAM)) {+ if (visible && isLiveStreamingRunning(state)) {disabled = true;tooltip = 'dialog.recordingDisabledBecauseOfActiveLiveStreamingTooltip';}