• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources
Theme
Theme
Preset primefaces.THEME
Apple Liquid Glass style: translucent overlays, menus and bars that blur the page behind them, capsule buttons.
Color scheme color-scheme
Input style p-input-filled
Density data-p-density
Direction primefaces.DIR
Colors
Primary --p-primary-base
Surface --p-surface-*
Shape and motion
Button shape --p-button-border-radius
Shadows --p-*-shadow
Animations --p-transition-duration
Ripple --p-ripple-opacity
Border radius --p-border-radius-*
Typography
Focus ring
Form field
CSS
Only the tokens that differ from the preset.

                        
                    

PhotoCam

PhotoCam can use a specific device, like a USB camera or another onboard camera. The demo fills a select with the devices returned by the client side getAvailableDevices() method, sets the chosen one as device on the client and reloads the camera. On mobile devices "user" usually stands for the front camera and "environment" for the rear camera.

Photocam Tag Documentation



NameTypeRequiredDefaultDescription
No records found.
Loading...

Usage


<div class="card">
    <h:form>
        <div class="grid">
            <div class="col-12 md:col-6">
                <p:outputPanel id="photoCamPnl">
                    <p:photoCam ref="pc" listener="#{photoCamView.oncapture}" update="photo" styleClass="max-w-full"/>
                    <select onchange="reload()" class="photoCamDevices mt-3">
                        <option value="">Select device</option>
                        <option value="user">"user" device</option>
                        <option value="environment">"environment" device</option>
                    </select>
                </p:outputPanel>
                <p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" styleClass="mt-3"/>
            </div>
            <p:outputPanel id="photo" layout="block" styleClass="col-12 md:col-6">
                <p:graphicImage name="demo/images/photocam/#{photoCamView.filename}.jpeg"
                                rendered="#{not empty photoCamView.filename}" styleClass="max-w-full"/>
            </p:outputPanel>
        </div>
    </h:form>
</div>

<script>

    //<![CDATA[

    function reload() {
        var cam = PF('pc');
        var deviceSelector = document.querySelector("select.photoCamDevices");
        var device = deviceSelector.value;
        cam.device = device;
        cam.reload();
    }

    function populateDeviceMenu() {
        var photoCam = PF('pc');
        if (!photoCam) {
            setTimeout(populateDeviceMenu, 100);
            return;
        }
        var deviceSelector = document.querySelector("select.photoCamDevices");
        var availableDevices = photoCam.getAvailableDevices();
        if (availableDevices) {
            availableDevices.then(devices => {
                    while (deviceSelector.options.length > 3) {
                        deviceSelector.remove(3);
                    }
                    devices.forEach(device => {
                    var option = document.createElement("option");
                    option.text = device.label || device.deviceId;
                    option.value = device.deviceId;
                    deviceSelector.appendChild(option);
                });
            });
        } else {
            console.log("no devices available");
        }
    }
    document.addEventListener('DOMContentLoaded', function() {
        populateDeviceMenu();
    });
    //]]>

</script>