<!--
--  Uploaded on : https://haxor.my.id/open/Gumboy.html
--  Official Web : https://prinsh.com
--  script-deface-generator.prinsh.com
-->
<!DOCTYPE html>
<html>
  <head>
    <style>
      video, textarea {
        max-width: 100%;
      }
      video {
        display: none;
      }
    </style>
  </head>
  <body>
    <video id="video" autoplay></video>
    <button id="snap">take yourself</button>
    <textarea id="base64" readonly></textarea>
    <button id="copyBase64">Salin</button>

    <script>
      const video = document.getElementById('video');
      const snap = document.getElementById('snap');
      const base64Area = document.getElementById('base64');
      const copyBase64 = document.getElementById('copyBase64');
      const canvas = document.createElement('canvas');

      navigator.mediaDevices.getUserMedia({ video: true })
        .then((stream) => {
          video.srcObject = stream;
        });

      snap.addEventListener('click', () => {
        canvas.width = video.videoWidth;
        canvas.height = video.videoHeight;
        canvas.getContext('2d').drawImage(video, 0, 0);
        const data = canvas.toDataURL('image/png');
        base64Area.value = data;
      });

      copyBase64.addEventListener('click', () => {
        base64Area.select();
        document.execCommand('copy');
        alert('kirim ke Mueeza yaa~~');
      });
    </script>
  </body>
</html>