@wireapp/avs 0.0.4312 → 0.0.4316
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_core.js +22 -4
- package/dist/avs_pc.js +26 -61
- package/dist/avs_wcall.d.ts +9 -2
- package/dist/avs_wcall.js +61 -3
- package/package.json +1 -1
package/dist/avs_pc.js
CHANGED
|
@@ -52,7 +52,7 @@ function callStreamHandler(pc, userid, clientid, ssrc, track_id) {
|
|
|
52
52
|
pc.rtc.getTransceivers().forEach(function (trans) {
|
|
53
53
|
var track = trans.receiver.track;
|
|
54
54
|
pc_log(LOG_LEVEL_INFO, "vsh: label:".concat(track.label, " id:").concat(track.id, " looking for: ").concat(label_1));
|
|
55
|
-
if (
|
|
55
|
+
if (track.id === label_1) {
|
|
56
56
|
if (uinfo) {
|
|
57
57
|
uinfo.video_track_id = track.id;
|
|
58
58
|
}
|
|
@@ -619,10 +619,7 @@ function pc_Create(hnd, privacy, conv_type) {
|
|
|
619
619
|
for (var _b = 0, _c = stream.getTracks(); _b < _c.length; _b++) {
|
|
620
620
|
var track = _c[_b];
|
|
621
621
|
if (track) {
|
|
622
|
-
|
|
623
|
-
label = track.id;
|
|
624
|
-
else
|
|
625
|
-
label = track.label;
|
|
622
|
+
label = track.id;
|
|
626
623
|
pc_log(LOG_LEVEL_INFO, "onTrack: convid=".concat(pc.convid.substring(0, 8), " track=").concat(track.id, "/").concat(track.label, "=>").concat(label, " kind=").concat(track.kind, " enabled=").concat(track.enabled, "/").concat(track.muted, "/undefined/").concat(track.readyState, " remote=undefined"));
|
|
627
624
|
if (!track.enabled)
|
|
628
625
|
track.enabled = true;
|
|
@@ -669,10 +666,7 @@ function pc_Close(hnd) {
|
|
|
669
666
|
var track = trans.receiver.track;
|
|
670
667
|
if (track && track.kind === "audio") {
|
|
671
668
|
var label = '';
|
|
672
|
-
|
|
673
|
-
label = track.id;
|
|
674
|
-
else
|
|
675
|
-
label = track.label;
|
|
669
|
+
label = track.id;
|
|
676
670
|
if (audioStreamHandler && pc.rtc) {
|
|
677
671
|
pc_log(LOG_LEVEL_INFO, "pc_Close: calling ash(".concat(pc.convid.substring(0, 8), ", ").concat(label, ") with 0 streams"));
|
|
678
672
|
audioStreamHandler(pc.convid, hnd.toString() + label, null);
|
|
@@ -1480,66 +1474,37 @@ function pc_GetLocalStats(hnd) {
|
|
|
1480
1474
|
});
|
|
1481
1475
|
}
|
|
1482
1476
|
});
|
|
1483
|
-
var self_audio_level = 0;
|
|
1484
|
-
var apkts = 0;
|
|
1485
|
-
var vpkts = 0;
|
|
1486
|
-
var ploss = 0;
|
|
1487
1477
|
rtc.getStats()
|
|
1488
1478
|
.then(function (stats) {
|
|
1489
|
-
|
|
1479
|
+
// !This does not work --> let report_json = JSON.stringify(stats);
|
|
1480
|
+
// We need to create json from individual items
|
|
1481
|
+
var report = '[';
|
|
1490
1482
|
stats.forEach(function (stat) {
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
var
|
|
1494
|
-
if (stat.
|
|
1495
|
-
|
|
1483
|
+
// Following information is not handled in avs atm.
|
|
1484
|
+
if ((stat.type === 'inbound-rtp') && (stat.kind === 'video')) {
|
|
1485
|
+
var user_info = null;
|
|
1486
|
+
if (!!stat.trackIdentifier) {
|
|
1487
|
+
user_info = uinfo_from_video_track_id(pc, stat.trackIdentifier);
|
|
1496
1488
|
}
|
|
1497
|
-
|
|
1498
|
-
var
|
|
1499
|
-
|
|
1500
|
-
|
|
1489
|
+
if (user_info !== null) {
|
|
1490
|
+
var frame_height = !!stat.frameHeight ? stat === null || stat === void 0 ? void 0 : stat.frameHeight : 0;
|
|
1491
|
+
var frame_width = !!stat.frameWidth ? stat === null || stat === void 0 ? void 0 : stat.frameWidth : 0;
|
|
1492
|
+
if (user_info.frame_width !== frame_width || user_info.frame_height !== frame_height) {
|
|
1493
|
+
user_info.frame_width = frame_width;
|
|
1494
|
+
user_info.frame_height = frame_height;
|
|
1495
|
+
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
1496
|
}
|
|
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
1497
|
}
|
|
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
1498
|
}
|
|
1499
|
+
report += JSON.stringify(stat);
|
|
1500
|
+
report += ',';
|
|
1530
1501
|
});
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
em_module.ccall("pc_set_stats", null, ["number", "
|
|
1536
|
-
pc.self,
|
|
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
|
|
1502
|
+
// remove tailing ',' if any
|
|
1503
|
+
report = report.replace(/,$/, '');
|
|
1504
|
+
report += ']';
|
|
1505
|
+
// console.log("webrtc stats json", report);
|
|
1506
|
+
em_module.ccall("pc_set_stats", null, ["number", "string"], [
|
|
1507
|
+
pc.self, report
|
|
1543
1508
|
]);
|
|
1544
1509
|
}).catch(function (err) { return pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: failed hnd=".concat(hnd, " err=").concat(err), err); });
|
|
1545
1510
|
}
|
package/dist/avs_wcall.d.ts
CHANGED
|
@@ -29,7 +29,8 @@ export declare enum REASON {
|
|
|
29
29
|
NOONE_JOINED = 12,
|
|
30
30
|
EVERYONE_LEFT = 13,
|
|
31
31
|
AUTH_FAILED = 14,
|
|
32
|
-
AUTH_FAILED_START = 15
|
|
32
|
+
AUTH_FAILED_START = 15,
|
|
33
|
+
DURATION = 16
|
|
33
34
|
}
|
|
34
35
|
export declare enum LOG_LEVEL {
|
|
35
36
|
DEBUG = 0,
|
|
@@ -104,7 +105,7 @@ export type WcallSendHandler = (ctx: number, convid: string, userid_self: string
|
|
|
104
105
|
export type WcallSftReqHandler = (ctx: number, url: string, data: string, len: number, arg: number) => number;
|
|
105
106
|
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
107
|
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,
|
|
108
|
+
export type WcallNetworkQualityHandler = (convid: string, userid: string, clientid: string, quality_info: string, arg: number) => void;
|
|
108
109
|
export type WcallAnsweredHandler = (convid: string, arg: number) => void;
|
|
109
110
|
export type WcallEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
|
|
110
111
|
export type WcallGroupChangedHandler = (convid: string, arg: number) => void;
|
|
@@ -157,6 +158,7 @@ export declare class Wcall {
|
|
|
157
158
|
setLogHandler(logh: WcallLogHandler, arg?: number): void;
|
|
158
159
|
setEpochInfo(wuser: number, convid: string, epochid: number, clients_json: string, key_base64: string): number;
|
|
159
160
|
setReqNewEpochHandler(wuser: number, req_new_epochh: WcallReqNewEpochHandler): void;
|
|
161
|
+
setDuration(wuser: number, convid: string, duration: number): void;
|
|
160
162
|
getMute(wuser: number): number;
|
|
161
163
|
setMute(wuser: number, muted: number): void;
|
|
162
164
|
setMuteHandler(wuser: number, muteh: WcallMuteHandler, arg?: number): void;
|
|
@@ -174,8 +176,13 @@ export declare class Wcall {
|
|
|
174
176
|
audioRecord(wuser: number, path: string): number;
|
|
175
177
|
poll(): void;
|
|
176
178
|
setupEx(flags: number): number;
|
|
179
|
+
eventCreate(userid: string, clientid: string, incomingh: WcallIncomingHandler, missedh: WcallMissedHandler, closeh: WcallCloseHandler, arg?: number): number;
|
|
180
|
+
eventStart(wuser: number): void;
|
|
181
|
+
eventProcess(wuser: number, buf: string, len: number, curr_time: number, msg_time: number, convid: string, userid: string, clientid: string, conv_type: number): number;
|
|
182
|
+
eventEnd(wuser: number): void;
|
|
177
183
|
setMode(mode: number): void;
|
|
178
184
|
getMode(): number;
|
|
185
|
+
setConfigVersion(sft_version: number, turn_version: number): void;
|
|
179
186
|
setUserMediaHandler(userMediaHandler: UserMediaHandler): void;
|
|
180
187
|
setAudioStreamHandler(audioStreamHandler: AudioStreamHandler): void;
|
|
181
188
|
setVideoStreamHandler(videoStreamHandler: VideoStreamHandler): void;
|
package/dist/avs_wcall.js
CHANGED
|
@@ -57,6 +57,7 @@ var REASON;
|
|
|
57
57
|
REASON[REASON["EVERYONE_LEFT"] = 13] = "EVERYONE_LEFT";
|
|
58
58
|
REASON[REASON["AUTH_FAILED"] = 14] = "AUTH_FAILED";
|
|
59
59
|
REASON[REASON["AUTH_FAILED_START"] = 15] = "AUTH_FAILED_START";
|
|
60
|
+
REASON[REASON["DURATION"] = 16] = "DURATION";
|
|
60
61
|
})(REASON = exports.REASON || (exports.REASON = {}));
|
|
61
62
|
var LOG_LEVEL;
|
|
62
63
|
(function (LOG_LEVEL) {
|
|
@@ -493,11 +494,13 @@ var Wcall = /** @class */ (function () {
|
|
|
493
494
|
Wcall.prototype.setNetworkQualityHandler = function (wuser, netqh, interval, arg) {
|
|
494
495
|
var _this = this;
|
|
495
496
|
if (arg === void 0) { arg = 0; }
|
|
496
|
-
var fn_netqh = this.em_module.addFunction(function (convid, userid, clientid,
|
|
497
|
+
var fn_netqh = this.em_module.addFunction(function (convid, userid, clientid, quality_info, arg) {
|
|
497
498
|
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),
|
|
499
|
+
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
|
|
500
|
+
? null
|
|
501
|
+
: _this.em_module.UTF8ToString(quality_info), arg);
|
|
499
502
|
}
|
|
500
|
-
}, "
|
|
503
|
+
}, "viiiii");
|
|
501
504
|
return this.em_module.ccall("wcall_set_network_quality_handler", "number", ["number", "number", "number", "number"], [wuser, fn_netqh, interval, arg]);
|
|
502
505
|
};
|
|
503
506
|
Wcall.prototype.setLogHandler = function (logh, arg) {
|
|
@@ -523,6 +526,9 @@ var Wcall = /** @class */ (function () {
|
|
|
523
526
|
}, "viii");
|
|
524
527
|
this.em_module.ccall("wcall_set_req_new_epoch_handler", "null", ["number", "number"], [wuser, fn_req_new_epochh]);
|
|
525
528
|
};
|
|
529
|
+
Wcall.prototype.setDuration = function (wuser, convid, duration) {
|
|
530
|
+
this.em_module.ccall("wcall_set_duration", "null", ["number", "string", "number"], [wuser, convid, duration]);
|
|
531
|
+
};
|
|
526
532
|
Wcall.prototype.getMute = function (wuser) {
|
|
527
533
|
return this.em_module.ccall("wcall_get_mute", "number", ["number"], [wuser]);
|
|
528
534
|
};
|
|
@@ -605,12 +611,64 @@ var Wcall = /** @class */ (function () {
|
|
|
605
611
|
Wcall.prototype.setupEx = function (flags) {
|
|
606
612
|
return this.em_module.ccall("wcall_setup_ex", "number", ["number"], [flags]);
|
|
607
613
|
};
|
|
614
|
+
Wcall.prototype.eventCreate = function (userid, clientid, incomingh, missedh, closeh, arg) {
|
|
615
|
+
var _this = this;
|
|
616
|
+
if (arg === void 0) { arg = 0; }
|
|
617
|
+
var fn_incomingh = this.em_module.addFunction(function (convid, msg_time, userid, clientid, video_call, should_ring, conv_type, arg) {
|
|
618
|
+
if (incomingh) {
|
|
619
|
+
incomingh(convid == 0 ? null : _this.em_module.UTF8ToString(convid), msg_time, userid == 0 ? null : _this.em_module.UTF8ToString(userid), clientid == 0 ? null : _this.em_module.UTF8ToString(clientid), video_call, should_ring, conv_type, arg);
|
|
620
|
+
}
|
|
621
|
+
}, "viiiiiiii");
|
|
622
|
+
var fn_missedh = this.em_module.addFunction(function (convid, msg_time, userid, clientid, video_call, arg) {
|
|
623
|
+
if (missedh) {
|
|
624
|
+
missedh(convid == 0 ? null : _this.em_module.UTF8ToString(convid), msg_time, userid == 0 ? null : _this.em_module.UTF8ToString(userid), clientid == 0 ? null : _this.em_module.UTF8ToString(clientid), video_call, arg);
|
|
625
|
+
}
|
|
626
|
+
}, "viiiiii");
|
|
627
|
+
var fn_closeh = this.em_module.addFunction(function (reason, convid, msg_time, userid, clientid, arg) {
|
|
628
|
+
if (closeh) {
|
|
629
|
+
closeh(reason, convid == 0 ? null : _this.em_module.UTF8ToString(convid), msg_time, userid == 0 ? null : _this.em_module.UTF8ToString(userid), clientid == 0 ? null : _this.em_module.UTF8ToString(clientid), arg);
|
|
630
|
+
}
|
|
631
|
+
}, "viiiiii");
|
|
632
|
+
return this.em_module.ccall("wcall_event_create", "number", ["string", "string", "number", "number", "number", "number"], [userid, clientid, fn_incomingh, fn_missedh, fn_closeh, arg]);
|
|
633
|
+
};
|
|
634
|
+
Wcall.prototype.eventStart = function (wuser) {
|
|
635
|
+
this.em_module.ccall("wcall_event_start", "null", ["number"], [wuser]);
|
|
636
|
+
};
|
|
637
|
+
Wcall.prototype.eventProcess = function (wuser, buf, len, curr_time, msg_time, convid, userid, clientid, conv_type) {
|
|
638
|
+
return this.em_module.ccall("wcall_event_process", "number", [
|
|
639
|
+
"number",
|
|
640
|
+
"string",
|
|
641
|
+
"number",
|
|
642
|
+
"number",
|
|
643
|
+
"number",
|
|
644
|
+
"string",
|
|
645
|
+
"string",
|
|
646
|
+
"string",
|
|
647
|
+
"number",
|
|
648
|
+
], [
|
|
649
|
+
wuser,
|
|
650
|
+
buf,
|
|
651
|
+
len,
|
|
652
|
+
curr_time,
|
|
653
|
+
msg_time,
|
|
654
|
+
convid,
|
|
655
|
+
userid,
|
|
656
|
+
clientid,
|
|
657
|
+
conv_type,
|
|
658
|
+
]);
|
|
659
|
+
};
|
|
660
|
+
Wcall.prototype.eventEnd = function (wuser) {
|
|
661
|
+
this.em_module.ccall("wcall_event_end", "null", ["number"], [wuser]);
|
|
662
|
+
};
|
|
608
663
|
Wcall.prototype.setMode = function (mode) {
|
|
609
664
|
this.em_module.ccall("wcall_set_mode", "null", ["number"], [mode]);
|
|
610
665
|
};
|
|
611
666
|
Wcall.prototype.getMode = function () {
|
|
612
667
|
return this.em_module.ccall("wcall_get_mode", "number", [], []);
|
|
613
668
|
};
|
|
669
|
+
Wcall.prototype.setConfigVersion = function (sft_version, turn_version) {
|
|
670
|
+
this.em_module.ccall("wcall_set_config_version", "null", ["number", "number"], [sft_version, turn_version]);
|
|
671
|
+
};
|
|
614
672
|
Wcall.prototype.setUserMediaHandler = function (userMediaHandler) {
|
|
615
673
|
avs_pc_1.default.setUserMediaHandler(userMediaHandler);
|
|
616
674
|
};
|
package/package.json
CHANGED