Skip to content
Snippets Groups Projects
Commit 9950ce23 authored by David Baker's avatar David Baker
Browse files

Detect OpenWebRTC and add workarounds, but comment out the turn server removal...

Detect OpenWebRTC and add workarounds, but comment out the turn server removal for now so we have a live demo of it not working.
parent 2b64c573
No related branches found
No related tags found
No related merge requests found
...@@ -92,7 +92,8 @@ angular.module('MatrixCall', []) ...@@ -92,7 +92,8 @@ angular.module('MatrixCall', [])
var pc; var pc;
if (window.mozRTCPeerConnection) { if (window.mozRTCPeerConnection) {
var iceServers = []; var iceServers = [];
if (MatrixCall.turnServer) { // https://github.com/EricssonResearch/openwebrtc/issues/85
if (MatrixCall.turnServer /*&& !this.isOpenWebRTC()*/) {
if (MatrixCall.turnServer.uris) { if (MatrixCall.turnServer.uris) {
for (var i = 0; i < MatrixCall.turnServer.uris.length; i++) { for (var i = 0; i < MatrixCall.turnServer.uris.length; i++) {
iceServers.push({ iceServers.push({
...@@ -110,7 +111,8 @@ angular.module('MatrixCall', []) ...@@ -110,7 +111,8 @@ angular.module('MatrixCall', [])
pc = new window.mozRTCPeerConnection({"iceServers":iceServers}); pc = new window.mozRTCPeerConnection({"iceServers":iceServers});
} else { } else {
var iceServers = []; var iceServers = [];
if (MatrixCall.turnServer) { // https://github.com/EricssonResearch/openwebrtc/issues/85
if (MatrixCall.turnServer /*&& !this.isOpenWebRTC()*/) {
if (MatrixCall.turnServer.uris) { if (MatrixCall.turnServer.uris) {
iceServers.push({ iceServers.push({
'urls': MatrixCall.turnServer.uris, 'urls': MatrixCall.turnServer.uris,
...@@ -492,6 +494,8 @@ angular.module('MatrixCall', []) ...@@ -492,6 +494,8 @@ angular.module('MatrixCall', [])
$timeout(function() { $timeout(function() {
var vel = self.getRemoteVideoElement(); var vel = self.getRemoteVideoElement();
if (vel.play) vel.play(); if (vel.play) vel.play();
// OpenWebRTC does not support oniceconnectionstatechange yet
if (self.isOpenWebRTC()) self.state = 'connected';
}); });
} }
}; };
...@@ -641,5 +645,15 @@ angular.module('MatrixCall', []) ...@@ -641,5 +645,15 @@ angular.module('MatrixCall', [])
return null; 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; return MatrixCall;
}]); }]);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment