Use KeyEvent to do the job.
adb shell input keyevent 85
85
corresponds to KEYCODE_MEDIA_PLAY_PAUSE
. More keycodes can be found here or here.
Alternatively, if the activity featuring Play/Pause options is in foreground then you can do:
adb shell input touchscreen tap <X> <Y>
where <X>
and <Y>
are the coordinates of the tap that you would perform for Play/Pause using your fingers. See my answer here to know how to obtain them (step 1 and 2 under Instructions for Tasker and Xposed Additions).
Or, you can opt to completely kill the app using:
adb shell am force-stop <PKG_NAME>
Edit
Kitkat and above has the command media
whose usage goes as,
adb shell media dispatch KEY
KEY
can be play, pause, play-pause, mute, headsethook, stop, next, previous, rewind, record, fast-forword. (Source)