Преглед на файлове

feat(SS): pass the source type to lib-jitsi-meet.

master
hristoterezov преди 8 години
родител
ревизия
1a9a8a2098

+ 12
- 0
conference.js Целия файл

@@ -2129,5 +2129,17 @@ export default {
2129 2129
      */
2130 2130
     getDesktopSharingSourceId() {
2131 2131
         return localVideo.sourceId;
2132
+    },
2133
+
2134
+    /**
2135
+     * Returns the desktop sharing source type or undefined if the desktop
2136
+     * sharing is not active at the moment.
2137
+     *
2138
+     * @returns {'screen'|'window'|undefined} - The source type. If the track is
2139
+     * not desktop track or the source type is not available, undefined will be
2140
+     * returned.
2141
+     */
2142
+    getDesktopSharingSourceType() {
2143
+        return localVideo.sourceType;
2132 2144
     }
2133 2145
 };

+ 24
- 11
react/features/desktop-picker/components/DesktopPicker.js Целия файл

@@ -85,7 +85,7 @@ class DesktopPicker extends Component {
85 85
         super(props);
86 86
 
87 87
         this.state = {
88
-            selectedSourceId: ''
88
+            selectedSource: {}
89 89
         };
90 90
 
91 91
         this._poller = null;
@@ -116,10 +116,13 @@ class DesktopPicker extends Component {
116 116
      * @returns {void}
117 117
      */
118 118
     componentWillReceiveProps(nextProps) {
119
-        if (!this.state.selectedSourceId
119
+        if (!this.state.selectedSource.id
120 120
                 && nextProps.sources.screen.length) {
121 121
             this.setState({
122
-                selectedSourceId: nextProps.sources.screen[0].id
122
+                selectedSource: {
123
+                    id: nextProps.sources.screen[0].id,
124
+                    type: 'screen'
125
+                }
123 126
             });
124 127
         }
125 128
     }
@@ -155,14 +158,16 @@ class DesktopPicker extends Component {
155 158
 
156 159
     /**
157 160
      * Dispatches an action to hide the DesktopPicker and invokes the passed in
158
-     * callback with a selectedSourceId, if any.
161
+     * callback with a selectedSource, if any.
159 162
      *
160 163
      * @param {string} id - The id of the DesktopCapturerSource to pass into the
161 164
      * onSourceChoose callback.
165
+     * @param {string} type - The type of the DesktopCapturerSource to pass into
166
+     * the onSourceChoose callback.
162 167
      * @returns {void}
163 168
      */
164
-    _onCloseModal(id = '') {
165
-        this.props.onSourceChoose(id);
169
+    _onCloseModal(id, type) {
170
+        this.props.onSourceChoose(id, type);
166 171
         this.props.dispatch(hideDialog());
167 172
     }
168 173
 
@@ -170,10 +175,16 @@ class DesktopPicker extends Component {
170 175
      * Sets the currently selected DesktopCapturerSource.
171 176
      *
172 177
      * @param {string} id - The id of DesktopCapturerSource.
178
+     * @param {string} type - The type of DesktopCapturerSource.
173 179
      * @returns {void}
174 180
      */
175
-    _onPreviewClick(id) {
176
-        this.setState({ selectedSourceId: id });
181
+    _onPreviewClick(id, type) {
182
+        this.setState({
183
+            selectedSource: {
184
+                id,
185
+                type
186
+            }
187
+        });
177 188
     }
178 189
 
179 190
     /**
@@ -183,7 +194,9 @@ class DesktopPicker extends Component {
183 194
      * @returns {void}
184 195
      */
185 196
     _onSubmit() {
186
-        this._onCloseModal(this.state.selectedSourceId);
197
+        const { id, type } = this.state.selectedSource;
198
+
199
+        this._onCloseModal(id, type);
187 200
     }
188 201
 
189 202
     /**
@@ -193,7 +206,7 @@ class DesktopPicker extends Component {
193 206
      * @returns {ReactElement}
194 207
      */
195 208
     _renderTabs() {
196
-        const { selectedSourceId } = this.state;
209
+        const { selectedSource } = this.state;
197 210
         const { sources, t } = this.props;
198 211
         const tabs
199 212
             = TABS_TO_POPULATE.map(({ defaultSelected, label, type }) => {
@@ -202,7 +215,7 @@ class DesktopPicker extends Component {
202 215
                         key = { type }
203 216
                         onClick = { this._onPreviewClick }
204 217
                         onDoubleClick = { this._onCloseModal }
205
-                        selectedSourceId = { selectedSourceId }
218
+                        selectedSourceId = { selectedSource.id }
206 219
                         sources = { sources[type] || [] }
207 220
                         type = { type } />,
208 221
                     defaultSelected,

+ 2
- 1
react/features/desktop-picker/components/DesktopPickerPane.js Целия файл

@@ -66,7 +66,8 @@ class DesktopPickerPane extends Component {
66 66
                         onClick = { onClick }
67 67
                         onDoubleClick = { onDoubleClick }
68 68
                         selected = { source.id === selectedSourceId }
69
-                        source = { source } />);
69
+                        source = { source }
70
+                        type = { type } />);
70 71
 
71 72
         return (
72 73
             <div className = { classNames }>

+ 12
- 3
react/features/desktop-picker/components/DesktopSourcePreview.js Целия файл

@@ -34,7 +34,12 @@ class DesktopSourcePreview extends Component {
34 34
         /**
35 35
          * The DesktopCapturerSource to display.
36 36
          */
37
-        source: React.PropTypes.object
37
+        source: React.PropTypes.object,
38
+
39
+        /**
40
+         * The source type of the DesktopCapturerSources to display.
41
+         */
42
+        type: React.PropTypes.string
38 43
     };
39 44
 
40 45
     /**
@@ -83,7 +88,9 @@ class DesktopSourcePreview extends Component {
83 88
      * @returns {void}
84 89
      */
85 90
     _onClick() {
86
-        this.props.onClick(this.props.source.id);
91
+        const { source, type } = this.props;
92
+
93
+        this.props.onClick(source.id, type);
87 94
     }
88 95
 
89 96
     /**
@@ -92,7 +99,9 @@ class DesktopSourcePreview extends Component {
92 99
      * @returns {void}
93 100
      */
94 101
     _onDoubleClick() {
95
-        this.props.onDoubleClick(this.props.source.id);
102
+        const { source, type } = this.props;
103
+
104
+        this.props.onDoubleClick(source.id, type);
96 105
     }
97 106
 }
98 107
 

Loading…
Отказ
Запис