mirror of https://github.com/vector-im/riot-web
Merge pull request #4967 from vector-im/rob/electron-screensharing
Add Jitsi screensharing support in electron apppull/5137/head
commit
94855c0f48
|
@ -21,7 +21,7 @@ import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform';
|
||||||
import dis from 'matrix-react-sdk/lib/dispatcher';
|
import dis from 'matrix-react-sdk/lib/dispatcher';
|
||||||
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
||||||
import Promise from 'bluebird';
|
import Promise from 'bluebird';
|
||||||
import {remote, ipcRenderer} from 'electron';
|
import {remote, ipcRenderer, desktopCapturer} from 'electron';
|
||||||
import rageshake from '../rageshake';
|
import rageshake from '../rageshake';
|
||||||
|
|
||||||
remote.autoUpdater.on('update-downloaded', onUpdateDownloaded);
|
remote.autoUpdater.on('update-downloaded', onUpdateDownloaded);
|
||||||
|
@ -207,4 +207,43 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
reload() {
|
reload() {
|
||||||
remote.getCurrentWebContents().reload();
|
remote.getCurrentWebContents().reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BEGIN copied and slightly-modified code
|
||||||
|
* setupScreenSharingForIframe function from:
|
||||||
|
* https://github.com/jitsi/jitsi-meet-electron-utils
|
||||||
|
* Copied directly here to avoid the need for a native electron module for
|
||||||
|
* 'just a bit of JavaScript'
|
||||||
|
* NOTE: Apache v2.0 licensed
|
||||||
|
*/
|
||||||
|
setupScreenSharingForIframe(iframe: Object) {
|
||||||
|
iframe.contentWindow.JitsiMeetElectron = {
|
||||||
|
/**
|
||||||
|
* Get sources available for screensharing. The callback is invoked
|
||||||
|
* with an array of DesktopCapturerSources.
|
||||||
|
*
|
||||||
|
* @param {Function} callback - The success callback.
|
||||||
|
* @param {Function} errorCallback - The callback for errors.
|
||||||
|
* @param {Object} options - Configuration for getting sources.
|
||||||
|
* @param {Array} options.types - Specify the desktop source types
|
||||||
|
* to get, with valid sources being "window" and "screen".
|
||||||
|
* @param {Object} options.thumbnailSize - Specify how big the
|
||||||
|
* preview images for the sources should be. The valid keys are
|
||||||
|
* height and width, e.g. { height: number, width: number}. By
|
||||||
|
* default electron will return images with height and width of
|
||||||
|
* 150px.
|
||||||
|
*/
|
||||||
|
obtainDesktopStreams(callback, errorCallback, options = {}) {
|
||||||
|
desktopCapturer.getSources(options,
|
||||||
|
(error, sources) => {
|
||||||
|
if (error) {
|
||||||
|
errorCallback(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(sources);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/* END of copied and slightly-modified code */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue