diff --git a/src/CallHandler.js b/src/CallHandler.js index b2ccf65df7..e3fbe9e5e3 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -51,13 +51,14 @@ limitations under the License. * } */ -var MatrixClientPeg = require('./MatrixClientPeg'); -var PlatformPeg = require("./PlatformPeg"); -var Modal = require('./Modal'); -var sdk = require('./index'); +import MatrixClientPeg from './MatrixClientPeg'; +import UserSettingsStore from './UserSettingsStore'; +import PlatformPeg from './PlatformPeg'; +import Modal from './Modal'; +import sdk from './index'; import { _t } from './languageHandler'; -var Matrix = require("matrix-js-sdk"); -var dis = require("./dispatcher"); +import Matrix from 'matrix-js-sdk'; +import dis from './dispatcher'; global.mxCalls = { //room_id: MatrixCall @@ -257,9 +258,9 @@ function _onAction(payload) { } else if (members.length === 2) { console.log("Place %s call in %s", payload.type, payload.room_id); - var call = Matrix.createNewMatrixCall( - MatrixClientPeg.get(), payload.room_id - ); + const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id, { + forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false), + }); placeCall(call); } else { // > 2 diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index e73f0335f0..5ac2e77256 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -110,6 +110,13 @@ const ANALYTICS_SETTINGS_LABELS = [ }, ]; +const WEBRTC_SETTINGS_LABELS = [ + { + id: 'webRtcForceTURN', + label: 'Disable Peer-to-Peer for 1:1 calls', + }, +]; + // Warning: Each "label" string below must be added to i18n/strings/en_EN.json, // since they will be translated when rendered. const CRYPTO_SETTINGS_LABELS = [ @@ -945,16 +952,13 @@ module.exports = React.createClass({ } }, - _renderWebRtcSettings: function() { + _renderWebRtcDeviceSettings: function() { if (this.state.mediaDevices === false) { - return
- {_t('Missing Media Permissions, click here to request.')} -
-+ {_t('Missing Media Permissions, click here to request.')} +
+ ); } else if (!this.state.mediaDevices) return; const Dropdown = sdk.getComponent('elements.Dropdown'); @@ -1008,10 +1012,17 @@ module.exports = React.createClass({ } return