Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #608 from matrix-org/dbkr/move_screen_sharing_error
Browse files Browse the repository at this point in the history
Move screen sharing error check into platform
  • Loading branch information
dbkr authored Jan 11, 2017
2 parents 085f134 + 37d9108 commit e95f5b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/BasePlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
12 changes: 12 additions & 0 deletions src/CallHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -187,6 +188,17 @@ 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);
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Unable to capture screen",
description: screenCapErrorString
});
return;
}
newCall.placeScreenSharingCall(
payload.remote_element,
payload.local_element
Expand Down

0 comments on commit e95f5b9

Please sign in to comment.