Would be better to avoid the duplicate checking of whether the message is 'headset-button-press'. Could check that upfront and then have separate blocks for 'playing' and '!playing'.

Also, '===' is preferred over '=='