Scan a QR code and decode it using p:photoCam

后端 未结 1 1523
野的像风
野的像风 2020-12-22 02:19

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

相关标签:
1条回答
  • 2020-12-22 02:45

    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

    0 讨论(0)
提交回复
热议问题