@flashphoner/websdk 2.0.260 → 2.0.261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docTemplate/README.md +1 -1
- package/flashphoner-no-flash.js +768 -81
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +666 -9
- package/flashphoner-no-webrtc.min.js +2 -2
- package/flashphoner-no-wsplayer.js +767 -80
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api-webrtc-only.js +768 -81
- package/flashphoner-room-api-webrtc-only.min.js +1 -1
- package/flashphoner-room-api.js +516 -60
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +667 -10
- package/flashphoner-temasys-flash-websocket.js +667 -10
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +767 -80
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +768 -81
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/constants.d.ts +6 -0
- package/src/constants.js +6 -0
- package/src/flashphoner-core.js +60 -5
- package/src/stats-collector.js +318 -0
- package/src/util.js +61 -1
- package/src/webrtc-media-provider.js +64 -48
|
@@ -453,66 +453,53 @@ var createConnection = function (options) {
|
|
|
453
453
|
return true;
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
var getStat = function (callbackFn, nativeStats) {
|
|
457
|
-
let browser = browserDetails.browser;
|
|
456
|
+
var getStat = async function (callbackFn, nativeStats) {
|
|
458
457
|
let result = {outboundStream: {}, inboundStream: {}, otherStats: []};
|
|
459
|
-
|
|
460
|
-
if (nativeStats) {
|
|
461
|
-
return connection.getStats(null);
|
|
462
|
-
} else {
|
|
463
|
-
connection.getStats(null).then(function (stat) {
|
|
464
|
-
if (stat) {
|
|
465
|
-
stat.forEach(function (report) {
|
|
466
|
-
if (!report.isRemote) {
|
|
467
|
-
let mediaType = "";
|
|
468
|
-
if (report.type === 'outbound-rtp') {
|
|
469
|
-
mediaType = getReportMediaType(report);
|
|
470
|
-
fillStatObject(result.outboundStream, report, mediaType);
|
|
471
|
-
if (mediaType === 'video') {
|
|
472
|
-
getVideoSize(result.outboundStream[mediaType], report);
|
|
473
|
-
}
|
|
474
|
-
} else if (report.type === 'inbound-rtp') {
|
|
475
|
-
mediaType = getReportMediaType(report);
|
|
476
|
-
fillStatObject(result.inboundStream, report, mediaType);
|
|
477
|
-
if (mediaType === 'video') {
|
|
478
|
-
getVideoSize(result.inboundStream[mediaType], report);
|
|
479
|
-
}
|
|
480
|
-
} else if (report.type === 'candidate-pair' && report.state === 'succeeded' && report.nominated) {
|
|
481
|
-
if (report.availableIncomingBitrate) {
|
|
482
|
-
result.otherStats.availableIncomingBitrate = report.availableIncomingBitrate;
|
|
483
|
-
} else if (localVideo && report.availableOutgoingBitrate) {
|
|
484
|
-
// availableOutgoingBitrate is defined for incoming stream too #WCS-4175
|
|
485
|
-
result.otherStats.availableOutgoingBitrate = report.availableOutgoingBitrate;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
});
|
|
458
|
+
let rawStat = await getWebRTCStats();
|
|
490
459
|
|
|
460
|
+
if (nativeStats) {
|
|
461
|
+
callbackFn(rawStat);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
if (rawStat["candidate-pair"]) {
|
|
465
|
+
rawStat["candidate-pair"].forEach((report) => {
|
|
466
|
+
if (report.state === 'succeeded' && report.nominated) {
|
|
467
|
+
if (report.availableIncomingBitrate) {
|
|
468
|
+
result.otherStats.availableIncomingBitrate = report.availableIncomingBitrate;
|
|
469
|
+
} else if (localVideo && report.availableOutgoingBitrate) {
|
|
470
|
+
// availableOutgoingBitrate is defined for incoming stream too #WCS-4175
|
|
471
|
+
result.otherStats.availableOutgoingBitrate = report.availableOutgoingBitrate;
|
|
472
|
+
}
|
|
491
473
|
}
|
|
492
|
-
callbackFn(result);
|
|
493
474
|
});
|
|
494
475
|
}
|
|
476
|
+
if (rawStat["outbound-rtp"]) {
|
|
477
|
+
rawStat["outbound-rtp"].forEach((report) => {
|
|
478
|
+
fillStatObject(result.outboundStream, report, report.kind);
|
|
479
|
+
if (report.kind === "video") {
|
|
480
|
+
getVideoSize(result.outboundStream[report.kind], report.type, report);
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
if (rawStat["inbound-rtp"]) {
|
|
485
|
+
rawStat["inbound-rtp"].forEach((report) => {
|
|
486
|
+
fillStatObject(result.inboundStream, report, report.kind);
|
|
487
|
+
if (report.kind === "video") {
|
|
488
|
+
getVideoSize(result.inboundStream["video"], report.type, report);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
callbackFn(result);
|
|
495
493
|
}
|
|
496
494
|
};
|
|
497
495
|
|
|
498
|
-
var
|
|
499
|
-
// Since Safari 17 report.mediaType is undefined #WCS-3922
|
|
500
|
-
if (report.mediaType !== undefined) {
|
|
501
|
-
return report.mediaType;
|
|
502
|
-
} else if (report.kind !== undefined) {
|
|
503
|
-
return report.kind;
|
|
504
|
-
}
|
|
505
|
-
logger.warn(LOG_PREFIX, "No media type provided in WebRTC statistics");
|
|
506
|
-
return "media";
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
var getVideoSize = function (obj, report) {
|
|
496
|
+
var getVideoSize = function (obj, type, report) {
|
|
510
497
|
let videoSize = {};
|
|
511
|
-
if (
|
|
498
|
+
if (type === 'outbound-rtp') {
|
|
512
499
|
if (localVideo !== undefined && localVideo != null) {
|
|
513
500
|
videoSize = localVideo.srcObject.getVideoTracks()[0].getSettings();
|
|
514
501
|
}
|
|
515
|
-
} else if (
|
|
502
|
+
} else if (type === 'inbound-rtp') {
|
|
516
503
|
if (remoteVideo !== undefined && remoteVideo != null) {
|
|
517
504
|
videoSize.width = remoteVideo.videoWidth;
|
|
518
505
|
videoSize.height = remoteVideo.videoHeight;
|
|
@@ -553,6 +540,7 @@ var createConnection = function (options) {
|
|
|
553
540
|
key.indexOf("audioLevel") != -1 ||
|
|
554
541
|
key === "framesPerSecond" ||
|
|
555
542
|
key === "qualityLimitationReason" ) {
|
|
543
|
+
|
|
556
544
|
obj[mediaType][key] = report[key];
|
|
557
545
|
}
|
|
558
546
|
if (key === "qualityLimitationDurations") {
|
|
@@ -948,6 +936,33 @@ var createConnection = function (options) {
|
|
|
948
936
|
return -1;
|
|
949
937
|
}
|
|
950
938
|
|
|
939
|
+
var getWebRTCStats = function() {
|
|
940
|
+
return new Promise(function (resolve, reject) {
|
|
941
|
+
let browser = browserDetails.browser;
|
|
942
|
+
if (connection && validBrowsers.includes(browser)) {
|
|
943
|
+
connection.getStats(null).then((stats) => {
|
|
944
|
+
let statObject = {};
|
|
945
|
+
if (stats) {
|
|
946
|
+
stats.forEach((report) => {
|
|
947
|
+
if (report) {
|
|
948
|
+
if (statObject[report.type] === undefined) {
|
|
949
|
+
statObject[report.type] = [];
|
|
950
|
+
}
|
|
951
|
+
statObject[report.type].push(report);
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
resolve(statObject);
|
|
956
|
+
}).catch((reason) => {
|
|
957
|
+
logger.error(LOG_PREFIX, reason);
|
|
958
|
+
reject(reason);
|
|
959
|
+
});
|
|
960
|
+
} else {
|
|
961
|
+
reject(constants.ERROR_INFO.CAN_NOT_GET_STATS);
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
};
|
|
965
|
+
|
|
951
966
|
var exports = {};
|
|
952
967
|
exports.state = state;
|
|
953
968
|
exports.createOffer = createOffer;
|
|
@@ -980,6 +995,7 @@ var createConnection = function (options) {
|
|
|
980
995
|
exports.getZoomCapabilities = getZoomCapabilities;
|
|
981
996
|
exports.setZoom = setZoom;
|
|
982
997
|
exports.getZoom = getZoom;
|
|
998
|
+
exports.getWebRTCStats = getWebRTCStats;
|
|
983
999
|
connections[id] = exports;
|
|
984
1000
|
resolve(exports);
|
|
985
1001
|
});
|