I'm a huge fan of the Audio Player plugin for Wordpress that lets you embed a flash player for a single MP3 file in a blog post. The problem is that you have to host the MP3 file yourself, and if your hosting service isn't very generous with either storage space or bandwidth, it's not a very good solution. Most of the time that I want to attach a song to a blog post, it's usually some pop song that I'm either listening to or my mood has reminded me of. Let's face it, YouTube is the new MTV. Name a pop song, and the music video is probably on YouTube. I could embed the whole YouTube video of a song on my blog, but what if I just want the audio? What do I do then?
Introducing.... YT-Audio, the plugin for Wordpress to embed the audio from a YouTube video on your blog!
It's actually ridiculously simple. All it does is embed YouTube's regular flash movie player inside two iframes that chop off all but the bottom control bar of the video. Nothing fancy. Just useful.
You install it just like any other Wordpress plugin. Unzip it into the /wp-content/plugins, directory. Then, in your post, put the text:
ytaudio(2_HXUhShhmY) Where "2_HXUhShhmY" is the code for the video on YouTube. And you should get something like:
It's just that simple! I've tested this on Firefox, Safari and IE 7. It looks pretty good in all three. Enjoy!
The player shows up, but the song won't play. What's up?
This will happen if embedding has been disabled for the video you are using. Because the video portion of the player is hidden, so is the message telling you that embedding is disabled. Try to embed the entire video with the full embed code from YouTube before reporting a problem.
Where is the volume control?
When the volume control opens in the YouTube player, it opens over the video portion of the player, which is hidden inside a frame by this plugin, so even if YT-Audio displayed the volume control button, you could not change the volume with it because the popup slider would be hidden. This is unfortunate, but there's nothing that can be done about it.
I'm getting something in the frame that looks like my blog header. What's wrong?
This will happen if your plugins directory is not in the default location. You will need to edit the two lines in `ytaudio.php` that contain `wp-content/plugins/yt-audio-streaming-audio-from-youtube` to reflect the actual location of the ytaudio plugin with respect to your blog root.
Changed embed code to work with YouTube's new player
Oops. Remembered why volume control should be hidden. Sorry!
Expanded iframe to include volume control.
Fixed urls referencing plugins directory to work with the zip file available from wordpress.org.
Fixed to accept YouTube codes with underscores and dashes.
Modified to handle YouTube's new flash player.