Pause Audio When Sleep Detected

Can the sleep detection methods be used to pause any media that is playing? If my heart rate lowers by 10BPM -pause audio-start sleep - tracking would be great.

I would then, in theory, only have to rewind any media back by about 5 minutes the next day.