You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
ability to specify webrtc audio/video inputs for the lib to request
This commit is contained in:
@@ -73,6 +73,23 @@ module.exports.InteractiveAuth = require("./interactive-auth");
|
|||||||
*/
|
*/
|
||||||
module.exports.createNewMatrixCall = require("./webrtc/call").createNewMatrixCall;
|
module.exports.createNewMatrixCall = require("./webrtc/call").createNewMatrixCall;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an audio input device to use for MatrixCalls
|
||||||
|
* @function
|
||||||
|
* @param {string=} deviceId the identifier for the device
|
||||||
|
* undefined treated as unset
|
||||||
|
*/
|
||||||
|
module.exports.setMatrixCallAudioInput = require('./webrtc/call').setAudioInput;
|
||||||
|
/**
|
||||||
|
* Set a video input device to use for MatrixCalls
|
||||||
|
* @function
|
||||||
|
* @param {string=} deviceId the identifier for the device
|
||||||
|
* undefined treated as unset
|
||||||
|
*/
|
||||||
|
module.exports.setMatrixCallVideoInput = require('./webrtc/call').setVideoInput;
|
||||||
|
|
||||||
|
|
||||||
// expose the underlying request object so different environments can use
|
// expose the underlying request object so different environments can use
|
||||||
// different request libs (e.g. request or browser-request)
|
// different request libs (e.g. request or browser-request)
|
||||||
let request;
|
let request;
|
||||||
|
|||||||
@@ -1187,16 +1187,25 @@ const _getChromeScreenSharingConstraints = function(call) {
|
|||||||
const _getUserMediaVideoContraints = function(callType) {
|
const _getUserMediaVideoContraints = function(callType) {
|
||||||
switch (callType) {
|
switch (callType) {
|
||||||
case 'voice':
|
case 'voice':
|
||||||
return ({audio: true, video: false});
|
return {
|
||||||
|
audio: {
|
||||||
|
deviceId: audioInput ? {exact: audioInput} : undefined,
|
||||||
|
}, video: false,
|
||||||
|
};
|
||||||
case 'video':
|
case 'video':
|
||||||
return ({audio: true, video: {
|
return {
|
||||||
mandatory: {
|
audio: {
|
||||||
minWidth: 640,
|
deviceId: audioInput ? {exact: audioInput} : undefined,
|
||||||
maxWidth: 640,
|
}, video: {
|
||||||
minHeight: 360,
|
deviceId: videoInput ? {exact: videoInput} : undefined,
|
||||||
maxHeight: 360,
|
mandatory: {
|
||||||
|
minWidth: 640,
|
||||||
|
maxWidth: 640,
|
||||||
|
minHeight: 360,
|
||||||
|
maxHeight: 360,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}});
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1228,6 +1237,22 @@ const forAllTracksOnStream = function(s, f) {
|
|||||||
/** The MatrixCall class. */
|
/** The MatrixCall class. */
|
||||||
module.exports.MatrixCall = MatrixCall;
|
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.
|
* Create a new Matrix call for the browser.
|
||||||
|
|||||||
Reference in New Issue
Block a user