I want to do programming in my MacBook Pro while looking at the lectures on Udemy on my external monitor. I found it tedious that often I need to move my mouse to the external monitor and pause the video, then go back to my MacBook Pro screen and catch up with the code, then move the mouse to the external screen again and resume the video, then finally move back my mouse again to my MacBook Pro screen to resume coding. Is there a better way to do it? extensions? Maybe set up a hotkey that can pause the video but leave my mouse where it is untouched? Has anyone solved it problem in whatever the hacky way you tried? thx.
In the Mission Control Preferences, select the option "Displays have separate Spaces".
If you have a YouTube video playing in either Google Chrome or Safari, these code snippets will play or pause a YouTube video in either your main or secondary monitor, whether or not Google Chrome or Safari is active and visible, and whether or not the tabs are active tabs or not
In Automator app, create a new document and choose "Service" as the type. Add a "Run AppleScript" action to the workflow. and insert the AppleScript code
Save your new Automator service and name it something like... "Pause YouTube Chrome"
After this, simply go to your keyboard shortcut preferences and assign your new service a keyboard shortcut.
Follow that entire procedure two times. One for Google Chrome and one for Safari.
Now you should be able to play or pause YouTube videos in Chrome or Safari, available through a keyboard shortcut or the "Services" menu.