@wireapp/avs 10.2.29 → 10.3.6

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/dist/avs_pc.js CHANGED
@@ -1480,66 +1480,37 @@ function pc_GetLocalStats(hnd) {
1480
1480
  });
1481
1481
  }
1482
1482
  });
1483
- var self_audio_level = 0;
1484
- var apkts = 0;
1485
- var vpkts = 0;
1486
- var ploss = 0;
1487
1483
  rtc.getStats()
1488
1484
  .then(function (stats) {
1489
- var rtt = 0;
1485
+ // !This does not work --> let report_json = JSON.stringify(stats);
1486
+ // We need to create json from individual items
1487
+ var report = '[';
1490
1488
  stats.forEach(function (stat) {
1491
- if (stat.type === 'inbound-rtp') {
1492
- ploss = ploss + stat.packetsLost;
1493
- var p = stat.packetsReceived;
1494
- if (stat.kind === 'audio') {
1495
- apkts = apkts + p;
1489
+ // Following information is not handled in avs atm.
1490
+ if ((stat.type === 'inbound-rtp') && (stat.kind === 'video')) {
1491
+ var user_info = null;
1492
+ if (!!stat.trackIdentifier) {
1493
+ user_info = uinfo_from_video_track_id(pc, stat.trackIdentifier);
1496
1494
  }
1497
- else if (stat.kind === 'video') {
1498
- var user_info = null;
1499
- if (!!stat.trackIdentifier) {
1500
- user_info = uinfo_from_video_track_id(pc, stat.trackIdentifier);
1495
+ if (user_info !== null) {
1496
+ var frame_height = !!stat.frameHeight ? stat === null || stat === void 0 ? void 0 : stat.frameHeight : 0;
1497
+ var frame_width = !!stat.frameWidth ? stat === null || stat === void 0 ? void 0 : stat.frameWidth : 0;
1498
+ if (user_info.frame_width !== frame_width || user_info.frame_height !== frame_height) {
1499
+ user_info.frame_width = frame_width;
1500
+ user_info.frame_height = frame_height;
1501
+ pc_log(LOG_LEVEL_INFO, "pc_user_resolution: label=".concat(user_info.label, " ").concat(user_info.userid.substring(0, 8), "/").concat(user_info.clientid.substring(0, 4), " resolution:").concat(user_info.frame_width, "x").concat(user_info.frame_height));
1501
1502
  }
1502
- if (user_info !== null) {
1503
- var frame_height = !!stat.frameHeight ? stat === null || stat === void 0 ? void 0 : stat.frameHeight : 0;
1504
- var frame_width = !!stat.frameWidth ? stat === null || stat === void 0 ? void 0 : stat.frameWidth : 0;
1505
- if (user_info.frame_width !== frame_width || user_info.frame_height !== frame_height) {
1506
- user_info.frame_width = frame_width;
1507
- user_info.frame_height = frame_height;
1508
- pc_log(LOG_LEVEL_INFO, "pc_user_resolution: label=".concat(user_info.label, " ").concat(user_info.userid.substring(0, 8), "/").concat(user_info.clientid.substring(0, 4), " resolution:").concat(user_info.frame_width, "x").concat(user_info.frame_height));
1509
- }
1510
- }
1511
- vpkts = vpkts + p;
1512
- }
1513
- }
1514
- else if (stat.type === 'outbound-rtp') {
1515
- var p = stat.packetsSent;
1516
- if (stat.kind === 'audio') {
1517
- pc.stats.sent_apkts = p;
1518
1503
  }
1519
- else if (stat.kind === 'video') {
1520
- pc.stats.sent_vpkts = p;
1521
- }
1522
- }
1523
- else if (stat.type === 'candidate-pair') {
1524
- rtt = stat.currentRoundTripTime * 1000;
1525
- }
1526
- else if (stat.type === 'media-source') {
1527
- if (stat.kind === 'audio')
1528
- self_audio_level = stat.audioLevel ? ((stat.audioLevel * 512.0) | 0) : 0;
1529
1504
  }
1505
+ report += JSON.stringify(stat);
1506
+ report += ',';
1530
1507
  });
1531
- pc.stats.recv_apkts = apkts;
1532
- pc.stats.recv_vpkts = vpkts;
1533
- pc.stats.ploss = ploss - pc.stats.lastploss;
1534
- pc.stats.lastploss = ploss;
1535
- em_module.ccall("pc_set_stats", null, ["number", "number", "number", "number", "number", "number", "number", "number"], [
1536
- pc.self, self_audio_level,
1537
- pc.stats.recv_apkts,
1538
- pc.stats.recv_vpkts,
1539
- pc.stats.sent_apkts,
1540
- pc.stats.sent_vpkts,
1541
- pc.stats.ploss,
1542
- rtt
1508
+ // remove tailing ',' if any
1509
+ report = report.replace(/,$/, '');
1510
+ report += ']';
1511
+ // console.log("webrtc stats json", report);
1512
+ em_module.ccall("pc_set_stats", null, ["number", "string"], [
1513
+ pc.self, report
1543
1514
  ]);
1544
1515
  }).catch(function (err) { return pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: failed hnd=".concat(hnd, " err=").concat(err), err); });
1545
1516
  }
@@ -104,7 +104,7 @@ export type WcallSendHandler = (ctx: number, convid: string, userid_self: string
104
104
  export type WcallSftReqHandler = (ctx: number, url: string, data: string, len: number, arg: number) => number;
105
105
  export type WcallIncomingHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, should_ring: number, conv_type: number, arg: number) => void;
106
106
  export type WcallMissedHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, arg: number) => void;
107
- export type WcallNetworkQualityHandler = (convid: string, userid: string, clientid: string, quality: number, rtt: number, uploss: number, downloss: number, arg: number) => void;
107
+ export type WcallNetworkQualityHandler = (convid: string, userid: string, clientid: string, quality_info: string, arg: number) => void;
108
108
  export type WcallAnsweredHandler = (convid: string, arg: number) => void;
109
109
  export type WcallEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
110
110
  export type WcallGroupChangedHandler = (convid: string, arg: number) => void;
package/dist/avs_wcall.js CHANGED
@@ -493,11 +493,13 @@ var Wcall = /** @class */ (function () {
493
493
  Wcall.prototype.setNetworkQualityHandler = function (wuser, netqh, interval, arg) {
494
494
  var _this = this;
495
495
  if (arg === void 0) { arg = 0; }
496
- var fn_netqh = this.em_module.addFunction(function (convid, userid, clientid, quality, rtt, uploss, downloss, arg) {
496
+ var fn_netqh = this.em_module.addFunction(function (convid, userid, clientid, quality_info, arg) {
497
497
  if (netqh) {
498
- netqh(convid == 0 ? null : _this.em_module.UTF8ToString(convid), userid == 0 ? null : _this.em_module.UTF8ToString(userid), clientid == 0 ? null : _this.em_module.UTF8ToString(clientid), quality, rtt, uploss, downloss, arg);
498
+ netqh(convid == 0 ? null : _this.em_module.UTF8ToString(convid), userid == 0 ? null : _this.em_module.UTF8ToString(userid), clientid == 0 ? null : _this.em_module.UTF8ToString(clientid), quality_info == 0
499
+ ? null
500
+ : _this.em_module.UTF8ToString(quality_info), arg);
499
501
  }
500
- }, "viiiiiiii");
502
+ }, "viiiii");
501
503
  return this.em_module.ccall("wcall_set_network_quality_handler", "number", ["number", "number", "number", "number"], [wuser, fn_netqh, interval, arg]);
502
504
  };
503
505
  Wcall.prototype.setLogHandler = function (logh, arg) {
package/package.json CHANGED
@@ -27,5 +27,5 @@
27
27
  "prepack": "prettier -w src/avs_wcall.ts && tsc && cp src/*.js src/*.d.ts dist/",
28
28
  "test": "karma start"
29
29
  },
30
- "version": "10.2.29"
30
+ "version": "10.3.6"
31
31
  }