Przeglądaj źródła

feat(recording): Disable buttons on active session

master
Hristo Terezov 5 lat temu
rodzic
commit
ce1de9e1e7

+ 2
- 0
lang/main.json Wyświetl plik

@@ -216,6 +216,7 @@
216 216
         "kickParticipantTitle": "Kick this participant?",
217 217
         "kickTitle": "Ouch! {{participantDisplayName}} kicked you out of the meeting",
218 218
         "liveStreaming": "Live Streaming",
219
+        "liveStreamingDisabledBecauseOfActiveRecordingTooltip": "Not possible while recording is active",
219 220
         "liveStreamingDisabledForGuestTooltip": "Guests can't start live streaming.",
220 221
         "liveStreamingDisabledTooltip": "Start live stream disabled.",
221 222
         "lockMessage": "Failed to lock the conference.",
@@ -249,6 +250,7 @@
249 250
         "popupError": "Your browser is blocking pop-up windows from this site. Please enable pop-ups in your browser's security settings and try again.",
250 251
         "popupErrorTitle": "Pop-up blocked",
251 252
         "recording": "Recording",
253
+        "recordingDisabledBecauseOfActiveLiveStreamingTooltip": "Not possible while a live stream is active",
252 254
         "recordingDisabledForGuestTooltip": "Guests can't start recordings.",
253 255
         "recordingDisabledTooltip": "Start recording disabled.",
254 256
         "rejoinNow": "Rejoin now",

+ 16
- 5
react/features/recording/components/LiveStream/AbstractLiveStreamButton.js Wyświetl plik

