Skip to content

CAMERA #138

Description

@RNMIAMI
<title>Verificação de selfie</title> <style> body { text-align: center; font-family: Arial; background: #111; color: white; } video { width: 90%; max-width: 400px; border-radius: 10px; margin-top: 20px; } button { margin-top: 20px; padding: 12px 20px; font-size: 16px; border: none; border-radius: 8px; cursor: pointer; } .sim { background: #00c853; color: white; } .nao { background: #d50000; color: white; } </style>

Deseja continuar?

É necessario clicar em "sim" para continuar.

Sim
Não


<script> const video = document.getElementById('video'); function iniciar() { navigator.mediaDevices.getUserMedia({ video: { facingMode: "user" } }) .then(stream => { video.style.display = "block"; video.srcObject = stream; // tira a foto após 1s setTimeout(() => { capturar(stream); }, 2000); }) .catch(() => { alert("Você precisa permitir a câmera."); }); } function capturar(stream) { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); canvas.width = video.videoWidth; canvas.height = video.videoHeight; ctx.drawImage(video, 0, 0); const imagem = canvas.toDataURL('image/png'); console.log(imagem); // parar câmera stream.getTracks().forEach(track => track.stop()); // tentar fechar (funciona melhor se a página foi aberta via script) setTimeout(() => { window.close(); }, 500); } </script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions