bump strophe.jingle version and make logging webrtc-internals importer compatible (even though it does not exist yet)
This commit is contained in:
parent
3ec2fa6d19
commit
a2ae759dee
28
app.js
28
app.js
|
@ -516,7 +516,12 @@ function dump(elem, filename) {
|
|||
var session = connection.jingle.sessions[sid];
|
||||
if (session.peerconnection && session.peerconnection.updateLog) {
|
||||
// FIXME: should probably be a .dump call
|
||||
data["jingle_" + session.sid] = session.peerconnection.updateLog;
|
||||
data["jingle_" + session.sid] = [];
|
||||
for (var j = 0; j < session.peerconnection.updateLog.length; j++) {
|
||||
var val = appendsession.peerconnection.updateLog[j];
|
||||
val.value = JSON.stringify(val.value);
|
||||
data["jingle_" + session.sid].push_back(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -530,24 +535,29 @@ function dump(elem, filename) {
|
|||
// <a onclick="dump(event.target);">my download button</a>
|
||||
function dump(elem, filename){
|
||||
elem = elem.parentNode;
|
||||
elem.download = filename || 'xmpplog.json';
|
||||
elem.download = filename || 'meetlog.json';
|
||||
elem.href = 'data:application/json;charset=utf-8,\n';
|
||||
var data = {};
|
||||
data.time = new Date();
|
||||
data.url = window.location.href;
|
||||
data.ua = navigator.userAgent;
|
||||
if (connection.logger) {
|
||||
data.xmpp = connection.logger.log;
|
||||
}
|
||||
if (connection.jingle) {
|
||||
Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
||||
var session = connection.jingle.sessions[sid];
|
||||
if (session.peerconnection && session.peerconnection.updateLog) {
|
||||
// FIXME: should probably be a .dump call
|
||||
data["jingle_" + session.sid] = session.peerconnection.updateLog;
|
||||
data["jingle_" + session.sid] = {
|
||||
updateLog: session.peerconnection.updateLog,
|
||||
url: window.location.href}
|
||||
;
|
||||
}
|
||||
});
|
||||
}
|
||||
metadata = {};
|
||||
metadata.time = new Date();
|
||||
metadata.url = window.location.href;
|
||||
metadata.ua = navigator.userAgent;
|
||||
if (connection.logger) {
|
||||
metadata.xmpp = connection.logger.log;
|
||||
}
|
||||
data.metadata = metadata;
|
||||
elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -11,64 +11,87 @@ function TraceablePeerConnection(ice_config, constraints) {
|
|||
self.updateLog.push({
|
||||
time: new Date(),
|
||||
type: what,
|
||||
value: info
|
||||
value: info || ""
|
||||
});
|
||||
};
|
||||
this.onicecandidate = null;
|
||||
this.peerconnection.onicecandidate = function (event) {
|
||||
self.trace('onicecandidate', event.candidate);
|
||||
self.trace('onicecandidate', JSON.stringify(event.candidate));
|
||||
if (self.onicecandidate !== null) {
|
||||
self.onicecandidate(event);
|
||||
}
|
||||
};
|
||||
this.onaddstream = null;
|
||||
this.peerconnection.onaddstream = function (event) {
|
||||
self.trace('onaddstream', event.stream);
|
||||
self.trace('onaddstream', event.stream.id);
|
||||
if (self.onaddstream !== null) {
|
||||
self.onaddstream(event);
|
||||
}
|
||||
};
|
||||
this.onremovestream = null;
|
||||
this.peerconnection.onremovestream = function (event) {
|
||||
self.trace('onremovestream', event.stream);
|
||||
self.trace('onremovestream', event.stream.id);
|
||||
if (self.onremovestream !== null) {
|
||||
self.onremovestream(event);
|
||||
}
|
||||
};
|
||||
this.onsignalingstatechange = null;
|
||||
this.peerconnection.onsignalingstatechange = function (event) {
|
||||
self.trace('onsignalingstatechange', event);
|
||||
self.trace('onsignalingstatechange', event.srcElement.signalingState);
|
||||
if (self.onsignalingstatechange !== null) {
|
||||
self.onsignalingstatechange(event);
|
||||
}
|
||||
};
|
||||
this.oniceconnectionstatechange = null;
|
||||
this.peerconnection.oniceconnectionstatechange = function (event) {
|
||||
self.trace('oniceconnectionstatechange', event);
|
||||
self.trace('oniceconnectionstatechange', event.srcElement.iceConnectionState);
|
||||
if (self.oniceconnectionstatechange !== null) {
|
||||
self.oniceconnectionstatechange(event);
|
||||
}
|
||||
};
|
||||
this.onnegotiationneeded = null;
|
||||
this.peerconnection.onnegotiationneeded = function (event) {
|
||||
self.trace('onnegotiationneeded');
|
||||
if (self.onnegotiationneeded !== null) {
|
||||
self.onnegotiationneeded(event);
|
||||
}
|
||||
};
|
||||
self.ondatachannel = null;
|
||||
this.peerconnection.ondatachannel = function (event) {
|
||||
self.trace('ondatachannel', event);
|
||||
if (self.ondatachannel !== null) {
|
||||
self.ondatachannel(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dumpSDP = function(description) {
|
||||
return 'type: ' + description.type + '\r\n' + description.sdp;
|
||||
}
|
||||
|
||||
TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
|
||||
TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
|
||||
TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() { return this.peerconnection.localDescription; });
|
||||
TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() { return this.peerconnection.remoteDescription; });
|
||||
|
||||
TraceablePeerConnection.prototype.addStream = function (stream) {
|
||||
this.trace('addStream', stream);
|
||||
this.trace('addStream', stream.id);
|
||||
this.peerconnection.addStream(stream);
|
||||
};
|
||||
|
||||
TraceablePeerConnection.prototype.removeStream = function (stream) {
|
||||
this.trace('removeStream', stream);
|
||||
this.trace('removeStream', stream.id);
|
||||
this.peerconnection.removeStream(stream);
|
||||
};
|
||||
|
||||
TraceablePeerConnection.prototype.createDataChannel = function (label, opts) {
|
||||
this.trace('createDataChannel', label, opts);
|
||||
this.peerconnection.createDataChannel(label, opts);
|
||||
}
|
||||
|
||||
TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
|
||||
var self = this;
|
||||
this.trace('setLocalDescription', description);
|
||||
this.trace('setLocalDescription', dumpSDP(description));
|
||||
this.peerconnection.setLocalDescription(description,
|
||||
function () {
|
||||
self.trace('setLocalDescriptionOnSuccess');
|
||||
|
@ -83,7 +106,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function (description, s
|
|||
|
||||
TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
|
||||
var self = this;
|
||||
this.trace('setRemoteDescription', description);
|
||||
this.trace('setRemoteDescription', dumpSDP(description));
|
||||
this.peerconnection.setRemoteDescription(description,
|
||||
function () {
|
||||
self.trace('setRemoteDescriptionOnSuccess');
|
||||
|
@ -103,11 +126,11 @@ TraceablePeerConnection.prototype.close = function () {
|
|||
|
||||
TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
|
||||
var self = this;
|
||||
this.trace('createOffer', constraints);
|
||||
this.trace('createOffer', JSON.stringify(constraints, null, " "));
|
||||
this.peerconnection.createOffer(
|
||||
function (sdp) {
|
||||
self.trace('createOfferOnSuccess', sdp);
|
||||
successCallback(sdp);
|
||||
function (offer) {
|
||||
self.trace('createOfferOnSuccess', dumpSDP(offer));
|
||||
successCallback(offer);
|
||||
},
|
||||
function(err) {
|
||||
self.trace('createOfferOnFailure', err);
|
||||
|
@ -119,11 +142,11 @@ TraceablePeerConnection.prototype.createOffer = function (successCallback, failu
|
|||
|
||||
TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
|
||||
var self = this;
|
||||
this.trace('createAnswer', constraints);
|
||||
this.trace('createAnswer', JSON.stringify(constraints, null, " "));
|
||||
this.peerconnection.createAnswer(
|
||||
function (sdp) {
|
||||
self.trace('createAnswerOnSuccess', sdp);
|
||||
successCallback(sdp);
|
||||
function (answer) {
|
||||
self.trace('createAnswerOnSuccess', dumpSDP(answer));
|
||||
successCallback(answer);
|
||||
},
|
||||
function(err) {
|
||||
self.trace('createAnswerOnFailure', err);
|
||||
|
@ -135,7 +158,7 @@ TraceablePeerConnection.prototype.createAnswer = function (successCallback, fail
|
|||
|
||||
TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
|
||||
var self = this;
|
||||
this.trace('addIceCandidate', candidate);
|
||||
this.trace('addIceCandidate', JSON.stringify(candidate));
|
||||
this.peerconnection.addIceCandidate(candidate);
|
||||
/* maybe later
|
||||
this.peerconnection.addIceCandidate(candidate,
|
||||
|
@ -411,6 +434,7 @@ Strophe.addConnectionPlugin('jingle', {
|
|||
case 'session-accept':
|
||||
sess.setRemoteDescription($(iq).find('>jingle'), 'answer');
|
||||
sess.accept();
|
||||
$(document).trigger('callaccepted.jingle', [sess.sid]);
|
||||
break;
|
||||
case 'session-terminate':
|
||||
console.log('terminating...');
|
||||
|
@ -1939,7 +1963,6 @@ JingleSession.prototype.sendAnswer = function (provisional) {
|
|||
|
||||
JingleSession.prototype.createdAnswer = function (sdp, provisional) {
|
||||
//console.log('createAnswer callback');
|
||||
console.log(sdp);
|
||||
var self = this;
|
||||
this.localSDP = new SDP(sdp.sdp);
|
||||
//this.localSDP.mangle();
|
||||
|
|
Loading…
Reference in New Issue