You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
allow setting the output device for webrtc calls
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -81,6 +81,13 @@ module.exports.IndexedDBCryptoStore =
|
|||||||
module.exports.createNewMatrixCall = require("./webrtc/call").createNewMatrixCall;
|
module.exports.createNewMatrixCall = require("./webrtc/call").createNewMatrixCall;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an audio output device to use for MatrixCalls
|
||||||
|
* @function
|
||||||
|
* @param {string=} deviceId the identifier for the device
|
||||||
|
* undefined treated as unset
|
||||||
|
*/
|
||||||
|
module.exports.setMatrixCallAudioOutput = require('./webrtc/call').setAudioOutput;
|
||||||
/**
|
/**
|
||||||
* Set an audio input device to use for MatrixCalls
|
* Set an audio input device to use for MatrixCalls
|
||||||
* @function
|
* @function
|
||||||
|
|||||||
@@ -1121,9 +1121,13 @@ const _tryPlayRemoteStream = function(self) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const _tryPlayRemoteAudioStream = function(self) {
|
const _tryPlayRemoteAudioStream = async function(self) {
|
||||||
if (self.getRemoteAudioElement() && self.remoteAStream) {
|
if (self.getRemoteAudioElement() && self.remoteAStream) {
|
||||||
const player = self.getRemoteAudioElement();
|
const player = self.getRemoteAudioElement();
|
||||||
|
|
||||||
|
// if audioOutput is non-default:
|
||||||
|
if (audioOutput) await player.setSinkId(audioOutput);
|
||||||
|
|
||||||
player.autoplay = true;
|
player.autoplay = true;
|
||||||
self.assignElement(player, self.remoteAStream, "remoteAudio");
|
self.assignElement(player, self.remoteAStream, "remoteAudio");
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -1317,8 +1321,16 @@ const forAllTracksOnStream = function(s, f) {
|
|||||||
/** The MatrixCall class. */
|
/** The MatrixCall class. */
|
||||||
module.exports.MatrixCall = MatrixCall;
|
module.exports.MatrixCall = MatrixCall;
|
||||||
|
|
||||||
|
let audioOutput;
|
||||||
let audioInput;
|
let audioInput;
|
||||||
let videoInput;
|
let videoInput;
|
||||||
|
/**
|
||||||
|
* Set an audio output device to use for MatrixCalls
|
||||||
|
* @function
|
||||||
|
* @param {string=} deviceId the identifier for the device
|
||||||
|
* undefined treated as unset
|
||||||
|
*/
|
||||||
|
module.exports.setAudioOutput = function(deviceId) { audioOutput = deviceId; };
|
||||||
/**
|
/**
|
||||||
* Set an audio input device to use for MatrixCalls
|
* Set an audio input device to use for MatrixCalls
|
||||||
* @function
|
* @function
|
||||||
|
|||||||
Reference in New Issue
Block a user