1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

ability to specify webrtc audio/video inputs for the lib to request

This commit is contained in:
Michael Telatynski
2017-04-27 16:06:34 +01:00
parent fdd42fbc6d
commit 98491a63a7
2 changed files with 50 additions and 8 deletions

View File

@@ -1187,16 +1187,25 @@ const _getChromeScreenSharingConstraints = function(call) {
const _getUserMediaVideoContraints = function(callType) {
switch (callType) {
case 'voice':
return ({audio: true, video: false});
return {
audio: {
deviceId: audioInput ? {exact: audioInput} : undefined,
}, video: false,
};
case 'video':
return ({audio: true, video: {
mandatory: {
minWidth: 640,
maxWidth: 640,
minHeight: 360,
maxHeight: 360,
return {
audio: {
deviceId: audioInput ? {exact: audioInput} : undefined,
}, video: {
deviceId: videoInput ? {exact: videoInput} : undefined,
mandatory: {
minWidth: 640,
maxWidth: 640,
minHeight: 360,
maxHeight: 360,
},
},
}});
};
}
};
@@ -1228,6 +1237,22 @@ const forAllTracksOnStream = function(s, f) {
/** The MatrixCall class. */
module.exports.MatrixCall = MatrixCall;
let audioInput;
let videoInput;
/**
* Set an audio input device to use for MatrixCalls
* @function
* @param {string=} deviceId the identifier for the device
* undefined treated as unset
*/
module.exports.setAudioInput = function(deviceId) { audioInput = deviceId; };
/**
* Set a video input device to use for MatrixCalls
* @function
* @param {string=} deviceId the identifier for the device
* undefined treated as unset
*/
module.exports.setVideoInput = function(deviceId) { videoInput = deviceId; };
/**
* Create a new Matrix call for the browser.