How do I detect if HTML5 audio play/pause state has been changed outside of webpage?
问题 I have a web app that plays an HTML5 Audio stream of a radio station. I'm using jQuery to play/pause the audio and toggle the play/pause button like so: var playerStream = document.getElementById('player-stream'); $('section.player').hammer().on('tap','button.toggle-stream', function(event){ if (playerStream.paused) { playerStream.play(); $('button.toggle-stream').attr('data-icon','s'); } else { playerStream.pause(); $('button.toggle-stream').attr('data-icon','p'); } }); This all works great.