|
@@ -162,6 +162,8 @@ function setResolutionConstraints(
|
162
|
162
|
* @param {Object} options.frameRate - used only for dekstop sharing.
|
163
|
163
|
* @param {Object} options.frameRate.min - Minimum fps
|
164
|
164
|
* @param {Object} options.frameRate.max - Maximum fps
|
|
165
|
+ * @param {bool} options.screenShareAudio - Used by electron clients to
|
|
166
|
+ * enable system audio screen sharing.
|
165
|
167
|
*/
|
166
|
168
|
function getConstraints(um, options = {}) {
|
167
|
169
|
const constraints = {
|
|
@@ -308,6 +310,21 @@ function getConstraints(um, options = {}) {
|
308
|
310
|
}),
|
309
|
311
|
optional: []
|
310
|
312
|
};
|
|
313
|
+
|
|
314
|
+ // Audio screen sharing for electron only works for screen type devices.
|
|
315
|
+ // i.e. when the user shares the whole desktop.
|
|
316
|
+ if (browser.isElectron() && options.screenShareAudio
|
|
317
|
+ && (options.desktopStream.indexOf('screen') >= 0)) {
|
|
318
|
+
|
|
319
|
+ // Provide constraints as described by the electron desktop capturer
|
|
320
|
+ // documentation here:
|
|
321
|
+ // https://www.electronjs.org/docs/api/desktop-capturer
|
|
322
|
+ constraints.audio = { mandatory: {
|
|
323
|
+ chromeMediaSource: constraints.video.mandatory.chromeMediaSource
|
|
324
|
+ } };
|
|
325
|
+
|
|
326
|
+ delete constraints.video.mandatory.chromeMediaSourceId;
|
|
327
|
+ }
|
311
|
328
|
}
|
312
|
329
|
|
313
|
330
|
if (options.bandwidth) {
|
|
@@ -930,6 +947,8 @@ class RTCUtils extends Listenable {
|
930
|
947
|
* @param {Object} options.frameRate - used only for dekstop sharing.
|
931
|
948
|
* @param {Object} options.frameRate.min - Minimum fps
|
932
|
949
|
* @param {Object} options.frameRate.max - Maximum fps
|
|
950
|
+ * @param {bool} options.screenShareAudio - Used by electron clients to
|
|
951
|
+ * enable system audio screen sharing.
|
933
|
952
|
* @returns {Promise} Returns a media stream on success or a JitsiTrackError
|
934
|
953
|
* on failure.
|
935
|
954
|
**/
|
|
@@ -940,17 +959,17 @@ class RTCUtils extends Listenable {
|
940
|
959
|
|
941
|
960
|
return new Promise((resolve, reject) => {
|
942
|
961
|
navigator.mediaDevices.getUserMedia(constraints)
|
943
|
|
- .then(stream => {
|
944
|
|
- logger.log('onUserMediaSuccess');
|
945
|
|
- updateGrantedPermissions(um, stream);
|
946
|
|
- resolve(stream);
|
947
|
|
- })
|
948
|
|
- .catch(error => {
|
949
|
|
- logger.warn('Failed to get access to local media. '
|
950
|
|
- + ` ${error} ${constraints} `);
|
951
|
|
- updateGrantedPermissions(um, undefined);
|
952
|
|
- reject(new JitsiTrackError(error, constraints, um));
|
953
|
|
- });
|
|
962
|
+ .then(stream => {
|
|
963
|
+ logger.log('onUserMediaSuccess');
|
|
964
|
+ updateGrantedPermissions(um, stream);
|
|
965
|
+ resolve(stream);
|
|
966
|
+ })
|
|
967
|
+ .catch(error => {
|
|
968
|
+ logger.warn('Failed to get access to local media. '
|
|
969
|
+ + ` ${error} ${constraints} `);
|
|
970
|
+ updateGrantedPermissions(um, undefined);
|
|
971
|
+ reject(new JitsiTrackError(error, constraints, um));
|
|
972
|
+ });
|
954
|
973
|
});
|
955
|
974
|
}
|
956
|
975
|
|