About Mobile audio does not automatically play the problem solving method

Source: Internet
Author: User

This method may only work with pages opened with a browser ...


<audio id="A" src= "Bg.mp3" AutoPlay></Audio >

< Span class= "S4" > < Span class= "S1" > first step: < Span class= "S3" > introduce JS

<script src= "Http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

Step Two: Wx.config

Wx.config ({

Debug:false,///Open debug mode, call the return value of all the API will be on the client alert out, to see the incoming parameters can be opened on the PC side, the parameter information will be typed through log, only on the PC side will be printed.

AppId: ",//required, unique identification of the public number

Timestamp:,//required, time stamp for signature generation

NONCESTR: ',//required, generate a random string of signatures

Signature: ',//required, signature, see Appendix 1

Jsapilist: []//required, the JS interface list to use, all JS interface list See Appendix 2

});

Fill in the corresponding parameters

Step three: Call play in Wx.ready ()

<script>

function autoPlayAudio1 () {

wx.ready (function() {

document.getElementById (' a '). Play ();

}

}

autoPlayAudio1 ();


</script>

The test OK can be played automatically.

There is no way to troubleshoot auto-playback of mobile audio

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.