From 97014cdaceaa28090a0a8f2f580208ebea9cd237 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 24 Apr 2014 18:24:03 -0300 Subject: [PATCH] video works both ways!! --- js/services/controllerUtils.js | 8 ++++++-- js/services/video.js | 16 ++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 8ca9836eb..45920abc7 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -5,7 +5,11 @@ angular.module('copay.controllerUtils') var root = {}; $rootScope.videoSrc = {}; $rootScope.getVideoURL = function(copayer) { - return $sce.trustAsResourceUrl(decodeURI($rootScope.videoSrc[copayer])); + var encoded = $rootScope.videoSrc[copayer]; + if (!encoded) return; + var url = decodeURI(encoded); + var trusted = $sce.trustAsResourceUrl(url); + return trusted; }; root.logout = function() { @@ -34,8 +38,8 @@ angular.module('copay.controllerUtils') var handlePeerVideo = function(err, peerID, url) { if (err) { root.onErrorDigest(err); + return; } - alert('add this video url='+url+' for peer '+peerID); $rootScope.videoSrc[peerID] = encodeURI(url); $rootScope.$apply(); }; diff --git a/js/services/video.js b/js/services/video.js index d70ce87bf..532dc9a1e 100644 --- a/js/services/video.js +++ b/js/services/video.js @@ -4,6 +4,8 @@ var Video = function() { navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; + + this.mediaConnections = {}; }; Video.prototype.setOwnPeer = function(peer, wallet, cb) { @@ -16,12 +18,13 @@ Video.prototype.setOwnPeer = function(peer, wallet, cb) { // This is called when user accepts using webcam self.localStream = stream; var online = wallet.getOnlinePeerIDs(); - for (var i=0; i