Advertisement
BrU32

JS Canvas Webcam Plus Zoom In Window SRC V1

Nov 2nd, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <style>
  6. body {
  7. background: black;
  8. color:#CCCCCC;
  9. }
  10. #c2 {
  11. background-image: url(foo.png);
  12. background-repeat: no-repeat;
  13. }
  14. div {
  15. float: left;
  16. border :1px solid #444444;
  17. padding:10px;
  18. margin: 10px;
  19. background:#3B3B3B;
  20. }
  21. </style>
  22. <script type="text/javascript;version=1.8" src="main.js"></script>
  23. </head>
  24.  
  25. <body onload="processor.Load()">
  26. <div>
  27. <video id="video" src="video.mp4" controls="true"/>
  28. </div>
  29. <div>
  30. <canvas id="c1" width="160" height="96"/>
  31. <canvas id="c2" width="160" height="96"/>
  32. </div>
  33. </body>
  34. </html>
  35.  
  36. <center>
  37. <body bgcolor="black">
  38. <video id="video" autoplay hidden>
  39. </video>
  40.  
  41. <canvas id="canvas" width="500" height="500"style="opacity:1.0;fillColor:black;">
  42. <script>
  43. var ii=1;
  44. var inn=prompt("Enter #:");
  45. var video = document.getElementById("video");
  46. var c = document.getElementById("c1");
  47. var ctx = c.getContext("2d");
  48. var i=0;
  49. var canvas = document.getElementById('canvas');
  50. var c2=document.getElementById('c2')
  51. var context = canvas.getContext('2d');
  52. var video = document.getElementById('video');
  53. var mediaConfig = { video: true,audio:true};
  54. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  55. video.src = this.window.URL.createObjectURL(stream);
  56. video.play();
  57. video.addEventListener("play", function() {i = window.setInterval(function() {
  58. canvas.style.opacity-=0.1;
  59. canvas.style.opacity=+Math.random()*.9;
  60. ctx.drawImage(video,1,1,ii++,ii++)},inn);
  61. }, false);
  62. });
  63. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement