Kaynağa Gözat

feat(remotecontrol): Make sure the receiver is always sharing entire screen

j8
hristoterezov 8 yıl önce
ebeveyn
işleme
dc8198100b

+ 10
- 3
conference.js Dosyayı Görüntüle

87
  * lib-jitsi-meet to detect and invoke
87
  * lib-jitsi-meet to detect and invoke
88
  */
88
  */
89
 window.JitsiMeetScreenObtainer = {
89
 window.JitsiMeetScreenObtainer = {
90
-    openDesktopPicker(onSourceChoose) {
91
-        APP.store.dispatch(showDesktopPicker(onSourceChoose));
90
+    openDesktopPicker(options, onSourceChoose) {
91
+        APP.store.dispatch(showDesktopPicker(options, onSourceChoose));
92
     }
92
     }
93
 };
93
 };
94
 
94
 
341
         .createLocalTracks({
341
         .createLocalTracks({
342
             // copy array to avoid mutations inside library
342
             // copy array to avoid mutations inside library
343
             devices: options.devices.slice(0),
343
             devices: options.devices.slice(0),
344
+            desktopSharingSources: options.desktopSharingSources,
344
             resolution: config.resolution,
345
             resolution: config.resolution,
345
             cameraDeviceId: typeof options.cameraDeviceId === 'undefined' ||
346
             cameraDeviceId: typeof options.cameraDeviceId === 'undefined' ||
346
                     options.cameraDeviceId === null
347
                     options.cameraDeviceId === null
1108
     /**
1109
     /**
1109
      * Toggles between screensharing and camera video.
1110
      * Toggles between screensharing and camera video.
1110
      * @param {boolean} [shareScreen]
1111
      * @param {boolean} [shareScreen]
1112
+     * @param {Object} [options] - Screen sharing options that will be passed to
1113
+     * createLocalTracks.
1114
+     * @param {Array<string>} [options.desktopSharingSources] - Array with the
1115
+     * sources that have to be displayed in the desktop picker window ('screen',
1116
+     * 'window', etc.).
1111
      * @return {Promise.<T>}
1117
      * @return {Promise.<T>}
1112
      */
1118
      */
1113
-    toggleScreenSharing(shareScreen = !this.isSharingScreen) {
1119
+    toggleScreenSharing(shareScreen = !this.isSharingScreen, options = {}) {
1114
         if (this.videoSwitchInProgress) {
1120
         if (this.videoSwitchInProgress) {
1115
             return Promise.reject('Switch in progress.');
1121
             return Promise.reject('Switch in progress.');
1116
         }
1122
         }
1130
 
1136
 
1131
         if (shareScreen) {
1137
         if (shareScreen) {
1132
             return createLocalTracks({
1138
             return createLocalTracks({
1139
+                desktopSharingSources: options.desktopSharingSources,
1133
                 devices: ['desktop'],
1140
                 devices: ['desktop'],
1134
                 desktopSharingExtensionExternalInstallation: {
1141
                 desktopSharingExtensionExternalInstallation: {
1135
                     interval: 500,
1142
                     interval: 500,

+ 1
- 0
lang/main.json Dosyayı Görüntüle

340
         "remoteControlDeniedMessage": "__user__ rejected your remote control request!",
340
         "remoteControlDeniedMessage": "__user__ rejected your remote control request!",
341
         "remoteControlAllowedMessage": "__user__ accepted your remote control request!",
341
         "remoteControlAllowedMessage": "__user__ accepted your remote control request!",
342
         "remoteControlErrorMessage": "An error occurred while trying to request remote control permissions from __user__!",
342
         "remoteControlErrorMessage": "An error occurred while trying to request remote control permissions from __user__!",
343
+        "startRemoteControlErrorMessage": "An error occurred while trying to start the remote control session!",
343
         "remoteControlStopMessage": "The remote control session ended!",
344
         "remoteControlStopMessage": "The remote control session ended!",
344
         "close": "Close",
345
         "close": "Close",
345
         "shareYourScreen": "Share your screen",
346
         "shareYourScreen": "Share your screen",

+ 16
- 5
modules/remotecontrol/Receiver.js Dosyayı Görüntüle

214
 
214
 
215
         let promise;
215
         let promise;
216
 
216
 
217
-        if (APP.conference.isSharingScreen) {
217
+        if (APP.conference.isSharingScreen
218
+                && APP.conference.getDesktopSharingSourceType() === 'screen') {
218
             promise = this._sendStartRequest();
219
             promise = this._sendStartRequest();
219
         } else {
220
         } else {
220
-            promise = APP.conference.toggleScreenSharing()
221
+            promise = APP.conference.toggleScreenSharing(
222
+                true,
223
+                {
224
+                    desktopSharingSources: [ 'screen' ]
225
+                })
221
                 .then(() => this._sendStartRequest());
226
                 .then(() => this._sendStartRequest());
222
         }
227
         }
223
 
228
 
228
                     action: PERMISSIONS_ACTIONS.grant
233
                     action: PERMISSIONS_ACTIONS.grant
229
                 })
234
                 })
230
             )
235
             )
231
-            .catch(() => {
236
+            .catch(error => {
237
+                logger.error(error);
238
+
232
                 this.sendRemoteControlEndpointMessage(userId, {
239
                 this.sendRemoteControlEndpointMessage(userId, {
233
                     type: EVENTS.permissions,
240
                     type: EVENTS.permissions,
234
                     action: PERMISSIONS_ACTIONS.error
241
                     action: PERMISSIONS_ACTIONS.error
235
                 });
242
                 });
236
 
243
 
237
-                // FIXME: show err msg
238
-                this._stop();
244
+                APP.UI.messageHandler.openMessageDialog(
245
+                    'dialog.remoteControlTitle',
246
+                    'dialog.startRemoteControlErrorMessage'
247
+                );
248
+
249
+                this._stop(true);
239
             });
250
             });
240
     }
251
     }
241
 
252
 

+ 3
- 1
react/features/desktop-picker/actions.js Dosyayı Görüntüle

62
 /**
62
 /**
63
  * Signals to open a dialog with the DesktopPicker component.
63
  * Signals to open a dialog with the DesktopPicker component.
64
  *
64
  *
65
+ * @param {Object} options - Desktop sharing settings.
65
  * @param {Function} onSourceChoose - The callback to invoke when
66
  * @param {Function} onSourceChoose - The callback to invoke when
66
  * a DesktopCapturerSource has been chosen.
67
  * a DesktopCapturerSource has been chosen.
67
  * @returns {Object}
68
  * @returns {Object}
68
  */
69
  */
69
-export function showDesktopPicker(onSourceChoose) {
70
+export function showDesktopPicker(options, onSourceChoose) {
70
     return openDialog(DesktopPicker, {
71
     return openDialog(DesktopPicker, {
72
+        options,
71
         onSourceChoose
73
         onSourceChoose
72
     });
74
     });
73
 }
75
 }

+ 52
- 23
react/features/desktop-picker/components/DesktopPicker.js Dosyayı Görüntüle

1
-/* global config */
2
-
3
 import Tabs from '@atlaskit/tabs';
1
 import Tabs from '@atlaskit/tabs';
4
 import React, { Component } from 'react';
2
 import React, { Component } from 'react';
5
 import { connect } from 'react-redux';
3
 import { connect } from 'react-redux';
33
         type: 'window'
31
         type: 'window'
34
     }
32
     }
35
 ];
33
 ];
36
-const CONFIGURED_TYPES = config.desktopSharingChromeSources || [];
37
 const VALID_TYPES = TAB_CONFIGURATIONS.map(c => c.type);
34
 const VALID_TYPES = TAB_CONFIGURATIONS.map(c => c.type);
38
-const TABS_TO_POPULATE
39
-    = TAB_CONFIGURATIONS.filter(
40
-        c => CONFIGURED_TYPES.includes(c.type) && VALID_TYPES.includes(c.type));
41
-const TYPES_TO_FETCH = TABS_TO_POPULATE.map(c => c.type);
42
 
35
 
43
 /**
36
 /**
44
  * React component for DesktopPicker.
37
  * React component for DesktopPicker.
63
          */
56
          */
64
         onSourceChoose: React.PropTypes.func,
57
         onSourceChoose: React.PropTypes.func,
65
 
58
 
59
+        /**
60
+         * An object with options related to desktop sharing.
61
+         */
62
+        options: React.PropTypes.object,
63
+
66
         /**
64
         /**
67
          * An object with arrays of DesktopCapturerSources. The key should be
65
          * An object with arrays of DesktopCapturerSources. The key should be
68
          * the source type.
66
          * the source type.
85
         super(props);
83
         super(props);
86
 
84
 
87
         this.state = {
85
         this.state = {
88
-            selectedSource: {}
86
+            selectedSource: {},
87
+            tabsToPopulate: [],
88
+            typesToFetch: []
89
         };
89
         };
90
 
90
 
91
         this._poller = null;
91
         this._poller = null;
102
      * @inheritdoc
102
      * @inheritdoc
103
      */
103
      */
104
     componentWillMount() {
104
     componentWillMount() {
105
+        const options = this.props.options || {};
106
+
107
+        this._onSourceTypesConfigChanged(
108
+            options.desktopSharingSources);
105
         this._updateSources();
109
         this._updateSources();
106
         this._startPolling();
110
         this._startPolling();
107
     }
111
     }
125
                 }
129
                 }
