idmission-web-sdk 2.2.161 → 2.2.163

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.161';
206
+ var webSdkVersion = '2.2.163';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3402,7 +3402,7 @@ function useFrameLoop(fn, _a) {
3402
3402
 
3403
3403
  function listAvailableCameras(facingMode_1) {
3404
3404
  return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
3405
- var cameraEnumerationStream, videoDevices;
3405
+ var cameraEnumerationStream, allDevices, allowedVideoDevices;
3406
3406
  if (requestMicAccess === void 0) {
3407
3407
  requestMicAccess = false;
3408
3408
  }
@@ -3423,7 +3423,8 @@ function listAvailableCameras(facingMode_1) {
3423
3423
  cameraEnumerationStream = _a.sent();
3424
3424
  return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
3425
3425
  case 2:
3426
- videoDevices = _a.sent().filter(function (_a) {
3426
+ allDevices = _a.sent();
3427
+ allowedVideoDevices = allDevices.filter(function (_a) {
3427
3428
  var kind = _a.kind,
3428
3429
  label = _a.label;
3429
3430
  return kind === 'videoinput' && !label.toLowerCase().includes('virtual');
@@ -3434,7 +3435,7 @@ function listAvailableCameras(facingMode_1) {
3434
3435
  track.stop();
3435
3436
  });
3436
3437
  cameraEnumerationStream = null;
3437
- return [2 /*return*/, videoDevices];
3438
+ return [2 /*return*/, allowedVideoDevices];
3438
3439
  }
3439
3440
  });
3440
3441
  });
@@ -3530,8 +3531,17 @@ var createCameraStore = function createCameraStore(config) {
3530
3531
  setConfig: function setConfig(config) {
3531
3532
  return set(config);
3532
3533
  },
3533
- onVideoMounted: function onVideoMounted() {
3534
- return set({
3534
+ onVideoMounted: function onVideoMounted(e) {
3535
+ var _a;
3536
+ var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
3537
+ if (!selectedVideoStreamId) return;
3538
+ var srcObject = e.currentTarget.srcObject;
3539
+ if (srcObject.id !== selectedVideoStreamId) {
3540
+ warn('camera tampering detected, reloading the page.');
3541
+ window.location.reload();
3542
+ return;
3543
+ }
3544
+ set({
3535
3545
  videoLoaded: true
3536
3546
  });
3537
3547
  },
@@ -3741,7 +3751,10 @@ var createCameraStore = function createCameraStore(config) {
3741
3751
  set({
3742
3752
  camera: null,
3743
3753
  cameraReady: false,
3744
- cameraAccessDenied: false
3754
+ cameraAccessDenied: false,
3755
+ videoDevice: null,
3756
+ videoStream: null,
3757
+ videoLoaded: false
3745
3758
  });
3746
3759
  return [2 /*return*/];
3747
3760
  });