Audio Player Fixes

Well, seems like everyone is moving away from flash like the plague and transitioning into HTML5. For those of us who have been using flash audio players and are too stubborn to switch, here’s one alternative. It simply requires you to update your broken audio player plugin in WordPress.

Fixing the first problem where since WordPress 3.4, seemingly the insert function for the audio player was broken from the Add Media menu.
Find this line of code in your “audio-player/audio-player.php” file in the plugin editor.

$form_fields["url"]["html"] .= "<button type='button' class='button urlaudioplayer audio-player-" . $post->ID . "' value='[audio:" . attribute_escape($file) . "]' title='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";

and change it to

$form_fields["url"]["html"] .= "<button type='button' class='button urlaudioplayer audio-player-" . $post->ID . "' data-link-url='[audio:" . attribute_escape($file) . "]' title='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";

If you did it correctly, you should be able to insert your audio tags into your post! [source]

Now for the good part, turning your flash based audio player into HTML5 automatically.

Download this version of the audio-player.js, rename it to match your original audio player and replace it in the /plugins/audio-player/assets/ folder. Keep in mind if the original plugin creator decides to update the plugin, this will wipe out any work you did on switching the player. Hopefully the creator sees that everyone is switching from flash and he/she will follow suit, but this project has been untouched for a while. [source]

Leave a Reply

Your email address will not be published. Required fields are marked *