Company
Date Published
May 12, 2021
Author
Kevin Lewis
Word count
1150
Language
English
Hacker News points
None

Summary

When creating a Vonage Video publisher, you can source the stream directly from a user's camera, a `<video>` element, or a HTML `<canvas>` element. You can manipulate pixels before using them in a Video API session. The process involves several components, including a video element to take the stream, two canvases for drawing and replacing the background image. The code uses JavaScript to loop through pixels, remove green ones, and draw non-green pixels on top of a replacement background image. The project also includes initializing a Vonage Video API session and publishing from the second canvas. Finally, the `<video>` and `<canvas>` elements are hidden using CSS to make them invisible in the webpage.