I need to capture and read a QR Code while the camera is capturing, all of this in a JSF Application.
I have already read a QR Code in a photo, but for now I have to
PrimeFaces Extensions 9 will have a pe:codeScanner
component to scan bar and QR codes from a device camera.
<pe:codeScanner width="600"
height="400">
<p:ajax event="codeScanned"
listener="#{codeScannerController.onCodeScanned}"/>
</pe:codeScanner>
Source: https://github.com/primefaces-extensions/primefaces-extensions/blob/master/showcase/src/main/webapp/sections/codeScanner/example-basicUsage.xhtml
public void onCodeScanned(final SelectEvent<Code> event) {
final Code code = event.getObject();
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_INFO,
String.format("Scanned: %s (%s)", code.getValue(), code.getFormat()),
null));
}
Source: https://github.com/primefaces-extensions/primefaces-extensions/blob/master/showcase/src/main/java/org/primefaces/extensions/showcase/controller/codescanner/CodeScannerController.java