How to add autoplay background music to WordPress website? - Nano Blogs Online

Nano Blogs Online

Nano Blogs Online provides free help in Web Technologies, Affiliate Marketing, Social Media Marketing, Digital Marketing, and reviews different products from the online world.

How to add autoplay background music to WordPress website?

How to add autoplay background music to WordPress website?

Share This

Welcome to this post. You are looking for How to add auto play background music to WordPress website? If yes  then in this post I want to give you a detail description about adding background music to WordPress website. There are different plugins used to add background music to WordPress.  Most of the WordPress users will have this complaint that why background music auto play is not working on mobile, because auto play is not desirable on mobile devices. The reason is that the auto play event on mobile trigger extra cost for the mobile device owner. For that sake most of the popular plugins are fail to fulfill this demand. According to my research the good and most widely used plugin is Soundy Background Music plugin, which will be discuss in this post. I will also show you the most easy custom way to add background music which will work both on desktop computer as well as on mobile.

Popular plugins used to add background music

1. Soundy Background Music

This plugin allows any page or post to play a background sound on that can be play auto but only work on desktop computer.
Click on here to access this plugin.
If the background much is not auto play on your mobile, after using this plugin the easy solution is to add the background music by custom why.

How to add background music by custom method?

Yes it is possible. You need to add the following JavaScript code in the dead tag of your website. If you are using WordPress, go to header.php and in between <head></head> past the following code.
<script type="text/javascript">
function autoPlay() {
 document.getElementById('my-audio').play();
}
window.addEventListener('load', autoPlay);
</script> 
<audio id="my-audio" src="http://www.w3schools.com/html/horse.mp3" autoplay></audio>
In the last line of code you can see the horse.mp3, replace this with your audio file.
you can easily upload your audio file, to WordPress site via Media/upload option and then copy url of your file and replace with http://www.w3schools.com/html/horse.mp3 link.

HTML/PHP website

If you want to add this to HTML/PHP website the add this code in the head section of index.html/index.php. I hope this will help you and you will enjoy it.
If you need more help please contact me via contact page, I will help you to solve your issue. I hope that now you will have no issue about How to add autoplay background music to WordPress website?

4 comments:

  1. There is a small spelling mistake in the article "If you want to add this to HTML/PHP website the add this code in the head section of index.html/index.phg." should be index.php

    Feel free to visit my website: https://www.shoutmecrunch.com

    ReplyDelete
  2. Firstly we need to install your own personal web server to run Wordpress. Wordpress requires a web server, a MySQL database and the PHP scripting language to run.https://edkentmedia.com/website-design-toronto

    ReplyDelete
  3. I tried to input the custom method in head, but it still doesn't autoplay in mobile.

    ReplyDelete