fix style issues

This commit is contained in:
Manuel Araoz 2014-04-24 20:56:36 -03:00
parent d98bc6f2e9
commit aa021125a0
5 changed files with 133 additions and 110 deletions

View File

@ -278,8 +278,17 @@ button.secondary:hover { background-color: #FFDF00 !important;}
} }
.video-small { .video-small {
width: 100px; width: 120px;
height: 100px; height: 120px;
border: 1px solid black; margin: 20px;
display: inline;
float:left;
}
.online {
border: 10px solid green;
}
.offline {
border: 10px solid gray;
} }

View File

@ -205,20 +205,29 @@
<script type="text/ng-template" id="peer.html"> <script type="text/ng-template" id="peer.html">
<div class="row"> <div class="row">
<div class="large-12 columns p70l"> <div class="large-12 columns p70l">
<h3 class="panel-title">Online Copayers: {{$root.wallet.network.connectedCopayers().length}}</h3>
<p class="text-info" ng-show="$root.wallet.publicKeyRing.requiredCopayers >$root.wallet.network.connectedCopayers()"> <i class="fi-alert size-28"></i> <p class="text-info" ng-show="$root.wallet.publicKeyRing.requiredCopayers >$root.wallet.network.connectedCopayers()"> <i class="fi-alert size-28"></i>
</div>
</div>
<div class="row">
<div class="large-12 columns p70l">
{{$root.wallet.publicKeyRing.requiredCopayers}} copayers needed for signing transactions {{$root.wallet.publicKeyRing.requiredCopayers}} copayers needed for signing transactions
</div>
<ul class="no-bullet"> </div>
<li class="panel" ng-repeat="copayer in $root.wallet.network.connectedPeers"> <div class="row">
<video class="video-small" autoplay ng-show="$root.videoSrc[copayer]" <div class="large-4 columns"
ng-src="{{$root.getVideoURL(copayer)}}" ng-repeat="copayer in $root.wallet.getRegisteredPeerIds()">
id="{{copayer + '-video'}}" muted="true"></video> <video
<img ng-show="!$root.videoSrc[copayer]" ng-class="($root.wallet.getOnlinePeerIDs().indexOf(copayer) != -1) ? 'online' : 'offline'"
src="/img/satoshi.gif" title="{{copayer + (copayer == $root.wallet.network.peerId?' (You)':'')}}" /> class="video-small"
</li> autoplay ng-show="$root.videoSrc[copayer]"
</ul> ng-src="{{$root.getVideoURL(copayer)}}"
id="{{copayer + '-video'}}" muted="true"
title="{{copayer + (copayer == $root.wallet.network.peerId?' (You)':'')}}" ></video>
<img ng-show="!$root.videoSrc[copayer]"
ng-class="($root.wallet.getOnlinePeerIDs().indexOf(copayer) != -1) ? 'online' : 'offline'"
class="video-small"
src="/img/satoshi.gif"
title="{{copayer + (copayer == $root.wallet.network.peerId?' (You)':'')}}" />
</div> </div>
</div> </div>
</script> </script>

View File

