Recently in some activity-related pages or similar to the easy-to-show type of light applications often encountered in the application of audio tags, for audio relevant common knowledge points and some related issues are as follows:
<audio id= "audios" src= "Xxxx.mp3" AutoPlay controls= "Controls" >your browser does not support the audio tag. </audio>browsers that do not support the audio element display the text audio related properties in the tag: src: Audio address autoplay: Automatically play after the audio is loaded. CONTROLS: Displays the playback control bar. Loop: Plays repeatedly when it is finished. Preload:auto Pre-load Audio video. Metadata only pre-load audio Video meta data. This property is not valid when there is a autoplay. JS Control Media Play () play pause () pause load () Reload related event: Oncanplay//triggered when the user can start playing video/audio (audio/video) (page load complete)OnError//triggered when an error occurs on an audio/video (audio/video) loadOntimeupdate//trigger Event.currenttime When sending changes in video/audio (Audio/video) Current playback positiononended//triggered at the end of video/audio (audio/video) playbackEnd and phone does not support autoplay problem reason is: Android iOS internal cause in order to save traffic, the regulation does not automatically play audio Video solution://--Create a page listener, wait for the end page to load and trigger audio playbackDocument.addeventlistener (' Weixinjsbridgeready ',function() {document.getElementById (' Audios '). Play ()})//--Create touch monitor, touch screen trigger event when browser opens page, make audio playbackDocument.addeventlistener (' Touchstart ',function() {document.getElementById (' Audios '). Play ()})
Html5-audio-How the mobile side plays automatically