My favorite and most used command while watching videos on my mac.
This code line triggers spacebar key, pausing or playing whatever running.
osascript -e 'tell application "System Events" to key code 49'
49 is the code related to spacebar, if you want to press any other keys look in the following link
https://eastmanreference.com/complete-list-of-applescript-key-codes