@ -1,14 +1,14 @@
'use strict'; 'use strict';
var imports = require('soop').imports(); var imports = require('soop').imports();
var bitcore = require('bitcore'); var bitcore = require('bitcore');
var coinUtil = bitcore.util; var coinUtil = bitcore.util;
var buffertools = bitcore.buffertools; var buffertools = bitcore.buffertools;
var Builder = bitcore.TransactionBuilder; var Builder = bitcore.TransactionBuilder;
var http = require('http'); var http = require('http');
var EventEmitter= imports.EventEmitter || require('events').EventEmitter; var EventEmitter = imports.EventEmitter || require('events').EventEmitter;
var copay = copay || require('../../../copay'); var copay = copay || require('../../../copay');
function Wallet(opts) { function Wallet(opts) {
var self = this; var self = this;
@ -17,12 +17,12 @@ function Wallet(opts) {
['storage', 'network', 'blockchain', ['storage', 'network', 'blockchain',
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed', 'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
'publicKeyRing', 'txProposals', 'privateKey' 'publicKeyRing', 'txProposals', 'privateKey'
].forEach( function(k){ ].forEach(function(k) {
if (typeof opts[k] === 'undefined') throw new Error('missing key:' + k); if (typeof opts[k] === 'undefined') throw new Error('missing key:' + k);
self[k] = opts[k]; self[k] = opts[k];
}); });
this.log('creating '+opts.requiredCopayers+' of '+opts.totalCopayers+' wallet'); this.log('creating ' + opts.requiredCopayers + ' of ' + opts.totalCopayers + ' wallet');
this.id = opts.id || Wallet.getRandomId(); this.id = opts.id || Wallet.getRandomId();
this.name = opts.name; this.name = opts.name;
@ -32,11 +32,11 @@ function Wallet(opts) {
} }
Wallet.parent=EventEmitter; Wallet.parent = EventEmitter;
Wallet.prototype.log = function(){ Wallet.prototype.log = function() {
if (!this.verbose) return; if (!this.verbose) return;
if (console) if (console)
console.log.apply(console, arguments); console.log.apply(console, arguments);
}; };
Wallet.getRandomId = function() { Wallet.getRandomId = function() {
@ -45,14 +45,14 @@ Wallet.getRandomId = function() {
}; };
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) { Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
this.log('RECV PUBLICKEYRING:',data); this.log('RECV PUBLICKEYRING:', data);
var shouldSend = false; var shouldSend = false;
var recipients, pkr = this.publicKeyRing; var recipients, pkr = this.publicKeyRing;
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing); var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
var hasChanged = pkr.merge(inPKR, true); var hasChanged = pkr.merge(inPKR, true);
if (hasChanged) { if (hasChanged) {
this.log('### BROADCASTING PKR'); this.log('### BROADCASTING PKR');
recipients = null; recipients = null;
shouldSend = true; shouldSend = true;
@ -72,15 +72,15 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) { Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
this.log('RECV TXPROPOSAL:',data); //TODO this.log('RECV TXPROPOSAL:', data); //TODO
var shouldSend = false; var shouldSend = false;
var recipients; var recipients;
var inTxp = copay.TxProposals.fromObj(data.txProposals); var inTxp = copay.TxProposals.fromObj(data.txProposals);
var mergeInfo = this.txProposals.merge(inTxp, true); var mergeInfo = this.txProposals.merge(inTxp, true);
var addSeen = this.addSeenToTxProposals(); var addSeen = this.addSeenToTxProposals();
if (mergeInfo.hasChanged || addSeen) { if (mergeInfo.hasChanged || addSeen) {
this.log('### BROADCASTING txProposals. ' ); this.log('### BROADCASTING txProposals. ');
recipients = null; recipients = null;
shouldSend = true; shouldSend = true;
} }
@ -91,21 +91,21 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
// shouldSend = true; // shouldSend = true;
// } // }
if (shouldSend) if (shouldSend)
this.sendTxProposals(recipients); this.sendTxProposals(recipients);
this.store(); this.store();
}; };
Wallet.prototype._handleData = function(senderId, data, isInbound) { Wallet.prototype._handleData = function(senderId, data, isInbound) {
// TODO check message signature // TODO check message signature
if (this.id !== data.walletId) { if (this.id !== data.walletId) {
this.emit('badMessage',senderId); this.emit('badMessage', senderId);
this.log('badMessage FROM:', senderId); //TODO this.log('badMessage FROM:', senderId); //TODO
return; return;
} }
this.log('[Wallet.js.98]' , data.type); //TODO this.log('[Wallet.js.98]', data.type); //TODO
switch(data.type) { switch (data.type) {
// This handler is repeaded on WalletFactory (#join). TODO // This handler is repeaded on WalletFactory (#join). TODO
case 'walletId': case 'walletId':
this.sendWalletReady(senderId); this.sendWalletReady(senderId);
@ -116,10 +116,10 @@ Wallet.prototype._handleData = function(senderId, data, isInbound) {
break; break;
case 'publicKeyRing': case 'publicKeyRing':
this._handlePublicKeyRing(senderId, data, isInbound); this._handlePublicKeyRing(senderId, data, isInbound);
break; break;
case 'txProposals': case 'txProposals':
this._handleTxProposals(senderId, data, isInbound); this._handleTxProposals(senderId, data, isInbound);
break; break;
} }
}; };
@ -127,13 +127,13 @@ Wallet.prototype._handleNetworkChange = function(newCopayerId) {
if (newCopayerId) { if (newCopayerId) {
this.log('#### Setting new PEER:', newCopayerId); this.log('#### Setting new PEER:', newCopayerId);
this.sendWalletId(newCopayerId); this.sendWalletId(newCopayerId);
this.emit('peer', newCopayerId); this.emit('peer', this.network.peerFromCopayer(newCopayerId));
} }
this.emit('refresh'); this.emit('refresh');
}; };
Wallet.prototype._optsToObj = function () { Wallet.prototype._optsToObj = function() {
var obj = { var obj = {
id: this.id, id: this.id,
spendUnconfirmed: this.spendUnconfirmed, spendUnconfirmed: this.spendUnconfirmed,
@ -159,9 +159,9 @@ Wallet.prototype.netStart = function() {
var self = this; var self = this;
var net = this.network; var net = this.network;
net.removeAllListeners(); net.removeAllListeners();
net.on('networkChange', self._handleNetworkChange.bind(self) ); net.on('networkChange', self._handleNetworkChange.bind(self));
net.on('data', self._handleData.bind(self) ); net.on('data', self._handleData.bind(self));
net.on('open', function() {}); // TODO net.on('open', function() {}); // TODO
net.on('openError', function() { net.on('openError', function() {
self.log('[Wallet.js.132:openError:] GOT openError'); //TODO self.log('[Wallet.js.132:openError:] GOT openError'); //TODO
self.emit('openError'); self.emit('openError');
@ -171,24 +171,24 @@ Wallet.prototype.netStart = function() {
}); });
var myId = self.getMyCopayerId(); var myId = self.getMyCopayerId();
var startOpts = { var startOpts = {
copayerId: myId, copayerId: myId,
signingKeyHex: self.privateKey.getSigningKey(), signingKeyHex: self.privateKey.getSigningKey(),
}; };
net.start(function() { net.start(startOpts, function() {
self.emit('created', net.getPeer()); self.emit('created', net.getPeer());
var registered = self.getRegisteredPeerIds(); var registered = self.getRegisteredPeerIds();
for (var i=0; i<registered.length; i++) { for (var i = 0; i < self.publicKeyRing.registeredCopayers(); i++) {
var otherPeerId = registered[i]; var otherId = self.getCopayerId(i);
if (otherPeerId !== myPeerId) { if (otherId !== myId) {
net.connectTo(otherPeerId); net.connectTo(otherId);
} }
if (self.firstCopayerId){ if (self.firstCopayerId) {
self.sendWalletReady(self.firstCopayerId); self.sendWalletReady(self.firstCopayerId);
self.firstCopayerId = null; self.firstCopayerId = null;
} }
self.emit('refresh'); self.emit('refresh');
} }
}); });
}; };
@ -199,8 +199,10 @@ Wallet.prototype.getOnlinePeerIDs = function() {
Wallet.prototype.getRegisteredPeerIds = function() { Wallet.prototype.getRegisteredPeerIds = function() {
var ret = []; var ret = [];
for (var i=0; i<this.publicKeyRing.registeredCopayers(); i++) { for (var i = 0; i < this.publicKeyRing.registeredCopayers(); i++) {
ret.push(this.getPeerId(i)); var cid = this.getCopayerId(i)
var pid = this.network.peerFromCopayer(cid);
ret.push(pid);
} }
return ret; return ret;
}; };
@ -212,8 +214,7 @@ Wallet.prototype.store = function(isSync) {
if (isSync) { if (isSync) {
this.log('Wallet stored.'); //TODO this.log('Wallet stored.'); //TODO
} } else {
else {
this.log('Wallet stored. REFRESH Emitted'); //TODO this.log('Wallet stored. REFRESH Emitted'); //TODO
this.emit('refresh'); this.emit('refresh');
} }
@ -244,10 +245,10 @@ Wallet.fromObj = function(wallet) {
}; };
Wallet.prototype.sendTxProposals = function(recipients) { Wallet.prototype.sendTxProposals = function(recipients) {
this.log('### SENDING txProposals TO:', recipients||'All', this.txProposals); this.log('### SENDING txProposals TO:', recipients || 'All', this.txProposals);
this.network.send( recipients, { this.network.send(recipients, {
type: 'txProposals', type: 'txProposals',
txProposals: this.txProposals.toObj(), txProposals: this.txProposals.toObj(),
walletId: this.id, walletId: this.id,
}); });
@ -257,18 +258,18 @@ Wallet.prototype.sendTxProposals = function(recipients) {
Wallet.prototype.sendWalletReady = function(recipients) { Wallet.prototype.sendWalletReady = function(recipients) {
this.log('### SENDING WalletReady TO:', recipients); this.log('### SENDING WalletReady TO:', recipients);
this.network.send(recipients, { this.network.send(recipients, {
type: 'walletReady', type: 'walletReady',
walletId: this.id, walletId: this.id,
}); });
this.emit('walletReady'); this.emit('walletReady');
}; };
Wallet.prototype.sendWalletId = function(recipients) { Wallet.prototype.sendWalletId = function(recipients) {
this.log('### SENDING walletId TO:', recipients||'All', this.walletId); this.log('### SENDING walletId TO:', recipients || 'All', this.walletId);
this.network.send(recipients, { this.network.send(recipients, {
type: 'walletId', type: 'walletId',
walletId: this.id, walletId: this.id,
opts: this._optsToObj() opts: this._optsToObj()
}); });
@ -276,10 +277,10 @@ Wallet.prototype.sendWalletId = function(recipients) {
Wallet.prototype.sendPublicKeyRing = function(recipients) { Wallet.prototype.sendPublicKeyRing = function(recipients) {
this.log('### SENDING publicKeyRing TO:', recipients||'All', this.publicKeyRing.toObj()); this.log('### SENDING publicKeyRing TO:', recipients || 'All', this.publicKeyRing.toObj());
this.network.send(recipients, { this.network.send(recipients, {
type: 'publicKeyRing', type: 'publicKeyRing',
publicKeyRing: this.publicKeyRing.toObj(), publicKeyRing: this.publicKeyRing.toObj(),
walletId: this.id, walletId: this.id,
}); });
@ -297,12 +298,12 @@ Wallet.prototype.generateAddress = function(isChange) {
Wallet.prototype.getTxProposals = function() { Wallet.prototype.getTxProposals = function() {
var ret = []; var ret = [];
for(var k in this.txProposals.txps) { for (var k in this.txProposals.txps) {
var i = this.txProposals.getTxProposal(k); var i = this.txProposals.getTxProposal(k);
i.signedByUs = i.signedBy[this.getMyCopayerId()]?true:false; i.signedByUs = i.signedBy[this.getMyCopayerId()] ? true : false;
i.rejectedByUs = i.rejectedBy[this.getMyCopayerId()]?true:false; i.rejectedByUs = i.rejectedBy[this.getMyCopayerId()] ? true : false;
if (this.totalCopayers-i.rejectCount < this.requiredCopayers) if (this.totalCopayers - i.rejectCount < this.requiredCopayers)
i.finallyRejected=true; i.finallyRejected = true;
ret.push(i); ret.push(i);
} }
@ -311,7 +312,7 @@ Wallet.prototype.getTxProposals = function() {
Wallet.prototype.reject = function(ntxid) { Wallet.prototype.reject = function(ntxid) {
var myId=this.getMyCopayerId(); var myId = this.getMyCopayerId();
var txp = this.txProposals.txps[ntxid]; var txp = this.txProposals.txps[ntxid];
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) return; if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) return;
@ -323,7 +324,7 @@ Wallet.prototype.reject = function(ntxid) {
Wallet.prototype.sign = function(ntxid) { Wallet.prototype.sign = function(ntxid) {
var self = this; var self = this;
var myId=this.getMyCopayerId(); var myId = this.getMyCopayerId();
var txp = self.txProposals.txps[ntxid]; var txp = self.txProposals.txps[ntxid];
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) return; if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) return;
@ -335,7 +336,7 @@ Wallet.prototype.sign = function(ntxid) {
b.sign(keys); b.sign(keys);
var ret = false; var ret = false;
if (b.signaturesAdded > before) { if (b.signaturesAdded > before) {
txp.signedBy[myId] = Date.now(); txp.signedBy[myId] = Date.now();
this.sendTxProposals(); this.sendTxProposals();
this.store(true); this.store(true);
@ -353,12 +354,12 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
this.log('[Wallet.js.231] BROADCASTING TX!!!'); //TODO this.log('[Wallet.js.231] BROADCASTING TX!!!'); //TODO
var txHex = tx.serialize().toString('hex'); var txHex = tx.serialize().toString('hex');
this.log('[Wallet.js.261:txHex:]',txHex); //TODO this.log('[Wallet.js.261:txHex:]', txHex); //TODO
var self = this; var self = this;
this.blockchain.sendRawTransaction(txHex, function(txid) { this.blockchain.sendRawTransaction(txHex, function(txid) {
self.log('BITCOND txid:',txid); //TODO self.log('BITCOND txid:', txid); //TODO
if (txid) { if (txid) {
self.txProposals.setSent(ntxid, txid); self.txProposals.setSent(ntxid, txid);
} }
@ -369,10 +370,10 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
}; };
Wallet.prototype.addSeenToTxProposals = function() { Wallet.prototype.addSeenToTxProposals = function() {
var ret=false; var ret = false;
var myId=this.getMyCopayerId(); var myId = this.getMyCopayerId();
for(var k in this.txProposals.txps) { for (var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k]; var txp = this.txProposals.txps[k];
if (!txp.seenBy[myId]) { if (!txp.seenBy[myId]) {
@ -400,9 +401,9 @@ Wallet.prototype.addressIsOwn = function(addrStr) {
var l = addrList.length; var l = addrList.length;
var ret = false; var ret = false;
for(var i=0; i<l; i++) { for (var i = 0; i < l; i++) {
if (addrList[i] === addrStr) { if (addrList[i] === addrStr) {
ret = true; ret = true;
break; break;
} }
} }
@ -416,23 +417,23 @@ Wallet.prototype.getBalance = function(safe, cb) {
var COIN = bitcore.util.COIN; var COIN = bitcore.util.COIN;
var addresses = this.getAddressesStr(true); var addresses = this.getAddressesStr(true);
if (!addresses.length) return cb(0,[]); if (!addresses.length) return cb(0, []);
// Prefill balanceByAddr with main address // Prefill balanceByAddr with main address
addresses.forEach(function(a){ addresses.forEach(function(a) {
balanceByAddr[a]=0; balanceByAddr[a] = 0;
isMain[a]=1; isMain[a] = 1;
}); });
var f = safe ? this.getSafeUnspent.bind(this):this.getUnspent.bind(this); var f = safe ? this.getSafeUnspent.bind(this) : this.getUnspent.bind(this);
f(function(utxos) { f(function(utxos) {
for(var i=0;i<utxos.length; i++) { for (var i = 0; i < utxos.length; i++) {
var u= utxos[i]; var u = utxos[i];
var amt = u.amount * COIN; var amt = u.amount * COIN;
balance = balance + amt; balance = balance + amt;
balanceByAddr[u.address] = (balanceByAddr[u.address]||0) + amt; balanceByAddr[u.address] = (balanceByAddr[u.address] || 0) + amt;
} }
for(var a in balanceByAddr){ for (var a in balanceByAddr) {
balanceByAddr[a] = balanceByAddr[a]/COIN; balanceByAddr[a] = balanceByAddr[a] / COIN;
} }
return cb(balance / COIN, balanceByAddr, isMain); return cb(balance / COIN, balanceByAddr, isMain);
}); });
@ -448,12 +449,12 @@ Wallet.prototype.getSafeUnspent = function(cb) {
var self = this; var self = this;
this.blockchain.getUnspent(this.getAddressesStr(), function(unspentList) { this.blockchain.getUnspent(this.getAddressesStr(), function(unspentList) {
var ret=[]; var ret = [];
var maxRejectCount = self.totalCopayers - self.requiredCopayers; var maxRejectCount = self.totalCopayers - self.requiredCopayers;
var uu = self.txProposals.getUsedUnspent(maxRejectCount); var uu = self.txProposals.getUsedUnspent(maxRejectCount);
for(var i in unspentList){ for (var i in unspentList) {
if (uu.indexOf(unspentList[i].txid) === -1) if (uu.indexOf(unspentList[i].txid) === -1)
ret.push(unspentList[i]); ret.push(unspentList[i]);
} }
@ -476,7 +477,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
self.getSafeUnspent(function(unspentList) { self.getSafeUnspent(function(unspentList) {
if (self.createTxSync(toAddress, amountSatStr, unspentList, opts)) { if (self.createTxSync(toAddress, amountSatStr, unspentList, opts)) {
self.sendPublicKeyRing(); // Change Address self.sendPublicKeyRing(); // Change Address
self.sendTxProposals(); self.sendTxProposals();
self.store(); self.store();
} }
@ -485,29 +486,33 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
}; };
Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) { Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
var pkr = this.publicKeyRing; var pkr = this.publicKeyRing;
var priv = this.privateKey; var priv = this.privateKey;
opts = opts || {}; opts = opts || {};
var amountSat = bitcore.bignum(amountSatStr); var amountSat = bitcore.bignum(amountSatStr);
if (! pkr.isComplete() ) { if (!pkr.isComplete()) {
throw new Error('publicKeyRing is not complete'); throw new Error('publicKeyRing is not complete');
} }
if (!opts.remainderOut) { if (!opts.remainderOut) {
opts.remainderOut ={ address: this.generateAddress(true).toString() }; opts.remainderOut = {
address: this.generateAddress(true).toString()
};
} }
var b = new Builder(opts) var b = new Builder(opts)
.setUnspent(utxos) .setUnspent(utxos)
.setHashToScriptMap(pkr.getRedeemScriptMap()) .setHashToScriptMap(pkr.getRedeemScriptMap())
.setOutputs([{address: toAddress, amountSat: amountSat}]) .setOutputs([{
; address: toAddress,
amountSat: amountSat
}]);
var signRet; var signRet;
if (priv) { if (priv) {
b.sign( priv.getAll(pkr.addressIndex, pkr.changeAddressIndex) ); b.sign(priv.getAll(pkr.addressIndex, pkr.changeAddressIndex));
} }
var myId = this.getMyCopayerId(); var myId = this.getMyCopayerId();
var now = Date.now(); var now = Date.now();
@ -520,8 +525,8 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
var data = { var data = {
signedBy: me, signedBy: me,
seenBy: meSeen, seenBy: meSeen,
creator: myId, creator: myId,
createdTs: now, createdTs: now,
builder: b, builder: b,
}; };
@ -536,7 +541,7 @@ Wallet.prototype.connectTo = function(peerId) {
Wallet.prototype.disconnect = function() { Wallet.prototype.disconnect = function() {
console.log('[Wallet.js.524] DISC'); //TODO console.log('[Wallet.js.524] DISC'); //TODO
this.network.disconnect(); this.network.disconnect();
}; };

View File

@ -37,7 +37,6 @@ angular.module('copay.controllerUtils')
root.setupUxHandlers = function(w) { root.setupUxHandlers = function(w) {
var handlePeerVideo = function(err, peerID, url) { var handlePeerVideo = function(err, peerID, url) {
if (err) { if (err) {
root.onErrorDigest(err);
return; return;
} }
$rootScope.videoSrc[peerID] = encodeURI(url); $rootScope.videoSrc[peerID] = encodeURI(url);

View File

@ -11,6 +11,7 @@ var Video = function() {
Video.prototype.setOwnPeer = function(peer, wallet, cb) { Video.prototype.setOwnPeer = function(peer, wallet, cb) {
var self = this; var self = this;
navigator.getUserMedia({ navigator.getUserMedia({
audio: true, audio: true,
video: true video: true