summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-09 17:37:50 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-09 17:38:40 +0100
commit253c327252a3455aa5ce3a3147e19406a4d67615 (patch)
tree88c7d31cc37c229a50bf0af8f6b9fffb98ad0141
parentFix bug where we used an unbound local variable if we ended up rolling back t... (diff)
downloadsynapse-253c327252a3455aa5ce3a3147e19406a4d67615.tar.xz
Don't play an engaged tone if we hang up locally.
-rw-r--r--webclient/app-controller.js2
-rw-r--r--webclient/components/matrix/matrix-call.js11
-rw-r--r--webclient/room/room-controller.js10
3 files changed, 18 insertions, 5 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index 20b5076727..4a57f66ef0 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -118,7 +118,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
             angular.element('#ringAudio')[0].pause();
             angular.element('#ringbackAudio')[0].pause();
             angular.element('#callendAudio')[0].play();
-        } else if (newVal == 'ended' && oldVal == 'invite_sent') {
+        } else if (newVal == 'ended' && oldVal == 'invite_sent' && $rootScope.currentCall.hangupParty == 'remote') {
             angular.element('#ringAudio')[0].pause();
             angular.element('#ringbackAudio')[0].pause();
             angular.element('#busyAudio')[0].play();
diff --git a/webclient/components/matrix/matrix-call.js b/webclient/components/matrix/matrix-call.js
index ae20b7650e..aae00a3f77 100644
--- a/webclient/components/matrix/matrix-call.js
+++ b/webclient/components/matrix/matrix-call.js
@@ -58,12 +58,13 @@ angular.module('MatrixCall', [])
         this.didConnect = false;
     }
 
-    MatrixCall.prototype.placeCall = function() {
+    MatrixCall.prototype.placeCall = function(config) {
         self = this;
         matrixPhoneService.callPlaced(this);
-        navigator.getUserMedia({audio: true, video: false}, function(s) { self.gotUserMediaForInvite(s); }, function(e) { self.getUserMediaFailed(e); });
-        self.state = 'wait_local_media';
+        navigator.getUserMedia({audio: config.audio, video: config.video}, function(s) { self.gotUserMediaForInvite(s); }, function(e) { self.getUserMediaFailed(e); });
+        this.state = 'wait_local_media';
         this.direction = 'outbound';
+        this.config = config;
     };
 
     MatrixCall.prototype.initWithInvite = function(msg) {
@@ -105,6 +106,8 @@ angular.module('MatrixCall', [])
         this.stopAllMedia();
         this.peerConn.close();
 
+        this.hangupParty = 'local';
+
         var content = {
             version: 0,
             call_id: this.call_id,
@@ -285,6 +288,7 @@ angular.module('MatrixCall', [])
         self = this;
         $rootScope.$apply(function() {
             self.state = 'ended';
+            this.hangupParty = 'remote';
             self.stopAllMedia();
             this.peerConn.close();
             self.onHangup();
@@ -300,6 +304,7 @@ angular.module('MatrixCall', [])
 
     MatrixCall.prototype.onHangupReceived = function() {
         this.state = 'ended';
+        this.hangupParty = 'remote';
         this.stopAllMedia();
         this.peerConn.close();
         this.onHangup();
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 59f64061cd..3d75ef5499 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -756,7 +756,15 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
         var call = new MatrixCall($scope.room_id);
         call.onError = $rootScope.onCallError;
         call.onHangup = $rootScope.onCallHangup;
-        call.placeCall();
+        call.placeCall({audio: true, video: false});
+        $rootScope.currentCall = call;
+    };
+
+    $scope.startVideoCall = function() {
+        var call = new MatrixCall($scope.room_id);
+        call.onError = $rootScope.onCallError;
+        call.onHangup = $rootScope.onCallHangup;
+        call.placeCall({audio: true, video: true});
         $rootScope.currentCall = call;
     };