Unable to play udemy using the play/pause button on any device
It's not your computer's fault. It's udemy
If you are using Chrome there is an extension named "Udemy Playback Control". It works for me.
Download the above extension.
Now you can do cmd+shift+2 to play and pause.
I suppose you are using a multi-screen setup and need this.
If you are using an external mouse or keyboard. You can use a macro function to create a shortcut for this key combination. I myself use a Logitech mouse and I created a macro in the Logitech G hub app. To play and pause with one key combination.
Below is the guide for Logitech hardware. You can find for your brand of equipment on Youtube.
MacBook Air, macOS 15.1