From a16aae1124281ad982e79d0ca46f5468ab82e2b3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 10 Jan 2017 18:37:57 +0000 Subject: [PATCH] Move screen sharing error check into platform Because on the browser it depends on HTTPS, on electron it doesn't matter. --- src/BasePlatform.js | 9 +++++++++ src/CallHandler.js | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/BasePlatform.js b/src/BasePlatform.js index b8c400c6e3..815133c334 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -73,4 +73,13 @@ export default class BasePlatform { getAppVersion() { throw new Error("getAppVersion not implemented!"); } + + /* + * If it's not expected that capturing the screen will work + * with getUserMedia, return a string explaining why not. + * Otherwise, return null. + */ + screenCaptureErrorString() { + return "Not implemented"; + } } diff --git a/src/CallHandler.js b/src/CallHandler.js index a7845f6bea..4442219686 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -52,6 +52,7 @@ limitations under the License. */ var MatrixClientPeg = require('./MatrixClientPeg'); +var PlatformPeg = require("./PlatformPeg"); var Modal = require('./Modal'); var sdk = require('./index'); var Matrix = require("matrix-js-sdk"); @@ -187,6 +188,12 @@ function _onAction(payload) { ); } else if (payload.type === 'screensharing') { + const screenCapErrorString = PlatformPeg.get().screenCaptureErrorString(); + if (screenCapErrorString) { + _setCallState(undefined, newCall.roomId, "ended"); + console.log("Can't capture screen: " + screenCapErrorString); + return; + } newCall.placeScreenSharingCall( payload.remote_element, payload.local_element