|
|
@@ -5,6 +5,11 @@ var jsSHA = require('jssha');
|
|
5
|
5
|
var io = require('socket.io-client');
|
|
6
|
6
|
var callStats = null;
|
|
7
|
7
|
|
|
|
8
|
+// getUserMedia calls happen before CallStats init
|
|
|
9
|
+// so if there are any getUserMedia errors, we store them in this array
|
|
|
10
|
+// and send them to callstats on init
|
|
|
11
|
+var pendingUserMediaErrors = [];
|
|
|
12
|
+
|
|
8
|
13
|
function initCallback (err, msg) {
|
|
9
|
14
|
console.log("Initializing Status: err="+err+" msg="+msg);
|
|
10
|
15
|
}
|
|
|
@@ -38,17 +43,25 @@ var CallStats = {
|
|
38
|
43
|
usage,
|
|
39
|
44
|
this.confID,
|
|
40
|
45
|
this.pcCallback.bind(this));
|
|
|
46
|
+
|
|
|
47
|
+ // notify callstats about getUserMedia failures if there were any
|
|
|
48
|
+ if (pendingUserMediaErrors.length) {
|
|
|
49
|
+ pendingUserMediaErrors.forEach(this.sendGetUserMediaFailed, this);
|
|
|
50
|
+ pendingUserMediaErrors.length = 0;
|
|
|
51
|
+ }
|
|
41
|
52
|
},
|
|
42
|
53
|
pcCallback: function (err, msg) {
|
|
43
|
|
- if (!callStats)
|
|
|
54
|
+ if (!callStats) {
|
|
44
|
55
|
return;
|
|
|
56
|
+ }
|
|
45
|
57
|
console.log("Monitoring status: "+ err + " msg: " + msg);
|
|
46
|
58
|
callStats.sendFabricEvent(this.peerconnection,
|
|
47
|
59
|
callStats.fabricEvent.fabricSetup, this.confID);
|
|
48
|
60
|
},
|
|
49
|
61
|
sendMuteEvent: function (mute, type) {
|
|
50
|
|
- if (!callStats)
|
|
|
62
|
+ if (!callStats) {
|
|
51
|
63
|
return;
|
|
|
64
|
+ }
|
|
52
|
65
|
var event = null;
|
|
53
|
66
|
if (type === "video") {
|
|
54
|
67
|
event = (mute? callStats.fabricEvent.videoPause :
|
|
|
@@ -74,7 +87,8 @@ var CallStats = {
|
|
74
|
87
|
callStats.sendFabricEvent(this.peerconnection,
|
|
75
|
88
|
callStats.fabricEvent.fabricSetupFailed, this.confID);
|
|
76
|
89
|
},
|
|
77
|
|
- /**
|
|
|
90
|
+
|
|
|
91
|
+ /**
|
|
78
|
92
|
* Sends the given feedback through CallStats.
|
|
79
|
93
|
*
|
|
80
|
94
|
* @param overallFeedback an integer between 1 and 5 indicating the
|
|
|
@@ -93,6 +107,86 @@ var CallStats = {
|
|
93
|
107
|
|
|
94
|
108
|
callStats.sendUserFeedback(
|
|
95
|
109
|
this.confID, feedbackJSON);
|
|
|
110
|
+ },
|
|
|
111
|
+
|
|
|
112
|
+ /**
|
|
|
113
|
+ * Notifies CallStats that getUserMedia failed.
|
|
|
114
|
+ *
|
|
|
115
|
+ * @param {Error} e error to send
|
|
|
116
|
+ */
|
|
|
117
|
+ sendGetUserMediaFailed: function (e) {
|
|
|
118
|
+ if(!callStats) {
|
|
|
119
|
+ pendingUserMediaErrors.push(e);
|
|
|
120
|
+ return;
|
|
|
121
|
+ }
|
|
|
122
|
+ callStats.reportError(this.peerconnection, this.confID,
|
|
|
123
|
+ callStats.webRTCFunctions.getUserMedia, e);
|
|
|
124
|
+ },
|
|
|
125
|
+
|
|
|
126
|
+ /**
|
|
|
127
|
+ * Notifies CallStats that peer connection failed to create offer.
|
|
|
128
|
+ *
|
|
|
129
|
+ * @param {Error} e error to send
|
|
|
130
|
+ */
|
|
|
131
|
+ sendCreateOfferFailed: function (e) {
|
|
|
132
|
+ if(!callStats) {
|
|
|
133
|
+ return;
|
|
|
134
|
+ }
|
|
|
135
|
+ callStats.reportError(this.peerconnection, this.confID,
|
|
|
136
|
+ callStats.webRTCFunctions.createOffer, e);
|
|
|
137
|
+ },
|
|
|
138
|
+
|
|
|
139
|
+ /**
|
|
|
140
|
+ * Notifies CallStats that peer connection failed to create answer.
|
|
|
141
|
+ *
|
|
|
142
|
+ * @param {Error} e error to send
|
|
|
143
|
+ */
|
|
|
144
|
+ sendCreateAnswerFailed: function (e) {
|
|
|
145
|
+ if(!callStats) {
|
|
|
146
|
+ return;
|
|
|
147
|
+ }
|
|
|
148
|
+ callStats.reportError(this.peerconnection, this.confID,
|
|
|
149
|
+ callStats.webRTCFunctions.createAnswer, e);
|
|
|
150
|
+ },
|
|
|
151
|
+
|
|
|
152
|
+ /**
|
|
|
153
|
+ * Notifies CallStats that peer connection failed to set local description.
|
|
|
154
|
+ *
|
|
|
155
|
+ * @param {Error} e error to send
|
|
|
156
|
+ */
|
|
|
157
|
+ sendSetLocalDescFailed: function (e) {
|
|
|
158
|
+ if(!callStats) {
|
|
|
159
|
+ return;
|
|
|
160
|
+ }
|
|
|
161
|
+ callStats.reportError(this.peerconnection, this.confID,
|
|
|
162
|
+ callStats.webRTCFunctions.setLocalDescription, e);
|
|
|
163
|
+ },
|
|
|
164
|
+
|
|
|
165
|
+ /**
|
|
|
166
|
+ * Notifies CallStats that peer connection failed to set remote description.
|
|
|
167
|
+ *
|
|
|
168
|
+ * @param {Error} e error to send
|
|
|
169
|
+ */
|
|
|
170
|
+ sendSetRemoteDescFailed: function (e) {
|
|
|
171
|
+ if(!callStats) {
|
|
|
172
|
+ return;
|
|
|
173
|
+ }
|
|
|
174
|
+ callStats.reportError(
|
|
|
175
|
+ this.peerconnection, this.confID,
|
|
|
176
|
+ callStats.webRTCFunctions.setRemoteDescription, e);
|
|
|
177
|
+ },
|
|
|
178
|
+
|
|
|
179
|
+ /**
|
|
|
180
|
+ * Notifies CallStats that peer connection failed to add ICE candidate.
|
|
|
181
|
+ *
|
|
|
182
|
+ * @param {Error} e error to send
|
|
|
183
|
+ */
|
|
|
184
|
+ sendAddIceCandidateFailed: function (e) {
|
|
|
185
|
+ if(!callStats) {
|
|
|
186
|
+ return;
|
|
|
187
|
+ }
|
|
|
188
|
+ callStats.reportError(this.peerconnection, this.confID,
|
|
|
189
|
+ callStats.webRTCFunctions.addIceCandidate, e);
|
|
96
|
190
|
}
|
|
97
|
191
|
};
|
|
98
|
|
-module.exports = CallStats;
|
|
|
192
|
+module.exports = CallStats;
|