Apple Mobile Phone Touch screen automatically play music, Apple automatically play music
// Trigger the playing and pause of music to solve the problem that ios cannot play music automatically. var once = 1; (function () {$ ("body "). bind ('touchstart', function () {if (once = 1) {bmusic () ;}}) () function bmusic () {if (window. HTMLAudioElement) {try {var oAudio = document. getElementById ('myaudio'); var btn = document. getElementById ('play'); var audioURL = document. getElementById ('audiofile'); // Skip loading if current file hasn' t changed. if (audioURL. value! = CurrentFile) {oAudio. src = audioURL. value; currentFile = audioURL. value;} // Tests the paused attribute and set state. if (oAudio. paused) {oAudio. play (); once = 0 ;}} catch (e) {// Fail silently but show in F12 developer tools console if (window. console & console. error ("Error:" + e ));}}}