Browse Source

fix(config): Document desktopSharingSources and improve types

factor2
Hristo Terezov 5 months ago
parent
commit
35554533d1

+ 3
- 0
config.js View File

1631
     //         video: true
1631
     //         video: true
1632
     //     },
1632
     //     },
1633
     // },
1633
     // },
1634
+    // The default type of desktop sharing sources that will be used in the electron app.
1635
+    // desktopSharingSources: ['screen', 'window'],
1636
+
1634
     // Disables the echo cancelation for local audio tracks.
1637
     // Disables the echo cancelation for local audio tracks.
1635
     // disableAEC: true,
1638
     // disableAEC: true,
1636
 
1639
 

+ 2
- 0
react/features/base/config/configType.ts View File

1
 import { ToolbarButton } from '../../toolbox/types';
1
 import { ToolbarButton } from '../../toolbox/types';
2
 import { ILoggingConfig } from '../logging/types';
2
 import { ILoggingConfig } from '../logging/types';
3
+import { DesktopSharingSourceType } from '../tracks/types';
3
 
4
 
4
 type ButtonsWithNotifyClick = 'camera' |
5
 type ButtonsWithNotifyClick = 'camera' |
5
     'chat' |
6
     'chat' |
280
         max?: number;
281
         max?: number;
281
         min?: number;
282
         min?: number;
282
     };
283
     };
284
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
283
     dialInConfCodeUrl?: string;
285
     dialInConfCodeUrl?: string;
284
     dialInNumbersUrl?: string;
286
     dialInNumbersUrl?: string;
285
     dialOutAuthUrl?: string;
287
     dialOutAuthUrl?: string;

+ 4
- 2
react/features/base/tracks/types.ts View File

12
         };
12
         };
13
     };
13
     };
14
     desktopSharingSourceDevice?: string;
14
     desktopSharingSourceDevice?: string;
15
-    desktopSharingSources?: string[];
15
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
16
     devices?: string[];
16
     devices?: string[];
17
     facingMode?: string;
17
     facingMode?: string;
18
     micDeviceId?: string | null;
18
     micDeviceId?: string | null;
67
     shareOptions: IShareOptions;
67
     shareOptions: IShareOptions;
68
 }
68
 }
69
 
69
 
70
+export type DesktopSharingSourceType = 'screen' | 'window';
71
+
70
 export interface IShareOptions {
72
 export interface IShareOptions {
71
     desktopSharingSourceDevice?: string;
73
     desktopSharingSourceDevice?: string;
72
-    desktopSharingSources?: string[];
74
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
73
     desktopStream?: any;
75
     desktopStream?: any;
74
 }
76
 }
75
 
77
 

+ 6
- 1
react/features/desktop-picker/actions.ts View File

1
 import { openDialog } from '../base/dialog/actions';
1
 import { openDialog } from '../base/dialog/actions';
2
+import { DesktopSharingSourceType } from '../base/tracks/types';
2
 
3
 
3
 import DesktopPicker from './components/DesktopPicker';
4
 import DesktopPicker from './components/DesktopPicker';
4
 
5
 
6
+type Options = {
7
+    desktopSharingSources?: Array<DesktopSharingSourceType>;
8
+};
9
+
5
 /**
10
 /**
6
  * Signals to open a dialog with the DesktopPicker component.
11
  * Signals to open a dialog with the DesktopPicker component.
7
  *
12
  *
10
  * a DesktopCapturerSource has been chosen.
15
  * a DesktopCapturerSource has been chosen.
11
  * @returns {Object}
16
  * @returns {Object}
12
  */
17
  */
13
-export function showDesktopPicker(options: { desktopSharingSources?: any; } = {}, onSourceChoose: Function) {
18
+export function showDesktopPicker(options: Options = {}, onSourceChoose: Function) {
14
     const { desktopSharingSources } = options;
19
     const { desktopSharingSources } = options;
15
 
20
 
16
     return openDialog(DesktopPicker, {
21
     return openDialog(DesktopPicker, {

+ 7
- 6
react/features/desktop-picker/components/DesktopPicker.tsx View File

5
 import { IStore } from '../../app/types';
5
 import { IStore } from '../../app/types';
6
 import { hideDialog } from '../../base/dialog/actions';
6
 import { hideDialog } from '../../base/dialog/actions';
7
 import { translate } from '../../base/i18n/functions';
7
 import { translate } from '../../base/i18n/functions';
8
+import { DesktopSharingSourceType } from '../../base/tracks/types';
8
 import Dialog from '../../base/ui/components/web/Dialog';
9
 import Dialog from '../../base/ui/components/web/Dialog';
9
 import Tabs from '../../base/ui/components/web/Tabs';
10
 import Tabs from '../../base/ui/components/web/Tabs';
10
 import { THUMBNAIL_SIZE } from '../constants';
11
 import { THUMBNAIL_SIZE } from '../constants';
32
     window: 'dialog.applicationWindow'
33
     window: 'dialog.applicationWindow'
33
 };
34
 };
34
 
35
 
35
-const VALID_TYPES = Object.keys(TAB_LABELS);
36
+const VALID_TYPES = Object.keys(TAB_LABELS) as DesktopSharingSourceType[];
36
 
37
 
37
 /**
38
 /**
38
  * The type of the React {@code Component} props of {@link DesktopPicker}.
39
  * The type of the React {@code Component} props of {@link DesktopPicker}.
42
     /**
43
     /**
43
      * An array with desktop sharing sources to be displayed.
44
      * An array with desktop sharing sources to be displayed.
44
      */
45
      */
45
-    desktopSharingSources: Array<string>;
46
+    desktopSharingSources: Array<DesktopSharingSourceType>;
46
 
47
 
47
     /**
48
     /**
48
      * Used to request DesktopCapturerSources.
49
      * Used to request DesktopCapturerSources.
84
     /**
85
     /**
85
      * The desktop source types to fetch previews for.
86
      * The desktop source types to fetch previews for.
86
      */
87
      */
87
-    types: Array<string>;
88
+    types: Array<DesktopSharingSourceType>;
88
 }
89
 }
89
 
90
 
90
 
91
 
112
      * @private
113
      * @private
113
      * @returns {Array<string>} The filtered types.
114
      * @returns {Array<string>} The filtered types.
114
      */
115
      */
115
-    static _getValidTypes(types: string[] = []) {
116
+    static _getValidTypes(types: DesktopSharingSourceType[] = []) {
116
         return types.filter(
117
         return types.filter(
117
             type => VALID_TYPES.includes(type));
118
             type => VALID_TYPES.includes(type));
118
     }
119
     }
346
             = types.map(
347
             = types.map(
347
                 type => {
348
                 type => {
348
                     return {
349
                     return {
349
-                        accessibilityLabel: t(TAB_LABELS[type as keyof typeof TAB_LABELS]),
350
+                        accessibilityLabel: t(TAB_LABELS[type]),
350
                         id: `${type}`,
351
                         id: `${type}`,
351
                         controlsId: `${type}-panel`,
352
                         controlsId: `${type}-panel`,
352
-                        label: t(TAB_LABELS[type as keyof typeof TAB_LABELS])
353
+                        label: t(TAB_LABELS[type])
353
                     };
354
                     };
354
                 });
355
                 });
355
 
356
 

Loading…
Cancel
Save