Keyboard shortcut and sequence on one key

Hi everyone. I want to customize the media key (play/pause) to send to specific apps. When I press Play/Pause once it is sent to the first app, when I press 2 times to the second. How can I set a condition for a shortcut (delay for this doesn't work) so that it waits for a double press and if it doesn't happen, then it works?