Pārlūkot izejas kodu

bump strophe.jingle version and make logging webrtc-internals importer compatible (even though it does not exist yet)

j8
Philipp Hancke 11 gadus atpakaļ
vecāks
revīzija
a2ae759dee
2 mainītis faili ar 62 papildinājumiem un 29 dzēšanām
  1. 19
    9
      app.js
  2. 43
    20
      libs/strophejingle.bundle.js

+ 19
- 9
app.js Parādīt failu

516
             var session = connection.jingle.sessions[sid];
516
             var session = connection.jingle.sessions[sid];
517
             if (session.peerconnection && session.peerconnection.updateLog) {
517
             if (session.peerconnection && session.peerconnection.updateLog) {
518
                 // FIXME: should probably be a .dump call
518
                 // FIXME: should probably be a .dump call
519
-                data["jingle_" + session.sid] = session.peerconnection.updateLog;
519
+                data["jingle_" + session.sid] = [];
520
+                for (var j = 0; j < session.peerconnection.updateLog.length; j++) {
521
+                    var val = appendsession.peerconnection.updateLog[j];
522
+                    val.value = JSON.stringify(val.value);
523
+                    data["jingle_" + session.sid].push_back(data);
524
+                }
520
             }
525
             }
521
         });
526
         });
522
     }
527
     }
530
 // <a onclick="dump(event.target);">my download button</a>
535
 // <a onclick="dump(event.target);">my download button</a>
531
 function dump(elem, filename){
536
 function dump(elem, filename){
532
     elem = elem.parentNode;
537
     elem = elem.parentNode;
533
-    elem.download = filename || 'xmpplog.json';
538
+    elem.download = filename || 'meetlog.json';
534
     elem.href = 'data:application/json;charset=utf-8,\n';
539
     elem.href = 'data:application/json;charset=utf-8,\n';
535
     var data = {};
540
     var data = {};
536
-    data.time = new Date();
537
-    data.url = window.location.href;
538
-    data.ua = navigator.userAgent;
539
-    if (connection.logger) {
540
-        data.xmpp = connection.logger.log;
541
-    }
542
     if (connection.jingle) {
541
     if (connection.jingle) {
543
         Object.keys(connection.jingle.sessions).forEach(function (sid) {
542
         Object.keys(connection.jingle.sessions).forEach(function (sid) {
544
             var session = connection.jingle.sessions[sid];
543
             var session = connection.jingle.sessions[sid];
545
             if (session.peerconnection && session.peerconnection.updateLog) {
544
             if (session.peerconnection && session.peerconnection.updateLog) {
546
                 // FIXME: should probably be a .dump call
545
                 // FIXME: should probably be a .dump call
547
-                data["jingle_" + session.sid] = session.peerconnection.updateLog;
546
+                data["jingle_" + session.sid] = {
547
+                    updateLog: session.peerconnection.updateLog,
548
+                    url: window.location.href}
549
+                ;
548
             }
550
             }
549
         });
551
         });
550
     }
552
     }
553
+    metadata = {};
554
+    metadata.time = new Date();
555
+    metadata.url = window.location.href;
556
+    metadata.ua = navigator.userAgent;
557
+    if (connection.logger) {
558
+        metadata.xmpp = connection.logger.log;
559
+    }
560
+    data.metadata = metadata;
551
     elem.href += encodeURIComponent(JSON.stringify(data, null, '  '));
561
     elem.href += encodeURIComponent(JSON.stringify(data, null, '  '));
552
     return false;
562
     return false;
553
 }
563
 }

+ 43
- 20
libs/strophejingle.bundle.js Parādīt failu

11
         self.updateLog.push({
11
         self.updateLog.push({
12
             time: new Date(),
12
             time: new Date(),
13
             type: what,
13
             type: what,
14
-            value: info
14
+            value: info || ""
15
         });
15
         });
16
     };
16
     };
17
     this.onicecandidate = null;
17
     this.onicecandidate = null;
18
     this.peerconnection.onicecandidate = function (event) {
18
     this.peerconnection.onicecandidate = function (event) {
19
-        self.trace('onicecandidate', event.candidate);
19
+        self.trace('onicecandidate', JSON.stringify(event.candidate));
20
         if (self.onicecandidate !== null) {
20
         if (self.onicecandidate !== null) {
21
             self.onicecandidate(event);
21
             self.onicecandidate(event);
22
         }
22
         }
23
     };
23
     };
