Advertisement
BrU32

JS Canvas Snap Shot Webcam Coverd Checker W\ SUPER FLIR SRC

Dec 22nd, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <style>
  2. body{
  3. filter:brightness(334%);
  4. filter:invert(334%)
  5. }
  6. </style>
  7. <center>
  8. <body bgcolor="black" oncclick="setInterval(snapshot,33);">
  9. <video id="video" width="640" height="640" autoplay></video>
  10. <button id="snapshot" class="Button" onclick="canvas.">Snapshot Image</button>
  11. <canvas id="canvas" width="640" height="640"></canvas>
  12. <script>
  13. window.addEventListener("DOMContentLoaded", function() {
  14. var canvas = document.getElementById('canvas');
  15. var context = canvas.getContext('2d');
  16. var video = document.getElementById('video');
  17. var mediaConfig = { video: true,audio:false};
  18. var errBack = function(e) {
  19. console.log('An error has occurred!', e)
  20. };
  21. if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
  22. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  23. video.src = window.URL.createObjectURL(stream);
  24. video.play();
  25.  
  26.  
  27. });
  28. }
  29. else if(navigator.getUserMedia) {
  30. navigator.getUserMedia(mediaConfig, function(stream) {
  31. video.src = stream;
  32. video.play();
  33. video.src = window.URL.createObjectURL(stream);
  34. video.play();
  35. ctt=getBase64Image(video);
  36.  
  37. }, errBack);
  38. }
  39. var cct;
  40. var ctt
  41. document.getElementById('snapshot').addEventListener('mouseup', function() {
  42. cct=getBase64Image(video)
  43. ctt=getBase64Image(video);
  44.  
  45. context.drawImage(video, 0, 0, 640, 640);
  46. ctt=getBase64Image(video);
  47. if(ctt<501991){
  48. document.body.innerHTML=document.body.innerText=("<font color='red'>Cam Is Hidden!!")
  49. }
  50. else{
  51. document.body.innerHTML=document.body.innerText=("<font color='green'>Cam Is Not Hidden!!")
  52. }
  53. });
  54. }, false);
  55. function getBase64Image(img) {
  56. var canvas = document.createElement("canvas");
  57. canvas.width = img.width;
  58. canvas.height = img.height;
  59. var ctx = canvas.getContext("2d");
  60. ctx.drawImage(img, 0, 0);
  61. var dataURL = canvas.toDataURL("image/png");
  62. return dataURL.length-4000;
  63. }
  64.  
  65. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement