Compact WordPress Audio/Music Player Plugin (All Browser Compatible)

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:

audio-player-template1-preview

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

  1. Go to the ‘Add New’ plugins screen in your WordPress admin area
  2. Click the ‘upload’ tab
  3. Browse for the plugin file (sc_audio_player.zip)
  4. Click ‘Install Now’ and then activate the plugin
  5. 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="http://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="http://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="http://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="http://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="http://www.example.com/my-audio.mp3|http://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” view of the post/page editor:

<p style="display: inline">My Audio: </p>[sc_embed_player fileurl="http://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="http://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="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]

The above shortcode will produce an output like the following preview:

audio-player-template1-preview

This template1 shortcode supports “autoplay” and “loops” parameters too. Here is an example:

[sc_embed_player_template1 fileurl="http://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 3.0 or higher.

Check out our projects page for more cool WordPress plugins.

Found this article interesting? Subscribe to Tips and Tricks HQ

email icon rss feed icon twitter icon google plus icon

Comments (109 responses)

  1. admin says:

    @Mark, You can hide it by using a small CSS tweak but I am not sure if the player will play the audio file if you hide it totally.

    The following CSS code will hide the player:

    .sc_player_container1 {
    display: none !important;
    }

  2. Mark says:

    Is there a short code to hide the player so I can just have it play on auto once the page opens…its just a 2 second intro jingle.

  3. admin says:

    @Michael, There should be no issue with that file.

  4. Michael says:

    Good day,
    I’ve been using m4a files with your plugin and they seem to be working fine. Is there any disadvantage to doing this?

  5. admin says:

    @Lee, Look under the main Settings menu of your WordPress admin dashboard. There will be one for the audio player there.

  6. Lee Crawford says:

    Great plugin! Just discovered it. I can’t seem to find the Settings menu though. You refer to it to disable simultaneous playback, but I can’t find Settings anywhere. Help?

  7. admin says:

    @Hanazair, Thank you. I have updated the documentation.

  8. Hanazair says:

    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?

  9. admin says:

    @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.

Speak Your Mind

*