Pause on headphone removal

I watch TV shows while away with work.

My work location means I share a cabin with someone else.

I have a tendency to watch something when I get into bed and quite often fall asleep. This wouldn’t generally pose a problem, but, if I fall asleep and my headphones come out the video will continue to play with audio out loud.

Is there anyway to have it behave like the standard music player and pause the song if headphones are unplugged during playback?