Fixed video while waiting for copayer

This commit is contained in:
Gustavo Maximiliano Cortez 2014-07-08 15:26:20 -03:00
parent 5d63741f35
commit ad403309ce
1 changed files with 19 additions and 1 deletions

View File

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