HTML-HTML5 Audio Music auto play, cycle play, etc.

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/u012246458/article/details/50618759

Audio play Music

[Java]View PlainCopy
    1. <audio id="audio" src="Images/openspeech.mp3" style= "opacity:0" preload= "Auto" controls loop hidden="true"/>

This code is: can do background music

Page load loading music but not playing

By calling this code:

[Java]View PlainCopy
    1. var Myauto = document.getElementById (' audio ');
    2. Myauto.play ();


Music playback.

Additional attribute explanations:

      • Preload: If this property appears, the audio loads when the page loads and prepares to play. If you use "autoplay", the property is ignored.
      • AutoPlay: If this property appears, the audio plays immediately when it is ready. Code: autoplay= "AutoPlay", can also be used: autoplay= "true"
      • CONTROLS: If this property appears, the control is displayed to the user, such as the play button.
      • Loop: If this property occurs, the playback starts again each time the audio ends.
      • Hidden: Hide the Playback interface

HTML-HTML5 Audio Music auto play, cycle play, etc.

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.