idmission-web-sdk 2.2.43 → 2.2.45

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.43';
214
+ var webSdkVersion = '2.2.45';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9495,7 +9495,7 @@
9495
9495
  },
9496
9496
  requestCameraAccess: function requestCameraAccess() {
9497
9497
  return __awaiter(this, void 0, void 0, function () {
9498
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded, videoTrack_1, camera_1, e_3;
9498
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
9499
9499
  var _b, _c, _d;
9500
9500
  return __generator(this, function (_e) {
9501
9501
  switch (_e.label) {
@@ -9625,16 +9625,17 @@
9625
9625
  }
9626
9626
  debug('camera access granted with constraints', constraints);
9627
9627
  iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
9628
- handleStreamEnded = function handleStreamEnded() {
9628
+ handleStreamEnded_1 = function handleStreamEnded_1() {
9629
9629
  if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
9630
9630
  debug('someone unplugged the continuity camera');
9631
- releaseCameraAccess();
9632
9631
  set({
9633
9632
  videoStream: null,
9634
9633
  videoDevice: null,
9634
+ cameraReady: false,
9635
9635
  iphoneContinuityCameraAvailable: false,
9636
9636
  iphoneContinuityCameraDenied: true
9637
9637
  });
9638
+ get().requestCameraAccess();
9638
9639
  } else {
9639
9640
  debug('someone unplugged the webcam');
9640
9641
  releaseCameraAccess();
@@ -9642,23 +9643,19 @@
9642
9643
  videoStream: null,
9643
9644
  videoDevice: null,
9644
9645
  videoLoaded: false,
9646
+ cameraReady: false,
9645
9647
  cameraAccessDenied: true
9646
9648
  });
9647
9649
  }
9648
9650
  };
9649
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded);
9651
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
9650
9652
  videoTrack_1 = stream_1.getVideoTracks()[0];
9651
- videoTrack_1.onended = handleStreamEnded;
9653
+ videoTrack_1.onended = handleStreamEnded_1;
9652
9654
  camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
9653
9655
  // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
9654
9656
  // when the camera access is being requested. This delay is a workaround for that.
9655
9657
  setTimeout(function () {
9656
- videoTrack_1.onmute = function () {
9657
- set({
9658
- cameraAccessDenied: true,
9659
- cameraReady: false
9660
- });
9661
- };
9658
+ videoTrack_1.onmute = handleStreamEnded_1;
9662
9659
  set({
9663
9660
  camera: camera_1,
9664
9661
  cameraReady: true,
@@ -9704,7 +9701,7 @@
9704
9701
  },
9705
9702
  requestMicrophoneAccess: function requestMicrophoneAccess() {
9706
9703
  return __awaiter(this, void 0, void 0, function () {
9707
- var stream;
9704
+ var stream_2;
9708
9705
  return __generator(this, function (_a) {
9709
9706
  switch (_a.label) {
9710
9707
  case 0:
@@ -9715,20 +9712,35 @@
9715
9712
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
9716
9713
  audio: true,
9717
9714
  video: false
9718
- })];
9715
+ })
9716
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
9717
+ // when the camera access is being requested. This delay is a workaround for that.
9718
+ ];
9719
9719
  case 2:
9720
- stream = _a.sent();
9721
- set({
9722
- audioStream: stream,
9723
- microphoneReady: true
9724
- });
9725
- stream.getAudioTracks().forEach(function (track) {
9726
- track.onended = function () {
9727
- set({
9728
- microphoneAccessDenied: true
9729
- });
9730
- };
9731
- });
9720
+ stream_2 = _a.sent();
9721
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
9722
+ // when the camera access is being requested. This delay is a workaround for that.
9723
+ setTimeout(function () {
9724
+ set({
9725
+ audioStream: stream_2,
9726
+ microphoneReady: true,
9727
+ microphoneAccessDenied: false
9728
+ });
9729
+ stream_2.getAudioTracks().forEach(function (track) {
9730
+ track.onended = function () {
9731
+ return set({
9732
+ microphoneReady: false,
9733
+ microphoneAccessDenied: true
9734
+ });
9735
+ };
9736
+ track.onmute = function () {
9737
+ return set({
9738
+ microphoneReady: false,
9739
+ microphoneAccessDenied: true
9740
+ });
9741
+ };
9742
+ });
9743
+ }, 500);
9732
9744
  return [3 /*break*/, 4];
9733
9745
  case 3:
9734
9746
  _a.sent();
@@ -9759,10 +9771,10 @@
9759
9771
  });
9760
9772
  });
9761
9773
  if (config.requestAccessAutomatically) {
9762
- store.getState().requestCameraAccess();
9774
+ void store.getState().requestCameraAccess();
9763
9775
  }
9764
9776
  if (config.requireMicrophoneAccess) {
9765
- store.getState().requestMicrophoneAccess();
9777
+ void store.getState().requestMicrophoneAccess();
9766
9778
  }
9767
9779
  return _assign(_assign({}, store), {
9768
9780
  destroy: function destroy() {