Html5-audio-How the mobile side plays automatically

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.