YT-Audio: Audio Hosting From YouTube in WordPress

September 25, 2007 By: erik Category: Geeky, Music, Wordpress 8,890 views

Rate this post:
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading...Loading...

YT-AudioI’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!

yt-audio-streaming-audio-from-youtube.zip

How does it work?

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.

Instructions

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!

Frequently Asked Questions

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.

Change History

1.7 2011-02-22 Changed embed code to work with YouTube’s new player
1.6 2009-04-30 Oops. Remembered why volume control should be hidden. Sorry!
1.5 2009-04-30 Expanded iframe to include volume control.
1.4 2009-02-23 Fixed urls referencing plugins directory to work with the zip file available from wordpress.org.
1.2 2009-02-20 Fixed to accept YouTube codes with underscores and dashes.
1.1 2007-12-04 Modified to handle YouTube’s new flash player.
1.0 2007-09-25 Original version
 
  • 123

    This is an awesome plugin. Thanks. Is it possible to add a feature to it that would enable me to isolate excerpts from the audio? a start/stop switch in the ytaudio code?

    That’d be even more awesome!

  • http://www.erik-rasmussen.com/ Erik R.

    Sorry, 123, but, if that control of the YouTube flash player is even possible, I don’t know how to do it.

  • Samy

    Do you know of any good hosting service that will host audio files. I am referring to just the audio recorded all by itself, not as part of the video on YouTube.

    Who can host the audio file that I can use for posting on several blog sites, without uploading the file on each blog site?

    Any help will be greatly appreciated.

  • http://metroflow.com/video/ Geoff Video Dodd

    Yes. Just the audio, without the video can be hosted at Apple iTunes as a podcast. Geoff.

  • http://urlredacted adi

    awesome, thanks!

  • http://urlredacted youtube

    thanks.

  • Daikil

    A problem with de YT code with _ inside? Thanks

  • http://www.TechHerding.com Dick Carlson

    Hello!

    I’ve tried to get your great plugin to work several times to no avail. Would you be able to take a look and see if there’s anything obvious that you can see?

    Thanks!

    Here’s the page:

    http://www.techherding.com/wp/2007/02/testing-plugin/

    I’ve downloaded the most recent version from your site, and also tried the version that comes us via WordPress 2.7 auto-install.

    Thanks!

    Dick

  • http://fruityoaty.com fruity

    I’ve been looking for something like this for over a year now! Cool! But does it word with WordPress sidebar widgets? Is it widgetized?

  • http://blog.turkbaron.com baron

    hi. Thanks for plugin

    perfect.

    Regards

  • http://www.locadora.info Luis – BsAs

    Genial! Gracias!

  • http://www.locadora.info Luis – BsAs

    it is not workin 2 me. dont know why. im using wp 2.7.1

  • http://www.erik-rasmussen.com/ Erik R.

    No, fruity, I don’t think it will work in a sidebar widget. It could probably be modified to, though.

  • http://www.erik-rasmussen.com/ Erik R.

    Dick, I’ve left a comment on that post. You don’t need the name of the parameter, just the value of the video code.

  • http://www.geotypografika.com Erik

    Hello Erik (great spelling!), I am trying to install your plugin, when I insert the command, I actually only get a small window of the top left corner of my own blog? I wish i could send you a screenshot. I am trying to use this for a dedication today, would love any help or advice. Many thanks in advance,

    Erik

  • http://www.erik-rasmussen.com/ Erik R.

    Erik, I tried to email you at the address you gave, but the email bounced back. You can email me a screenshot to erikwordpressplugins -at- gmail.

  • http:www.geotypografika.com Erik

    Thanks for the quick reply, Erik! I sent an email with the screenshots–also have a request into my server people about the bounce back, so I included an alternative email in this request. Cheers for your help!

  • http://www.geotypografika.com Erik

    Hello Erik,

    Sorry for this flurry of emails and requests for help, I am including an alternate contact from my blog. I have sent the screen shots from both addresses just in case there is an issue, hope you receive those in good order. Thanks again fro any advice,

    Erik

  • http://bgabgbr.com Chris

    Is there a way to enable a “auto play/start” function so the music just starts playing?

  • http://www.erik-rasmussen.com/ Erik R.

    Chris, that’s an interesting idea. I was unaware that you could make an embedded YouTube video autoplay, but a quick google search showed me how. I might incorporate such a feature into YT-Audio soon.

  • Mig

    What a perfect plugin!
    Thanks

  • http://www.simonandjun.com Simon

    Hi Chris,

    If you like to have the autoplay function, edit the frame.php file and look for the following line:-

    src=”http://www.youtube.com/v/”>

    and add “&autoplay=1″ just before the closing hyphen like below

    src=”http://www.youtube.com/v/&autoplay=1″>

    It works well for me.

  • http://www.nahyaninc.com Nahyan

    thanks Erik,

    this plugin is awesome.

  • http://[email protected] brian

    Hi,

    Just wanted to thank you for this incredbile plugin. I have yet to install it, but it is going to save me a bunch of time!

    Great timer about your baby as well. =)

    Cheers,
    Brian

  • http://www.havehimeatingoutofyourhand.com Elaine

    Hi Erik
    wow what a great plugin- I’ve spent the last 2 days trying to get wp audio plugin to work- it won’t. Then I found another audio plugin- but my files were too big to upload- now yours- brilliant.
    My question- is there a way just to add audio that is hosted on youtube? I have some audio files that I want to add to my blog but they are too large to upload apparently- any suggestions?

    Thank you
    Elaine

  • http://www.erik-rasmussen.com/ Erik R.

    Elaine, YouTube doesn’t host “just audio”. You’ll have to make a video with your audio as a soundtrack (it can be blank except for the audio) and upload that to YouTube, and use it with YT-Audio. Hope that helps.

  • Raize

    thanks for the plugin bro…simple and genius

  • musicalnote

    i have wordpress it doesnt work for me = (

    idk if i’m doin something wrong

    • http://www.erik-rasmussen.com/ Erik R.

      I need more information if you want help. Paste in the code you are putting into your post?

  • Rob

    It would be cool to have a smaller version of the player. LIke half the size.

  • John

    Hi, I am wondering why the volume button is hidden? Isn’t it annoying if you ‘don’t have control over this function?

    regards,
    John

    • http://www.erik-rasmussen.com/ Erik R.

      Yes, that is annoying. There’s a good reason, though. The reason is that the way the volume controls work in YouTube is that it pops up a vertical slider, and this slider is hidden inside the iframe just like the video is. Unfortunately there’s no way around this.

      I forgot about this when I published version 1.5, but it immediately became obvious why the volume button is useless, so I hid it again in version 1.6.

  • http://drumandbass.de J-Cut

    great stuff! that’s just what i was searching for. keep up the good work

  • Dale

    Wicked plugin – but a quick question – I can get it playing individual songs but have tried to get it to play an entire playlist – am i missing something or is there an easy tweak to be done in order to include a playlist?

    for example, i’d like to turn this test playlist into an audio player…

    http://www.youtube.com/view_play_list?p=706409C9F41DE9A6

    thoughts?

    cheers!
    dale

    • http://www.erik-rasmussen.com/ Erik R.

      As far as I know, you cannot embed playlists. I just made one and tried to embed it, and it didn’t move to the next video. They seem to only work if you’re on youtube.com.

      • http://AustinCityPermits.com gary etie

        Eric,

        Ah, but you can embed Playlists, but you have to create a Custom Player from that Playlist first, then embed the Custom Player.

        There used to be a link on the Account page. I don’t see a link, anywhere, but if you’re signed in, this link will get you there:

        http://www.youtube.com/my_players

        And here’s an example of an embedded Playlist, in a Custom Player:

        http://www.savekutaustin.com/?page_id=1314

        gary

  • Kenold Beauplan

    I’v been looking for this forever – thank you

  • otto

    Hi, Erik,

    This plug-in is something I’ve been looking for! I’ve got one question. Would it be possible to use the plug-in in the footer? If possible, how? I’d like to know a php line as I’m not familiar with php at all…

    Thank you for your advice!

    • http://www.erik-rasmussen.com/ Erik R.

      That’s a good idea, Otto. I hope to get to adding this feature by next week. Stay tuned here.

      • otto

        Thank you for your response! I’ll look forward to it.

        By the way, I’ve found a little problem with IE 7 (windows). While the YouTube player looks pretty good on FireFox, Chrome, Safari (all Mac), it looks little bit “off” with IE 7. I’m not sure whether you see what I saw, but top gray line disappears and also left gray line looks thicker and darker on IE 7. Yes, this is very very minor appearance matter, and nothing to do with the functionality, but would it be any tweak to fix this?

        Thank you. :)

  • http://egotrippingatthegates.blogspot.com/ Dana

    Really makes me wish I was wordpress and not blogger. Any idea if it can be used on a blogspot blog as well? Any way at all?

    • http://www.erik-rasmussen.com/ Erik R.

      Sorry, I don’t know enough about the inner workings of Blogger. You’d need to be able to upload your own PHP file.

  • Arik

    For some reason this wont work

    ytaudio(mUT3KoxVzQg)

    Any suggestions?

    Also is there a way to have it automatically play when you view the post?

  • http://brandonovak.com Johnny

    Great plugin. The only issue is you can’t use the volume control. Is there any way to fix this?

    • http://www.erik-rasmussen.com/ Erik R.

      Good question, Johnny, and one that is frequently asked. So I have added a FAQ section of the post above to answer it.

  • http://humgurung.com Hum

    Hi Erik,
    Your plugin is what I was looking for last few days. Well, everything so far so good. Is there any chance that if you could add a ‘button’ on WordPress post editor so instead of typing ‘ytaudio’ each time user just click button – small window pops up – enter Youtube video id – click OK – then automatically insert the code ‘ytaudio(ytcode)’ to post. So it avoids typing mistake sometime. Example: Vipers Quickvideo Tag.
    Thanks.
    Hum

  • Marcio

    Hey there, I’d like to know if there is a way to make this plugin works in the comments as well ? Please advice.

  • lan

    how do i use this for tumblr?

    • http://www.erik-rasmussen.com/ Erik R.

      You can’t. It’s a WordPress plugin.

  • Tony

    http://www.speedytown.com/index.php/2009/02/23/embed-play-youtube-as-mp3-on-wordpress-blog/ This guy copied everything you wrote on this post. which one is the real deal?

    • http://www.erik-rasmussen.com/ Erik R.

      Well, he links to me, and I don’t link to him. So I’m the real deal.

      That and the Official Plugin Page on WordPress.org lists me as the author.

  • http://www.letteratu.it gianluca [futuroprossimo]

    Hi!

    how can i insert this with a function in single.php file?
    i would insert a song using a custom field…

    • http://www.erik-rasmussen.com/ Erik R.

      You can’t. It’s a variable replacement, not a function call.

      Is there some reason you want to put the YouTube id in a custom variable? It’s an interesting idea, but it doesn’t seem that useful to me.

  • http://ifilmi.eu Firefly

    Hi,
    it would be nice to have a function for the plugin. Or at least real shortcode. I Want to put the video id like post tag and then to echo the function and the tag. That way you can insert some id’s and it will list them like e song list in the post.

  • dbrod

    Hi,
    I have some problem on google Chrome with your plug in.
    He`s downloading frame.php every time i opening the page with him, but on internet Explorer its work good.
    Please advice.

    • erik

      Works fine for me in Chrome.

  • Recruitment SEO

    Great – was thinking of having to subvert / hack the embed code then had the bright idea of searching for a plugin. Good ol’ WordPress. And good ol’ you. Thanks!!

  • bob

    Hey there,

    I keep trying your code ytaudio(xyz) and replacing “xyz” with either the direct URL or the embed code for the youtube video, but the former just keeps the link and the latter embeds the video with ytaudio(video) surrounding it. What am I doing wrong?

    Example code:

    ytaudio(http://www.youtube.com/watch?v=LVQnFzZUITM)

    or

    ytaudio()

    • erik

      You want just the code that’s after the v= in the url.

      Like this: ytaudio(LVQnFzZUITM)

  • Dave I

    I cannot get the plug in to work. I can only get the full embedded video with the audio from YouTube. I have tried using the embed code, the URL, editing the embed code to remove references to the video and screen size and other experiments. I have entered all attempt in html vs visual.
    Your explanation says to add the “code” to ytaudio(“code here”). Is it something other than the embed code? Do I need to edit the embed code? Is the code supposed to be put between parenthesis or something else?
    Finally, the “ytaudio” always appears as text followed by the embedded video. The parenthesis also are visible. Putting a around the text hides it but the video portion of YouTube is still there.

    • erik

      No, you don’t put the entire embed code between the parentheses. You only need the unique alphanumeric string that identifies the video. When you are looking at the video on YouTube, look at the url in your browser and see the value after the v= in the url. That’s what you put between the parentheses.

      • Dave I

        Thanks, this worked. I didn’t understand how to do it from the plugin description. You might want to look at re-wording the instructions for thick headed blog new comers like me. Once I figured it out, this is a GREAT and very simple plugin to use.

        Thanks for your quick response

  • http://twitter.com/Castiel101 Castiel 101

    Is there a limit on the number of times you can use this in a post.  More that 6 in a post does not seem to work. 

  • kristin

    Is there a way for it to play automatically without pressing the play button?

  • http://www.graduatecoursesonline.com/ Mrselfexpression

    Is this plugin still available? Tried from both here and the WordPress location but 404’d on both. Would be AWESOME to have this, thanks

    • http://erikras.com/?utm_source=disqus&utm_medium=profile&utm_campaign=Disqus%2BProfile Erik R.

      Hmmm. I’ll have to investigate. Thank you for your interest. I’ll get back to you if/when I fix it.

    • http://erikras.com/?utm_source=disqus&utm_medium=profile&utm_campaign=Disqus%2BProfile Erik R.

      How strange! WordPress.org has delisted this plugin, even though it can be found with the direct link.

      I have moved the zip to dropbox and fixed the link in the post. Enjoy!

  • shierley

    Does it work on Chrome? It works well on Firefox, but when open the page on Chrome, something it missing. Thank in advance

  • Guest

    thanks, very nice

  • ozgurhaber.org

    thanks, very nice