Browse Source

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

master
hristoterezov 8 years ago
parent
commit
1a9a8a2098

+ 12
- 0
conference.js View File

2129
      */
2129
      */
2130
     getDesktopSharingSourceId() {
2130
     getDesktopSharingSourceId() {
2131
         return localVideo.sourceId;
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 View File

85
         super(props);
85
         super(props);
86
 
86
 
87
         this.state = {
87
         this.state = {
88
-            selectedSourceId: ''
88
+            selectedSource: {}
89
         };
89
         };
90
 
90
 
91
         this._poller = null;
91
         this._poller = null;
116
      * @returns {void}
116
      * @returns {void}
117
      */
117
      */
118
     componentWillReceiveProps(nextProps) {
118
     componentWillReceiveProps(nextProps) {
119
-        if (!this.state.selectedSourceId
119
+        if (!this.state.selectedSource.id
120
                 && nextProps.sources.screen.length) {
120
                 && nextProps.sources.screen.length) {
121
             this.setState({
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
 
158
 
156
     /**
159
     /**
157
      * Dispatches an action to hide the DesktopPicker and invokes the passed in
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
      * @param {string} id - The id of the DesktopCapturerSource to pass into the
163
      * @param {string} id - The id of the DesktopCapturerSource to pass into the
161
      * onSourceChoose callback.
164
      * onSourceChoose callback.
165
+     * @param {string} type - The type of the DesktopCapturerSource to pass into
166
+     * the onSourceChoose callback.
162
      * @returns {void}
167
      * @returns {void}
163
      */
168
      */
164
-    _onCloseModal(id = '') {
165
-        this.props.onSourceChoose(id);
169
+    _onCloseModal(id, type) {
170
+        this.props.onSourceChoose(id, type);
166
         this.props.dispatch(hideDialog());
171
         this.props.dispatch(hideDialog());
167
     }
172
     }
168
 
173
 
170
      * Sets the currently selected DesktopCapturerSource.
175
      * Sets the currently selected DesktopCapturerSource.
171
      *
176
      *
172
      * @param {string} id - The id of DesktopCapturerSource.
177
      * @param {string} id - The id of DesktopCapturerSource.
178
+     * @param {string} type - The type of DesktopCapturerSource.
173
      * @returns {void}
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
      * @returns {void}
194
      * @returns {void}
184
      */
195
      */
185
     _onSubmit() {
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
      * @returns {ReactElement}
206
      * @returns {ReactElement}
194
      */
207
      */
195
     _renderTabs() {
208
     _renderTabs() {
196
-        const { selectedSourceId } = this.state;
209
+        const { selectedSource } = this.state;
197
         const { sources, t } = this.props;
210
         const { sources, t } = this.props;
198
         const tabs
211
         const tabs
199
             = TABS_TO_POPULATE.map(({ defaultSelected, label, type }) => {
212
             = TABS_TO_POPULATE.map(({ defaultSelected, label, type }) => {
202
                         key = { type }
215
                         key = { type }
203
                         onClick = { this._onPreviewClick }
216
                         onClick = { this._onPreviewClick }
204
                         onDoubleClick = { this._onCloseModal }
217
                         onDoubleClick = { this._onCloseModal }
205
-                        selectedSourceId = { selectedSourceId }
218
+                        selectedSourceId = { selectedSource.id }
206
                         sources = { sources[type] || [] }
219
                         sources = { sources[type] || [] }
207
                         type = { type } />,
220
                         type = { type } />,
208
                     defaultSelected,
221
                     defaultSelected,

+ 2
- 1
react/features/desktop-picker/components/DesktopPickerPane.js View File

66
                         onClick = { onClick }
66
                         onClick = { onClick }
67
                         onDoubleClick = { onDoubleClick }
67
                         onDoubleClick = { onDoubleClick }
68
                         selected = { source.id === selectedSourceId }
68
                         selected = { source.id === selectedSourceId }
69
-                        source = { source } />);
69
+                        source = { source }
70
+                        type = { type } />);
70
 
71
 
71
         return (
72
         return (
72
             <div className = { classNames }>
73
             <div className = { classNames }>

+ 12
- 3
react/features/desktop-picker/components/DesktopSourcePreview.js View File

34
         /**
34
         /**
35
          * The DesktopCapturerSource to display.
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
      * @returns {void}
88
      * @returns {void}
84
      */
89
      */
85
     _onClick() {
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
      * @returns {void}
99
      * @returns {void}
93
      */
100
      */
94
     _onDoubleClick() {
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…
Cancel
Save