Merge pull request #1079 from matrix-org/t3chguy/voip/force_turn

allow forcing of TURN
pull/21833/head
Matthew Hodgson 2017-06-12 21:44:00 +01:00 committed by GitHub
commit bc55d44bcf
3 changed files with 34 additions and 21 deletions

View File

@ -51,13 +51,14 @@ limitations under the License.
* } * }
*/ */
var MatrixClientPeg = require('./MatrixClientPeg'); import MatrixClientPeg from './MatrixClientPeg';
var PlatformPeg = require("./PlatformPeg"); import UserSettingsStore from './UserSettingsStore';
var Modal = require('./Modal'); import PlatformPeg from './PlatformPeg';
var sdk = require('./index'); import Modal from './Modal';
import sdk from './index';
import { _t } from './languageHandler'; import { _t } from './languageHandler';
var Matrix = require("matrix-js-sdk"); import Matrix from 'matrix-js-sdk';
var dis = require("./dispatcher"); import dis from './dispatcher';
global.mxCalls = { global.mxCalls = {
//room_id: MatrixCall //room_id: MatrixCall
@ -257,9 +258,9 @@ function _onAction(payload) {
} }
else if (members.length === 2) { else if (members.length === 2) {
console.log("Place %s call in %s", payload.type, payload.room_id); console.log("Place %s call in %s", payload.type, payload.room_id);
var call = Matrix.createNewMatrixCall( const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id, {
MatrixClientPeg.get(), payload.room_id forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false),
); });
placeCall(call); placeCall(call);
} }
else { // > 2 else { // > 2

View File

@ -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, // Warning: Each "label" string below must be added to i18n/strings/en_EN.json,
// since they will be translated when rendered. // since they will be translated when rendered.
const CRYPTO_SETTINGS_LABELS = [ const CRYPTO_SETTINGS_LABELS = [
@ -945,16 +952,13 @@ module.exports = React.createClass({
} }
}, },
_renderWebRtcSettings: function() { _renderWebRtcDeviceSettings: function() {
if (this.state.mediaDevices === false) { if (this.state.mediaDevices === false) {
return <div> return (
<h3>{_t('VoIP')}</h3> <p className="mx_UserSettings_link" onClick={this._requestMediaPermissions}>
<div className="mx_UserSettings_section"> {_t('Missing Media Permissions, click here to request.')}
<p className="mx_UserSettings_link" onClick={this._requestMediaPermissions}> </p>
{_t('Missing Media Permissions, click here to request.')} );
</p>
</div>
</div>;
} else if (!this.state.mediaDevices) return; } else if (!this.state.mediaDevices) return;
const Dropdown = sdk.getComponent('elements.Dropdown'); const Dropdown = sdk.getComponent('elements.Dropdown');
@ -1008,10 +1012,17 @@ module.exports = React.createClass({
} }
return <div> return <div>
<h3>{_t('VoIP')}</h3>
<div className="mx_UserSettings_section">
{microphoneDropdown} {microphoneDropdown}
{webcamDropdown} {webcamDropdown}
</div>;
},
_renderWebRtcSettings: function() {
return <div>
<h3>{_t('VoIP')}</h3>
<div className="mx_UserSettings_section">
{ WEBRTC_SETTINGS_LABELS.map(this._renderLocalSetting) }
{ this._renderWebRtcDeviceSettings() }
</div> </div>
</div>; </div>;
}, },

View File

@ -907,5 +907,6 @@
"If you already have a Matrix account you can <a>log in</a> instead.": "If you already have a Matrix account you can <a>log in</a> instead.", "If you already have a Matrix account you can <a>log in</a> instead.": "If you already have a Matrix account you can <a>log in</a> instead.",
"Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions", "Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions",
"Not a valid Riot keyfile": "Not a valid Riot keyfile", "Not a valid Riot keyfile": "Not a valid Riot keyfile",
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?" "Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
"Disable Peer-to-Peer for 1:1 calls": "Disable Peer-to-Peer for 1:1 calls"
} }