ソースを参照

feat(recording): Disable buttons on active session

master
Hristo Terezov 5年前
コミット
ce1de9e1e7

+ 2
- 0
lang/main.json ファイルの表示

216
         "kickParticipantTitle": "Kick this participant?",
216
         "kickParticipantTitle": "Kick this participant?",
217
         "kickTitle": "Ouch! {{participantDisplayName}} kicked you out of the meeting",
217
         "kickTitle": "Ouch! {{participantDisplayName}} kicked you out of the meeting",
218
         "liveStreaming": "Live Streaming",
218
         "liveStreaming": "Live Streaming",
219
+        "liveStreamingDisabledBecauseOfActiveRecordingTooltip": "Not possible while recording is active",
219
         "liveStreamingDisabledForGuestTooltip": "Guests can't start live streaming.",
220
         "liveStreamingDisabledForGuestTooltip": "Guests can't start live streaming.",
220
         "liveStreamingDisabledTooltip": "Start live stream disabled.",
221
         "liveStreamingDisabledTooltip": "Start live stream disabled.",
221
         "lockMessage": "Failed to lock the conference.",
222
         "lockMessage": "Failed to lock the conference.",
249
         "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
         "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
         "popupErrorTitle": "Pop-up blocked",
251
         "popupErrorTitle": "Pop-up blocked",
251
         "recording": "Recording",
252
         "recording": "Recording",
253
+        "recordingDisabledBecauseOfActiveLiveStreamingTooltip": "Not possible while a live stream is active",
252
         "recordingDisabledForGuestTooltip": "Guests can't start recordings.",
254
         "recordingDisabledForGuestTooltip": "Guests can't start recordings.",
253
         "recordingDisabledTooltip": "Start recording disabled.",
255
         "recordingDisabledTooltip": "Start recording disabled.",
254
         "rejoinNow": "Rejoin now",
256
         "rejoinNow": "Rejoin now",

+ 16
- 5
react/features/recording/components/LiveStream/AbstractLiveStreamButton.js ファイルの表示

25
      */
25
      */
26
     _isLiveStreamRunning: boolean,
26
     _isLiveStreamRunning: boolean,
27
 
27
 
28
+    /**
29
+     * True if the button needs to be disabled.
30
+     */
31
+    _disabled: Boolean,
32
+
28
     /**
33
     /**
29
      * The redux {@code dispatch} function.
34
      * The redux {@code dispatch} function.
30
      */
35
      */
80
  * @param {Props} ownProps - The own props of the Component.
85
  * @param {Props} ownProps - The own props of the Component.
81
  * @private
86
  * @private
82
  * @returns {{
87
  * @returns {{
88
+ *     _disabled: boolean,
83
  *     _isLiveStreamRunning: boolean,
89
  *     _isLiveStreamRunning: boolean,
84
  *     visible: boolean
90
  *     visible: boolean
85
  * }}
91
  * }}
87
 export function _mapStateToProps(state: Object, ownProps: Props) {
93
 export function _mapStateToProps(state: Object, ownProps: Props) {
88
     let { visible } = ownProps;
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
     if (typeof visible === 'undefined') {
100
     if (typeof visible === 'undefined') {
95
         // If the containing component provides the visible prop, that is one
101
         // If the containing component provides the visible prop, that is one
105
 
111
 
106
         if (enableFeaturesBasedOnToken) {
112
         if (enableFeaturesBasedOnToken) {
107
             visible = visible && String(features.livestreaming) === 'true';
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
     return {
123
     return {
124
+        _disabled,
113
         _isLiveStreamRunning: Boolean(
125
         _isLiveStreamRunning: Boolean(
114
             getActiveSession(state, JitsiRecordingConstants.mode.STREAM)),
126
             getActiveSession(state, JitsiRecordingConstants.mode.STREAM)),
115
-        disabledByFeatures,
116
         visible
127
         visible
117
     };
128
     };
118
 }
129
 }

+ 7
- 6
react/features/recording/components/LiveStream/web/LiveStreamButton.js ファイルの表示

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

+ 18
- 10
react/features/recording/components/Recording/AbstractRecordButton.js ファイルの表示

24
  */
24
  */
25
 export type Props = AbstractButtonProps & {
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
      * True if there is a running active recording, false otherwise.
33
      * True if there is a running active recording, false otherwise.
29
      */
34
      */
103
  * @param {Props} ownProps - The own props of the Component.
108
  * @param {Props} ownProps - The own props of the Component.
104
  * @private
109
  * @private
105
  * @returns {{
110
  * @returns {{
111
+ *     _disabled: boolean,
106
  *     _isRecordingRunning: boolean,
112
  *     _isRecordingRunning: boolean,
107
- *     disabledByFeatures: boolean,
108
  *     visible: boolean
113
  *     visible: boolean
109
  * }}
114
  * }}
110
  */
115
  */
111
 export function _mapStateToProps(state: Object, ownProps: Props): Object {
116
 export function _mapStateToProps(state: Object, ownProps: Props): Object {
112
     let { visible } = ownProps;
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
     if (typeof visible === 'undefined') {
123
     if (typeof visible === 'undefined') {
119
         // If the containing component provides the visible prop, that is one
124
         // If the containing component provides the visible prop, that is one
126
         } = state['features/base/config'];
131
         } = state['features/base/config'];
127
         const { features = {} } = getLocalParticipant(state);
132
         const { features = {} } = getLocalParticipant(state);
128
 
133
 
129
-        visible = isModerator
130
-            && fileRecordingsEnabled;
134
+        visible = isModerator && fileRecordingsEnabled;
131
 
135
 
132
         if (enableFeaturesBasedOnToken) {
136
         if (enableFeaturesBasedOnToken) {
133
             visible = visible && String(features.recording) === 'true';
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
     return {
147
     return {
139
-        _isRecordingRunning:
140
-            Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE)),
141
-        disabledByFeatures,
148
+        _disabled,
149
+        _isRecordingRunning: Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE)),
142
         visible
150
         visible
143
     };
151
     };
144
 }
152
 }

+ 10
- 11
react/features/recording/components/Recording/web/RecordButton.js ファイルの表示

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

読み込み中…
キャンセル
保存