diff --git a/static/js/controllers/appcontroller.js b/static/js/controllers/appcontroller.js index e97b9ef6..0f226cc0 100644 --- a/static/js/controllers/appcontroller.js +++ b/static/js/controllers/appcontroller.js @@ -56,6 +56,13 @@ define(["jquery", "angular", "underscore"], function($, angular, _) { videoLeakyBucket: true, videoNoiseReduction: false }, + webrtc: { + turn: { + urls: ['turn:turnserver:port?transport=udp', 'turn:turnserver:port?transport=tcp'], + username: 'myusername', + password: 'the-default-turn-secret-do-not-keep' + } + }, sound: { incomingMessages: true, incomingCall: true, diff --git a/static/js/directives/settings.js b/static/js/directives/settings.js index 43c9f9a2..075a5c38 100644 --- a/static/js/directives/settings.js +++ b/static/js/directives/settings.js @@ -70,6 +70,18 @@ define(['jquery', 'underscore', 'text!partials/settings.html'], function($, _, t $scope.withUsers = mediaStream.config.UsersEnabled; $scope.withUsersRegistration = mediaStream.config.UsersAllowRegistration; $scope.withUsersMode = mediaStream.config.UsersMode; + $scope.withTurnCustomizable = mediaStream.config.TurnURIsClientSideSetable; + + var updateTurnSettings = function() { + constraints.turn($scope.user.settings.webrtc.turn); + }; + + if ($scope.withTurnCustomizable && $scope.user.settings.webrtc.turn.urls) { + // Overwrite server Turn settings + appData.e.one("userSettingsLoaded", function() { + updateTurnSettings(); + }); + } _.each(availableLanguages, function(name, code) { $scope.availableLanguages.push({ @@ -90,6 +102,9 @@ define(['jquery', 'underscore', 'text!partials/settings.html'], function($, _, t if (form.$valid && form.$dirty) { var user = $scope.user; $scope.update(user); + if ($scope.withTurnCustomizable) { + updateTurnSettings(); + } if ($scope.rememberSettings) { userSettingsData.save(user); localStorage.setItem("mediastream-language", user.settings.language || ""); diff --git a/static/partials/settings.html b/static/partials/settings.html index 9d064763..129edad1 100644 --- a/static/partials/settings.html +++ b/static/partials/settings.html @@ -283,6 +283,27 @@ +