@wireapp/avs 9.0.21 → 9.1.5

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { WcallLogHandler } from "./avs_wcall";
2
- export declare type UserMediaHandler = (convid: string, useAudio: boolean, useVideo: boolean, useScreenShare: boolean) => Promise<MediaStream>;
3
- export declare type AudioStreamHandler = (convid: string, stream_id: string, streams: readonly MediaStream[] | null) => void;
4
- export declare type VideoStreamHandler = (convid: string, remote_userid: string, remote_clientid: string, streams: readonly MediaStream[] | null) => void;
2
+ export type UserMediaHandler = (convid: string, useAudio: boolean, useVideo: boolean, useScreenShare: boolean) => Promise<MediaStream>;
3
+ export type AudioStreamHandler = (convid: string, stream_id: string, streams: readonly MediaStream[] | null) => void;
4
+ export type VideoStreamHandler = (convid: string, remote_userid: string, remote_clientid: string, streams: readonly MediaStream[] | null) => void;
5
5
  declare function pc_InitModule(module: any, logh: WcallLogHandler): void;
6
6
  declare function pc_SetUserMediaHandler(umh: UserMediaHandler): void;
7
7
  declare function pc_SetAudioStreamHandler(ash: AudioStreamHandler): void;
package/dist/avs_pc.js CHANGED
@@ -16,7 +16,7 @@ var workerContent = "\n\nvar coders = {};\n\nconst HDR_VERSION = 0;\n\n/*\nHeade
16
16
  function callStreamHandler(pc, userid, clientid, ssrc) {
17
17
  if (ssrc == "0") {
18
18
  if (videoStreamHandler) {
19
- pc_log(LOG_LEVEL_INFO, "calling vsh(" + pc.convid + ", " + userid + ", " + clientid + ") to remove renderer");
19
+ pc_log(LOG_LEVEL_INFO, "calling vsh(".concat(pc.convid, ", ").concat(userid, ", ").concat(clientid, ") to remove renderer"));
20
20
  videoStreamHandler(pc.convid, userid, clientid, null);
21
21
  }
22
22
  }
@@ -26,7 +26,7 @@ function callStreamHandler(pc, userid, clientid, ssrc) {
26
26
  if (trans.receiver.track.label === label_1) {
27
27
  var stream = new MediaStream([trans.receiver.track]);
28
28
  if (videoStreamHandler) {
29
- pc_log(LOG_LEVEL_INFO, "calling vsh(" + pc.convid + ", " + userid + ", " + clientid + ") with 1 stream");
29
+ pc_log(LOG_LEVEL_INFO, "calling vsh(".concat(pc.convid, ", ").concat(userid, ", ").concat(clientid, ") with 1 stream"));
30
30
  videoStreamHandler(pc.convid, userid, clientid, [stream]);
31
31
  }
32
32
  }
@@ -173,7 +173,7 @@ function replace_track(pc, newTrack) {
173
173
  newTrack.enabled = enabled;
174
174
  sender.replaceTrack(newTrack);
175
175
  sender.track.enabled = enabled;
176
- pc_log(LOG_LEVEL_INFO, "replace_track: kind=" + newTrack.kind + " enabled=" + sender.track.enabled);
176
+ pc_log(LOG_LEVEL_INFO, "replace_track: kind=".concat(newTrack.kind, " enabled=").concat(sender.track.enabled));
177
177
  return true;
178
178
  }
179
179
  }
@@ -184,7 +184,7 @@ function update_tracks(pc, stream) {
184
184
  var rtc = pc.rtc;
185
185
  var tracks = stream.getTracks();
186
186
  var found = false;
187
- pc_log(LOG_LEVEL_INFO, "update_tracks: pc=" + pc.self + " tracks=" + tracks.length);
187
+ pc_log(LOG_LEVEL_INFO, "update_tracks: pc=".concat(pc.self, " tracks=").concat(tracks.length));
188
188
  if (!rtc)
189
189
  return;
190
190
  var senders = rtc.getSenders();
@@ -200,9 +200,9 @@ function update_tracks(pc, stream) {
200
200
  for (var _a = 0, tracks_1 = tracks; _a < tracks_1.length; _a++) {
201
201
  var track = tracks_1[_a];
202
202
  if (track)
203
- pc_log(LOG_LEVEL_INFO, "update_tracks: kind=" + track.kind + " sender=" + sender.track.kind);
203
+ pc_log(LOG_LEVEL_INFO, "update_tracks: kind=".concat(track.kind, " sender=").concat(sender.track.kind));
204
204
  else
205
- pc_log(LOG_LEVEL_INFO, "update_tracks: sender.track=" + sender.track + " track=" + track);
205
+ pc_log(LOG_LEVEL_INFO, "update_tracks: sender.track=".concat(sender.track, " track=").concat(track));
206
206
  if (sender.track) {
207
207
  if (sender.track.kind === track.kind) {
208
208
  found = true;
@@ -224,7 +224,7 @@ function update_tracks(pc, stream) {
224
224
  track.enabled = !pc.muted;
225
225
  }
226
226
  if (!replace_track(pc, track)) {
227
- pc_log(LOG_LEVEL_INFO, "update_tracks: adding track of kind=" + track.kind);
227
+ pc_log(LOG_LEVEL_INFO, "update_tracks: adding track of kind=".concat(track.kind));
228
228
  rtc.addTrack(track, stream);
229
229
  }
230
230
  });
@@ -290,7 +290,7 @@ function gatheringHandler(pc) {
290
290
  return;
291
291
  }
292
292
  var state = rtc.iceGatheringState;
293
- pc_log(LOG_LEVEL_INFO, "ice gathering state=" + state);
293
+ pc_log(LOG_LEVEL_INFO, "ice gathering state=".concat(state));
294
294
  switch (state) {
295
295
  case "new":
296
296
  break;
@@ -306,7 +306,7 @@ function gatheringHandler(pc) {
306
306
  }
307
307
  }
308
308
  function negotiationHandler(pc) {
309
- pc_log(LOG_LEVEL_INFO, "negotiationHandler: " + pc.self);
309
+ pc_log(LOG_LEVEL_INFO, "negotiationHandler: ".concat(pc.self));
310
310
  }
311
311
  function signallingHandler(pc) {
312
312
  var rtc = pc.rtc;
@@ -314,7 +314,7 @@ function signallingHandler(pc) {
314
314
  return;
315
315
  }
316
316
  var stateStr = rtc.signalingState;
317
- pc_log(LOG_LEVEL_INFO, "signalingHandler: state: " + stateStr);
317
+ pc_log(LOG_LEVEL_INFO, "signalingHandler: state: ".concat(stateStr));
318
318
  ccallSignallingHandler(pc, sigState(stateStr));
319
319
  }
320
320
  function setMute(pc) {
@@ -334,7 +334,7 @@ function setMute(pc) {
334
334
  function candidateHandler(pc, cand) {
335
335
  var mindex = cand ? cand.sdpMLineIndex : null;
336
336
  if (cand !== null)
337
- pc_log(LOG_LEVEL_INFO, "candidateHandler: cand=" + cand.candidate + " type=" + cand.type + " mindex=" + mindex);
337
+ pc_log(LOG_LEVEL_INFO, "candidateHandler: cand=".concat(cand.candidate, " type=").concat(cand.type, " mindex=").concat(mindex));
338
338
  else {
339
339
  pc_log(LOG_LEVEL_INFO, "candidateHandler: cand=NULL");
340
340
  }
@@ -351,7 +351,7 @@ function candidateHandler(pc, cand) {
351
351
  if (mindex != null) {
352
352
  var cmid = pc.cands[mindex];
353
353
  if (!cmid) {
354
- pc_log(LOG_LEVEL_INFO, "candidateHandler: adding mindex=" + mindex);
354
+ pc_log(LOG_LEVEL_INFO, "candidateHandler: adding mindex=".concat(mindex));
355
355
  pc.cands[mindex] = {
356
356
  mindex: mindex,
357
357
  hasRelay: false
@@ -373,7 +373,7 @@ function candidateHandler(pc, cand) {
373
373
  for (var _i = 0, _a = pc.cands; _i < _a.length; _i++) {
374
374
  var cc = _a[_i];
375
375
  if (cc && !cc.hasRelay) {
376
- pc_log(LOG_LEVEL_INFO, "candidateHandler: mindex=" + cc.mindex + " still missing relay");
376
+ pc_log(LOG_LEVEL_INFO, "candidateHandler: mindex=".concat(cc.mindex, " still missing relay"));
377
377
  return;
378
378
  }
379
379
  }
@@ -388,7 +388,7 @@ function connectionHandler(pc) {
388
388
  return;
389
389
  }
390
390
  var state = rtc.iceConnectionState;
391
- pc_log(LOG_LEVEL_INFO, "connectionHandler state: " + state);
391
+ pc_log(LOG_LEVEL_INFO, "connectionHandler state: ".concat(state));
392
392
  ccallConnectionHandler(pc, state);
393
393
  setMute(pc);
394
394
  }
@@ -403,18 +403,20 @@ function setupDataChannel(pc, dc) {
403
403
  ccallDcStateChangeHandler(pc, DC_STATE_CLOSED);
404
404
  };
405
405
  dc.onerror = function (event) {
406
- pc_log(LOG_LEVEL_INFO, "dc-error: " + event.error);
407
- ccallDcStateChangeHandler(pc, DC_STATE_ERROR);
406
+ if (event instanceof RTCErrorEvent) {
407
+ pc_log(LOG_LEVEL_INFO, "dc-error: ".concat(event.error));
408
+ ccallDcStateChangeHandler(pc, DC_STATE_ERROR);
409
+ }
408
410
  };
409
411
  dc.onmessage = function (event) {
410
- pc_log(LOG_LEVEL_INFO, "dc-onmessage: data=" + event.data.length);
412
+ pc_log(LOG_LEVEL_INFO, "dc-onmessage: data=".concat(event.data.length));
411
413
  ccallDcDataHandler(pc, event.data.toString());
412
414
  };
413
415
  return dcHnd;
414
416
  }
415
417
  function dataChannelHandler(pc, event) {
416
418
  var dc = event.channel;
417
- pc_log(LOG_LEVEL_INFO, "dataChannelHandler: " + dc);
419
+ pc_log(LOG_LEVEL_INFO, "dataChannelHandler: ".concat(dc));
418
420
  var dcHnd = setupDataChannel(pc, dc);
419
421
  ccallDcEstabHandler(pc, dcHnd);
420
422
  }
@@ -475,7 +477,7 @@ function pc_Create(hnd, privacy, conv_type) {
475
477
  var pt = RTCRtpSender.prototype;
476
478
  pc.insertable_legacy = !!pt.createEncodedVideoStreams;
477
479
  pc.insertable_streams = !!pt.createEncodedStreams;
478
- pc_log(LOG_LEVEL_INFO, "insertable: " + pc.insertable_legacy + "/" + pc.insertable_streams);
480
+ pc_log(LOG_LEVEL_INFO, "insertable: ".concat(pc.insertable_legacy, "/").concat(pc.insertable_streams));
479
481
  var transportPolicy = privacy !== 0 ? "relay" : "all";
480
482
  var useEncoding = pc.conv_type === CONV_TYPE_CONFERENCE;
481
483
  var config = {
@@ -487,7 +489,7 @@ function pc_Create(hnd, privacy, conv_type) {
487
489
  forceEncodedVideoInsertableStreams: useEncoding,
488
490
  forceEncodedAudioInsertableStreams: useEncoding,
489
491
  };
490
- pc_log(LOG_LEVEL_INFO, "pc_Create: configuring: " + pc.turnServers.length + " TURN servers");
492
+ pc_log(LOG_LEVEL_INFO, "pc_Create: configuring: ".concat(pc.turnServers.length, " TURN servers"));
491
493
  var rtc = new RTCPeerConnection(config);
492
494
  pc.rtc = rtc;
493
495
  rtc.onicegatheringstatechange = function () { return gatheringHandler(pc); };
@@ -498,16 +500,16 @@ function pc_Create(hnd, privacy, conv_type) {
498
500
  rtc.onnegotiationneeded = function () { return negotiationHandler(pc); };
499
501
  var label = '';
500
502
  rtc.ontrack = function (event) {
501
- pc_log(LOG_LEVEL_INFO, "onTrack: self=" + pc.self + " convid=" + pc.convid + " userid=" + pc.remote_userid + "/" + pc.remote_clientid + " streams=" + event.streams.length);
503
+ pc_log(LOG_LEVEL_INFO, "onTrack: self=".concat(pc.self, " convid=").concat(pc.convid, " userid=").concat(pc.remote_userid, "/").concat(pc.remote_clientid, " streams=").concat(event.streams.length));
502
504
  if (event.streams && event.streams.length > 0) {
503
505
  for (var _i = 0, _a = event.streams; _i < _a.length; _i++) {
504
506
  var stream = _a[_i];
505
- pc_log(LOG_LEVEL_INFO, "onTrack: convid=" + pc.convid + " stream=" + stream);
507
+ pc_log(LOG_LEVEL_INFO, "onTrack: convid=".concat(pc.convid, " stream=").concat(stream));
506
508
  for (var _b = 0, _c = stream.getTracks(); _b < _c.length; _b++) {
507
509
  var track = _c[_b];
508
510
  if (track) {
509
511
  label = track.label;
510
- pc_log(LOG_LEVEL_INFO, "onTrack: convid=" + pc.convid + " track=" + track.id + "/" + track.label + " kind=" + track.kind + " enabled=" + track.enabled + "/" + track.muted + "/" + track.readonly + "/" + track.readyState + " remote=" + track.remote);
512
+ pc_log(LOG_LEVEL_INFO, "onTrack: convid=".concat(pc.convid, " track=").concat(track.id, "/").concat(track.label, " kind=").concat(track.kind, " enabled=").concat(track.enabled, "/").concat(track.muted, "/undefined/").concat(track.readyState, " remote=undefined"));
511
513
  if (!track.enabled)
512
514
  track.enabled = true;
513
515
  if (pc.conv_type === CONV_TYPE_CONFERENCE) {
@@ -523,7 +525,7 @@ function pc_Create(hnd, privacy, conv_type) {
523
525
  }
524
526
  }
525
527
  if (event.track.kind == "audio" && audioStreamHandler) {
526
- pc_log(LOG_LEVEL_INFO, "onTrack: calling ash(" + pc.convid + ", " + label + ") with " + event.streams.length + " streams");
528
+ pc_log(LOG_LEVEL_INFO, "onTrack: calling ash(".concat(pc.convid, ", ").concat(label, ") with ").concat(event.streams.length, " streams"));
527
529
  audioStreamHandler(pc.convid, hnd.toString() + label, event.streams);
528
530
  }
529
531
  if (event.track.kind == "video" && videoStreamHandler) {
@@ -535,14 +537,14 @@ function pc_Create(hnd, privacy, conv_type) {
535
537
  clientid = uinfo.clientid;
536
538
  }
537
539
  if (userid != "sft" && userid != "") {
538
- pc_log(LOG_LEVEL_INFO, "onTrack: calling vsh(" + pc.convid + ", " + userid + ", " + clientid + ") with " + event.streams.length + " streams");
540
+ pc_log(LOG_LEVEL_INFO, "onTrack: calling vsh(".concat(pc.convid, ", ").concat(userid, ", ").concat(clientid, ") with ").concat(event.streams.length, " streams"));
539
541
  videoStreamHandler(pc.convid, userid, clientid, event.streams);
540
542
  }
541
543
  }
542
544
  };
543
545
  }
544
546
  function pc_Close(hnd) {
545
- pc_log(LOG_LEVEL_INFO, "pc_Close: hnd=" + hnd);
547
+ pc_log(LOG_LEVEL_INFO, "pc_Close: hnd=".concat(hnd));
546
548
  var pc = connectionsStore.getPeerConnection(hnd);
547
549
  if (pc == null) {
548
550
  return;
@@ -553,7 +555,7 @@ function pc_Close(hnd) {
553
555
  if (track && track.kind === "audio") {
554
556
  var label = track.label;
555
557
  if (audioStreamHandler && pc.rtc) {
556
- pc_log(LOG_LEVEL_INFO, "pc_Close: calling ash(" + pc.convid + ", " + label + ") with 0 streams");
558
+ pc_log(LOG_LEVEL_INFO, "pc_Close: calling ash(".concat(pc.convid, ", ").concat(label, ") with 0 streams"));
557
559
  audioStreamHandler(pc.convid, hnd.toString() + label, null);
558
560
  }
559
561
  }
@@ -569,7 +571,7 @@ function pc_Close(hnd) {
569
571
  pc.rtc = null;
570
572
  }
571
573
  function pc_AddTurnServer(hnd, urlPtr, usernamePtr, passwordPtr) {
572
- pc_log(LOG_LEVEL_INFO, "pc_AddTurnServer: hnd=" + hnd);
574
+ pc_log(LOG_LEVEL_INFO, "pc_AddTurnServer: hnd=".concat(hnd));
573
575
  var pc = connectionsStore.getPeerConnection(hnd);
574
576
  if (pc == null) {
575
577
  return;
@@ -577,7 +579,7 @@ function pc_AddTurnServer(hnd, urlPtr, usernamePtr, passwordPtr) {
577
579
  var url = em_module.UTF8ToString(urlPtr);
578
580
  var username = em_module.UTF8ToString(usernamePtr);
579
581
  var credential = em_module.UTF8ToString(passwordPtr);
580
- pc_log(LOG_LEVEL_INFO, "pc_AddTurnServer: hnd=" + hnd + " adding: " + username + ":" + credential + "@" + url);
582
+ pc_log(LOG_LEVEL_INFO, "pc_AddTurnServer: hnd=".concat(hnd, " adding: ").concat(username, ":").concat(credential, "@").concat(url));
581
583
  var server = {
582
584
  urls: url,
583
585
  username: username,
@@ -590,7 +592,7 @@ function pc_HasVideo(hnd) {
590
592
  if (pc == null) {
591
593
  return 0;
592
594
  }
593
- pc_log(LOG_LEVEL_INFO, "pc_HasVideo(" + hnd + "): sending=" + pc.sending_video);
595
+ pc_log(LOG_LEVEL_INFO, "pc_HasVideo(".concat(hnd, "): sending=").concat(pc.sending_video));
594
596
  var senders = pc.rtc ? pc.rtc.getSenders() : [];
595
597
  pc_log(LOG_LEVEL_INFO, "pc_HasVideo: " + senders.length + " senders");
596
598
  for (var _i = 0, senders_4 = senders; _i < senders_4.length; _i++) {
@@ -612,7 +614,7 @@ function pc_HasVideo(hnd) {
612
614
  }
613
615
  var rx = txrx.receiver;
614
616
  var tx = txrx.sender;
615
- pc_log(LOG_LEVEL_INFO, "pc_HasVideo: txrx dir=" + txrx.direction + "/" + txrx.currentDirection + " rx=" + rx + " tx=" + tx);
617
+ pc_log(LOG_LEVEL_INFO, "pc_HasVideo: txrx dir=".concat(txrx.direction, "/").concat(txrx.currentDirection, " rx=").concat(rx, " tx=").concat(tx));
616
618
  }
617
619
  return 0;
618
620
  }
@@ -621,7 +623,7 @@ function pc_SetVideoState(hnd, vstate) {
621
623
  if (pc == null) {
622
624
  return;
623
625
  }
624
- pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: hnd=" + hnd + " vstate=" + vstate + "/" + pc.vstate + " callType=" + pc.call_type + " active=" + pc.sending_video);
626
+ pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: hnd=".concat(hnd, " vstate=").concat(vstate, "/").concat(pc.vstate, " callType=").concat(pc.call_type, " active=").concat(pc.sending_video));
625
627
  if (pc.vstate === vstate)
626
628
  return;
627
629
  var active = false;
@@ -646,11 +648,11 @@ function pc_SetVideoState(hnd, vstate) {
646
648
  should_update = true;
647
649
  else if (vstate === PC_VIDEO_STATE_SCREENSHARE)
648
650
  should_update = true;
649
- pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: should_update=" + should_update + " vstate=" + vstate + " active=" + active);
651
+ pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: should_update=".concat(should_update, " vstate=").concat(vstate, " active=").concat(active));
650
652
  if (should_update && userMediaHandler) {
651
653
  var use_video = vstate === PC_VIDEO_STATE_STARTED;
652
654
  var use_ss = vstate === PC_VIDEO_STATE_SCREENSHARE;
653
- pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: calling umh(1, " + use_video + ", " + use_ss + ")");
655
+ pc_log(LOG_LEVEL_INFO, "pc_SetVideoState: calling umh(1, ".concat(use_video, ", ").concat(use_ss, ")"));
654
656
  userMediaHandler(pc.convid, true, use_video, use_ss)
655
657
  .then(function (stream) {
656
658
  update_tracks(pc, stream);
@@ -726,7 +728,7 @@ function setupSenderTransform(pc, sender) {
726
728
  senderStreams = sender.createEncodedStreams();
727
729
  else
728
730
  senderStreams = mtype === 1 ? sender.createEncodedVideoStreams() : sender.createEncodedAudioStreams();
729
- pc_log(LOG_LEVEL_INFO, "setupSenderTransform: senderStream: " + senderStreams.readable + "/" + senderStreams.readableStream);
731
+ pc_log(LOG_LEVEL_INFO, "setupSenderTransform: senderStream: ".concat(senderStreams.readable, "/").concat(senderStreams.readableStream));
730
732
  var readableStream = senderStreams.readable || senderStreams.readableStream;
731
733
  var writableStream = senderStreams.writable || senderStreams.writableStream;
732
734
  worker.postMessage({
@@ -750,7 +752,7 @@ function setupReceiverTransform(pc, receiver) {
750
752
  receiverStreams = receiver.createEncodedStreams();
751
753
  else
752
754
  receiverStreams = mtype === 1 ? receiver.createEncodedVideoStreams() : receiver.createEncodedAudioStreams();
753
- pc_log(LOG_LEVEL_INFO, "setupReceiverTransform: receiverStream: " + receiverStreams.readable + "/" + receiverStreams.readableStream);
755
+ pc_log(LOG_LEVEL_INFO, "setupReceiverTransform: receiverStream: ".concat(receiverStreams.readable, "/").concat(receiverStreams.readableStream));
754
756
  var readableStream = receiverStreams.readable || receiverStreams.readableStream;
755
757
  var writableStream = receiverStreams.writable || receiverStreams.writableStream;
756
758
  worker.postMessage({
@@ -762,7 +764,7 @@ function setupReceiverTransform(pc, receiver) {
762
764
  }
763
765
  function createSdp(pc, callType, vstate, isOffer) {
764
766
  var rtc = pc.rtc;
765
- pc_log(LOG_LEVEL_INFO, "createSdp: isOffer=" + isOffer + " rtc=" + rtc);
767
+ pc_log(LOG_LEVEL_INFO, "createSdp: isOffer=".concat(isOffer, " rtc=").concat(rtc));
766
768
  if (!rtc) {
767
769
  return;
768
770
  }
@@ -770,7 +772,7 @@ function createSdp(pc, callType, vstate, isOffer) {
770
772
  pc.vstate = vstate;
771
773
  var use_video = vstate === PC_VIDEO_STATE_STARTED;
772
774
  var use_ss = vstate === PC_VIDEO_STATE_SCREENSHARE;
773
- pc_log(LOG_LEVEL_INFO, "createSdp: calling umh(1, " + use_video + ", " + use_ss + ")");
775
+ pc_log(LOG_LEVEL_INFO, "createSdp: calling umh(1, ".concat(use_video, ", ").concat(use_ss, ")"));
774
776
  pc.sending_video = use_video || use_ss;
775
777
  if (userMediaHandler) {
776
778
  userMediaHandler(pc.convid, true, use_video, use_ss)
@@ -786,7 +788,7 @@ function createSdp(pc, callType, vstate, isOffer) {
786
788
  .then(function (sdp) {
787
789
  var typeStr = sdp.type;
788
790
  var sdpStr = sdp.sdp || '';
789
- pc_log(LOG_LEVEL_INFO, "createSdp: type=" + typeStr + " sdp=" + sdpStr);
791
+ pc_log(LOG_LEVEL_INFO, "createSdp: type=".concat(typeStr, " sdp=").concat(sdpStr));
790
792
  var modSdp = sdpMap(sdpStr, true, false);
791
793
  ccallLocalSdpHandler(pc, 0, typeStr, modSdp);
792
794
  })
@@ -806,11 +808,11 @@ function pc_CreateOffer(hnd, callType, vstate) {
806
808
  if (pc == null) {
807
809
  return;
808
810
  }
809
- pc_log(LOG_LEVEL_INFO, "pc_CreateOffer: hnd=" + hnd + " self=" + pc.self.toString(16) + " call_type=" + callType);
811
+ pc_log(LOG_LEVEL_INFO, "pc_CreateOffer: hnd=".concat(hnd, " self=").concat(pc.self.toString(16), " call_type=").concat(callType));
810
812
  createSdp(pc, callType, vstate, true);
811
813
  }
812
814
  function pc_CreateAnswer(hnd, callType, vstate) {
813
- pc_log(LOG_LEVEL_INFO, "pc_CreateAnswer: " + hnd + " callType=" + callType);
815
+ pc_log(LOG_LEVEL_INFO, "pc_CreateAnswer: ".concat(hnd, " callType=").concat(callType));
814
816
  var pc = connectionsStore.getPeerConnection(hnd);
815
817
  pc_log(LOG_LEVEL_INFO, 'pc_CreateAnswer: pc=' + pc);
816
818
  if (pc == null) {
@@ -819,7 +821,7 @@ function pc_CreateAnswer(hnd, callType, vstate) {
819
821
  createSdp(pc, callType, vstate, false);
820
822
  }
821
823
  function pc_AddDecoderAnswer(hnd) {
822
- pc_log(LOG_LEVEL_INFO, "pc_AddDecoderAnswer: " + hnd);
824
+ pc_log(LOG_LEVEL_INFO, "pc_AddDecoderAnswer: ".concat(hnd));
823
825
  var pc = connectionsStore.getPeerConnection(hnd);
824
826
  pc_log(LOG_LEVEL_INFO, 'pc_AddDecoderAnswer: pc=' + pc);
825
827
  if (pc == null) {
@@ -840,7 +842,7 @@ function pc_AddDecoderAnswer(hnd) {
840
842
  });
841
843
  }
842
844
  function pc_AddUserInfo(hnd, labelPtr, useridPtr, clientidPtr, ssrcaPtr, ssrcvPtr, audioIvPtr, videoIvPtr, ivlen) {
843
- pc_log(LOG_LEVEL_INFO, "pc_AddUserInfo: hnd=" + hnd);
845
+ pc_log(LOG_LEVEL_INFO, "pc_AddUserInfo: hnd=".concat(hnd));
844
846
  var pc = connectionsStore.getPeerConnection(hnd);
845
847
  if (pc == null) {
846
848
  return;
@@ -872,7 +874,7 @@ function pc_AddUserInfo(hnd, labelPtr, useridPtr, clientidPtr, ssrcaPtr, ssrcvPt
872
874
  first_succ_video: false,
873
875
  transp_ssrcv: null,
874
876
  };
875
- pc_log(LOG_LEVEL_INFO, "pc_AddUserInfo: label=" + label + " " + userId + "/" + clientId + " ssrc:" + ssrca + "/" + ssrcv);
877
+ pc_log(LOG_LEVEL_INFO, "pc_AddUserInfo: label=".concat(label, " ").concat(userId, "/").concat(clientId, " ssrc:").concat(ssrca, "/").concat(ssrcv));
876
878
  pc.users[label] = uinfo;
877
879
  worker.postMessage({
878
880
  op: 'addUser',
@@ -882,14 +884,14 @@ function pc_AddUserInfo(hnd, labelPtr, useridPtr, clientidPtr, ssrcaPtr, ssrcvPt
882
884
  }
883
885
  function pc_RemoveUserInfo(hnd, labelPtr) {
884
886
  var label = em_module.UTF8ToString(labelPtr);
885
- pc_log(LOG_LEVEL_INFO, "pc_RemoveUserInfo: hnd=" + hnd + " label=" + label);
887
+ pc_log(LOG_LEVEL_INFO, "pc_RemoveUserInfo: hnd=".concat(hnd, " label=").concat(label));
886
888
  var pc = connectionsStore.getPeerConnection(hnd);
887
889
  if (pc == null) {
888
890
  return;
889
891
  }
890
892
  if (pc.users.hasOwnProperty(label)) {
891
893
  if (audioStreamHandler) {
892
- pc_log(LOG_LEVEL_INFO, "pcRemoveUserInfo: calling ash(" + pc.convid + ", " + label + ") with 0 streams");
894
+ pc_log(LOG_LEVEL_INFO, "pcRemoveUserInfo: calling ash(".concat(pc.convid, ", ").concat(label, ") with 0 streams"));
893
895
  audioStreamHandler(pc.convid, hnd.toString() + label, null);
894
896
  }
895
897
  delete pc.users[label];
@@ -906,7 +908,7 @@ function extractSSRCs(pc, sdp) {
906
908
  });
907
909
  }
908
910
  function pc_SetRemoteDescription(hnd, typePtr, sdpPtr) {
909
- pc_log(LOG_LEVEL_INFO, "pc_SetRemoteDescription: hnd=" + hnd);
911
+ pc_log(LOG_LEVEL_INFO, "pc_SetRemoteDescription: hnd=".concat(hnd));
910
912
  var pc = connectionsStore.getPeerConnection(hnd);
911
913
  if (pc == null) {
912
914
  return;
@@ -926,7 +928,7 @@ function pc_SetRemoteDescription(hnd, typePtr, sdpPtr) {
926
928
  if (pc.conv_type == CONV_TYPE_CONFERENCE) {
927
929
  sdpStr = sdpCbrMap(sdpStr);
928
930
  }
929
- pc_log(LOG_LEVEL_INFO, "pc_SetRemoteDescription: hnd=" + hnd + " SDP=" + sdpStr);
931
+ pc_log(LOG_LEVEL_INFO, "pc_SetRemoteDescription: hnd=".concat(hnd, " SDP=").concat(sdpStr));
930
932
  rtc
931
933
  .setRemoteDescription({ type: type, sdp: sdpStr })
932
934
  .then(function () { })
@@ -936,7 +938,7 @@ function pc_SetRemoteDescription(hnd, typePtr, sdpPtr) {
936
938
  extractSSRCs(pc, sdp);
937
939
  }
938
940
  function pc_SetLocalDescription(hnd, typePtr, sdpPtr) {
939
- pc_log(LOG_LEVEL_INFO, "pc_SetLocalDescription: hnd=" + hnd);
941
+ pc_log(LOG_LEVEL_INFO, "pc_SetLocalDescription: hnd=".concat(hnd));
940
942
  var pc = connectionsStore.getPeerConnection(hnd);
941
943
  if (pc == null) {
942
944
  return;
@@ -968,7 +970,7 @@ function pc_SetLocalDescription(hnd, typePtr, sdpPtr) {
968
970
  });
969
971
  }
970
972
  function pc_LocalDescription(hnd, typePtr) {
971
- pc_log(LOG_LEVEL_INFO, "pc_LocalDescription: hnd=" + hnd);
973
+ pc_log(LOG_LEVEL_INFO, "pc_LocalDescription: hnd=".concat(hnd));
972
974
  var pc = connectionsStore.getPeerConnection(hnd);
973
975
  if (pc == null) {
974
976
  return 0;
@@ -990,7 +992,7 @@ function pc_LocalDescription(hnd, typePtr) {
990
992
  }
991
993
  var sdp = sdpDesc.sdp.toString();
992
994
  var sdpStr = sdp;
993
- pc_log(LOG_LEVEL_INFO, "pc_LocalDescription: env=" + pc_env);
995
+ pc_log(LOG_LEVEL_INFO, "pc_LocalDescription: env=".concat(pc_env));
994
996
  if (pc_env === ENV_FIREFOX) {
995
997
  sdpStr = sdp.replace(' UDP/DTLS/SCTP', ' DTLS/SCTP');
996
998
  sdpStr = sdpMap(sdpStr, true, false);
@@ -1004,7 +1006,7 @@ function pc_HeapFree(ptr) {
1004
1006
  em_module._free(ptr);
1005
1007
  }
1006
1008
  function pc_IceGatheringState(hnd) {
1007
- pc_log(LOG_LEVEL_INFO, "pc_IceGatheringState: hnd=" + hnd);
1009
+ pc_log(LOG_LEVEL_INFO, "pc_IceGatheringState: hnd=".concat(hnd));
1008
1010
  var state = PC_GATHER_STATE_UNKNOWN;
1009
1011
  var pc = connectionsStore.getPeerConnection(hnd);
1010
1012
  if (!pc) {
@@ -1029,7 +1031,7 @@ function pc_IceGatheringState(hnd) {
1029
1031
  return state;
1030
1032
  }
1031
1033
  function pc_SignalingState(hnd) {
1032
- pc_log(LOG_LEVEL_INFO, "pc_SignalingState: hnd=" + hnd);
1034
+ pc_log(LOG_LEVEL_INFO, "pc_SignalingState: hnd=".concat(hnd));
1033
1035
  var state = PC_SIG_STATE_UNKNOWN;
1034
1036
  var pc = connectionsStore.getPeerConnection(hnd);
1035
1037
  if (!pc) {
@@ -1041,11 +1043,11 @@ function pc_SignalingState(hnd) {
1041
1043
  }
1042
1044
  var stateStr = rtc.signalingState;
1043
1045
  state = sigState(stateStr);
1044
- pc_log(LOG_LEVEL_INFO, "pc_SignalingState: hnd=" + hnd + " " + stateStr + " mapped: " + state);
1046
+ pc_log(LOG_LEVEL_INFO, "pc_SignalingState: hnd=".concat(hnd, " ") + stateStr + " mapped: " + state);
1045
1047
  return state;
1046
1048
  }
1047
1049
  function pc_ConnectionState(hnd) {
1048
- pc_log(LOG_LEVEL_INFO, "pc_ConnectionState: hnd=" + hnd);
1050
+ pc_log(LOG_LEVEL_INFO, "pc_ConnectionState: hnd=".concat(hnd));
1049
1051
  var pc = connectionsStore.getPeerConnection(hnd);
1050
1052
  if (!pc) {
1051
1053
  return 0;
@@ -1085,7 +1087,7 @@ function pc_SetRemoteUserClientId(hnd, useridPtr, clientidPtr) {
1085
1087
  }
1086
1088
  /* Data Channel related */
1087
1089
  function pc_CreateDataChannel(hnd, labelPtr) {
1088
- pc_log(LOG_LEVEL_INFO, "pc_CreateDataChannel: hnd=" + hnd);
1090
+ pc_log(LOG_LEVEL_INFO, "pc_CreateDataChannel: hnd=".concat(hnd));
1089
1091
  var pc = connectionsStore.getPeerConnection(hnd);
1090
1092
  if (pc == null) {
1091
1093
  return 0;
@@ -1103,7 +1105,7 @@ function pc_CreateDataChannel(hnd, labelPtr) {
1103
1105
  return dcHnd;
1104
1106
  }
1105
1107
  function pc_DataChannelId(hnd) {
1106
- pc_log(LOG_LEVEL_INFO, "pc_DataChannelId: hnd=" + hnd);
1108
+ pc_log(LOG_LEVEL_INFO, "pc_DataChannelId: hnd=".concat(hnd));
1107
1109
  var dc = connectionsStore.getDataChannel(hnd);
1108
1110
  if (dc == null) {
1109
1111
  return -1;
@@ -1111,7 +1113,7 @@ function pc_DataChannelId(hnd) {
1111
1113
  return dc.id;
1112
1114
  }
1113
1115
  function pc_DataChannelState(hnd) {
1114
- pc_log(LOG_LEVEL_INFO, "pc_DataChannelState: hnd=" + hnd);
1116
+ pc_log(LOG_LEVEL_INFO, "pc_DataChannelState: hnd=".concat(hnd));
1115
1117
  var state = DC_STATE_ERROR;
1116
1118
  var dc = connectionsStore.getDataChannel(hnd);
1117
1119
  if (dc == null) {
@@ -1133,13 +1135,13 @@ function pc_DataChannelState(hnd) {
1133
1135
  return state;
1134
1136
  }
1135
1137
  function pc_DataChannelSend(hnd, dataPtr, dataLen) {
1136
- pc_log(LOG_LEVEL_INFO, "pc_DataChannelSend: hnd=" + hnd);
1138
+ pc_log(LOG_LEVEL_INFO, "pc_DataChannelSend: hnd=".concat(hnd));
1137
1139
  var dc = connectionsStore.getDataChannel(hnd);
1138
1140
  if (dc == null) {
1139
1141
  return;
1140
1142
  }
1141
1143
  if (dc.readyState !== 'open') {
1142
- pc_log(LOG_LEVEL_WARN, "pc_DataChannelSend: hnd=" + hnd + " not open");
1144
+ pc_log(LOG_LEVEL_WARN, "pc_DataChannelSend: hnd=".concat(hnd, " not open"));
1143
1145
  return;
1144
1146
  }
1145
1147
  //const data = new Uint8Array(em_module.HEAPU8.buffer, dataPtr, dataLen);
@@ -1147,7 +1149,7 @@ function pc_DataChannelSend(hnd, dataPtr, dataLen) {
1147
1149
  dc.send(data);
1148
1150
  }
1149
1151
  function pc_DataChannelClose(hnd) {
1150
- pc_log(LOG_LEVEL_INFO, "pc_DataChannelClose: hnd=" + hnd);
1152
+ pc_log(LOG_LEVEL_INFO, "pc_DataChannelClose: hnd=".concat(hnd));
1151
1153
  var dc = connectionsStore.getDataChannel(hnd);
1152
1154
  if (dc == null) {
1153
1155
  return;
@@ -1231,7 +1233,7 @@ function pc_GetStats(convid) {
1231
1233
  return Promise.all(statsPromises);
1232
1234
  }
1233
1235
  function pc_GetLocalStats(hnd) {
1234
- pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: hnd=" + hnd);
1236
+ pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: hnd=".concat(hnd));
1235
1237
  var pc = connectionsStore.getPeerConnection(hnd);
1236
1238
  if (pc == null) {
1237
1239
  return;
@@ -1322,7 +1324,7 @@ function pc_GetLocalStats(hnd) {
1322
1324
  pc.stats.sent_apkts, pc.stats.sent_vpkts,
1323
1325
  pc.stats.ploss, rtt]);
1324
1326
  })
1325
- .catch(function (err) { return pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: failed hnd=" + hnd + " err=" + err, err); });
1327
+ .catch(function (err) { return pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: failed hnd=".concat(hnd, " err=").concat(err), err); });
1326
1328
  }
1327
1329
  exports.default = {
1328
1330
  init: pc_InitModule,
@@ -86,33 +86,33 @@ export interface WcallClient {
86
86
  userid: string;
87
87
  clientid: string;
88
88
  }
89
- export declare type WcallReadyHandler = (version: number, arg: number) => void;
90
- export declare type WcallShutdownHandler = (wuser: number, arg: number) => void;
91
- export declare type WcallSendHandler = (ctx: number, convid: string, userid_self: string, clientid_self: string, targets: string | null, unused: string | null, data: string, len: number, trans: number, my_clients_only: number, arg: number) => number;
92
- export declare type WcallSftReqHandler = (ctx: number, url: string, data: string, len: number, arg: number) => number;
93
- export declare type WcallIncomingHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, should_ring: number, conv_type: number, arg: number) => void;
94
- export declare type WcallMissedHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, arg: number) => void;
95
- export declare type WcallNetworkQualityHandler = (convid: string, userid: string, clientid: string, quality: number, rtt: number, uploss: number, downloss: number, arg: number) => void;
96
- export declare type WcallAnsweredHandler = (convid: string, arg: number) => void;
97
- export declare type WcallEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
98
- export declare type WcallGroupChangedHandler = (convid: string, arg: number) => void;
99
- export declare type WcallParticipantChangedHandler = (convid: string, mjson: string, arg: number) => void;
100
- export declare type WcallMediaEstabHandler = (convid: string, peer: number, userid: string, clientid: string, arg: number) => void;
101
- export declare type WcallMediaStoppedHandler = (convid: string, arg: number) => void;
102
- export declare type WcallDataChanEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
103
- export declare type WcallMuteHandler = (muted: number, arg: number) => void;
104
- export declare type WcallReqNewEpochHandler = (wuser: number, convid: string, arg: number) => void;
105
- export declare type WcallCloseHandler = (reason: number, convid: string, msg_time: number, userid: string, clientid: string, arg: number) => void;
106
- export declare type WcallMetricsHandler = (convid: string, metrics_json: string, arg: number) => void;
107
- export declare type WcallLogHandler = (level: number, msg: string, arg: any) => void;
108
- export declare type WcallVideoStateChangeHandler = (convid: string, userid: string, clientid: string, state: number, arg: number) => void;
109
- export declare type WcallVideoSizeHandler = (w: number, h: number, userid: string, clientid: string, arg: number) => void;
110
- export declare type WcallAudioCbrChangeHandler = (userid: string, clientid: string, enabled: number, arg: number) => void;
111
- export declare type WcallConfigReqHandler = (wuser: number, arg: number) => number;
112
- export declare type WcallStateChangeHandler = (convid: string, state: number, arg: number) => void;
113
- export declare type WcallReqClientsHandler = (wuser: number, convid: string, arg: number) => void;
114
- export declare type WcallActiveSpeakerHandler = (wuser: number, convid: string, json_levels: string, arg: number) => void;
115
- export declare type WcallNetprobeHandler = (err: number, rtt_avg: number, n_pkt_sent: number, n_pkt_recv: number, arg: number) => void;
89
+ export type WcallReadyHandler = (version: number, arg: number) => void;
90
+ export type WcallShutdownHandler = (wuser: number, arg: number) => void;
91
+ export type WcallSendHandler = (ctx: number, convid: string, userid_self: string, clientid_self: string, targets: string | null, unused: string | null, data: string, len: number, trans: number, my_clients_only: number, arg: number) => number;
92
+ export type WcallSftReqHandler = (ctx: number, url: string, data: string, len: number, arg: number) => number;
93
+ export type WcallIncomingHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, should_ring: number, conv_type: number, arg: number) => void;
94
+ export type WcallMissedHandler = (convid: string, msg_time: number, userid: string, clientid: string, video_call: number, arg: number) => void;
95
+ export type WcallNetworkQualityHandler = (convid: string, userid: string, clientid: string, quality: number, rtt: number, uploss: number, downloss: number, arg: number) => void;
96
+ export type WcallAnsweredHandler = (convid: string, arg: number) => void;
97
+ export type WcallEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
98
+ export type WcallGroupChangedHandler = (convid: string, arg: number) => void;
99
+ export type WcallParticipantChangedHandler = (convid: string, mjson: string, arg: number) => void;
100
+ export type WcallMediaEstabHandler = (convid: string, peer: number, userid: string, clientid: string, arg: number) => void;
101
+ export type WcallMediaStoppedHandler = (convid: string, arg: number) => void;
102
+ export type WcallDataChanEstabHandler = (convid: string, userid: string, clientid: string, arg: number) => void;
103
+ export type WcallMuteHandler = (muted: number, arg: number) => void;
104
+ export type WcallReqNewEpochHandler = (wuser: number, convid: string, arg: number) => void;
105
+ export type WcallCloseHandler = (reason: number, convid: string, msg_time: number, userid: string, clientid: string, arg: number) => void;
106
+ export type WcallMetricsHandler = (convid: string, metrics_json: string, arg: number) => void;
107
+ export type WcallLogHandler = (level: number, msg: string, arg: any) => void;
108
+ export type WcallVideoStateChangeHandler = (convid: string, userid: string, clientid: string, state: number, arg: number) => void;
109
+ export type WcallVideoSizeHandler = (w: number, h: number, userid: string, clientid: string, arg: number) => void;
110
+ export type WcallAudioCbrChangeHandler = (userid: string, clientid: string, enabled: number, arg: number) => void;
111
+ export type WcallConfigReqHandler = (wuser: number, arg: number) => number;
112
+ export type WcallStateChangeHandler = (convid: string, state: number, arg: number) => void;
113
+ export type WcallReqClientsHandler = (wuser: number, convid: string, arg: number) => void;
114
+ export type WcallActiveSpeakerHandler = (wuser: number, convid: string, json_levels: string, arg: number) => void;
115
+ export type WcallNetprobeHandler = (err: number, rtt_avg: number, n_pkt_sent: number, n_pkt_recv: number, arg: number) => void;
116
116
  export declare class Wcall {
117
117
  private em_module;
118
118
  constructor(em_module: any);
package/dist/avs_wcall.js CHANGED
@@ -17,6 +17,7 @@
17
17
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.getAvsInstance = exports.Wcall = exports.VSTREAMS = exports.STATE = exports.CONV_TYPE = exports.CALL_TYPE = exports.ENV = exports.VIDEO_STATE = exports.AUDIO_STATE = exports.LOG_LEVEL = exports.REASON = exports.QUALITY = exports.ERROR = void 0;
20
21
  /* DO NOT edit this file by hand. It is generated by the AVS make
21
22
  * system and any changes you make will be lost.
22
23
  */
@@ -603,7 +604,7 @@ var Wcall = /** @class */ (function () {
603
604
  return Wcall;
604
605
  }());
605
606
  exports.Wcall = Wcall;
606
- exports.getAvsInstance = function () {
607
+ var getAvsInstance = function () {
607
608
  if (instance) {
608
609
  return Promise.resolve(instance);
609
610
  }
@@ -614,3 +615,4 @@ exports.getAvsInstance = function () {
614
615
  });
615
616
  });
616
617
  };
618
+ exports.getAvsInstance = getAvsInstance;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "description": "AVS API for the web",
3
3
  "devDependencies": {
4
- "@types/jasmine": "^3.3.16",
5
- "jasmine": "^3.4.0",
6
- "karma": "^4.2.0",
7
- "karma-chrome-launcher": "^3.0.0",
4
+ "@types/jasmine": "^4.3.1",
5
+ "jasmine": "^4.5.0",
6
+ "karma": "^6.4.1",
7
+ "karma-chrome-launcher": "^3.1.1",
8
8
  "karma-commonjs": "^1.0.0",
9
- "karma-jasmine": "^2.0.1",
9
+ "karma-jasmine": "^5.1.0",
10
10
  "karma-typescript-preprocessor": "^0.4.0",
11
- "prettier": "^2.8.0",
12
- "typescript": "^3.4.5"
11
+ "prettier": "^2.8.1",
12
+ "typescript": "^4.9.4"
13
13
  },
14
14
  "files": [
15
15
  "dist"
@@ -21,5 +21,5 @@
21
21
  "prepack": "prettier -w src/avs_wcall.ts && tsc && cp src/*.js src/*.d.ts dist/",
22
22
  "test": "karma start"
23
23
  },
24
- "version": "9.0.21"
24
+ "version": "9.1.5"
25
25
  }