@whereby.com/media 2.6.5 → 2.6.7

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/index.cjs CHANGED
@@ -2602,11 +2602,6 @@ class RtcStream {
2602
2602
  var rtcManagerEvents = {
2603
2603
  CAMERA_NOT_WORKING: "camera_not_working",
2604
2604
  CONNECTION_BLOCKED_BY_NETWORK: "connection_blocked_by_network",
2605
- ICE_IPV6_SEEN: "ice_ipv6_seen",
2606
- ICE_MDNS_SEEN: "ice_mdns_seen",
2607
- ICE_NO_PUBLIC_IP_GATHERED: "ice_no_public_ip_gathered",
2608
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: "ice_no_public_ip_gathered_3sec",
2609
- ICE_RESTART: "ice_restart",
2610
2605
  MICROPHONE_NOT_WORKING: "microphone_not_working",
2611
2606
  MICROPHONE_STOPPED_WORKING: "microphone_stopped_working",
2612
2607
  CAMERA_STOPPED_WORKING: "camera_stopped_working",
@@ -2675,6 +2670,16 @@ class P2pRtcManager {
2675
2670
  this.totalSessionsCreated = 0;
2676
2671
  this.analytics = {
2677
2672
  P2PReplaceTrackNoPC: 0,
2673
+ P2PNonErrorRejectionValueGUMError: 0,
2674
+ numNewPc: 0,
2675
+ numIceConnected: 0,
2676
+ numIceRestart: 0,
2677
+ numIceNoPublicIpGathered: 0,
2678
+ numIceNoPublicIpGatheredIn3sec: 0,
2679
+ numIceIpv6Seen: 0,
2680
+ numIceIpv6TeredoSeen: 0,
2681
+ numIceIpv6SixToFour: 0,
2682
+ numIceMdnsSeen: 0,
2678
2683
  };
2679
2684
  }
2680
2685
  numberOfPeerconnections() {
@@ -2904,6 +2909,9 @@ class P2pRtcManager {
2904
2909
  previous: previousStatus,
2905
2910
  });
2906
2911
  }, 0);
2912
+ if (newStatus === TYPES.CONNECTION_SUCCESSFUL) {
2913
+ this.analytics.numIceConnected++;
2914
+ }
2907
2915
  }
2908
2916
  _setJitterBufferTarget(pc) {
2909
2917
  try {
@@ -3018,6 +3026,7 @@ class P2pRtcManager {
3018
3026
  clientId,
3019
3027
  });
3020
3028
  setTimeout(() => this._emit(rtcManagerEvents.NEW_PC), 0);
3029
+ this.analytics.numNewPc++;
3021
3030
  pc.ontrack = (event) => {
3022
3031
  const stream = event.streams[0];
3023
3032
  if (stream.id === "default" && stream.getAudioTracks().length === 0) {
@@ -3285,10 +3294,10 @@ class P2pRtcManager {
3285
3294
  session.serverReflexiveCandidateSeen = false;
3286
3295
  session.publicHostCandidateSeen = false;
3287
3296
  session.ipv6HostCandidateSeen = false;
3288
- this.ipv6HostCandidateTeredoSeen = false;
3289
- this.ipv6HostCandidate6to4Seen = false;
3290
- this.mdnsHostCandidateSeen = false;
3291
- this._emit(rtcManagerEvents.ICE_RESTART);
3297
+ session.ipv6HostCandidateTeredoSeen = false;
3298
+ session.ipv6HostCandidate6to4Seen = false;
3299
+ session.mdnsHostCandidateSeen = false;
3300
+ this.analytics.numIceRestart++;
3292
3301
  this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
3293
3302
  }
3294
3303
  }
@@ -3442,7 +3451,7 @@ class P2pRtcManager {
3442
3451
  !session.relayCandidateSeen &&
3443
3452
  !session.serverReflexiveCandidateSeen) {
3444
3453
  if (pc.iceConnectionState !== "connected" || pc.iceConnectionState !== "completed")
3445
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED_3SEC);
3454
+ this.analytics.numIceNoPublicIpGatheredIn3sec++;
3446
3455
  }
3447
3456
  }, ICE_PUBLIC_IP_GATHERING_TIMEOUT);
3448
3457
  break;
@@ -3490,15 +3499,11 @@ class P2pRtcManager {
3490
3499
  }
3491
3500
  break;
3492
3501
  case "srflx":
