I'm currently working on a progressive web app to play music (like Spotify or Google Play Music). I came upon a few things I'm not quite sure how to accomplish.
One of them is the feature that the music stopps playing as soon as the aux cable is removed from the phone. Is there a Javascript event or something similar I can attach an event handler to to dispatch the 'pause' action once the aux jack is removed?