开发者

HTML How to add Background Music

开发者 https://www.devze.com 2023-02-11 22:12 出处:网络
How do I add Background Music such as Youtube video to Music.I don\'t want to add my songs from the harddrive, ju开发者_开发技巧st online song to background.

How do I add Background Music such as Youtube video to Music. I don't want to add my songs from the harddrive, ju开发者_开发技巧st online song to background.

This way If people come to my website there is some kind of music to listen too.

Thanks and if you know the code please tell me and thank you for your time.

I think there is something to do with Iframe


If your background music music is from YouTube, the way I do it is to make the size 1px by 1px so you can't see it then add a loop and autoplay to it.

<iframe width="1" height="1" wmode="transparent" src="//www.youtube.com/embed/VIDEO_ID?autoplay=1&loop=1&playlist=VIDEO_ID" frameborder="0" allowfullscreen>

The VIDEO_ID is are the letters, numbers and symbols after the www.youtube.com/watch?v= (VIDEO_ID)


You can use html tag audio and autoplay attribute

<audio type="audio/mp3" src="<url for song>" autoplay loop>


Youtube has a feature called embed, it's located below every video on the website. Take the code given and insert the markup into your HTML document and viola!

Some videos may having embedding blocked so just find another one.


This should work in the head html:

<audio autoplay loop "{Replace this text in theese brackets with this music file including the path}" type="audio/fileextension"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消