How do I insert a music that plays automatically in my Web page? Use on any Web page

Source: Internet
Author: User

Website features do not need too much, their own needs of the good, their own blog slowly improve, a function of the increase, are their own needs and practical, they will cherish the hands!

The function of the music is simple, a piece of code:

<audio controls autoplay= "AutoPlay" loop= "loop" ><source src= "Http://lykezhan.com/test.mp3" type= "audio/ MPEG "/> If not played, your browser is not supported! </audio>

Plus there's going to be a player that shows

Believe anyone can understand, but a few notes, why do I have to add a "loop" behind? Isn't this a repetition of "autoplay"?

Yes, repeat, but not contradictory, my own site if not added "loop", it will not be automatically played.

For the sake of beauty I will also add hidden, hide the player, reach the point in the page to play

I only use music when I have very few and special pages!

Next, the code is written to the template page, and then the background Edit article page to add a text box to facilitate the input of the music address.

This is very convenient in the time to add the article at random, of course, in the special template, otherwise, each page will have to load a player, not to make the site become very bloated? So copy a new template page, when you need to add music to choose the template page!

Revision completed, I only in the "Life Diary" column added music function, template version of the Code to change:

<audio controls autoplay= "AutoPlay" loop= "loop" style= "Display:none;" ><source src= "{dede:field.shorttitle/}" type= "Audio/mpeg"/> If not played, your browser does not support! </audio>

Need to note is in the column where to modify the article content template!

How do I insert a music that plays automatically in my Web page? Use on any Web page

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.