Navarr's Tech Side The Technical Side of my Life

YouTube Audio Player

Play
Sample Link

The YouTube Audio Player is some custom (X)HTML Generator output by a PHP script that turns any YouTube Video or Playlist URL into a small embedded Audio Player.

Created because I was tired of custom-editing the Embed Code for YouTube videos to make them smaller, or add a link that would show up on Facebook where they strip out the Object and Embed tags, I decided to write code to do it for me, and thus the YouTube Audio Player was quickly hacked together.

The YouTube Audio Player Generator currently supports:

  • Rendering YouTube Videos/Playlists with only two buttons: Play/Pause, and Mute/Unmute
  • Optional Progress Bar
    • Optional Time Code
    • Three Sizes
      • Small
      • Medium
      • Large
  • Optional Ability to Autoplay the Video/Playlist
  • Optional Ability to Loop the Video/Playlist
  • Image Duplicate of the look of the player that links to the YouTube pages in cases where the code will be rendered without flash support, including the alternate text "Play" for clients without image support.

You can generate a YouTube Audio Player here, or you can simply drag the bookmarklet below to you bookmarks bar, and click it on any YouTube Video or Playlist Page:

Bookmarklet:
Generate Audio Player

Generator's Source Code License

Creative Commons License

YouTube Audio Player Generator by Navarr T. Barnier is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Based on a work at www.gtaero.net.
Permissions beyond the scope of this license may be available at mailto:navarr@koneko-chan.net.

  • Gabriele

    Bruno Mars – Just the way you are.

  • Chris

    Doesn’t seem to work anymore… perhaps YouTube changed the way it processes code. Any ideas?

  • http://tech.gtaero.net/ Navarr Barnier

    YouTube NoCookie is 404′ing for some reason. Thats very problematic.

  • Chris

    Any workaround I can try for now?

  • http://tech.gtaero.net/ Navarr Barnier

    Yes actually. Just replace where it says “youtube-nocookie.com” with “youtube.com” and it will work.

    I should probably program it to do that, but im hoping its simply a temporary error on youtube’s part.

  • selena

    where do you paste the code??

  • http://tech.gtaero.net/ Navarr Barnier

    Its HTML, so you can paste it anywhere HTML can go.

  • Phillipe
  • Pingback: lose belly fat diet

  • Tilly

    What about a code with only play button? That’s what I’m looking for.

  • http://tech.gtaero.net/ Navarr Barnier

    Use the new tiny option I just added.

  • Anonymous

    Can i put like 5 links (songs) to it?

  • http://tech.gtaero.net/ Navarr Barnier

    You’d have to put them into a YouTube playlist first, and then give the playlist URL to it.

  • Anonymous

    Can i put like 5 links (songs) or more on it? :)

  • Anonymous

    oh. thanks. :)

  • Anonymous

    Okay. So i’m done on making a playlist but when i try to make the player it doesn’t play even when i ticked the autoplay fuction. :/ help </3

  • Taay Pfl

    beyonce-ego

  • http://www.dreamcastbr.com/ Igor Isaias Banlian

    I can not run your script from source code. See the error messages that appear:

    Notice: Undefined variable: type in /home/server/youtube-audio-player.php on line 72
    Notice: Undefined variable: type in /home/server/youtube-audio-player.php on line 78
    Notice: Undefined variable: embed_url in /home/server/youtube-audio-player.php on line 89
    Notice: Undefined variable: embed_url in /home/server/youtube-audio-player.php on line 92
    Notice: Undefined variable: link_url in /home/server/youtube-audio-player.php on line 94
    Notice: Undefined variable: e in /home/lithium/server/youtube-audio-player.php on line 144
    Notice: Undefined variable: plcode in /home/server/youtube-audio-player.php on line 171

    I’m using Apache 2.2.21 and PHP 5.3.8!

    Sorry for my bad English, I am Brazilian!

    Regards,Igor Isaias Banlian

  • rudolf

    hi, i just ported your script into a WordPress plugin
    http://wordpress.org/extend/plugins/audio-tube/

    cheers,
    rudolf

  • http://tech.gtaero.net/ Navarr Barnier

    I approve of this.  Awesome.

  • http://tech.gtaero.net/ Navarr Barnier

    These are just notices.  You can turn them off.  error_reporting(~E_NOTICE);

  • rudolf

    CooL! :o [)

  • rudolf

    turn off your english error notice too
    …eu sou brasileiro também :)

  • rudolf

    looks like version 2 of the playlist player is broken

    also, it seems that it doesn’t run in the -nocookie domain

    do you think it will be possible to tweak the version 3?

  • Simzgoncalves

    how do i get it to work on my tumblr?

  • bob

    Can you make a video for the ignorant?

  • Backtoyou

    Navarr – I don’t have my own website or blog. Is it possible to embed the audio only play/pause button somehow within an e-mail message?

  • http://tech.gtaero.net/ Navarr Barnier

    The technical answer: YES ABSOLUTE.

    The real world answer: Maybe somehow… but it probably won’t work.