The WordPress Audio Player plugin is a compact HTML5 + flash hybrid  based WordPress plugin which can be used to play an audio file (.mp3 or .ogg). The audio player is compatible with all major browsers and devices (Android, iPhone).
- If you are selling audio files from your site then you can use this plugin to offer a preview
- If you do podcasting then this audio player can be used to embed the audio files on WordPress posts or pages
- The audio player is compact so it doesn’t take a lot of real estate on your webpage
- HTML5 compatible so the audio files embedded with this plugin will play on iOS devices
Audio Player Plugin Screenshot
The following images show how the audio player looks when it is playing and not playing a music file:
The following is a preview of how the audio player looks when using template 1:
When the play button is clicked, the button will change to a pause button allowing users to pause the music playback.
Audio Player Plugin Installation and Usage
- Go to the ‘Add New’ plugins screen in your WordPress admin area
- Click the ‘upload’ tab
- Browse for the plugin file (sc_audio_player.zip)
- Click ‘Install Now’ and then activate the plugin
- Use the following shortcode to embed an audio file anywhere on your site
[sc_embed_player fileurl="URL-OF-THE-MP3-FILE"]
Example shortcode:
[sc_embed_player fileurl="https://www.example.com/wp-content/uploads/my-music/mysong.mp3"]
Additional Usage Documentation
Using Auto Play Option
Use the “autoplay” parameter in the shortcode to play the audio file on page load. Here is an example shortcode with autoplay option:
[sc_embed_player autoplay=true fileurl="https://www.example.com/wp-content/uploads/my-music/mysong.mp3"]
Specifying a Volume Level
Use the optional “volume” parameter in the shortcode to specify a volume level for the audio. You can use a value between 0 – 100 for the volume level. Here is an example shortcode usage:
[sc_embed_player volume="50" fileurl="https://www.example.com/wp-content/uploads/my-music/mysong.mp3"]
The above will set the volume level of the audio file to 50.
Looping the Sound
Use the “loops” parameter in the audio player shortcode to loop an audio file playback automatically. Here is an example shortcode usage with auto loop:
[sc_embed_player loops="true" fileurl="https://www.example.com/wp-content/uploads/my-music/mysong.mp3"]
Specifying Both MP3 and OGG Files for the Audio
Note: You don’t really need to use this option. You can just use the mp3 option and the plugin will make sure that the file is playable in all devices.
You can specify both the files types in the “fileurl” parameter separating them with a “|” character. Here is an example shortcode usage that is specifying both the .mp3 and .ogg version of the audio file:
[sc_embed_player loops="true" fileurl="https://www.example.com/my-audio.mp3|https://www.example.com/my-audio.ogg"]
The plugin will play the supported file based on the user’s device.
Wrapping Text Around the Audio Player
If you want to wrap some text around the audio player then use the following in the “Text/HTML” view of the post/page editor:
<p style="display: inline">My Audio: </p>[sc_embed_player fileurl="https://www.example.com/my-music/mysong.mp3"]
Alternatively, use the following in the “Text” view of the post/page editor (wrap the audio player shortcode in another CSS class with float):
Some example text <div style="float: left;"> [sc_embed_player fileurl="https://www.example.com/my-music/mysong.mp3"] </div>
Audio Player Template 1
A few users have asked us to add a player template that has a seek bar and volume control. Audio player template1 gives you that option:
Use the following shortcode to embed the audio player using template 1:
[sc_embed_player_template1 fileurl="https://www.example.com/wp-content/uploads/my-music/mysong.mp3"]
The above shortcode will produce an output like the following preview:
This template1 shortcode supports “autoplay” and “loops” parameters too. Here is an example:
[sc_embed_player_template1 fileurl="https://www.example.com/my-music/mysong.mp3" autoplay="true" loops="true"]
Misc Tips and Tweaks
Remove the White Pixel/Dot on Black Background
If you are using a WordPress theme with black background then you may notice a very small white dot below the audio player. Add the following block of CSS code to your theme’s CSS file to get rid of it:
#sm2-container{ bottom: 0px; }
Adding the Audio Player to a Theme’s Template File
You can also embed the audio player in your theme’s template file. Here is an example code that you can add to your template file:
<?php echo do_shortcode('[sc_embed_player fileurl="URL OF THE MP3 FILE"]'); ?>
Playing Audio on Your Home Page Only
Here is an example code that you can add to your header.php or footer.php template file and it will autoplay the audio file on your home page only:
<?php if(is_front_page()){ echo do_shortcode('[sc_embed_player fileurl="URL OF THE MP3 FILE" autoplay="true"]'); } ?>
Change the Player Background Color for Template 1
Add the following CSS code to your theme’s CSS file or via the custom CSS plugin to change the player background color. The following example will change the color to red.
.mejs-container, .mejs-embed, .mejs-embed body, .mejs-container .mejs-controls { background: red !important; }
Disable Simultaneous Audio File Playback
Go to the settings menu of this plugin and check the “Disable Simultaneous Play” option to turn off simultaneous audio file playback option. When this option is used, it will automatically stop the audio file that is currently playing when the visitor plays a new file.
Autoplay is not Working on IOS Devices
IOS devices (iPhone iPad) do not allow you to do autoplay. This is a functionality that Apple prevents on their devices. Nothing we can do in the plugin for this unfortunately.
Hosting Your Audio Files
The most obvious choice is to upload your audio files to your site using WordPress’s media uploader. After you upload the audio file via media uploader, it will give you the URL of the file. You can then use the URL in the shortcode of this audio player plugin.
Alternatively, you can host your audio files on Amazon s3.
Download The Latest Version
Plugin Compatibility
Works with the latest version of WordPress.
Plugin Requires
Requires WordPress 4.0 or higher.
Check out our projects page for more cool WordPress plugins.
If you are trying to play the music on homepage only that is NOT a blog-post you need to use ‘is_front_page() ‘ rather than ‘is_home()’ . See http://codex.wordpress.org/Function_Reference/is_home
Note to Developer – could you update the instructions with this addition?
@Pablo, Read the “Adding the Audio Player to a Theme’s Template File” section from this page. Then edit your header.php file (I am guessing that is the file for your theme header) and use the suggested code in there.
Hi dear friends. Its a great player. I just want to know how to insert the code in the header of my theme. I’m sorry my knowlegde of web programing are basic… Thanks
Thanks! This is nice and clean. Just how I like it!
@Jeff, There is no way to do the continuous play at this stage.
Regarding your answer below to @Jo: “You can make it autoplay but when the user browse to a new page, the song will start again”
Is there any possible way to have the song that autoplays on the homepage continue to play as the user browses the site?
Great plugin, thanks!
@KPCTA, No, the plugin won’t be able to remember that you paused it in one page.
Thank you for your help! Your plugin in working like a charm. I have 51 instances of it on one page and all is working great!
Great plugin. I use it on couple of sites, but I have one question: Is it possible, if I put player on widget and set it to autoplay, and click stop button it stay paused on every other page/post.
Thank you in advance
@Larry, you should be able to customize the height using CSS. The following two resources should be helpful:
https://www.tipsandtricks-hq.com/how-to-use-firebug-to-modify-your-wordpress-sites-css-video-tutorial-4037
https://www.tipsandtricks-hq.com/wordpress-custom-css-plugin-6413
Thanks for this great plugin! I did change the graphics successfully, but have an issue: I have lots of audio files on one page and need to make the play and pause images smaller than the supplied 32×32. I did that, but there is still a 32×32 area around them that gets gray when hovering over them, and this is limiting how close I can put them together. I wanted to make them about 12 pixels high. Any way to do that?
Nice plugin. Thanks. I had a problem using it on a local installation. When I put multiple players on the same page, it always plays the first audio file no matter which button I press. It only does this for me on the local installation but when I put it on my hosting server, it works fine. Not sure why this is but thought I would pass this along.
Work perfect. great plugin. Thanks
@Jo, I don’t have one ready for that. If you can provide an image, I can add it to the plugin as an option.
Hi,
Is it possible to provide us a round play button with a better resolution ? For retina devices like iPad Air, Chromebook etc… ?
@Nils, yeah you can use a custom play button image. Take a look at my earlier reply.
Is there a way to change the play button to a custom play button?
Thanks for a great plug!
Use filezilla to connect to your server then browse to this plugins folder:
https://www.tipsandtricks-hq.com/using-filezilla-ftp-client-for-your-wordpress-site-6566
…/wp-content/plugins/compact-wp-audio-player/images
Where is the image folder of this plugin? I don’t know where to look. I want to find the play button and enlarge it.
@J, Those buttons are actually images. So look in the images folder of this plugin and replace them with your custom image.
Thanks for this great plugin, beautifully simple.
One question though: Is it possible to change the colour of the player and the play/pause sign to match the styling of my website?
Thanks
J
Hey guys, long time since I’ve been here.
This little audio plugin of yours is simply great like ALL your other products.
thanks
Mario Bruneau
@LotusZen, Check the documentation above to learn how to loop the sound track. You can make it autoplay but when the user browse to a new page, the song will start again (so I don’t think this one will do what you are after).
How can I get this plugin to loop the song I am playing? And which file should I add the shortcode to if I want the song to play continuously across the site background? Footer.php? Thank you for your advise – great plugin!
Works LIKE a CHARM!!
@Arnab, What code are you using to add the player to your footer.php file?
Hi,
Great audio player, runs perfectly when it’s embedded in a page, post or widget. However, it’s not working in either of the header and footer files.
Not to sound like a complete noob, but when you say “You can also embed the audio player in your theme’s template file”, what is the name of the file that I’m supposed to be embedding it into? Like I mentioned above, header.php and footer.php don’t seem to be working for me…
@Steve, I am pretty sure this theme has some javascript errors which is causing this issue. Switch to the default WordPress theme as a test and then check if the audio player can play the file correctly or not.
Hi, thanks for the quick reply – copied and pasted that link into address bar – plays fine – I am wondering if it maybe has something to do with the theme I am using – do you know if anyone has used it on a Parallax theme (the reason I ask is that this is on a ‘Page Section’ rather than on the ‘Page’ which is the usual place on a wordpress theme ?
@Steve, Yeah it works on a local host testing environment too. I would double check the URL… if you enter the URL of the audio file in the browser’s address bar, does it play the song or download the file?
Nice and compact thanks 🙂 – just wondering if the mp3 should be playing on a local testing environment ? I have installed the plugin and put the shortcode in as per instructions – clicking on play is looking normal – but no audio – I have tried presetting volume to 100% – still nothing – checked the url – looks right – any ideas ?
@Jagrav, No it takes one file per player.
Can we add multiple mp3s files to one player?
@James, It uses two images for the play and pause buttons. You can replace those images with the ones you want to use. So try overwriting the current play and pause button images with your your ones in the “images” directory of this plugin.
Thanks for your great plug in! I have a request please. Can you add a parameter for the shortcode that enables one to change the colour of the player (and play/pause button) to blend in better with a given website colour scheme? Thanks again.
WOW I love it!!!! 😀 😀
@Sylvia, If you can share the URL of the page where this issue is happening then I will take a look at it.
Hi and congrats for your great work. I am using the plugin to add sound samples to the songs in the repertoire of my Gospel Choir’s webpage (which is currently under construction). Not all the songs I list have their own sound sample, and I noticed that the player adds an extra space below and makes the following line shift down, resulting in uneven spaces between the items in my unordered list. I tried to find the way to change this in the css but couldn’t figure it out. I hope I described the problem clearly enough.. Any help? Thank you!
@ashlyn, Have you uploaded an mp3 file to your site using the WordPress’s media uploader?
Hello,
I am having a hard time adding music to my blog site. Starting with getting an accurate mp3 file url link, do you have any suggestions as to where?
And trying to find a place on my blogsite to add the auto player. Under which section?
Thanks
@Krystal, You can use all the shortcode parameters together in one shortcode. Here is an example:
[sc_embed_player autoplay="true" volume="50" fileurl="url-of-your-audio-file.mp3"]
Hi,
What would the code look like if i wanted it to autostart AND lower the volume?
@Joe, It will use flash in Firefox browser. HTML5 is for browsers that don’t support flash (on those browsers it falls back to HTML5).
Hi guys, in firefox if you have flash blocked it throws the missing swf error, but i thought it was html5 too right? so it shouldn’t need flash?
@Rob, If the widget (where you embedded the audio player) is being displayed on every page then the player will keep playing on every page. If you only want it on your homepage then add the audio player in your homepage only (some themes have widgets for home page only). Or check the example in the “Playing Audio on Your Home Page Only” section above.
I have this player installed with autoplay on a text file widget. Problem is it autoplays on every page I click on. Any way to just play on the Home page only?
@angelicotter, Yeah you should be able to save the audio file URL as a custom field in a post, then retrieve that value and call the audio player function to embed the player. You will obviously need to do a little custom coding to suit your need. Where were you going to show/embed the audio player?
Hi,
Love the minimal look of this plug in. Is there any way to use it as a custom field so that the user can just choose it as a custom field and put in the url of the sound file location as the name value.
please advise.
ao
OK, i just found a possibility to add multiple files to the player by changing something in the plugin-core. Soundmanager2 now supports an array as url:
soundManager.createSound({
id: ‘foo’,
url: [‘bar.ogg’,’bar.mp3′]
});
I added these lines to the function play_mp3():
this looks out for a similar-named file with the other extension (mp3 -> ogg and reverse)
perhaps it’ll be easy possible to add multiple files to the shortcode like:
[sc_embed_player fileurl=”path/to/file.mp3|path/to/file.ogg”]
Hi
Thanks for this great little player 🙂
It would be nice to have the possibility to define a mp3 AND a ogg file, and the script choses the one that works… my ogg-files don’t work in any browser… 🙁