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 #1355 from matrix-org/rob/electron-screensharing
Browse files Browse the repository at this point in the history
Add support for Jitsi screensharing in electron app
  • Loading branch information
dbkr authored Sep 25, 2017
2 parents b42cf74 + 24de01e commit 79af970
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/BasePlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export default class BasePlatform {

isElectron(): boolean { return false; }

setupScreenSharingForIframe() {
}

/**
* Restarts the application, without neccessarily reloading
* any application code
Expand Down
25 changes: 25 additions & 0 deletions src/components/views/elements/AppTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
import url from 'url';
import React from 'react';
import MatrixClientPeg from '../../../MatrixClientPeg';
import PlatformPeg from '../../../PlatformPeg';
import ScalarAuthClient from '../../../ScalarAuthClient';
import SdkConfig from '../../../SdkConfig';
import Modal from '../../../Modal';
Expand Down Expand Up @@ -127,6 +128,30 @@ export default React.createClass({
loading: false,
});
});
window.addEventListener('message', this._onMessage, false);
},

componentWillUnmount() {
window.removeEventListener('message', this._onMessage);
},

_onMessage(event) {
if (this.props.type !== 'jitsi') {
return;
}
if (!event.origin) {
event.origin = event.originalEvent.origin;
}

if (!this.state.widgetUrl.startsWith(event.origin)) {
return;
}

if (event.data.widgetAction === 'jitsi_iframe_loaded') {
const iframe = this.refs.appFrame.contentWindow
.document.querySelector('iframe[id^="jitsiConferenceFrame"]');
PlatformPeg.get().setupScreenSharingForIframe(iframe);
}
},

_canUserModify: function() {
Expand Down

0 comments on commit 79af970

Please sign in to comment.