Skip to content

Commit 55040c4

Browse files
v2.23.1
1 parent bbbe9e5 commit 55040c4

9 files changed

Lines changed: 807 additions & 210 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "quickblox",
33
"description": "QuickBlox JavaScript SDK",
4-
"version": "2.23.0",
4+
"version": "2.23.1",
55
"homepage": "https://quickblox.com/developers/Javascript",
66
"main": "src/qbMain.js",
77
"types": "quickblox.d.ts",
@@ -83,6 +83,9 @@
8383
"lint": "jshint src --reporter=node_modules/jshint-stylish",
8484
"test:node-regression": "node spec/phase-a-upgrade-check.js",
8585
"test:regression": "npm run test:node-regression && npm test",
86+
"test:pr": "jasmine --config=spec/support/jasmine.pr.json",
87+
"test:full": "jasmine --config=spec/support/jasmine.full.json",
88+
"test:ci": "npm run lint && npm run test:node-regression && npm run test:pr",
8689
"build": "cross-env NODE_ENV=production npm run lint && gulp build && gulp minify",
8790
"buildNotMinified": "npm run lint && gulp build",
8891
"generateBuildVersion": "gulp generate-build_version",

quickblox.js

Lines changed: 398 additions & 101 deletions
Large diffs are not rendered by default.

quickblox.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/video_conferencing/js/config/apps.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var creds = {
2-
'appId': 0,
3-
'authKey': '',
4-
'authSecret': '',
5-
'accountKey': ''
2+
'appId': -1,
3+
'authKey': '',
4+
'authSecret': '',
5+
'accountKey': ''
66
};
77

