Hi -ayusa-,
We understand your AirPods keep playing and pausing audio. We're happy to help.
We'd recommend checking the Settings for your AirPods. With the AirPods in your ears and connected to your device go to Settings > Bluetooth and tap on the Info button next to your AirPods. On the Settings page check to see if you currently have the Automatic Ear Detection option turned on. If you do, turn it off then test out the AirPods and see if you continue to have the same issue when playing audio.
Adjust the settings of your AirPods
We hope this helps. Take care!