Mobile Audio Auto-play problem

Source: Internet
Author: User

The Mid-Autumn festival near, Whim want to do a mobile phone-side greeting card, the previous contact with less mobile, although it is a simple greeting card, in fact, quite a lot of pits, briefly speaking in the process of making greeting cards encountered the pit:

A: Mobile screen size can not be counted as body size, because the phone browser head has a URL navigation and so on, the bottom also has left white, should go out this part;

Two: Audio background music is not automatically play, no matter how debugging JS are useless, after a lot of verification, incredibly mobile has done a limit, must be user interaction to trigger, the online solution is mostly through the Touchstart event;

<audio id= "Myaudio" >    <source src= "/static/warn.mp3" type= "Audio/mpeg" ></audio><script >var tt;function Audioplay () {    document.getElementById ("Myaudio"). Play ();    tt = SetTimeout (Audioplay, 5000);} function Audioload () {    document.getElementById ("Myaudio"). Pause ();} </script>//Trigger play Audioplay ();//Clear timed task cleartimeout (TT);

Mobile Audio Auto-play problem

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.