See also
Wordpress to Octopress: Audio¶
![Wordpress to Octopress](../_images/20120828-wordpress_to_octopress.png)
Another step on the migration from Wordpress to Octopress is to get the audio elements and embedded audio files to the new platform. Well, the files are quite simple, but to get some plugins playing nicely with them, is a different story.
After testing around with some of the many available plugins (like soundmanager2) and failing all time long I stumbled over audio.js. Again.
I remembered that I once was working on this specific problem a couple of months ago and I’ve already included the plugin into the theme.
A simple test confirmed it was working and so I’ve re-written the photo_tag-plugin from Devin Weaver again and created the plugin for replacing an audio-tag with the corresponding code.
It’s plain and simple.
Add the
audio.min.js
file to your JavaScript folder.Include the code from the
audio.js
project into your Octopress installation by putting the JavaScript lines into yourhead.html
(watch out for the correct paths here!)<script src="/javascripts/audio.min.js"></script> <script> audiojs.events.ready(function() { var as = audiojs.createAll(); }); </script>
You’ll find the code below. Save it to a file
<root>/plugins/audio_tag.rb
and it should work.
One comment on that: I prefer to not automatically start the plugin to play when initialised. Therefore the parameter for the audio.js-plugin has been set to “none”. If you want it in an other way, replace the parameter:
preload="auto"