126
             });
130
             });
127
         }
131
         }
132
+
133
+        const options = this.props.options || {};
134
+
135
+        this._onSourceTypesConfigChanged(
136
+            options.desktopSharingSources);
128
     }
137
     }
129
 
138
 
130
     /**
139
     /**
166
      * the onSourceChoose callback.
175
      * the onSourceChoose callback.
167
      * @returns {void}
176
      * @returns {void}
168
      */
177
      */
169
-    _onCloseModal(id, type) {
178
+    _onCloseModal(id = '', type) {
170
         this.props.onSourceChoose(id, type);
179
         this.props.onSourceChoose(id, type);
171
         this.props.dispatch(hideDialog());
180
         this.props.dispatch(hideDialog());
172
     }
181
     }
209
         const { selectedSource } = this.state;
218
         const { selectedSource } = this.state;
210
         const { sources, t } = this.props;
219
         const { sources, t } = this.props;
211
         const tabs
220
         const tabs
212
-            = TABS_TO_POPULATE.map(({ defaultSelected, label, type }) => {
213
-                return {
214
-                    content: <DesktopPickerPane
215
-                        key = { type }
216
-                        onClick = { this._onPreviewClick }
217
-                        onDoubleClick = { this._onCloseModal }
218
-                        selectedSourceId = { selectedSource.id }
219
-                        sources = { sources[type] || [] }
220
-                        type = { type } />,
221
-                    defaultSelected,
222
-                    label: t(label)
223
-                };
224
-            });
221
+            = this.state.tabsToPopulate.map(
222
+                ({ defaultSelected, label, type }) => {
223
+                    return {
224
+                        content: <DesktopPickerPane
225
+                            key = { type }
226
+                            onClick = { this._onPreviewClick }
227
+                            onDoubleClick = { this._onCloseModal }
228
+                            selectedSourceId = { selectedSource.id }
229
+                            sources = { sources[type] || [] }
230
+                            type = { type } />,
231
+                        defaultSelected,
232
+                        label: t(label)
233
+                    };
234
+                });
225
 
