Better still a hardware switch.
https://jscholarship.library.jhu.edu/bitstream/handle/1774.2...
Just have the only positive voltage rail going to the camera be the same one that is directly powering the LED. The firmware will be turning this rail on and off, hence turning the camera and the LED on and off simultaneously.
Convince the firmware to use a lower voltage, one that doesn't hit the breakover voltage on the LED but still powers the camera.
Strobe the line, get snapshots without the LED doing more than very faintly glowing.
Your second idea is even more scary and realistic.
https://www.youtube.com/watch?v=Tyel1gfSjl4
Specifically around the 18:00 mark. Also he does provide source examples that you can ruin your computer with if you want.
He gets into a lot of it, but shows quite a few examples including what I'm talking about. The people that he catches aren't necessarily savvy, but he does talk about taking pictures fast enough for the light not to be visible.