@@ -25,6 +25,11 @@ export type Props = AbstractButtonProps & {
25 25
      */
26 26
     _isLiveStreamRunning: boolean,
27 27
 
28
+    /**
29
+     * True if the button needs to be disabled.
30
+     */
31
+    _disabled: Boolean,
32
+
28 33
     /**
29 34
      * The redux {@code dispatch} function.
30 35
      */
@@ -80,6 +85,7 @@ export default class AbstractLiveStreamButton<P: Props>
80 85
  * @param {Props} ownProps - The own props of the Component.
81 86
  * @private
82 87
  * @returns {{
88
+ *     _disabled: boolean,
83 89
  *     _isLiveStreamRunning: boolean,
84 90
  *     visible: boolean
85 91
  * }}
@@ -87,9 +93,9 @@ export default class AbstractLiveStreamButton<P: Props>
87 93
 export function _mapStateToProps(state: Object, ownProps: Props) {
88 94
     let { visible } = ownProps;
89 95
 
90
-    // a button can be disabled/enabled only if enableFeaturesBasedOnToken
91
-    // is on
92
-    let disabledByFeatures;
96
+    // A button can be disabled/enabled only if enableFeaturesBasedOnToken
97
+    // is on or if the recording is running.
98
+    let _disabled;
93 99
 
94 100
     if (typeof visible === 'undefined') {
95 101
         // If the containing component provides the visible prop, that is one
@@ -105,14 +111,19 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
105 111
 
106 112
         if (enableFeaturesBasedOnToken) {
107 113
             visible = visible && String(features.livestreaming) === 'true';
108
-            disabledByFeatures = String(features.livestreaming) === 'disabled';
114
+            _disabled = String(features.livestreaming) === 'disabled';
109 115
         }
110 116
     }
111 117
 
118
+    // disable the button if the recording is running.
119
+    if (getActiveSession(state, JitsiRecordingConstants.mode.FILE)) {
120
+        _disabled = true;
121
+    }
122
+
112 123
     return {
124
+        _disabled,
113 125
         _isLiveStreamRunning: Boolean(
114 126
             getActiveSession(state, JitsiRecordingConstants.mode.STREAM)),
115
-        disabledByFeatures,
116 127
         visible
117 128
     };
118 129
 }

+ 7
- 6
react/features/recording/components/LiveStream/web/LiveStreamButton.js Wyświetl plik

@@ -74,12 +74,10 @@ function _mapStateToProps(state: Object, ownProps: Props) {
74 74
     const abstractProps = _abstractMapStateToProps(state, ownProps);
75 75
     let { visible } = ownProps;
76 76
 
77
-    const _disabledByFeatures = abstractProps.disabledByFeatures;
78
-    let _disabled = false;
77
+    let { _disabled } = abstractProps;
79 78
     let _liveStreamDisabledTooltipKey;
80 79
 
81
-    if (!abstractProps.visible
82
-            && _disabledByFeatures !== undefined && !_disabledByFeatures) {
80
+    if (!abstractProps.visible && _disabled !== undefined && !_disabled) {
83 81
         _disabled = true;
84 82
 
85 83
         // button and tooltip
@@ -90,12 +88,15 @@ function _mapStateToProps(state: Object, ownProps: Props) {
90 88
             _liveStreamDisabledTooltipKey
91 89
                 = 'dialog.liveStreamingDisabledTooltip';
92 90
         }
91
+    } else if (_disabled) {
92
+        _liveStreamDisabledTooltipKey = 'dialog.liveStreamingDisabledBecauseOfActiveRecordingTooltip';
93
+    } else {
94
+        _disabled = false;
93 95
     }
94 96
 
95 97
     if (typeof visible === 'undefined') {
96 98
         visible = interfaceConfig.TOOLBAR_BUTTONS.includes('livestreaming')
97
-            && (abstractProps.visible
98
-                    || Boolean(_liveStreamDisabledTooltipKey));
99
+            && (abstractProps.visible || Boolean(_liveStreamDisabledTooltipKey));
99 100
     }
100 101
 
101 102
     return {

+ 18
- 10
react/features/recording/components/Recording/AbstractRecordButton.js Wyświetl plik

@@ -24,6 +24,11 @@ import { StartRecordingDialog, StopRecordingDialog } from './_';
24 24
  */
25 25
 export type Props = AbstractButtonProps & {
26 26
 
27
+    /**
28
+     * True if the button needs to be disabled.
29
+     */
30
+    _disabled: Boolean,
31
+
27 32
     /**
28 33
      * True if there is a running active recording, false otherwise.
29 34
      */
@@ -103,17 +108,17 @@ export default class AbstractRecordButton<P: Props>
103 108
  * @param {Props} ownProps - The own props of the Component.
104 109
  * @private
105 110
  * @returns {{
111
+ *     _disabled: boolean,
106 112
  *     _isRecordingRunning: boolean,
107
- *     disabledByFeatures: boolean,
108 113
  *     visible: boolean
109 114
  * }}
110 115
  */
111 116
 export function _mapStateToProps(state: Object, ownProps: Props): Object {
112 117
     let { visible } = ownProps;
113 118
 
114
-    // a button can be disabled/enabled only if enableFeaturesBasedOnToken
115
-    // is on
116
-    let disabledByFeatures;
119
+    // a button can be disabled/enabled if enableFeaturesBasedOnToken
120
+    // is on or if the livestreaming is running.
121
+    let _disabled;
117 122
 
118 123
     if (typeof visible === 'undefined') {
119 124
         // If the containing component provides the visible prop, that is one
@@ -126,19 +131,22 @@ export function _mapStateToProps(state: Object, ownProps: Props): Object {
126 131
         } = state['features/base/config'];
127 132
         const { features = {} } = getLocalParticipant(state);
128 133
 
129
-        visible = isModerator
130
-            && fileRecordingsEnabled;
134
+        visible = isModerator && fileRecordingsEnabled;
131 135
 
132 136
         if (enableFeaturesBasedOnToken) {
133 137
             visible = visible && String(features.recording) === 'true';
134
-            disabledByFeatures = String(features.recording) === 'disabled';
138
+            _disabled = String(features.recording) === 'disabled';
135 139
         }
136 140
     }
137 141
 
142
+    // disable the button if the livestreaming is running.
143
+    if (getActiveSession(state, JitsiRecordingConstants.mode.STREAM)) {
144
+        _disabled = true;
145
+    }
146
+
138 147
     return {
139
-        _isRecordingRunning:
140
-            Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE)),
141
-        disabledByFeatures,
148
+        _disabled,
149
+        _isRecordingRunning: Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE)),
142 150
         visible
143 151
     };
144 152
 }

+ 10
- 11
react/features/recording/components/Recording/web/RecordButton.js Wyświetl plik

@@ -40,7 +40,7 @@ class RecordButton extends AbstractRecordButton<Props> {
40 40
      * @returns {string}
41 41
      */
42 42
     _getTooltip() {
43
-        return this.tooltip || '';
43
+        return this.props._fileRecordingsDisabledTooltipKey || '';
44 44
     }
45 45
 
46 46
     /**
@@ -74,28 +74,27 @@ export function _mapStateToProps(state: Object, ownProps: Props): Object {
74 74
     const abstractProps = _abstractMapStateToProps(state, ownProps);
75 75
     let { visible } = ownProps;
76 76
 
77
-    const _disabledByFeatures = abstractProps.disabledByFeatures;
78
-    let _disabled = false;
77
+    let { _disabled } = abstractProps;
79 78
     let _fileRecordingsDisabledTooltipKey;
80 79
 
81
-    if (!abstractProps.visible
82
-            && _disabledByFeatures !== undefined && !_disabledByFeatures) {
80
+    if (!abstractProps.visible && _disabled !== undefined && !_disabled) {
83 81
         _disabled = true;
84 82
 
85 83
         // button and tooltip
86 84
         if (state['features/base/jwt'].isGuest) {
87
-            _fileRecordingsDisabledTooltipKey
88
-                = 'dialog.recordingDisabledForGuestTooltip';
85
+            _fileRecordingsDisabledTooltipKey = 'dialog.recordingDisabledForGuestTooltip';
89 86
         } else {
90
-            _fileRecordingsDisabledTooltipKey
91
-                = 'dialog.recordingDisabledTooltip';
87
+            _fileRecordingsDisabledTooltipKey = 'dialog.recordingDisabledTooltip';
92 88
         }
89
+    } else if (_disabled) {
90
+        _fileRecordingsDisabledTooltipKey = 'dialog.recordingDisabledBecauseOfActiveLiveStreamingTooltip';
91
+    } else {
92
+        _disabled = false;
93 93
     }
94 94
 
95 95
     if (typeof visible === 'undefined') {
96 96
         visible = interfaceConfig.TOOLBAR_BUTTONS.includes('recording')
97
-            && (abstractProps.visible
98
-                    || Boolean(_fileRecordingsDisabledTooltipKey));
97
+            && (abstractProps.visible || Boolean(_fileRecordingsDisabledTooltipKey));
99 98
     }
100 99
 
101 100
     return {

Ładowanie…
Anuluj
Zapisz