summary refs log tree commit diff
path: root/webclient/app-controller.js
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-08 16:10:36 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-08 16:10:36 +0100
commit972f664b6b38029cda46a6ba709b7fc8b6b6bdae (patch)
tree582d79e95eb0f3e5e53cc52ba917c1604880ef69 /webclient/app-controller.js
parentMerge branch 'origin/release-v0.2.2' into develop (diff)
downloadsynapse-972f664b6b38029cda46a6ba709b7fc8b6b6bdae.tar.xz
add sounds to the calling interface
Diffstat (limited to 'webclient/app-controller.js')
-rw-r--r--webclient/app-controller.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index 064bde3ab2..20b5076727 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -105,6 +105,29 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
             }
         );
     });
+    $rootScope.$watch('currentCall.state', function(newVal, oldVal) {
+        if (newVal == 'ringing') {
+            angular.element('#ringbackAudio')[0].pause();
+            angular.element('#ringAudio')[0].load();
+            angular.element('#ringAudio')[0].play();
+        } else if (newVal == 'invite_sent') {
+            angular.element('#ringAudio')[0].pause();
+            angular.element('#ringbackAudio')[0].load();
+            angular.element('#ringbackAudio')[0].play();
+        } else if (newVal == 'ended' && oldVal == 'connected') {
+            angular.element('#ringAudio')[0].pause();
+            angular.element('#ringbackAudio')[0].pause();
+            angular.element('#callendAudio')[0].play();
+        } else if (newVal == 'ended' && oldVal == 'invite_sent') {
+            angular.element('#ringAudio')[0].pause();
+            angular.element('#ringbackAudio')[0].pause();
+            angular.element('#busyAudio')[0].play();
+        } else if (oldVal == 'invite_sent') {
+            angular.element('#ringbackAudio')[0].pause();
+        } else if (oldVal == 'ringing') {
+            angular.element('#ringAudio')[0].pause();
+        }
+    });
 
     $rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) {
         console.trace("incoming call");
@@ -125,7 +148,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
             $animate.addClass(icon, 'callIconRotate');
             $timeout(function(){
                 $rootScope.currentCall = undefined;
-            }, 2000);
+            }, 4070);
         }, 100);
     };
     
@@ -139,7 +162,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
             $animate.addClass(icon, 'callIconRotate');
             $timeout(function(){
                 $rootScope.currentCall = undefined;
-            }, 2000);
+            }, 4070);
         }, 100);
     }
 }]);