Image capture issues on web client
This page describes edge cases related to the Smile ID browser based tools and how to solve them.
Problem - Device not supported
On some devices using the Web Client(s), we are unable to capture proper images. When we attempt to, we get green or black images. This is a known issue that primarily affects old Android devices.
A version of the chromium engine, shipped with a regression that breaks the WebRTC video stream we use to capture images. This bug was caused by Hardware Accelerated Video Decoding. While this is a setting end users can attempt to change, we do not believe most of our end users have the technical know-how to fix this themselves. References - Chromium Bug Report
Solution
We check the number of colours in the image in the component, and display an error screen when we detect that the image won't work within our systems.
\
Version with fix
This fix has been automatically applied in our Web Integration (iframe embed), and Smile Links. However, if you're using the Javascript SDK, the update is available on v1.0.2 upwards.
Problem - Camera not loading
In some situations, it is required that the web client (Javascript SDK, Hosted Web Integration, or Smile links) is loaded in an iframe on your website.
While this is trivial to accomplish, there are times when the camera from the component does not display and/or does not provide an option for granting camera usage permissions and the browser therefore blocks the use of the camera. This is due to how web browsers handle camera permissions in nested iframes. Without the correct settings, the browser won’t allow access to the camera, even if permissions are generally enabled.
Solution
In order to proceed, explicit permission needs to be granted for the component to display properly in the browser.
To ensure that the camera works when integrating Smile ID in a browser (Javascript SDK, Hosted Web Integration, or Smile links) inside an iframe add the allow
attribute to all levels of the iframe that contains the Smile ID component. This attribute tells the browser that camera access should be allowed.
See some sample snippets for iframe usage below:
To allow for all domains:
<iframe src ="https://links.usesmileid.com/xxx" allow="camera *"></iframe>
To allow for specific domains:
<iframe src ="https://links.usesmileid.com/xxx" allow="camera https://www.domain.one https://www.domain.two"></iframe>
You can find more technical context on this setup in the MDN documentation here.
Problem - Camera loading in full screen in webView
There are times when the camera of a web component loads up in full screen without the rest of the page. This then makes it difficult to capture an image successfully. This is due to the way mobile devices handles browser based camera inside webView.
Solution
You have to handle inline media playback, and set the configuration to true. This allows the camera view to play inline within the webView rather than forcing a fullscreen playback.
class _WebViewScreenState extends State<WebViewScreen> {
late final WebViewController _controller;
@override
void initState() {
super.initState();
//target the platform where webview will be used (iOS/Android)
late final PlatformWebViewControllerCreationParams params;
if (WebViewPlatform.instance is WebKitWebViewPlatform) {
//iOS
params = WebKitWebViewControllerCreationParams(
allowsInlineMediaPlayback: true,
mediaTypesRequiringUserAction: const <PlaybackMediaTypes>{},
);
} else {
//android
params = const PlatformWebViewControllerCreationParams();
}
//initialize the controller
_controller = WebViewController.fromPlatformCreationParams(params)
..loadRequest(Uri.parse('https://url-to-your-smile-id-web-component/'));
}
...
...
//now use the _controller in your widget
//WebViewWidget(controller: _controller)
}
Please see the flutter webview documentation here
Last updated
Was this helpful?