idmission-web-sdk 0.0.78 → 0.0.80

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.
@@ -50,7 +50,7 @@ var tf__namespace = /*#__PURE__*/_interopNamespace(tf);
50
50
  var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
51
51
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
52
 
53
- var webSdkVersion = '0.0.78';
53
+ var webSdkVersion = '0.0.80';
54
54
 
55
55
  function getPlatform() {
56
56
  return window.platform;
@@ -1422,14 +1422,15 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1422
1422
  if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
1423
1423
  (function () {
1424
1424
  return tslib.__awaiter(void 0, void 0, void 0, function () {
1425
- var stream, e_2;
1426
- return tslib.__generator(this, function (_a) {
1427
- switch (_a.label) {
1425
+ var stream, e_2, handleStreamEnded;
1426
+ var _a;
1427
+ return tslib.__generator(this, function (_b) {
1428
+ switch (_b.label) {
1428
1429
  case 0:
1429
1430
  stream = null;
1430
- _a.label = 1;
1431
+ _b.label = 1;
1431
1432
  case 1:
1432
- _a.trys.push([1, 3,, 4]);
1433
+ _b.trys.push([1, 3,, 4]);
1433
1434
  return [4, navigator.mediaDevices.getUserMedia({
1434
1435
  audio: requestMicrophoneAccess,
1435
1436
  video: {
@@ -1443,10 +1444,10 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1443
1444
  }
1444
1445
  })];
1445
1446
  case 2:
1446
- stream = _a.sent();
1447
+ stream = _b.sent();
1447
1448
  return [3, 4];
1448
1449
  case 3:
1449
- e_2 = _a.sent();
1450
+ e_2 = _b.sent();
1450
1451
  if (e_2.name === 'NotAllowedError') {
1451
1452
  if (iphoneContinuityCameraAllowed) {
1452
1453
  setIphoneContinuityCameraAvailable(false);
@@ -1459,26 +1460,26 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1459
1460
  return [3, 4];
1460
1461
  case 4:
1461
1462
  if (!!stream) return [3, 8];
1462
- _a.label = 5;
1463
+ _b.label = 5;
1463
1464
  case 5:
1464
- _a.trys.push([5, 7,, 8]);
1465
+ _b.trys.push([5, 7,, 8]);
1465
1466
  return [4, navigator.mediaDevices.getUserMedia({
1466
1467
  audio: false,
1467
1468
  video: true
1468
1469
  })];
1469
1470
  case 6:
1470
- stream = _a.sent();
1471
+ stream = _b.sent();
1471
1472
  console.log('opened stream with no width and height constraints');
1472
1473
  return [3, 8];
1473
1474
  case 7:
1474
- _a.sent();
1475
+ _b.sent();
1475
1476
  console.log('cannot open stream at all');
1476
1477
  return [3, 8];
1477
1478
  case 8:
1478
1479
  if (!stream) {
1479
1480
  throw new Error('failed to open camera');
1480
1481
  }
1481
- stream.getVideoTracks()[0].onended = function () {
1482
+ handleStreamEnded = function handleStreamEnded() {
1482
1483
  var _a;
1483
1484
  if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
1484
1485
  console.log('someone unplugged the continuity camera');
@@ -1493,6 +1494,10 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1493
1494
  setCaptureDevice(null);
1494
1495
  }
1495
1496
  };
1497
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
1498
+ stream.getVideoTracks().forEach(function (track) {
1499
+ track.onended = handleStreamEnded;
1500
+ });
1496
1501
  cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
1497
1502
  return [2];
1498
1503
  }