But I noticed it gives a random RBG value.
It is not random! It's RGB value from the pixel in the center. It may not be accurate because of the camera noise etc. So if you need better detection, you have to calculate an average color for an area of pixels.
You can take snapshots constantly, but you still have to wait for snapshot to finish. Saving a snapshot is not a fast operation, especially on large camera image. So you may not be able to detect moving objects with this method.
And if you need to detect a red object anywhere on the screen, this will be nearly impossible to make with events. I suggest you look for some JS library.