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];
|
var session = connection.jingle.sessions[sid];
|
||||||
if (session.peerconnection && session.peerconnection.updateLog) {
|
if (session.peerconnection && session.peerconnection.updateLog) {
|
||||||
// FIXME: should probably be a .dump call
|
// 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>
|
// <a onclick="dump(event.target);">my download button</a>
|
||||||
function dump(elem, filename){
|
function dump(elem, filename){
|
||||||
elem = elem.parentNode;
|
elem = elem.parentNode;
|
||||||
elem.download = filename || 'xmpplog.json';
|
elem.download = filename || 'meetlog.json';
|
||||||
elem.href = 'data:application/json;charset=utf-8,\n';
|
elem.href = 'data:application/json;charset=utf-8,\n';
|
||||||
var data = {};
|
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) {
|
if (connection.jingle) {
|
||||||
Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
||||||
var session = connection.jingle.sessions[sid];
|
var session = connection.jingle.sessions[sid];
|
||||||
if (session.peerconnection && session.peerconnection.updateLog) {
|
if (session.peerconnection && session.peerconnection.updateLog) {
|
||||||
// FIXME: should probably be a .dump call
|
// 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, ' '));
|
elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,64 +11,87 @@ function TraceablePeerConnection(ice_config, constraints) {
|
||||||
self.updateLog.push({
|
self.updateLog.push({
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
type: what,
|
type: what,
|
||||||
value: info
|
value: info || ""
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
this.onicecandidate = null;
|
this.onicecandidate = null;
|
||||||
this.peerconnection.onicecandidate = function (event) {
|
this.peerconnection.onicecandidate = function (event) {
|
||||||
self.trace('onicecandidate', event.candidate);
|
self.trace('onicecandidate', JSON.stringify(event.candidate));
|
||||||
if (self.onicecandidate !== null) {
|
if (self.onicecandidate !== null) {
|
||||||
self.onicecandidate(event);
|
self.onicecandidate(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.onaddstream = null;
|
this.onaddstream = null;
|
||||||
this.peerconnection.onaddstream = function (event) {
|
this.peerconnection.onaddstream = function (event) {
|
||||||
self.trace('onaddstream', event.stream);
|
self.trace('onaddstream', event.stream.id);
|
||||||
if (self.onaddstream !== null) {
|
if (self.onaddstream !== null) {
|
||||||
self.onaddstream(event);
|
self.onaddstream(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.onremovestream = null;
|
this.onremovestream = null;
|
||||||
this.peerconnection.onremovestream = function (event) {
|
this.peerconnection.onremovestream = function (event) {
|
||||||
self.trace('onremovestream', event.stream);
|
self.trace('onremovestream', event.stream.id);
|
||||||
if (self.onremovestream !== null) {
|
if (self.onremovestream !== null) {
|
||||||
self.onremovestream(event);
|
self.onremovestream(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.onsignalingstatechange = null;
|
this.onsignalingstatechange = null;
|
||||||
this.peerconnection.onsignalingstatechange = function (event) {
|
this.peerconnection.onsignalingstatechange = function (event) {
|
||||||
self.trace('onsignalingstatechange', event);
|
self.trace('onsignalingstatechange', event.srcElement.signalingState);
|
||||||
if (self.onsignalingstatechange !== null) {
|
if (self.onsignalingstatechange !== null) {
|
||||||
self.onsignalingstatechange(event);
|
self.onsignalingstatechange(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.oniceconnectionstatechange = null;
|
this.oniceconnectionstatechange = null;
|
||||||
this.peerconnection.oniceconnectionstatechange = function (event) {
|
this.peerconnection.oniceconnectionstatechange = function (event) {
|
||||||
self.trace('oniceconnectionstatechange', event);
|
self.trace('oniceconnectionstatechange', event.srcElement.iceConnectionState);
|
||||||
if (self.oniceconnectionstatechange !== null) {
|
if (self.oniceconnectionstatechange !== null) {
|
||||||
self.oniceconnectionstatechange(event);
|
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__('signalingState', function() { return this.peerconnection.signalingState; });
|
||||||
TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
|
TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
|
||||||
TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() { return this.peerconnection.localDescription; });
|
TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() { return this.peerconnection.localDescription; });
|
||||||
TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() { return this.peerconnection.remoteDescription; });
|
TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() { return this.peerconnection.remoteDescription; });
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.addStream = function (stream) {
|
TraceablePeerConnection.prototype.addStream = function (stream) {
|
||||||
this.trace('addStream', stream);
|
this.trace('addStream', stream.id);
|
||||||
this.peerconnection.addStream(stream);
|
this.peerconnection.addStream(stream);
|
||||||
};
|
};
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.removeStream = function (stream) {
|
TraceablePeerConnection.prototype.removeStream = function (stream) {
|
||||||
this.trace('removeStream', stream);
|
this.trace('removeStream', stream.id);
|
||||||
this.peerconnection.removeStream(stream);
|
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) {
|
TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.trace('setLocalDescription', description);
|
this.trace('setLocalDescription', dumpSDP(description));
|
||||||
this.peerconnection.setLocalDescription(description,
|
this.peerconnection.setLocalDescription(description,
|
||||||
function () {
|
function () {
|
||||||
self.trace('setLocalDescriptionOnSuccess');
|
self.trace('setLocalDescriptionOnSuccess');
|
||||||
|
@ -83,7 +106,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function (description, s
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
|
TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.trace('setRemoteDescription', description);
|
this.trace('setRemoteDescription', dumpSDP(description));
|
||||||
this.peerconnection.setRemoteDescription(description,
|
this.peerconnection.setRemoteDescription(description,
|
||||||
function () {
|
function () {
|
||||||
self.trace('setRemoteDescriptionOnSuccess');
|
self.trace('setRemoteDescriptionOnSuccess');
|
||||||
|
@ -103,11 +126,11 @@ TraceablePeerConnection.prototype.close = function () {
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
|
TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.trace('createOffer', constraints);
|
this.trace('createOffer', JSON.stringify(constraints, null, " "));
|
||||||
this.peerconnection.createOffer(
|
this.peerconnection.createOffer(
|
||||||
function (sdp) {
|
function (offer) {
|
||||||
self.trace('createOfferOnSuccess', sdp);
|
self.trace('createOfferOnSuccess', dumpSDP(offer));
|
||||||
successCallback(sdp);
|
successCallback(offer);
|
||||||
},
|
},
|
||||||
function(err) {
|
function(err) {
|
||||||
self.trace('createOfferOnFailure', err);
|
self.trace('createOfferOnFailure', err);
|
||||||
|
@ -119,11 +142,11 @@ TraceablePeerConnection.prototype.createOffer = function (successCallback, failu
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
|
TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.trace('createAnswer', constraints);
|
this.trace('createAnswer', JSON.stringify(constraints, null, " "));
|
||||||
this.peerconnection.createAnswer(
|
this.peerconnection.createAnswer(
|
||||||
function (sdp) {
|
function (answer) {
|
||||||
self.trace('createAnswerOnSuccess', sdp);
|
self.trace('createAnswerOnSuccess', dumpSDP(answer));
|
||||||
successCallback(sdp);
|
successCallback(answer);
|
||||||
},
|
},
|
||||||
function(err) {
|
function(err) {
|
||||||
self.trace('createAnswerOnFailure', err);
|
self.trace('createAnswerOnFailure', err);
|
||||||
|
@ -135,7 +158,7 @@ TraceablePeerConnection.prototype.createAnswer = function (successCallback, fail
|
||||||
|
|
||||||
TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
|
TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.trace('addIceCandidate', candidate);
|
this.trace('addIceCandidate', JSON.stringify(candidate));
|
||||||
this.peerconnection.addIceCandidate(candidate);
|
this.peerconnection.addIceCandidate(candidate);
|
||||||
/* maybe later
|
/* maybe later
|
||||||
this.peerconnection.addIceCandidate(candidate,
|
this.peerconnection.addIceCandidate(candidate,
|
||||||
|
@ -411,6 +434,7 @@ Strophe.addConnectionPlugin('jingle', {
|
||||||
case 'session-accept':
|
case 'session-accept':
|
||||||
sess.setRemoteDescription($(iq).find('>jingle'), 'answer');
|
sess.setRemoteDescription($(iq).find('>jingle'), 'answer');
|
||||||
sess.accept();
|
sess.accept();
|
||||||
|
$(document).trigger('callaccepted.jingle', [sess.sid]);
|
||||||
break;
|
break;
|
||||||
case 'session-terminate':
|
case 'session-terminate':
|
||||||
console.log('terminating...');
|
console.log('terminating...');
|
||||||
|
@ -1939,7 +1963,6 @@ JingleSession.prototype.sendAnswer = function (provisional) {
|
||||||
|
|
||||||
JingleSession.prototype.createdAnswer = function (sdp, provisional) {
|
JingleSession.prototype.createdAnswer = function (sdp, provisional) {
|
||||||
//console.log('createAnswer callback');
|
//console.log('createAnswer callback');
|
||||||
console.log(sdp);
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.localSDP = new SDP(sdp.sdp);
|
this.localSDP = new SDP(sdp.sdp);
|
||||||
//this.localSDP.mangle();
|
//this.localSDP.mangle();
|
||||||
|
|
Loading…
Reference in New Issue