235
 
226
         return <Tabs tabs = { tabs } />;
236
         return <Tabs tabs = { tabs } />;
227
     }
237
     }
248
         this._poller = null;
258
         this._poller = null;
249
     }
259
     }
250
 
260
 
261
+    /**
262
+     * Handles changing of allowed desktop sharing source types.
263
+     *
264
+     * @param {Array<string>} desktopSharingSourceTypes - The types that will be
265
+     * fetched and displayed.
266
+     * @returns {void}
267
+     */
268
+    _onSourceTypesConfigChanged(desktopSharingSourceTypes = []) {
269
+        const tabsToPopulate = TAB_CONFIGURATIONS.filter(
270
+            c => desktopSharingSourceTypes.includes(c.type)
271
+                && VALID_TYPES.includes(c.type)
272
+        );
273
+
274
+        this.setState({
275
+            tabsToPopulate,
276
+            typesToFetch: tabsToPopulate.map(c => c.type)
277
+        });
278
+    }
279
+
251
     /**
280
     /**
252
      * Dispatches an action to get currently available DesktopCapturerSources.
281
      * Dispatches an action to get currently available DesktopCapturerSources.
253
      *
282
      *
256
      */
285
      */
257
     _updateSources() {
286
     _updateSources() {
258
         this.props.dispatch(obtainDesktopSources(
287
         this.props.dispatch(obtainDesktopSources(
259
-            TYPES_TO_FETCH,
288
+            this.state.typesToFetch,
260
             {
289
             {
261
                 THUMBNAIL_SIZE
290
                 THUMBNAIL_SIZE
262
             }
291
             }

+ 2
- 1
react/features/remote-control/components/RemoteControlAuthorizationDialog.js Dosyayı Görüntüle

94
     _getAdditionalMessage() {
94
     _getAdditionalMessage() {
95
         // FIXME: Once we have this information in redux we should
95
         // FIXME: Once we have this information in redux we should
96
         // start getting it from there.
96
         // start getting it from there.
97
-        if (APP.conference.isSharingScreen) {
97
+        if (APP.conference.isSharingScreen
98
+                && APP.conference.getDesktopSharingSourceType() === 'screen') {
98
             return null;
99
             return null;
99
         }
100
         }
100
 
101
 

Loading…
İptal
Kaydet