3493
- if (!session.serverReflexiveCandidateSeen) {
3494
- session.serverReflexiveCandidateSeen = true;
3495
- }
3502
+ session.serverReflexiveCandidateSeen = true;
3496
3503
  break;
3497
3504
  case "relay":
3498
3505
  case "relayed":
3499
- if (!session.relayCandidateSeen) {
3500
- session.relayCandidateSeen = true;
3501
- }
3506
+ session.relayCandidateSeen = true;
3502
3507
  break;
3503
3508
  }
3504
3509
  this._emitServerEvent(RELAY_MESSAGES.ICE_CANDIDATE, {
@@ -3515,16 +3520,17 @@ class P2pRtcManager {
3515
3520
  !session.serverReflexiveCandidateSeen &&
3516
3521
  pc.iceConnectionState !== "connected" &&
3517
3522
  pc.iceConnectionState !== "completed") {
3518
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED);
3523
+ this.analytics.numIceNoPublicIpGathered++;
3519
3524
  }
3520
3525
  if (session.ipv6HostCandidateSeen) {
3521
- this._emit(rtcManagerEvents.ICE_IPV6_SEEN, {
3522
- teredoSeen: session.ipv6HostCandidateTeredoSeen,
3523
- sixtofourSeen: session.ipv6HostCandidate6to4Seen,
3524
- });
3526
+ this.analytics.numIceIpv6Seen++;
3527
+ if (session.ipv6HostCandidate6to4Seen)
3528
+ this.analytics.numIceIpv6SixToFour++;
3529
+ if (session.ipv6HostCandidateTeredoSeen)
3530
+ this.analytics.numIceIpv6TeredoSeen++;
3525
3531
  }
3526
3532
  if (session.mdnsHostCandidateSeen)
3527
- this._emit(rtcManagerEvents.ICE_MDNS_SEEN);
3533
+ this.analytics.numIceMdnsSeen++;
3528
3534
  }
3529
3535
  };
3530
3536
  pc.onnegotiationneeded = () => {
@@ -3618,7 +3624,9 @@ class P2pRtcManager {
3618
3624
  if (!constraints) {
3619
3625
  return;
3620
3626
  }
3621
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
3627
+ navigator.mediaDevices
3628
+ .getUserMedia({ video: constraints })
3629
+ .then((stream) => {
3622
3630
  const track = stream.getVideoTracks()[0];
3623
3631
  localStream.addTrack(track);
3624
3632
  this._monitorVideoTrack(track);
@@ -3628,6 +3636,13 @@ class P2pRtcManager {
3628
3636
  screenShare: false,
3629
3637
  });
3630
3638
  this._handleStopOrResumeVideo({ enable, track });
3639
+ })
3640
+ .catch((e) => {
3641
+ if (!(e instanceof Error)) {
3642
+ this.analytics.P2PNonErrorRejectionValueGUMError++;
3643
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
3644
+ }
3645
+ throw e;
3631
3646
  });
3632
3647
  }
3633
3648
  }
@@ -4560,6 +4575,7 @@ class VegaRtcManager {
4560
4575
  vegaIceRestarts: 0,
4561
4576
  vegaIceRestartMissingTransport: 0,
4562
4577
  vegaIceRestartWrongTransportId: 0,
4578
+ vegaNonErrorRejectionValueGUMError: 0,
4563
4579
  };
4564
4580
  }
4565
4581
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
@@ -5556,7 +5572,9 @@ class VegaRtcManager {
5556
5572
  }
5557
5573
  else if (localStream.getVideoTracks().length === 0) {
5558
5574
  const constraints = this._webrtcProvider.getMediaConstraints().video;
5559
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
5575
+ navigator.mediaDevices
5576
+ .getUserMedia({ video: constraints })
5577
+ .then((stream) => {
5560
5578
  const track = stream.getVideoTracks()[0];
5561
5579
  localStream.addTrack(track);
5562
5580
  this._monitorVideoTrack(track);
@@ -5566,6 +5584,13 @@ class VegaRtcManager {
5566
5584
  screenShare: false,
5567
5585
  });
5568
5586
  this._handleStopOrResumeVideo({ enable, track });
5587
+ })
5588
+ .catch((e) => {
5589
+ if (!(e instanceof Error)) {
5590
+ this.analytics.vegaNonErrorRejectionValueGUMError++;
5591
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
5592
+ }
5593
+ throw e;
5569
5594
  });
5570
5595
  }
5571
5596
  }
