BrU32

JS/CSS Canvas Webcam Grayscale SRC

Dec 11th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <style>
  2. video{
  3. filter: grayscale(100%);
  4. }
  5. </style>
  6. <center>
  7. <body bgcolor="black">
  8. <video id="video" width="500" height="500" autoplay></video>
  9. <canvas id="canvas" width="500" height="500"></canvas>
  10. </center>
  11. <script>
  12. var canvas = document.getElementById('canvas');
  13. var context = canvas.getContext('2d');
  14. var video = document.getElementById('video');
  15. var mediaConfig = {video:true,audio:true};
  16. navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {
  17. video.src = window.URL.createObjectURL(stream);
  18. video.play();
  19. });
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment