|
@@ -74,6 +74,11 @@ type Props = {
|
74
|
74
|
*/
|
75
|
75
|
type State = {
|
76
|
76
|
|
|
77
|
+ /**
|
|
78
|
+ * The state of the audio screen share checkbox.
|
|
79
|
+ */
|
|
80
|
+ screenShareAudio: boolean,
|
|
81
|
+
|
77
|
82
|
/**
|
78
|
83
|
* The currently higlighted DesktopCapturerSource.
|
79
|
84
|
*/
|
|
@@ -128,6 +133,7 @@ class DesktopPicker extends PureComponent<Props, State> {
|
128
|
133
|
_poller = null;
|
129
|
134
|
|
130
|
135
|
state = {
|
|
136
|
+ screenShareAudio: false,
|
131
|
137
|
selectedSource: {},
|
132
|
138
|
selectedTab: 0,
|
133
|
139
|
sources: {},
|
|
@@ -153,6 +159,7 @@ class DesktopPicker extends PureComponent<Props, State> {
|
153
|
159
|
// Bind event handlers so they are only bound once per instance.
|
154
|
160
|
this._onCloseModal = this._onCloseModal.bind(this);
|
155
|
161
|
this._onPreviewClick = this._onPreviewClick.bind(this);
|
|
162
|
+ this._onShareAudioChecked = this._onShareAudioChecked.bind(this);
|
156
|
163
|
this._onSubmit = this._onSubmit.bind(this);
|
157
|
164
|
this._onTabSelected = this._onTabSelected.bind(this);
|
158
|
165
|
this._updateSources = this._updateSources.bind(this);
|
|
@@ -241,7 +248,7 @@ class DesktopPicker extends PureComponent<Props, State> {
|
241
|
248
|
return selectedSource;
|
242
|
249
|
}
|
243
|
250
|
|
244
|
|
- _onCloseModal: (?string, string) => void;
|
|
251
|
+ _onCloseModal: (?string, string, ?boolean) => void;
|
245
|
252
|
|
246
|
253
|
/**
|
247
|
254
|
* Dispatches an action to hide the DesktopPicker and invokes the passed in
|
|
@@ -251,10 +258,12 @@ class DesktopPicker extends PureComponent<Props, State> {
|
251
|
258
|
* the onSourceChoose callback.
|
252
|
259
|
* @param {string} type - The type of the DesktopCapturerSource to pass into
|
253
|
260
|
* the onSourceChoose callback.
|
|
261
|
+ * @param {boolean} screenShareAudio - Whether or not to add system audio to
|
|
262
|
+ * screen sharing session.
|
254
|
263
|
* @returns {void}
|
255
|
264
|
*/
|
256
|
|
- _onCloseModal(id = '', type) {
|
257
|
|
- this.props.onSourceChoose(id, type);
|
|
265
|
+ _onCloseModal(id = '', type, screenShareAudio = false) {
|
|
266
|
+ this.props.onSourceChoose(id, type, screenShareAudio);
|
258
|
267
|
this.props.dispatch(hideDialog());
|
259
|
268
|
}
|
260
|
269
|
|
|
@@ -285,9 +294,9 @@ class DesktopPicker extends PureComponent<Props, State> {
|
285
|
294
|
* @returns {void}
|
286
|
295
|
*/
|
287
|
296
|
_onSubmit() {
|
288
|
|
- const { id, type } = this.state.selectedSource;
|
|
297
|
+ const { selectedSource: { id, type }, screenShareAudio } = this.state;
|
289
|
298
|
|
290
|
|
- this._onCloseModal(id, type);
|
|
299
|
+ this._onCloseModal(id, type, screenShareAudio);
|
291
|
300
|
}
|
292
|
301
|
|
293
|
302
|
_onTabSelected: () => void;
|
|
@@ -306,12 +315,29 @@ class DesktopPicker extends PureComponent<Props, State> {
|
306
|
315
|
const { types, sources } = this.state;
|
307
|
316
|
|
308
|
317
|
this._selectedTabType = types[tabIndex];
|
|
318
|
+
|
|
319
|
+ // When we change tabs also reset the screenShareAudio state so we don't
|
|
320
|
+ // use the option from one tab when sharing from another.
|
309
|
321
|
this.setState({
|
|
322
|
+ screenShareAudio: false,
|
310
|
323
|
selectedSource: this._getSelectedSource(sources),
|
311
|
324
|
selectedTab: tabIndex
|
312
|
325
|
});
|
313
|
326
|
}
|
314
|
327
|
|
|
328
|
+ _onShareAudioChecked: (boolean) => void;
|
|
329
|
+
|
|
330
|
+ /**
|
|
331
|
+ * Set the screenSharingAudio state indicating whether or not to also share
|
|
332
|
+ * system audio.
|
|
333
|
+ *
|
|
334
|
+ * @param {boolean} checked - Share audio or not.
|
|
335
|
+ * @returns {void}
|
|
336
|
+ */
|
|
337
|
+ _onShareAudioChecked(checked) {
|
|
338
|
+ this.setState({ screenShareAudio: checked });
|
|
339
|
+ }
|
|
340
|
+
|
315
|
341
|
/**
|
316
|
342
|
* Configures and renders the tabs for display.
|
317
|
343
|
*
|
|
@@ -328,7 +354,8 @@ class DesktopPicker extends PureComponent<Props, State> {
|
328
|
354
|
content: <DesktopPickerPane
|
329
|
355
|
key = { type }
|
330
|
356
|
onClick = { this._onPreviewClick }
|
331
|
|
- onDoubleClick = { this._onCloseModal }
|
|
357
|
+ onDoubleClick = { this._onSubmit }
|
|
358
|
+ onShareAudioChecked = { this._onShareAudioChecked }
|
332
|
359
|
selectedSourceId = { selectedSource.id }
|
333
|
360
|
sources = { sources[type] }
|
334
|
361
|
type = { type } />,
|