idmission-web-sdk 2.2.43 → 2.2.44

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/sdk2.esm.js CHANGED
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.43';
206
+ var webSdkVersion = '2.2.44';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3501,13 +3501,14 @@ var createCameraStore = function createCameraStore(config) {
3501
3501
  handleStreamEnded = function handleStreamEnded() {
3502
3502
  if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
3503
3503
  debug('someone unplugged the continuity camera');
3504
- releaseCameraAccess();
3505
3504
  set({
3506
3505
  videoStream: null,
3507
3506
  videoDevice: null,
3507
+ cameraReady: false,
3508
3508
  iphoneContinuityCameraAvailable: false,
3509
3509
  iphoneContinuityCameraDenied: true
3510
3510
  });
3511
+ get().requestCameraAccess();
3511
3512
  } else {
3512
3513
  debug('someone unplugged the webcam');
3513
3514
  releaseCameraAccess();
@@ -3515,6 +3516,7 @@ var createCameraStore = function createCameraStore(config) {
3515
3516
  videoStream: null,
3516
3517
  videoDevice: null,
3517
3518
  videoLoaded: false,
3519
+ cameraReady: false,
3518
3520
  cameraAccessDenied: true
3519
3521
  });
3520
3522
  }
@@ -3577,7 +3579,7 @@ var createCameraStore = function createCameraStore(config) {
3577
3579
  },
3578
3580
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3579
3581
  return __awaiter(this, void 0, void 0, function () {
3580
- var stream;
3582
+ var stream_2;
3581
3583
  return __generator(this, function (_a) {
3582
3584
  switch (_a.label) {
3583
3585
  case 0:
@@ -3588,20 +3590,35 @@ var createCameraStore = function createCameraStore(config) {
3588
3590
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3589
3591
  audio: true,
3590
3592
  video: false
3591
- })];
3593
+ })
3594
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3595
+ // when the camera access is being requested. This delay is a workaround for that.
3596
+ ];
3592
3597
  case 2:
3593
- stream = _a.sent();
3594
- set({
3595
- audioStream: stream,
3596
- microphoneReady: true
3597
- });
3598
- stream.getAudioTracks().forEach(function (track) {
3599
- track.onended = function () {
3600
- set({
3601
- microphoneAccessDenied: true
3602
- });
3603
- };
3604
- });
3598
+ stream_2 = _a.sent();
3599
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3600
+ // when the camera access is being requested. This delay is a workaround for that.
3601
+ setTimeout(function () {
3602
+ set({
3603
+ audioStream: stream_2,
3604
+ microphoneReady: true,
3605
+ microphoneAccessDenied: false
3606
+ });
3607
+ stream_2.getAudioTracks().forEach(function (track) {
3608
+ track.onended = function () {
3609
+ return set({
3610
+ microphoneReady: false,
3611
+ microphoneAccessDenied: true
3612
+ });
3613
+ };
3614
+ track.onmute = function () {
3615
+ return set({
3616
+ microphoneReady: false,
3617
+ microphoneAccessDenied: true
3618
+ });
3619
+ };
3620
+ });
3621
+ }, 500);
3605
3622
  return [3 /*break*/, 4];
3606
3623
  case 3:
3607
3624
  _a.sent();
@@ -3632,10 +3649,10 @@ var createCameraStore = function createCameraStore(config) {
3632
3649
  });
3633
3650
  });
3634
3651
  if (config.requestAccessAutomatically) {
3635
- store.getState().requestCameraAccess();
3652
+ void store.getState().requestCameraAccess();
3636
3653
  }
3637
3654
  if (config.requireMicrophoneAccess) {
3638
- store.getState().requestMicrophoneAccess();
3655
+ void store.getState().requestMicrophoneAccess();
3639
3656
  }
3640
3657
  return _assign(_assign({}, store), {
3641
3658
  destroy: function destroy() {