play-pause music by a foot switch in a website
Set up the foot switch as a USB HID keyboard device. Then you don't have to change anything compared to the keyboard you already know how to interact with.

There would be no difference in electronics between what you want, and a keyboard. The foot switch is just physically different shape than a keyboard key.