Skip to content

Commit 7114ced

Browse files
added v11.7.1
1 parent d109704 commit 7114ced

File tree

6 files changed

+113
-28
lines changed

6 files changed

+113
-28
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Acuant JavaScript Web SDK v11.7.0
1+
# Acuant JavaScript Web SDK v11.7.1
22

3-
**July 2022**
3+
**November 2022**
44

55
See [https://github.com/Acuant/JavascriptWebSDKV11/releases](https://github.com/Acuant/JavascriptWebSDKV11/releases) for release notes.
66

@@ -697,13 +697,17 @@ Starting and stopping Workers is a very slow operation, so you will see performa
697697

698698
## Known Issues/FAQ
699699

700+
1. iPhone 13 Pro, 13 Pro Max, 14 Pro, and 14 Pro Max struggle to focus at close distances when running iOS 16.
701+
702+
11.7.1 adds a workaround for this issue by having those devices capture from further away. This is a workaround for an issue in iOS 16. There is a more detailed explanation of both the issue and the workaround in the 11.7.1 section of the [Migration Details](docs/MigrationDetails.md). We have been in contact with Apple and they tell us that they are now aware of the issue and are looking into it.
703+
700704
1. iOS 15 has multiple issues that manifest themselves as GPU Highwater failures (ie system daemon used too much memory).
701705

702-
The reduced resolution of the camera in the latest version of the SDK has mitigated the issue. Unfortunately, because this is an iOS issue, we can’t provide a better solution other than reducing the capture resolution. This issue will be revisited in the next major iOS release to determine which changes have been made in that version.
706+
The reduced resolution of the camera in the latest version of the SDK has mitigated the issue. Unfortunately, because this is an iOS issue, we can’t provide a better solution other than reducing the capture resolution. This issue was fixed in iOS 16.
703707

704708
1. The camera preview has a low/throttled frame rate (as low as 10-15fps).
705709

706-
The frame rate is intentionally throttled because higher frame rates on iOS 15 can be unstable. For consistency, the frame rate is throttled on all devices. In our experience, the throttled frame rate is high enough to successfully perform Live Capture. We will continue to monitor this issue and will remove the throttle once we believe higher frame rates no longer cause instability.
710+
The frame rate is intentionally throttled because higher frame rates on iOS 15 can be unstable. For consistency, the frame rate is throttled on all devices. In our experience, the throttled frame rate is high enough to successfully perform Live Capture. We will continue to monitor this issue and will remove the throttle once we believe higher frame rates no longer cause instability. This throttling was removed in 11.7.1
707711

708712
1. Camera previews on iOS 15.0 and 15.1 can appear rotated
709713

app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
</head>
110110

111111
<body>
112-
<p id="desc"></p>
112+
<p id="desc">11.7.1</p>
113113
<div id="acuant-loader" class="row text-center" style="display:none;">
114114
<div class="col-md-12">
115115
<div class="loader" style="margin: 20% auto 0 auto"></div>

docs/MigrationDetails.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Migration Details JavaScript Web SDK
22

3+
## v11.7.1
4+
5+
v11.7.1 is backwards compatible. This section provides details about the focus issues in iOS 16 and tools for more in-depth implementations. If you are not interested in this information, you can ignore this section.
6+
7+
iOS 16 introduced issues that affect the iPhone 13 Pro, 13 Pro Max, 14 Pro, and 14 Pro Max. In the JS camera, iOS exposes only a generic front and back camera. Apple's implementation of this generic back camera always selects the same (non-near focus) camera on multi-camera devices and does not re-select when that camera fails to focus. As a result, we have no way to select a camera that can focus at short distances. Apple also did not implement zoom control for cameras in JS, nor a way to know the camera's minimum focus distance. We have contacted Apple about this issue. However, in the meantime, we have provided a workaround.
8+
9+
Forcing these devices to capture from farther away achieves adequate sharpness. Due to iOS 16's increased stability, we also were able to increase the capture resolution for the affected devices. As a result, even though these devices are capturing from farther away, the higher resolution results in a DPI similar to that of other devices. The main limitation to this workaround is the detection of the affected devices. Because modern browsers do not provide detailed information about the user's device inside of the UA, we have to use secondary characteristics to "fingerprint" these devices. The simplest method that results in a high success rate is to examine the device's viewport. If the viewport matches one of four hardcoded sizes, we instruct the device to run at a higher resolution and to capture from farther away.
10+
11+
This method, however, can occasionally result in false positives and false negatives. There are several devices (the iPhone 12, 12 Pro, 12 Pro Max, 13, and 14) that share a viewport size with the affected devices. As a result, those devices also will be instructed to capture from farther away. This behavior is not a major concern because those devices can still capture a sharp image with adequate DPI at this increased distance. Additionally, if one of the affected devices is running with an nonstandard viewport size, the device will not be detected and likely will be unable to focus. We consider this to be a rare edge case, but it is possible.
12+
13+
To help account for these cases, we provided the ability for the implementer to override this detection by setting one of the following cookies on the page:
14+
15+
`AcuantForceRegularCapture=true` forces the capture to proceed at a normal distance, while
16+
17+
`AcuantForceDistantCapture=true` forces the capture to use the far away capture.
18+
19+
If both cookies are set, `AcuantForceRegularCapture=true` takes priority. If, as an implementer, you have additional knowledge about the user's device, you can use the cookies to guarantee that the user is instructed to capture at the correct distance. You also can use the cookies to, for example, send a user to distant capture if the user has captured a blurry image several times. Or, prompt the user by asking whether the user's device is one of the affected ones, and then use the cookies to send the user to the correct capture flow.
20+
21+
On most devices manual capture also allows for capture of sharp, high resolution images, this is another alternative if a user is consistently getting low sharpness.
22+
23+
We are hopeful that Apple will resolve this issue so we can return all devices to the regular capture.
24+
25+
326
## v11.7.0
427

528
### AcuantCamera
@@ -177,7 +200,7 @@ Remove the old html elements (canvas and video) and replace them with a single d
177200

178201
<div id="acuant-camera"></div>
179202
180-
Most likely, you are already using a viewport meta tag for your Mobile page. Using a meta tag is now a requirement. If you dont use the tag, the device will render at a much higher resolution and cause frequent GPU and memory failures.
203+
Most likely, you are already using a viewport meta tag for your Mobile page. Using a meta tag is now a requirement. If you don't use the tag, the device will render at a much higher resolution and cause frequent GPU and memory failures.
181204

182205
<meta name="viewport" content="width=device-width, initial-scale=1">
183206

webSdk/AcuantCamera.js

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// eslint-disable-next-line no-unused-vars
2-
const AcuantCameraUI = (function () {
1+
// eslint-disable-next-line no-unused-vars, no-var
2+
var AcuantCameraUI = (function () {
33
'use strict';
44
let player = null;
55

@@ -39,7 +39,7 @@ const AcuantCameraUI = (function () {
3939
}
4040
};
4141

42-
const TRIGGER_TIME = 2000;
42+
const TRIGGER_TIME = 3000;
4343
const DETECT_TIME_THRESHOLD = 400;//slightly increased from 300,
4444
let minTime = Number.MAX_VALUE;
4545

@@ -486,9 +486,8 @@ const AcuantCameraUI = (function () {
486486

487487
})();
488488

489-
/* eslint-disable no-unused-vars */
490-
// eslint-disable-next-line no-redeclare
491-
const AcuantCamera = (function () {
489+
// eslint-disable-next-line no-unused-vars, no-var
490+
var AcuantCamera = (function () {
492491
'use strict';
493492
let player = null;
494493
let uiCanvas = null;
@@ -594,7 +593,8 @@ const AcuantCamera = (function () {
594593

595594
//This might help performance, especially on low end devices. Might be less important after apple fixes the ios 15 bug,
596595
// but right now we want to do as little redraws as possible to avoid GPU load.
597-
frameRate: { min: 10, ideal: 15, max: 15 }
596+
//20221110 update removing this as this did not seem to be relevant and might be negatively affecting firefox
597+
//frameRate: { min: 10, ideal: 15, max: 15 }
598598
}
599599
}
600600
};
@@ -603,8 +603,26 @@ const AcuantCamera = (function () {
603603
// I believe this is because the true ratio of the camera is 4:3 so this ratio means people do not need to get as close
604604
// to the id to get good dpi. Cameras might struggle to focus at very close angles.
605605
if (isIOS()) {
606-
config.primaryConstraints.video.aspectRatio = 4 / 3;
607-
config.primaryConstraints.video.width = { min: MAX_VIDEO_WIDTH_IOS, ideal: MAX_VIDEO_WIDTH_IOS };
606+
if (isDeviceAffectedByIOS16Issue()) {
607+
// ios devices dont support zoom, because why would they?!
608+
// config.primaryConstraints.video.zoom = 2;
609+
//need to instead bump resolution since we will be capturing from further away, ios 16 seems to have fixed the issue so hopefully alright.
610+
//also change aspect ratio to make it seem like the id is closer from user's pov.
611+
config.primaryConstraints.video.aspectRatio = Math.max(window.innerWidth, window.innerHeight) * 1.0 / Math.min(window.innerWidth, window.innerHeight);
612+
//unsure about the stability of pushing resolution this high, but I have not seen a crash thus far
613+
config.primaryConstraints.video.height = { min: 1440, ideal: 2880 };
614+
} else {
615+
//1.3333 aspect ratio and lower ideal height seems to result in better focus and higher dpi on ios devices.
616+
// I believe this is because the true ratio of the camera is 4:3 so this ratio means people do not need to get as close
617+
// to the id to get good dpi. Cameras might struggle to focus at very close angles.
618+
//20221110 update something like the ios 16 fix might work better for this, if we can detect those devices
619+
config.primaryConstraints.video.aspectRatio = 4 / 3;
620+
if (isiOS15()) {
621+
config.primaryConstraints.video.width = { min: MAX_VIDEO_WIDTH_IOS, ideal: MAX_VIDEO_WIDTH_IOS };
622+
} else {
623+
config.primaryConstraints.video.height = { min: 1440, ideal: 1440 };
624+
}
625+
}
608626
} else {
609627
config.primaryConstraints.video.height = { min: 1440, ideal: 1440 };
610628
if (isSamsungNote10OrS10OrNewer()) {
@@ -895,7 +913,7 @@ const AcuantCamera = (function () {
895913
width = image.width,
896914
height = image.height;
897915

898-
if (isIOS()) {
916+
if (isiOS15()) {
899917
MAX_WIDTH = MAX_VIDEO_WIDTH_IOS;
900918
MAX_HEIGHT = Math.floor(MAX_VIDEO_WIDTH_IOS * 3 / 4);
901919
}
@@ -1022,11 +1040,44 @@ const AcuantCamera = (function () {
10221040
return ver && ver != -1 && ver.length >= 2 && ver[0] == 14 && ver[1] >= 4;
10231041
}
10241042

1025-
function isiOS15Plus() {
1043+
function isiOS15() {
10261044
let ver = iOSversion();
10271045
return ver && ver != -1 && ver.length >= 1 && ver[0] == 15;
10281046
}
10291047

1048+
function isiOS16() {
1049+
let ver = iOSversion();
1050+
return ver && ver != -1 && ver.length >= 1 && ver[0] == 16
1051+
}
1052+
1053+
function isDeviceAffectedByIOS16Issue() {
1054+
let decodedCookie = decodeURIComponent(document.cookie);
1055+
if (decodedCookie.includes('AcuantForceRegularCapture=true')) {
1056+
return false;
1057+
}
1058+
if (decodedCookie.includes('AcuantForceDistantCapture=true')) {
1059+
return true;
1060+
}
1061+
if (isiOS16()) {
1062+
let dims = [screen.width, screen.height];
1063+
let long = Math.max(...dims);
1064+
let short = Math.min(...dims);
1065+
if (long == 852 && short == 393) { //14 pro
1066+
return true;
1067+
}
1068+
if (long == 932 && short == 430) { //14 pro max
1069+
return true;
1070+
}
1071+
if (long == 844 && short == 390) { //13 pro
1072+
return true;
1073+
}
1074+
if (long == 926 && short == 428) { //13 pro max
1075+
return true;
1076+
}
1077+
}
1078+
return false;
1079+
}
1080+
10301081
function isiPad13Plus() {
10311082
return navigator.maxTouchPoints && navigator.maxTouchPoints >= 2 && /MacIntel/.test(navigator.platform);
10321083
}
@@ -1260,13 +1311,6 @@ const AcuantCamera = (function () {
12601311
}
12611312
});
12621313

1263-
//cant seem to figure out the logic of the math here. Ideally if we get 600 dpi even far from the screen edges we
1264-
//should still mark it as an okay doc, but I tried a couple different things and could not get the theoretical dpi
1265-
//to match the real one.
1266-
//
1267-
//const dpi = response.dpi / userConfig.frameScale * userConfig.canvasScale;
1268-
//console.log("Response DPI: " + response.dpi + " Frame Scale: " + userConfig.frameScale + " Canvas Scale: " + userConfig.canvasScale + " Theoretical dpi: " + dpi)
1269-
12701314
const minRatio = Math.min(response.dimensions.width, response.dimensions.height) / Math.min(hiddenCanvas.width, hiddenCanvas.height);
12711315
const maxRatio = Math.max(response.dimensions.width, response.dimensions.height) / Math.max(hiddenCanvas.width, hiddenCanvas.height);
12721316
const isPassport = response.type == 2;
@@ -1282,7 +1326,21 @@ const AcuantCamera = (function () {
12821326
if (isIOS()) {
12831327
minRatioLowerBoundThreshold = 0.65;
12841328
maxRatioLowerBoundThreshold = 0.7;
1285-
if (isPassport) {
1329+
if (isDeviceAffectedByIOS16Issue()) {
1330+
if (isPassport) { //intentionally large to help address issues with cvml inaccuaretly detecting passports
1331+
minRatioUpperBoundThreshold = 0.72;
1332+
maxRatioUpperBoundThreshold = 0.77;
1333+
minRatioLowerBoundThreshold = 0.22;
1334+
maxRatioLowerBoundThreshold = 0.28;
1335+
// minRatioLowerBoundThreshold = 0.57;
1336+
// maxRatioLowerBoundThreshold = 0.53;
1337+
} else { //id
1338+
minRatioUpperBoundThreshold = 0.41;
1339+
maxRatioUpperBoundThreshold = 0.45;
1340+
minRatioLowerBoundThreshold = 0.22;
1341+
maxRatioLowerBoundThreshold = 0.28;
1342+
}
1343+
} else if (isPassport) {
12861344
minRatioUpperBoundThreshold = 0.95;
12871345
maxRatioUpperBoundThreshold = 1;
12881346
minRatioLowerBoundThreshold = 0.7;
@@ -1459,7 +1517,7 @@ const AcuantCamera = (function () {
14591517
}
14601518

14611519
function sequenceBreak() {
1462-
if (isiOS15Plus() || isiPad13Plus()) {
1520+
if (isiOS15() || isiPad13Plus()) {
14631521
callCameraError(SEQUENCE_BREAK_IOS_15, AcuantJavascriptWebSdk.SEQUENCE_BREAK_CODE);
14641522
} else {
14651523
callCameraError(SEQUENCE_BREAK_OTHER, AcuantJavascriptWebSdk.SEQUENCE_BREAK_CODE);

webSdk/AcuantCamera.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webSdk/AcuantJavascriptWebSdk.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)