From ad403309ceba9aab8491e90f9533502adb21eee0 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 8 Jul 2014 15:26:20 -0300 Subject: [PATCH] Fixed video while waiting for copayer --- js/controllers/header.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/js/controllers/header.js b/js/controllers/header.js index 66e72d6dd..1b61dc518 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('HeaderController', - function($scope, $rootScope, $location, notification, $http, controllerUtils, backupService) { + function($scope, $rootScope, $location, notification, $http, $sce, controllerUtils, backupService) { $scope.menu = [{ 'title': 'Addresses', 'icon': 'fi-address-book', @@ -93,4 +93,22 @@ angular.module('copayApp.controllers').controller('HeaderController', backupService.download(w); }; + $scope.getVideoURL = function(copayer) { + if (config.disableVideo) return; + + var vi = $rootScope.videoInfo[copayer] + if (!vi) return; + + if ($rootScope.wallet.getOnlinePeerIDs().indexOf(copayer) === -1) { + // peer disconnected, remove his video + delete $rootScope.videoInfo[copayer] + return; + } + + var encoded = vi.url; + var url = decodeURI(encoded); + var trusted = $sce.trustAsResourceUrl(url); + return trusted; + }; + });