88
var config = {

src/modules/chat/qbChat.js

Lines changed: 296 additions & 25 deletions
Large diffs are not rendered by default.

src/modules/webrtc/qbRTCPeerConnection.js

Lines changed: 95 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -542,92 +542,110 @@ function _getStats(peer, lastResults, successCallback, errorCallback) {
542542

543543
peer.getStats(null).then(function (results) {
544544
results.forEach(function (result) {
545-
var item;
546-
547-
if (result.bytesReceived && result.type === 'inbound-rtp') {
548-
item = statistic.remote[result.mediaType];
549-
item.bitrate = _getBitratePerSecond(result, lastResults, false);
550-
item.bytesReceived = result.bytesReceived;
551-
item.packetsReceived = result.packetsReceived;
552-
item.timestamp = result.timestamp;
553-
if (result.mediaType === 'video' && result.framerateMean) {
554-
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
555-
}
556-
} else if (result.bytesSent && result.type === 'outbound-rtp') {
557-
item = statistic.local[result.mediaType];
558-
item.bitrate = _getBitratePerSecond(result, lastResults, true);
559-
item.bytesSent = result.bytesSent;
560-
item.packetsSent = result.packetsSent;
561-
item.timestamp = result.timestamp;
562-
if (result.mediaType === 'video' && result.framerateMean) {
563-
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
564-
}
565-
} else if (result.type === 'local-candidate') {
566-
item = statistic.local.candidate;
567-
if (result.candidateType === 'host' && result.mozLocalTransport === 'udp' && result.transport === 'udp') {
568-
item.protocol = result.transport;
569-
item.ip = result.ipAddress;
570-
item.port = result.portNumber;
571-
} else if (!Helpers.getVersionFirefox()) {
572-
item.protocol = result.protocol;
573-
item.ip = result.ip;
574-
item.port = result.port;
575-
}
576-
} else if (result.type === 'remote-candidate') {
577-
item = statistic.remote.candidate;
578-
item.protocol = result.protocol || result.transport;
579-
item.ip = result.ip || result.ipAddress;
580-
item.port = result.port || result.portNumber;
581-
} else if (result.type === 'track' && result.kind === 'video' && !Helpers.getVersionFirefox()) {
582-
if (result.remoteSource) {
583-
item = statistic.remote.video;
584-
item.frameHeight = result.frameHeight;
585-
item.frameWidth = result.frameWidth;
586-
item.framesPerSecond = _getFramesPerSecond(result, lastResults, false);
587-
} else {
588-
item = statistic.local.video;
589-
item.frameHeight = result.frameHeight;
590-
item.frameWidth = result.frameWidth;
591-
item.framesPerSecond = _getFramesPerSecond(result, lastResults, true);
592-
}
593-
}
545+
_applyStatReport(statistic, result, lastResults);
594546
});
595547
successCallback(statistic, results);
596548
}, errorCallback);
549+
}
597550

598-
function _getBitratePerSecond(result, lastResults, isLocal) {
599-
var lastResult = lastResults && lastResults.get(result.id),
600-
seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
601-
kilo = 1024,
602-
bit = 8,
603-
bitrate;
604-
605-
if (!lastResult) {
606-
bitrate = 0;
607-
} else if (isLocal) {
608-
bitrate = bit * (result.bytesSent - lastResult.bytesSent) / (kilo * seconds);
551+
function _applyStatReport(statistic, result, lastResults) {
552+
var item;
553+
// mediaType is deprecated in the W3C webrtc-stats spec and replaced by kind.
554+
// Safari/WebKit omits mediaType on some reports and provides only kind, so we
555+
// normalize once and use it for both the statistic lookup and the 'video' check.
556+
var mediaType = result.mediaType || result.kind;
557+
558+
if (result.bytesReceived && result.type === 'inbound-rtp') {
559+
item = statistic.remote[mediaType];
560+
561+
if (item) {
562+
item.bitrate = _getBitratePerSecond(result, lastResults, false);
563+
item.bytesReceived = result.bytesReceived;
564+
item.packetsReceived = result.packetsReceived;
565+
item.timestamp = result.timestamp;
566+
if (mediaType === 'video' && result.framerateMean) {
567+
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
568+
}
569+
} else {
570+
Helpers.traceWarning('_getStats: skipping inbound-rtp report with unknown mediaType/kind: ' + mediaType);
571+
}
572+
} else if (result.bytesSent && result.type === 'outbound-rtp') {
573+
item = statistic.local[mediaType];
574+
575+
if (item) {
576+
item.bitrate = _getBitratePerSecond(result, lastResults, true);
577+
item.bytesSent = result.bytesSent;
578+
item.packetsSent = result.packetsSent;
579+
item.timestamp = result.timestamp;
580+
if (mediaType === 'video' && result.framerateMean) {
581+
item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
582+
}
583+
} else {
584+
Helpers.traceWarning('_getStats: skipping outbound-rtp report with unknown mediaType/kind: ' + mediaType);
585+
}
586+
} else if (result.type === 'local-candidate') {
587+
item = statistic.local.candidate;
588+
if (result.candidateType === 'host' && result.mozLocalTransport === 'udp' && result.transport === 'udp') {
589+
item.protocol = result.transport;
590+
item.ip = result.ipAddress;
591+
item.port = result.portNumber;
592+
} else if (!Helpers.getVersionFirefox()) {
593+
item.protocol = result.protocol;
594+
item.ip = result.ip;
595+
item.port = result.port;
596+
}
597+
} else if (result.type === 'remote-candidate') {
598+
item = statistic.remote.candidate;
599+
item.protocol = result.protocol || result.transport;
600+
item.ip = result.ip || result.ipAddress;
601+
item.port = result.port || result.portNumber;
602+
} else if (result.type === 'track' && result.kind === 'video' && !Helpers.getVersionFirefox()) {
603+
if (result.remoteSource) {
604+
item = statistic.remote.video;
605+
item.frameHeight = result.frameHeight;
606+
item.frameWidth = result.frameWidth;
607+
item.framesPerSecond = _getFramesPerSecond(result, lastResults, false);
609608
} else {
610-
bitrate = bit * (result.bytesReceived - lastResult.bytesReceived) / (kilo * seconds);
609+
item = statistic.local.video;
610+
item.frameHeight = result.frameHeight;
611+
item.frameWidth = result.frameWidth;
612+
item.framesPerSecond = _getFramesPerSecond(result, lastResults, true);
611613
}
614+
}
615+
}
612616

613-
return Math.round(bitrate);
617+
function _getBitratePerSecond(result, lastResults, isLocal) {
618+
var lastResult = lastResults && lastResults.get(result.id),
619+
seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
620+
kilo = 1024,
621+
bit = 8,
622+
bitrate;
623+
624+
if (!lastResult) {
625+
bitrate = 0;
626+
} else if (isLocal) {
627+
bitrate = bit * (result.bytesSent - lastResult.bytesSent) / (kilo * seconds);
628+
} else {
629+
bitrate = bit * (result.bytesReceived - lastResult.bytesReceived) / (kilo * seconds);
614630
}
615631

616-
function _getFramesPerSecond(result, lastResults, isLocal) {
617-
var lastResult = lastResults && lastResults.get(result.id),
618-
seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
619-
framesPerSecond;
632+
return Math.round(bitrate);
633+
}
620634

621-
if (!lastResult) {
622-
framesPerSecond = 0;
623-
} else if (isLocal) {
624-
framesPerSecond = (result.framesSent - lastResult.framesSent) / seconds;
625-
} else {
626-
framesPerSecond = (result.framesReceived - lastResult.framesReceived) / seconds;
627-
}
635+
function _getFramesPerSecond(result, lastResults, isLocal) {
636+
var lastResult = lastResults && lastResults.get(result.id),
637+
seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
638+
framesPerSecond;
628639

629-
return Math.round(framesPerSecond * 10) / 10;
640+
if (!lastResult) {
641+
framesPerSecond = 0;
642+
} else if (isLocal) {
643+
framesPerSecond = (result.framesSent - lastResult.framesSent) / seconds;
644+
} else {
645+
framesPerSecond = (result.framesReceived - lastResult.framesReceived) / seconds;
630646
}
647+
648+
return Math.round(framesPerSecond * 10) / 10;
631649
}
632650

633651
// Find the line in sdpLines[startLine...endLine - 1] that starts with |prefix|
@@ -814,4 +832,7 @@ function setMediaBitrate(sdp, media, bitrate) {
814832
return newLines.join('\n');
815833
}
816834

835+
// PRIVATE - exposed for unit tests only, not part of the public SDK contract.
836+
qbRTCPeerConnection._applyStatReport = _applyStatReport;
837+
817838
module.exports = qbRTCPeerConnection;

src/qbConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
*/
1313

1414
var config = {
15-
version: '2.23.0',
16-
buildNumber: '1178',
15+
version: '2.23.1',
16+
buildNumber: '1179',
1717
creds: {
1818
'appId': 0,
1919
'authKey': '',

src/qbStrophe.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ function Connection(onLogListenerCallback) {
7474
Utils.QBLog('[QBChat]', 'RECV:', data);
7575
safeCallbackCall('RECV:', data);
7676

77+
// [QC-1454 DIAGNOSTIC] Flag groupchat messages at transport level
78+
if (typeof data === 'string' && data.indexOf('groupchat') !== -1) {
79+
Utils.QBLog('[QBChat]', '[TRANSPORT] Groupchat stanza received at WebSocket level');
80+
}
81+
7782
try {
7883
let parser = new DOMParser();
7984
let xmlDoc = parser.parseFromString(data, 'text/xml');

0 commit comments

Comments
 (0)