package/dist/index.d.cts CHANGED
@@ -1080,8 +1080,18 @@ declare function fromLocation({ host, protocol }?: {
1080
1080
 
1081
1081
  type P2PAnalytics = {
1082
1082
  P2PReplaceTrackNoPC: number;
1083
+ P2PNonErrorRejectionValueGUMError: number;
1084
+ numNewPc: number;
1085
+ numIceConnected: number;
1086
+ numIceRestart: number;
1087
+ numIceNoPublicIpGathered: number;
1088
+ numIceNoPublicIpGatheredIn3sec: number;
1089
+ numIceIpv6Seen: number;
1090
+ numIceIpv6TeredoSeen: number;
1091
+ numIceIpv6SixToFour: number;
1092
+ numIceMdnsSeen: number;
1083
1093
  };
1084
- type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
1094
+ type P2PAnalyticMetric = keyof P2PAnalytics;
1085
1095
  type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
1086
1096
  declare class P2pRtcManager implements RtcManager {
1087
1097
  _selfId: any;
@@ -1112,9 +1122,6 @@ declare class P2pRtcManager implements RtcManager {
1112
1122
  _mediaserverConfigTtlSeconds: any;
1113
1123
  _fetchMediaServersTimer: any;
1114
1124
  _wasScreenSharing: any;
1115
- ipv6HostCandidateTeredoSeen: any;
1116
- ipv6HostCandidate6to4Seen: any;
1117
- mdnsHostCandidateSeen: any;
1118
1125
  _stoppedVideoTrack: any;
1119
1126
  icePublicIPGatheringTimeoutID: any;
1120
1127
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
@@ -1240,11 +1247,6 @@ declare class RtcManagerDispatcher {
1240
1247
  declare const _default: {
1241
1248
  CAMERA_NOT_WORKING: string;
1242
1249
  CONNECTION_BLOCKED_BY_NETWORK: string;
1243
- ICE_IPV6_SEEN: string;
1244
- ICE_MDNS_SEEN: string;
1245
- ICE_NO_PUBLIC_IP_GATHERED: string;
1246
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: string;
1247
- ICE_RESTART: string;
1248
1250
  MICROPHONE_NOT_WORKING: string;
1249
1251
  MICROPHONE_STOPPED_WORKING: string;
1250
1252
  CAMERA_STOPPED_WORKING: string;
@@ -1500,6 +1502,7 @@ type VegaAnalytics = {
1500
1502
  vegaIceRestarts: number;
1501
1503
  vegaIceRestartMissingTransport: number;
1502
1504
  vegaIceRestartWrongTransportId: number;
1505
+ vegaNonErrorRejectionValueGUMError: number;
1503
1506
  };
1504
1507
 
1505
1508
  type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
package/dist/index.d.mts CHANGED
@@ -1080,8 +1080,18 @@ declare function fromLocation({ host, protocol }?: {
1080
1080
 
1081
1081
  type P2PAnalytics = {
1082
1082
  P2PReplaceTrackNoPC: number;
1083
+ P2PNonErrorRejectionValueGUMError: number;
1084
+ numNewPc: number;
1085
+ numIceConnected: number;
1086
+ numIceRestart: number;
1087
+ numIceNoPublicIpGathered: number;
1088
+ numIceNoPublicIpGatheredIn3sec: number;
1089
+ numIceIpv6Seen: number;
1090
+ numIceIpv6TeredoSeen: number;
1091
+ numIceIpv6SixToFour: number;
1092
+ numIceMdnsSeen: number;
1083
1093
  };
1084
- type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
1094
+ type P2PAnalyticMetric = keyof P2PAnalytics;
1085
1095
  type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
1086
1096
  declare class P2pRtcManager implements RtcManager {
1087
1097
  _selfId: any;
@@ -1112,9 +1122,6 @@ declare class P2pRtcManager implements RtcManager {
1112
1122
  _mediaserverConfigTtlSeconds: any;
1113
1123
  _fetchMediaServersTimer: any;
1114
1124
  _wasScreenSharing: any;
1115
- ipv6HostCandidateTeredoSeen: any;
1116
- ipv6HostCandidate6to4Seen: any;
1117
- mdnsHostCandidateSeen: any;
1118
1125
  _stoppedVideoTrack: any;
1119
1126
  icePublicIPGatheringTimeoutID: any;
1120
1127
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
@@ -1240,11 +1247,6 @@ declare class RtcManagerDispatcher {
1240
1247
  declare const _default: {
1241
1248
  CAMERA_NOT_WORKING: string;
1242
1249
  CONNECTION_BLOCKED_BY_NETWORK: string;
1243
- ICE_IPV6_SEEN: string;
1244
- ICE_MDNS_SEEN: string;
1245
- ICE_NO_PUBLIC_IP_GATHERED: string;
1246
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: string;
1247
- ICE_RESTART: string;
1248
1250
  MICROPHONE_NOT_WORKING: string;
1249
1251
  MICROPHONE_STOPPED_WORKING: string;
1250
1252
  CAMERA_STOPPED_WORKING: string;
@@ -1500,6 +1502,7 @@ type VegaAnalytics = {
1500
1502
  vegaIceRestarts: number;
1501
1503
  vegaIceRestartMissingTransport: number;
1502
1504
  vegaIceRestartWrongTransportId: number;
1505
+ vegaNonErrorRejectionValueGUMError: number;
1503
1506
  };
1504
1507
 
1505
1508
  type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
package/dist/index.d.ts CHANGED
@@ -1080,8 +1080,18 @@ declare function fromLocation({ host, protocol }?: {
1080
1080
 
1081
1081
  type P2PAnalytics = {
1082
1082
  P2PReplaceTrackNoPC: number;
1083
+ P2PNonErrorRejectionValueGUMError: number;
1084
+ numNewPc: number;
1085
+ numIceConnected: number;
1086
+ numIceRestart: number;
1087
+ numIceNoPublicIpGathered: number;
1088
+ numIceNoPublicIpGatheredIn3sec: number;
1089
+ numIceIpv6Seen: number;
1090
+ numIceIpv6TeredoSeen: number;
1091
+ numIceIpv6SixToFour: number;
1092
+ numIceMdnsSeen: number;
1083
1093
  };
1084
- type P2PAnalyticMetric = "P2PReplaceTrackNoPC";
1094
+ type P2PAnalyticMetric = keyof P2PAnalytics;
1085
1095
  type P2PIncrementAnalyticMetric = (metric: P2PAnalyticMetric) => void;
1086
1096
  declare class P2pRtcManager implements RtcManager {
1087
1097
  _selfId: any;
@@ -1112,9 +1122,6 @@ declare class P2pRtcManager implements RtcManager {
1112
1122
  _mediaserverConfigTtlSeconds: any;
1113
1123
  _fetchMediaServersTimer: any;
1114
1124
  _wasScreenSharing: any;
1115
- ipv6HostCandidateTeredoSeen: any;
1116
- ipv6HostCandidate6to4Seen: any;
1117
- mdnsHostCandidateSeen: any;
1118
1125
  _stoppedVideoTrack: any;
1119
1126
  icePublicIPGatheringTimeoutID: any;
1120
1127
  _videoTrackBeingMonitored?: CustomMediaStreamTrack;
@@ -1240,11 +1247,6 @@ declare class RtcManagerDispatcher {
1240
1247
  declare const _default: {
1241
1248
  CAMERA_NOT_WORKING: string;
1242
1249
  CONNECTION_BLOCKED_BY_NETWORK: string;
1243
- ICE_IPV6_SEEN: string;
1244
- ICE_MDNS_SEEN: string;
1245
- ICE_NO_PUBLIC_IP_GATHERED: string;
1246
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: string;
1247
- ICE_RESTART: string;
1248
1250
  MICROPHONE_NOT_WORKING: string;
1249
1251
  MICROPHONE_STOPPED_WORKING: string;
1250
1252
  CAMERA_STOPPED_WORKING: string;
@@ -1500,6 +1502,7 @@ type VegaAnalytics = {
1500
1502
  vegaIceRestarts: number;
1501
1503
  vegaIceRestartMissingTransport: number;
1502
1504
  vegaIceRestartWrongTransportId: number;
1505
+ vegaNonErrorRejectionValueGUMError: number;
1503
1506
  };
1504
1507
 
1505
1508
  type MediaStreamWhichMayHaveInboundId = MediaStream & { inboundId?: string };
package/dist/index.mjs CHANGED
@@ -2581,11 +2581,6 @@ class RtcStream {
2581
2581
  var rtcManagerEvents = {
2582
2582
  CAMERA_NOT_WORKING: "camera_not_working",
2583
2583
  CONNECTION_BLOCKED_BY_NETWORK: "connection_blocked_by_network",
2584
- ICE_IPV6_SEEN: "ice_ipv6_seen",
2585
- ICE_MDNS_SEEN: "ice_mdns_seen",
2586
- ICE_NO_PUBLIC_IP_GATHERED: "ice_no_public_ip_gathered",
2587
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: "ice_no_public_ip_gathered_3sec",
2588
- ICE_RESTART: "ice_restart",
2589
2584
  MICROPHONE_NOT_WORKING: "microphone_not_working",
2590
2585
  MICROPHONE_STOPPED_WORKING: "microphone_stopped_working",
2591
2586
  CAMERA_STOPPED_WORKING: "camera_stopped_working",
@@ -2654,6 +2649,16 @@ class P2pRtcManager {
2654
2649
  this.totalSessionsCreated = 0;
2655
2650
  this.analytics = {
2656
2651
  P2PReplaceTrackNoPC: 0,
2652
+ P2PNonErrorRejectionValueGUMError: 0,
2653
+ numNewPc: 0,
2654
+ numIceConnected: 0,
2655
+ numIceRestart: 0,
2656
+ numIceNoPublicIpGathered: 0,
2657
+ numIceNoPublicIpGatheredIn3sec: 0,
2658
+ numIceIpv6Seen: 0,
2659
+ numIceIpv6TeredoSeen: 0,
2660
+ numIceIpv6SixToFour: 0,
2661
+ numIceMdnsSeen: 0,
2657
2662
  };
2658
2663
  }
2659
2664
  numberOfPeerconnections() {
@@ -2883,6 +2888,9 @@ class P2pRtcManager {
2883
2888
  previous: previousStatus,
2884
2889
  });
2885
2890
  }, 0);
2891
+ if (newStatus === TYPES.CONNECTION_SUCCESSFUL) {
2892
+ this.analytics.numIceConnected++;
2893
+ }
2886
2894
  }
2887
2895
  _setJitterBufferTarget(pc) {
2888
2896
  try {
@@ -2997,6 +3005,7 @@ class P2pRtcManager {
2997
3005
  clientId,
2998
3006
  });
2999
3007
  setTimeout(() => this._emit(rtcManagerEvents.NEW_PC), 0);
3008
+ this.analytics.numNewPc++;
3000
3009
  pc.ontrack = (event) => {
3001
3010
  const stream = event.streams[0];
3002
3011
  if (stream.id === "default" && stream.getAudioTracks().length === 0) {
@@ -3264,10 +3273,10 @@ class P2pRtcManager {
3264
3273
  session.serverReflexiveCandidateSeen = false;
3265
3274
  session.publicHostCandidateSeen = false;
3266
3275
  session.ipv6HostCandidateSeen = false;
3267
- this.ipv6HostCandidateTeredoSeen = false;
3268
- this.ipv6HostCandidate6to4Seen = false;
3269
- this.mdnsHostCandidateSeen = false;
3270
- this._emit(rtcManagerEvents.ICE_RESTART);
3276
+ session.ipv6HostCandidateTeredoSeen = false;
3277
+ session.ipv6HostCandidate6to4Seen = false;
3278
+ session.mdnsHostCandidateSeen = false;
3279
+ this.analytics.numIceRestart++;
3271
3280
  this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
3272
3281
  }
3273
3282
  }
@@ -3421,7 +3430,7 @@ class P2pRtcManager {
3421
3430
  !session.relayCandidateSeen &&
3422
3431
  !session.serverReflexiveCandidateSeen) {
3423
3432
  if (pc.iceConnectionState !== "connected" || pc.iceConnectionState !== "completed")
3424
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED_3SEC);
3433
+ this.analytics.numIceNoPublicIpGatheredIn3sec++;
3425
3434
  }
3426
3435
  }, ICE_PUBLIC_IP_GATHERING_TIMEOUT);
3427
3436
  break;
@@ -3469,15 +3478,11 @@ class P2pRtcManager {
3469
3478
  }
3470
3479
  break;
3471
3480
  case "srflx":
3472
- if (!session.serverReflexiveCandidateSeen) {
3473
- session.serverReflexiveCandidateSeen = true;
3474
- }
3481
+ session.serverReflexiveCandidateSeen = true;
3475
3482
  break;
3476
3483
  case "relay":
3477
3484
  case "relayed":
3478
- if (!session.relayCandidateSeen) {
3479
- session.relayCandidateSeen = true;
3480
- }
3485
+ session.relayCandidateSeen = true;
3481
3486
  break;
3482
3487
  }
3483
3488
  this._emitServerEvent(RELAY_MESSAGES.ICE_CANDIDATE, {
@@ -3494,16 +3499,17 @@ class P2pRtcManager {
3494
3499
  !session.serverReflexiveCandidateSeen &&
3495
3500
  pc.iceConnectionState !== "connected" &&
3496
3501
  pc.iceConnectionState !== "completed") {
3497
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED);
3502
+ this.analytics.numIceNoPublicIpGathered++;
3498
3503
  }
3499
3504
  if (session.ipv6HostCandidateSeen) {
3500
- this._emit(rtcManagerEvents.ICE_IPV6_SEEN, {
3501
- teredoSeen: session.ipv6HostCandidateTeredoSeen,
3502
- sixtofourSeen: session.ipv6HostCandidate6to4Seen,
3503
- });
3505
+ this.analytics.numIceIpv6Seen++;
3506
+ if (session.ipv6HostCandidate6to4Seen)
3507
+ this.analytics.numIceIpv6SixToFour++;
3508
+ if (session.ipv6HostCandidateTeredoSeen)
3509
+ this.analytics.numIceIpv6TeredoSeen++;
3504
3510
  }
3505
3511
  if (session.mdnsHostCandidateSeen)
3506
- this._emit(rtcManagerEvents.ICE_MDNS_SEEN);
3512
+ this.analytics.numIceMdnsSeen++;
3507
3513
  }
3508
3514
  };
3509
3515
  pc.onnegotiationneeded = () => {
@@ -3597,7 +3603,9 @@ class P2pRtcManager {
3597
3603
  if (!constraints) {
3598
3604
  return;
3599
3605
  }
3600
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
3606
+ navigator.mediaDevices
3607
+ .getUserMedia({ video: constraints })
3608
+ .then((stream) => {
3601
3609
  const track = stream.getVideoTracks()[0];
3602
3610
  localStream.addTrack(track);
3603
3611
  this._monitorVideoTrack(track);
@@ -3607,6 +3615,13 @@ class P2pRtcManager {
3607
3615
  screenShare: false,
3608
3616
  });
3609
3617
  this._handleStopOrResumeVideo({ enable, track });
3618
+ })
3619
+ .catch((e) => {
3620
+ if (!(e instanceof Error)) {
3621
+ this.analytics.P2PNonErrorRejectionValueGUMError++;
3622
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
3623
+ }
3624
+ throw e;
3610
3625
  });
3611
3626
  }
3612
3627
  }
@@ -4539,6 +4554,7 @@ class VegaRtcManager {
4539
4554
  vegaIceRestarts: 0,
4540
4555
  vegaIceRestartMissingTransport: 0,
4541
4556
  vegaIceRestartWrongTransportId: 0,
4557
+ vegaNonErrorRejectionValueGUMError: 0,
4542
4558
  };
4543
4559
  }
4544
4560
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
@@ -5535,7 +5551,9 @@ class VegaRtcManager {
5535
5551
  }
5536
5552
  else if (localStream.getVideoTracks().length === 0) {
5537
5553
  const constraints = this._webrtcProvider.getMediaConstraints().video;
5538
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
5554
+ navigator.mediaDevices
5555
+ .getUserMedia({ video: constraints })
5556
+ .then((stream) => {
5539
5557
  const track = stream.getVideoTracks()[0];
5540
5558
  localStream.addTrack(track);
5541
5559
  this._monitorVideoTrack(track);
@@ -5545,6 +5563,13 @@ class VegaRtcManager {
5545
5563
  screenShare: false,
5546
5564
  });
5547
5565
  this._handleStopOrResumeVideo({ enable, track });
5566
+ })
5567
+ .catch((e) => {
5568
+ if (!(e instanceof Error)) {
5569
+ this.analytics.vegaNonErrorRejectionValueGUMError++;
5570
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
5571
+ }
5572
+ throw e;
5548
5573
  });
5549
5574
  }
5550
5575
  }
@@ -2581,11 +2581,6 @@ class RtcStream {
2581
2581
  var rtcManagerEvents = {
2582
2582
  CAMERA_NOT_WORKING: "camera_not_working",
2583
2583
  CONNECTION_BLOCKED_BY_NETWORK: "connection_blocked_by_network",
2584
- ICE_IPV6_SEEN: "ice_ipv6_seen",
2585
- ICE_MDNS_SEEN: "ice_mdns_seen",
2586
- ICE_NO_PUBLIC_IP_GATHERED: "ice_no_public_ip_gathered",
2587
- ICE_NO_PUBLIC_IP_GATHERED_3SEC: "ice_no_public_ip_gathered_3sec",
2588
- ICE_RESTART: "ice_restart",
2589
2584
  MICROPHONE_NOT_WORKING: "microphone_not_working",
2590
2585
  MICROPHONE_STOPPED_WORKING: "microphone_stopped_working",
2591
2586
  CAMERA_STOPPED_WORKING: "camera_stopped_working",
@@ -2654,6 +2649,16 @@ class P2pRtcManager {
2654
2649
  this.totalSessionsCreated = 0;
2655
2650
  this.analytics = {
2656
2651
  P2PReplaceTrackNoPC: 0,
2652
+ P2PNonErrorRejectionValueGUMError: 0,
2653
+ numNewPc: 0,
2654
+ numIceConnected: 0,
2655
+ numIceRestart: 0,
2656
+ numIceNoPublicIpGathered: 0,
2657
+ numIceNoPublicIpGatheredIn3sec: 0,
2658
+ numIceIpv6Seen: 0,
2659
+ numIceIpv6TeredoSeen: 0,
2660
+ numIceIpv6SixToFour: 0,
2661
+ numIceMdnsSeen: 0,
2657
2662
  };
2658
2663
  }
2659
2664
  numberOfPeerconnections() {
@@ -2883,6 +2888,9 @@ class P2pRtcManager {
2883
2888
  previous: previousStatus,
2884
2889
  });
2885
2890
  }, 0);
2891
+ if (newStatus === TYPES.CONNECTION_SUCCESSFUL) {
2892
+ this.analytics.numIceConnected++;
2893
+ }
2886
2894
  }
2887
2895
  _setJitterBufferTarget(pc) {
2888
2896
  try {
@@ -2997,6 +3005,7 @@ class P2pRtcManager {
2997
3005
  clientId,
2998
3006
  });
2999
3007
  setTimeout(() => this._emit(rtcManagerEvents.NEW_PC), 0);
3008
+ this.analytics.numNewPc++;
3000
3009
  pc.ontrack = (event) => {
3001
3010
  const stream = event.streams[0];
3002
3011
  if (stream.id === "default" && stream.getAudioTracks().length === 0) {
@@ -3264,10 +3273,10 @@ class P2pRtcManager {
3264
3273
  session.serverReflexiveCandidateSeen = false;
3265
3274
  session.publicHostCandidateSeen = false;
3266
3275
  session.ipv6HostCandidateSeen = false;
3267
- this.ipv6HostCandidateTeredoSeen = false;
3268
- this.ipv6HostCandidate6to4Seen = false;
3269
- this.mdnsHostCandidateSeen = false;
3270
- this._emit(rtcManagerEvents.ICE_RESTART);
3276
+ session.ipv6HostCandidateTeredoSeen = false;
3277
+ session.ipv6HostCandidate6to4Seen = false;
3278
+ session.mdnsHostCandidateSeen = false;
3279
+ this.analytics.numIceRestart++;
3271
3280
  this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
3272
3281
  }
3273
3282
  }
@@ -3421,7 +3430,7 @@ class P2pRtcManager {
3421
3430
  !session.relayCandidateSeen &&
3422
3431
  !session.serverReflexiveCandidateSeen) {
3423
3432
  if (pc.iceConnectionState !== "connected" || pc.iceConnectionState !== "completed")
3424
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED_3SEC);
3433
+ this.analytics.numIceNoPublicIpGatheredIn3sec++;
3425
3434
  }
3426
3435
  }, ICE_PUBLIC_IP_GATHERING_TIMEOUT);
3427
3436
  break;
@@ -3469,15 +3478,11 @@ class P2pRtcManager {
3469
3478
  }
3470
3479
  break;
3471
3480
  case "srflx":
3472
- if (!session.serverReflexiveCandidateSeen) {
3473
- session.serverReflexiveCandidateSeen = true;
3474
- }
3481
+ session.serverReflexiveCandidateSeen = true;
3475
3482
  break;
3476
3483
  case "relay":
3477
3484
  case "relayed":
3478
- if (!session.relayCandidateSeen) {
3479
- session.relayCandidateSeen = true;
3480
- }
3485
+ session.relayCandidateSeen = true;
3481
3486
  break;
3482
3487
  }
3483
3488
  this._emitServerEvent(RELAY_MESSAGES.ICE_CANDIDATE, {
@@ -3494,16 +3499,17 @@ class P2pRtcManager {
3494
3499
  !session.serverReflexiveCandidateSeen &&
3495
3500
  pc.iceConnectionState !== "connected" &&
3496
3501
  pc.iceConnectionState !== "completed") {
3497
- this._emit(rtcManagerEvents.ICE_NO_PUBLIC_IP_GATHERED);
3502
+ this.analytics.numIceNoPublicIpGathered++;
3498
3503
  }
3499
3504
  if (session.ipv6HostCandidateSeen) {
3500
- this._emit(rtcManagerEvents.ICE_IPV6_SEEN, {
3501
- teredoSeen: session.ipv6HostCandidateTeredoSeen,
3502
- sixtofourSeen: session.ipv6HostCandidate6to4Seen,
3503
- });
3505
+ this.analytics.numIceIpv6Seen++;
3506
+ if (session.ipv6HostCandidate6to4Seen)
3507
+ this.analytics.numIceIpv6SixToFour++;
3508
+ if (session.ipv6HostCandidateTeredoSeen)
3509
+ this.analytics.numIceIpv6TeredoSeen++;
3504
3510
  }
3505
3511
  if (session.mdnsHostCandidateSeen)
3506
- this._emit(rtcManagerEvents.ICE_MDNS_SEEN);
3512
+ this.analytics.numIceMdnsSeen++;
3507
3513
  }
3508
3514
  };
3509
3515
  pc.onnegotiationneeded = () => {
@@ -3597,7 +3603,9 @@ class P2pRtcManager {
3597
3603
  if (!constraints) {
3598
3604
  return;
3599
3605
  }
3600
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
3606
+ navigator.mediaDevices
3607
+ .getUserMedia({ video: constraints })
3608
+ .then((stream) => {
3601
3609
  const track = stream.getVideoTracks()[0];
3602
3610
  localStream.addTrack(track);
3603
3611
  this._monitorVideoTrack(track);
@@ -3607,6 +3615,13 @@ class P2pRtcManager {
3607
3615
  screenShare: false,
3608
3616
  });
3609
3617
  this._handleStopOrResumeVideo({ enable, track });
3618
+ })
3619
+ .catch((e) => {
3620
+ if (!(e instanceof Error)) {
3621
+ this.analytics.P2PNonErrorRejectionValueGUMError++;
3622
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
3623
+ }
3624
+ throw e;
3610
3625
  });
3611
3626
  }
3612
3627
  }
@@ -4539,6 +4554,7 @@ class VegaRtcManager {
4539
4554
  vegaIceRestarts: 0,
4540
4555
  vegaIceRestartMissingTransport: 0,
4541
4556
  vegaIceRestartWrongTransportId: 0,
4557
+ vegaNonErrorRejectionValueGUMError: 0,
4542
4558
  };
4543
4559
  }
4544
4560
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, sfuServers, mediaserverConfigTtlSeconds, }) {
@@ -5535,7 +5551,9 @@ class VegaRtcManager {
5535
5551
  }
5536
5552
  else if (localStream.getVideoTracks().length === 0) {
5537
5553
  const constraints = this._webrtcProvider.getMediaConstraints().video;
5538
- navigator.mediaDevices.getUserMedia({ video: constraints }).then((stream) => {
5554
+ navigator.mediaDevices
5555
+ .getUserMedia({ video: constraints })
5556
+ .then((stream) => {
5539
5557
  const track = stream.getVideoTracks()[0];
5540
5558
  localStream.addTrack(track);
5541
5559
  this._monitorVideoTrack(track);
@@ -5545,6 +5563,13 @@ class VegaRtcManager {
5545
5563
  screenShare: false,
5546
5564
  });
5547
5565
  this._handleStopOrResumeVideo({ enable, track });
5566
+ })
5567
+ .catch((e) => {
5568
+ if (!(e instanceof Error)) {
5569
+ this.analytics.vegaNonErrorRejectionValueGUMError++;
5570
+ e = new Error(`non-error gUM rejection value: ${JSON.stringify(e)}`);
5571
+ }
5572
+ throw e;
5548
5573
  });
5549
5574
  }
5550
5575
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whereby.com/media",
3
3
  "description": "Media library for Whereby",
4
- "version": "2.6.5",
4
+ "version": "2.6.7",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {