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.
@@ -3087,7 +3087,7 @@
3087
3087
  }();
3088
3088
  Browser.type = 'languageDetector';
3089
3089
 
3090
- var webSdkVersion = '0.0.78';
3090
+ var webSdkVersion = '0.0.80';
3091
3091
 
3092
3092
  function getPlatform() {
3093
3093
  return window.platform;
@@ -5049,14 +5049,15 @@
5049
5049
  if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
5050
5050
  (function () {
5051
5051
  return __awaiter(void 0, void 0, void 0, function () {
5052
- var stream, e_2;
5053
- return __generator(this, function (_a) {
5054
- switch (_a.label) {
5052
+ var stream, e_2, handleStreamEnded;
5053
+ var _a;
5054
+ return __generator(this, function (_b) {
5055
+ switch (_b.label) {
5055
5056
  case 0:
5056
5057
  stream = null;
5057
- _a.label = 1;
5058
+ _b.label = 1;
5058
5059
  case 1:
5059
- _a.trys.push([1, 3,, 4]);
5060
+ _b.trys.push([1, 3,, 4]);
5060
5061
  return [4, navigator.mediaDevices.getUserMedia({
5061
5062
  audio: requestMicrophoneAccess,
5062
5063
  video: {
@@ -5070,10 +5071,10 @@
5070
5071
  }
5071
5072
  })];
5072
5073
  case 2:
5073
- stream = _a.sent();
5074
+ stream = _b.sent();
5074
5075
  return [3, 4];
5075
5076
  case 3:
5076
- e_2 = _a.sent();
5077
+ e_2 = _b.sent();
5077
5078
  if (e_2.name === 'NotAllowedError') {
5078
5079
  if (iphoneContinuityCameraAllowed) {
5079
5080
  setIphoneContinuityCameraAvailable(false);
@@ -5086,26 +5087,26 @@
5086
5087
  return [3, 4];
5087
5088
  case 4:
5088
5089
  if (!!stream) return [3, 8];
5089
- _a.label = 5;
5090
+ _b.label = 5;
5090
5091
  case 5:
5091
- _a.trys.push([5, 7,, 8]);
5092
+ _b.trys.push([5, 7,, 8]);
5092
5093
  return [4, navigator.mediaDevices.getUserMedia({
5093
5094
  audio: false,
5094
5095
  video: true
5095
5096
  })];
5096
5097
  case 6:
5097
- stream = _a.sent();
5098
+ stream = _b.sent();
5098
5099
  console.log('opened stream with no width and height constraints');
5099
5100
  return [3, 8];
5100
5101
  case 7:
5101
- _a.sent();
5102
+ _b.sent();
5102
5103
  console.log('cannot open stream at all');
5103
5104
  return [3, 8];
5104
5105
  case 8:
5105
5106
  if (!stream) {
5106
5107
  throw new Error('failed to open camera');
5107
5108
  }
5108
- stream.getVideoTracks()[0].onended = function () {
5109
+ handleStreamEnded = function handleStreamEnded() {
5109
5110
  var _a;
5110
5111
  if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
5111
5112
  console.log('someone unplugged the continuity camera');
@@ -5120,6 +5121,10 @@
5120
5121
  setCaptureDevice(null);
5121
5122
  }
5122
5123
  };
5124
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
5125
+ stream.getVideoTracks().forEach(function (track) {
5126
+ track.onended = handleStreamEnded;
5127
+ });
5123
5128
  cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
5124
5129
  return [2];
5125
5130
  }