0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 23:43:52 +01:00

Detect OpenWebRTC and add workarounds, but comment out the turn server removal for now so we have a live demo of it not working.

This commit is contained in:
David Baker 2014-11-12 17:34:00 +00:00
parent 2b64c573c3
commit 9950ce2334

View file

@ -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;
}]);