1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2020-12-26 08:50:46 +01:00
parent 49e238d580
commit f410004d45

View File

@@ -371,7 +371,7 @@ export class MatrixCall extends EventEmitter {
if (window.desktopCapturer) { if (window.desktopCapturer) {
// We have access to the Electron desktop capturer // We have access to the Electron desktop capturer
logger.debug("Electron desktopCapturer is available"); logger.debug("Electron desktopCapturer is available...");
try { try {
const options: ElectronGetSourcesOptions = { const options: ElectronGetSourcesOptions = {
thumbnailSize: { thumbnailSize: {
@@ -384,32 +384,20 @@ export class MatrixCall extends EventEmitter {
], ],
}; };
window.desktopCapturer.getSources(options).then((sources: Array<ElectronDesktopCapturerSource>) => { const sources = await window.desktopCapturer.getSources(options);
console.log("Sources:", sources); const selectedSource = await selectDesktopCapturerSource(sources);
selectDesktopCapturerSource(sources).then((selectedSource)=> { this.screenSharingStream = await window.navigator.mediaDevices.getUserMedia({
console.log("Source:", selectedSource); audio: false,
window.navigator.mediaDevices.getUserMedia({ video: {
audio: false, mandatory: {
video: { chromeMediaSource: "desktop",
mandatory: { chromeMediaSourceId: selectedSource.id,
chromeMediaSource: "desktop", },
chromeMediaSourceId: selectedSource.id, },
},
},
}).then((stream)=> {
this.screenSharingStream = stream;
console.log("Stream", this.screenSharingStream);
logger.debug("Got screen stream, requesting audio stream...");
const audioConstraints = getUserMediaVideoContraints(CallType.Voice);
this.placeCallWithConstraints(audioConstraints);
}).catch( (error) => {
this.emit(error);
});
});
}).catch((error) => {
this.emit(error);
}); });
logger.debug("Got screen stream, requesting audio stream...");
const audioConstraints = getUserMediaVideoContraints(CallType.Voice);
this.placeCallWithConstraints(audioConstraints);
} catch (err) { } catch (err) {
this.emit(CallEvent.Error, this.emit(CallEvent.Error,
new CallError( new CallError(
@@ -421,7 +409,7 @@ export class MatrixCall extends EventEmitter {
} else { } else {
/* We do not have access to the Electron desktop capturer, /* We do not have access to the Electron desktop capturer,
* therefore we can assume we are on the web */ * therefore we can assume we are on the web */
logger.debug("Electron desktopCapturer is not available"); logger.debug("Electron desktopCapturer is not available...");
try { try {
this.screenSharingStream = await navigator.mediaDevices.getDisplayMedia({'audio': false}); this.screenSharingStream = await navigator.mediaDevices.getDisplayMedia({'audio': false});
logger.debug("Got screen stream, requesting audio stream..."); logger.debug("Got screen stream, requesting audio stream...");