How to add extra output like buzzer into esp 32 cam

To learn about selecting and using pins, start with a simple example rather than all that code. This web site has over a hundred excellent and well explained ESP32 examples.

Keep in mind that you cannot connect arbitrary things to a pin. You must observe voltage and current restrictions. For example, connecting a naked speaker to an output pin can destroy the pin circuitry.

Also, on the ESP32-CAM, only certain pins are available, depending on which other things your program is doing, in addition to buzzing. Be sure to read the ESP32-CAM guide carefully.

Please post a link to the "buzzer" you plan to use.