24
     this.onaddstream = null;
24
     this.onaddstream = null;
25
     this.peerconnection.onaddstream = function (event) {
25
     this.peerconnection.onaddstream = function (event) {
26
-        self.trace('onaddstream', event.stream);
26
+        self.trace('onaddstream', event.stream.id);
27
         if (self.onaddstream !== null) {
27
         if (self.onaddstream !== null) {
28
             self.onaddstream(event);
28
             self.onaddstream(event);
29
         }
29
         }
30
     };
30
     };
31
     this.onremovestream = null;
31
     this.onremovestream = null;
32
     this.peerconnection.onremovestream = function (event) {
32
     this.peerconnection.onremovestream = function (event) {
33
-        self.trace('onremovestream', event.stream);
33
+        self.trace('onremovestream', event.stream.id);
34
         if (self.onremovestream !== null) {
34
         if (self.onremovestream !== null) {
35
             self.onremovestream(event);
35
             self.onremovestream(event);
36
         }
36
         }
37
     };
37
     };
38
     this.onsignalingstatechange = null;
38
     this.onsignalingstatechange = null;
39
     this.peerconnection.onsignalingstatechange = function (event) {
39
     this.peerconnection.onsignalingstatechange = function (event) {
40
-        self.trace('onsignalingstatechange', event);
40
+        self.trace('onsignalingstatechange', event.srcElement.signalingState);
41
         if (self.onsignalingstatechange !== null) {
41
         if (self.onsignalingstatechange !== null) {
42
             self.onsignalingstatechange(event);
42
             self.onsignalingstatechange(event);
43
         }
43
         }
44
     };
44
     };
45
     this.oniceconnectionstatechange = null;
45
     this.oniceconnectionstatechange = null;
46
     this.peerconnection.oniceconnectionstatechange = function (event) {
46
     this.peerconnection.oniceconnectionstatechange = function (event) {
47
-        self.trace('oniceconnectionstatechange', event);
47
+        self.trace('oniceconnectionstatechange', event.srcElement.iceConnectionState);
48
         if (self.oniceconnectionstatechange !== null) {
48
         if (self.oniceconnectionstatechange !== null) {
49
             self.oniceconnectionstatechange(event);
49
             self.oniceconnectionstatechange(event);
50
         }
50
         }
51
+    };
52
+    this.onnegotiationneeded = null;
53
+    this.peerconnection.onnegotiationneeded = function (event) {
54
+        self.trace('onnegotiationneeded');
55
+        if (self.onnegotiationneeded !== null) {
56
+            self.onnegotiationneeded(event);
57
+        }
58
+    };
59
+    self.ondatachannel = null;
60
+    this.peerconnection.ondatachannel = function (event) {
61
+        self.trace('ondatachannel', event);
62
+        if (self.ondatachannel !== null) {
63
+            self.ondatachannel(event);
64
+        }
51
     }
65
     }
52
 };
66
 };
53
 
67
 
68
+dumpSDP = function(description) {
69
+    return 'type: ' + description.type + '\r\n' + description.sdp;
70
+}
71
+
54
 TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
72
 TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
55
 TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
73
 TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
56
 TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() { return this.peerconnection.localDescription; });
74
 TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() { return this.peerconnection.localDescription; });
57
 TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() { return this.peerconnection.remoteDescription; });
75
 TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() { return this.peerconnection.remoteDescription; });
58
 
76
 
59
 TraceablePeerConnection.prototype.addStream = function (stream) {
77
 TraceablePeerConnection.prototype.addStream = function (stream) {
60
-    this.trace('addStream', stream);
78
+    this.trace('addStream', stream.id);
61
     this.peerconnection.addStream(stream);
79
     this.peerconnection.addStream(stream);
62
 };
80
 };
63
 
81
 
64
 TraceablePeerConnection.prototype.removeStream = function (stream) {
82
 TraceablePeerConnection.prototype.removeStream = function (stream) {
65
-    this.trace('removeStream', stream);
83
+    this.trace('removeStream', stream.id);
66
     this.peerconnection.removeStream(stream);
84
     this.peerconnection.removeStream(stream);
67
 };
85
 };
68
 
86
 
