Tag: Code auto iOS weixin Super Read CLI code page
In iOS the first call play method to play the audio will be blocked, you have to wait for the user to have interactive action, such as Touchstart,click after the normal call, in the can listen to Weixinjsbridgeready event to play a super short no sound file in advance, Then replace SRC so that the play method can be called again.
The code is as follows:
$(Document).One(' Weixinjsbridgeready ',function(){VarAudio=Document.getElementById("Audio");Audio.Play();Execute onceAudio.setattribute ( ' src ' img/ Shake.mp3 ' //replace SRC audio. Load () }) //Monitor shake event simplified version window. Addeventlistener ( ' devicemotion ' function Span class= "P" > () {document. Getelementbyid ( "audio" ). Play (); //successfully played }, false);
HTML5 audio does not automatically load/play music on mobile Web pages, can this function be implemented?