summary refs log tree commit diff
path: root/syweb
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-11-12 17:34:00 +0000
committerDavid Baker <dbkr@matrix.org>2014-11-12 17:34:00 +0000
commit9950ce23342a754e9598419fc1b71cb1dc5c4de6 (patch)
tree61a8acdae86fe3075bc985c1405b65ddbd53bf72 /syweb
parentOops, change videoElement / selector in audio call too. (diff)
downloadsynapse-9950ce23342a754e9598419fc1b71cb1dc5c4de6.tar.xz
Detect OpenWebRTC and add workarounds, but comment out the turn server removal for now so we have a live demo of it not working.
Diffstat (limited to 'syweb')
-rw-r--r--syweb/webclient/components/matrix/matrix-call.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/syweb/webclient/components/matrix/matrix-call.js b/syweb/webclient/components/matrix/matrix-call.js
index 7687cb6971..a1c3aaa103 100644
--- a/syweb/webclient/components/matrix/matrix-call.js
+++ b/syweb/webclient/components/matrix/matrix-call.js
@@ -92,7 +92,8 @@ angular.module('MatrixCall', [])
         var pc;
         if (window.mozRTCPeerConnection) {
             var iceServers = [];
-            if (MatrixCall.turnServer) {
+            // https://github.com/EricssonResearch/openwebrtc/issues/85
+            if (MatrixCall.turnServer /*&& !this.isOpenWebRTC()*/) {
                 if (MatrixCall.turnServer.uris) {
                     for (var i = 0; i < MatrixCall.turnServer.uris.length; i++) {
                         iceServers.push({
@@ -110,7 +111,8 @@ angular.module('MatrixCall', [])
             pc = new window.mozRTCPeerConnection({"iceServers":iceServers});
         } else {
             var iceServers = [];
-            if (MatrixCall.turnServer) {
+            // https://github.com/EricssonResearch/openwebrtc/issues/85
+            if (MatrixCall.turnServer /*&& !this.isOpenWebRTC()*/) {
                 if (MatrixCall.turnServer.uris) {
                     iceServers.push({
                         'urls': MatrixCall.turnServer.uris,
@@ -492,6 +494,8 @@ angular.module('MatrixCall', [])
             $timeout(function() {
                 var vel = self.getRemoteVideoElement();
                 if (vel.play) vel.play();
+                // OpenWebRTC does not support oniceconnectionstatechange yet
+                if (self.isOpenWebRTC()) self.state = 'connected';
             });
         }
     };
@@ -641,5 +645,15 @@ angular.module('MatrixCall', [])
         return null;
     };
 
+    MatrixCall.prototype.isOpenWebRTC = function() {
+        var scripts = angular.element('script');
+        for (var i = 0; i < scripts.length; i++) {
+            if (scripts[i].src.indexOf("owr.js") > -1) {
+                return true;
+            }
+        }
+        return false;
+    };
+
     return MatrixCall;
 }]);