87
+TraceablePeerConnection.prototype.createDataChannel = function (label, opts) {
88
+    this.trace('createDataChannel', label, opts);
89
+    this.peerconnection.createDataChannel(label, opts);
90
+}
91
+
69
 TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
92
 TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
70
     var self = this;
93
     var self = this;
71
-    this.trace('setLocalDescription', description);
94
+    this.trace('setLocalDescription', dumpSDP(description));
72
     this.peerconnection.setLocalDescription(description, 
95
     this.peerconnection.setLocalDescription(description, 
73
         function () {
96
         function () {
74
             self.trace('setLocalDescriptionOnSuccess');
97
             self.trace('setLocalDescriptionOnSuccess');
83
 
106
 
84
 TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
107
 TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
85
     var self = this;
108
     var self = this;
86
-    this.trace('setRemoteDescription', description);
109
+    this.trace('setRemoteDescription', dumpSDP(description));
87
     this.peerconnection.setRemoteDescription(description, 
110
     this.peerconnection.setRemoteDescription(description, 
88
         function () {
111
         function () {
89
             self.trace('setRemoteDescriptionOnSuccess');
112
             self.trace('setRemoteDescriptionOnSuccess');
103
 
126
 
104
 TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
127
 TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
105
     var self = this;
128
     var self = this;
106
-    this.trace('createOffer', constraints);
129
+    this.trace('createOffer', JSON.stringify(constraints, null, " "));
107
     this.peerconnection.createOffer(
130
     this.peerconnection.createOffer(
108
-        function (sdp) {
109
-            self.trace('createOfferOnSuccess', sdp);
110
-            successCallback(sdp);
131
+        function (offer) {
132
+            self.trace('createOfferOnSuccess', dumpSDP(offer));
133
+            successCallback(offer);
111
         },
134
         },
112
         function(err) {
135
         function(err) {
113
             self.trace('createOfferOnFailure', err);
136
             self.trace('createOfferOnFailure', err);
119
 
142
 
120
 TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
143
 TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
121
     var self = this;
144
     var self = this;
122
-    this.trace('createAnswer', constraints);
145
+    this.trace('createAnswer', JSON.stringify(constraints, null, " "));
123
     this.peerconnection.createAnswer(
146
     this.peerconnection.createAnswer(
124
-        function (sdp) {
125
-            self.trace('createAnswerOnSuccess', sdp);
126
-            successCallback(sdp);
147
+        function (answer) {
148
+            self.trace('createAnswerOnSuccess', dumpSDP(answer));
149
+            successCallback(answer);
127
         },
150
         },
128
         function(err) {
151
         function(err) {
129
             self.trace('createAnswerOnFailure', err);
152
             self.trace('createAnswerOnFailure', err);
135
 
158
 
136
 TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
159
 TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
137
     var self = this;
160
     var self = this;
138
-    this.trace('addIceCandidate', candidate);
161
+    this.trace('addIceCandidate', JSON.stringify(candidate));
139
     this.peerconnection.addIceCandidate(candidate);
162
     this.peerconnection.addIceCandidate(candidate);
140
     /* maybe later
163
     /* maybe later
141
     this.peerconnection.addIceCandidate(candidate, 
164
     this.peerconnection.addIceCandidate(candidate, 
411
         case 'session-accept':
434
         case 'session-accept':
412
             sess.setRemoteDescription($(iq).find('>jingle'), 'answer');
435
             sess.setRemoteDescription($(iq).find('>jingle'), 'answer');
413
             sess.accept();
436
             sess.accept();
437
+            $(document).trigger('callaccepted.jingle', [sess.sid]);
414
             break;
438
             break;
415
         case 'session-terminate':
439
         case 'session-terminate':
416
             console.log('terminating...');
440
             console.log('terminating...');
1939
 
1963
 
1940
 JingleSession.prototype.createdAnswer = function (sdp, provisional) {
1964
 JingleSession.prototype.createdAnswer = function (sdp, provisional) {
1941
     //console.log('createAnswer callback');
1965
     //console.log('createAnswer callback');
1942
-    console.log(sdp);
1943
     var self = this;
1966
     var self = this;
1944
     this.localSDP = new SDP(sdp.sdp);
1967
     this.localSDP = new SDP(sdp.sdp);
1945
     //this.localSDP.mangle();
1968
     //this.localSDP.mangle();

Notiek ielāde…
Atcelt
Saglabāt