2005
09.09

The WordPress XSPF Player Plugin

[Spanish]

Warning: Comments are closed here. For support, please go to the forum.

I wanted my WordPress site to have some MP3 background music, but didn’t found any suitable plugin for it:

My webhosting server has little space, and cannot store tracks online. I just wanted a flash player or alike to be embedded into my pages which reads mp3 files via HTTP anywere on the internet. The XSPF web player does exactly that, and is licensed GPL.

I have developed this tiny plugin to allow WordPress pages to have background MP3 music embedding this player. You can see the player on the right sidebar. Just press play and music should start playing.

Features:

  • Works under Linux and Windows (and probably on every PC with a flash-compatible browser).
  • Plays local and remote MP3 music (HTTP)
  • Autostart playing and autorepeat if desired.
  • Song and Categories database managed from the Options menu
  • 3 player modes selectables.
  • Track order defined by user.
  • Inline (on the fly) parameter customization. New!

 
Hope you enjoy it.

Samples:

  • [xspf]_start(FALSE, ‘order=1-10&mode=2&width=180’)[/xspf]
    Slim mode. Just an horizontal bar. Clicking on the little arrow on the right jumps to the artists page (when available).
     
  • [xspf]_start(FALSE, ‘order=1-10&mode=3&width=180&height=100’)[/xspf]
    Wide List mode. A list-box with the tracks. Clicking on the photo jumps to the artists page (when available).

[Download] Current version of XSPF Player plugin

To do:
A nice online tutorial. Please, contribute to the Wiki.
 
Changelog:

  • Version 3.4
    * Bugfix: Possible security vulnerability. XSPF Player setup could be changed by a CSRF / XSS attack. Fixed.
  • Version 3.3
    + Feature: URL and category description can now have up to 255 chars long.
    + Feature: Version displayed in config menu, and other cosmetics.
    + Feature: Better directory protection.
    + Feature: Button to CLEAR all SQL xspf tables.
    * Bugfix: Category edition not shown when no tracks on database. Fixed.
  • Version 3.2
    * Bugfix: When no default player mode selected, the player may not work. Fixed.
    * Bugfix: The [XSPF] button does not work on WP 2.1. Fixed (Thanks, Renato Alves).
    * Bugfix: Cleanup database songs tables when installing for first time.
    + Feature: Now it’s possible (and preferred) to use [XSPF] … [ /XSPF] instead of <xspf>…</xspf> tags.
    Other: Everything is in one folder now (source code rearranged)
  • Version 3.1
    * Bugfix: Playlist sometimes does not works with PHP version < 5.x (MBCS). Fixed.
    * Bugfix: Slim mode sometimes showed an underlining color background. Fixed.
    * Bugfix: Sometimes the height and width were not set when choosing the mode on-the-fly (advanced users). Fixed.
    * Bugfix: When calling the player inside a post/page body, the output was not XHTML compliant. Fixed (MUST use _start() function now).
    + Feature: Under some free web-hosts, the playlist did not work because header insertions. This have been solved.
  • Version 3.0 “D.A.R.Y.L.” Major Release
    + Feature: Can insert the player within the post body
    + Feature: Added mode 0 (player can choose player URL)
    + Feature: Added mode 4 (button with overlay menu)
    + Feature: Parameters changeable on the fly (see Wiki)
    Other: Some glitches and code rearrangement.
  • Version 2.1
    * Bugfix: Total page number not correctly displayed in the tracks management panel.
    + Feature: Improved track management.
    + Feature: Plugin background color selectable via color picker.
    + Feature: Improved player mode selection.
  • Version 2.0 “The Grinch” Major Release
    * Bug Fix: No more than 10 Tracks displayed on the Tracks management panel. FIXED.
    * Bug Fix: Sometimes didn’t delete tracks from database if WP was localized to other languages. FIXED.
    * Bug Fix: Some glitches with de CSS fixed.
    + Feature: Song order now available per category!
    + Feature: The 3 Player bundled, and selectable with one click (3 player modes)!
    Change: Categories now moved to the management page.
    + Feature: Tracks now are paginated for better management.
    + Feature: Shuffle and Autoplay options available for each category.
  • Version 1.6
    + Feature: Autoload playlist
    + Feature: Preview in Options panel!
    * Bugfix: Playlist may give errors with some plugins. Fixed.
    * Bugfix: Entering a blank URL trak made the management panel to dissapear until page reloaded. FIXED.
    * Bugfix: Characters ‘ and ” escaped. Fixed.
  • Version 1.5
    * Bugfix: Compatible with PHP 5.0.x
    Note: This plugin was already compatible with PHP 5.1.x
  • Version 1.4
    * XHTML compliant code
  • Version 1.3
    * Bugfix: The playlist did not load if category specified. FIXED.
    + Feature: If no title is specified for a song, the URL track is used as default in the management section.
    + Feature: Shuffle tracks for each category.
  • Version 1.2
    * Bugfix: The playlist did not load on Internet Explorer. FIXED.
  • Version 1.1
    * Bugfix: The XML playlist was not correctly generated and the plugin might not work. FIXED.
    Known Bugs:
    * Seems not to load the playlist with Internet Explorer. Working on it…
  • Version 1.0
    Initial version.

 
List of sites using this plugin (Random order) all over the world:
[Lavondys] [KHertz] [Darran] [SilentEve] [Chester] [Le Blog de FredoMikado] [Wang Inc. Blog] [Ende Blog] [Podcast Blog] [La-Bella.Net] [Loonyworld] [Xarcell] [The Palomar] [Centralvet] [Spreeblick] [Xyth’s Phrontistery] [Bandsalat-zum-Fruehstueck] [Wuzz Bloggin’?] [AAwakenings] [How about that … Melody?] [Aeternus Tenebrae] [En el tren] [marcus’ tagebuch] [Easy Does It University] [பெட�?டிக�?கடை] [Go 2 Malawi] [El Desviado] [What it is] [.: ray = out :.] [American Liar]

Share
  1. thanks for the quick reply, Boriel…

    Strangely enough it works now, without your suggestions…
    I knew about the admin issue… that was not the problem.

    I switched the default player to slim… updated and it worked… after that back to button and it worked as well…

    Although the player mode is set, I really had to change and update it, so that it was set properly.

    tx a lot though, this plugin is really great!

    Like or Dislike: Thumb up 0 Thumb down 0

  2. Hi Boriel.

    I was through the media player and discover that it is possible for anyone to download the mp3 just by right-clicking it.

    At this point I do not wish to share; Is there anyway that I could prevent anyone from downloading the music?

    Cheers, man. 🙂

    Like or Dislike: Thumb up 0 Thumb down 0

  3. Kristiaan (497):

    1) PHP 5.0.x is buggy. Upgrade to 5.1.x whenever possible. In fact there were even some syntax changes in 5.0.x that might made the plugin incompatible (though I try to avoid this as possible). 5.0.x branch has been abandoned.

    2) The plugin only allows to use embedding code to admin user for security reasons. If you have more than one user in your WP system, try the admin one. This should be already fixed by version 3.0.

    3) The plugin uses the function ob_start and related functions. See ob_start help, and also uses eval function. This might be disabled in your system (I’m going to write a test for it). This is used when the player is inserted within a post or page. You should see the player in your sidebar, for example, if using it in your template. A simple test: If you can see the plugin on your Options panel, and can play some music on it, then the plugin is Ok, and this must be the reason.

    Anyway keep in telling me whether this helps you or not.

    Like or Dislike: Thumb up 0 Thumb down 0

  4. Hey i was wondering…

    I read about my problem a couple of times on this pages but there has been no solution to it yet.

    All options have been set correctly, i’m sure (the players works on the options page), but still the plugin doesnt generated the code, but instead just displays the text that has been in between the code tags. so instead of showing a button it shows _start(FALSE, ‘order=2’) in the post. I edited the text in the code tab, not in the visual tab. Even with the visual editor disabled in my profile, it doesnt work. It doesn’t matter if it is created by IE or FF. The theme doesn’t not affect this either, also the default theme encouters this problem

    Im on WordPress 2.2, PhP 5.0.4 and MySQL 4.1.22 and have no idea about a solution…

    I love how this plugin works and i would love it to work on my musicblog as well!

    hoping for some help!

    Like or Dislike: Thumb up 0 Thumb down 0

  5. […] Xspf_player – automatische Player für alle MP3 Files die im Artikel integriert werden […]

    Like or Dislike: Thumb up 0 Thumb down 0

  6. Hi Boriel.

    I’m from Singapore and I’d like to say your plugin is the sweetest thing since my 1st time getting laid! 😛

    Great work, man! Thanks! 😀

    Like or Dislike: Thumb up 0 Thumb down 0

  7. That plugin is fantastic!!!
    Thanks a lot!!!

    :mrgreen: :mrgreen:

    Like or Dislike: Thumb up 0 Thumb down 0

  8. […] XSPF Player […]

    Like or Dislike: Thumb up 0 Thumb down 0

  9. Boriel great work, and thanks for the commented code :P.

    On the next release if you also include the “new” enhanced xspf player. You should also include info that the feature only works with the xspf players, i.e. the single button and others don’t have the autoresume feature.

    Cheers

    Like or Dislike: Thumb up 0 Thumb down 0

  10. very nice plug in for put mp3 files on wordpress

    Like or Dislike: Thumb up 0 Thumb down 0

  11. […] Player XSPF Player Version: 3.0License: n/aDescription: Allows mp3 music playing on your WP website! Embed the XSPF […]

    Like or Dislike: Thumb up 0 Thumb down 0

  12. As cool a fix this is for the XSPF player, it is still a little choppy. It’s for a band and continuous play is a must. How do I go about setting this up as a pop-up or pop-under?

    Like or Dislike: Thumb up 0 Thumb down 0

  13. […] Bin mir nicht ganz sicher ob es funktioniert. 2. Um die Musik abspielen zu können habe ich das XSPF Player Plugin installiert. 3. Auf der rechten Seite seht ihr Wordspew. Eine Ajax-Shoutbox, mit der man live […]

    Like or Dislike: Thumb up 0 Thumb down 0

  14. RE the autoresume patch. It works great. Thanks.

    Like or Dislike: Thumb up 0 Thumb down 0

  15. Connor (#470):

    I’ve created a patch. Download it from here, uncompress it, and overwrite the original .php file with this one.

    Then invoke the player with:
    [xspf]_start(FALSE, autoresume='1')[/xspf]
    😉

    Like or Dislike: Thumb up 0 Thumb down 0

  16. Well, I have just seen your reply above to #475, to have a player that doesn’t stop even when page reloaded…How about opening a new window to hold the player?

    Like or Dislike: Thumb up 0 Thumb down 0

  17. Hi, I love this widget and I have written a widget to
    keep it in widget-based sidebars 😛
    If you have the interest to add this widget into your
    plugin please visit my website and let me know, thanks.
    I’ve also found out several problems about the plugin.

    Like or Dislike: Thumb up 0 Thumb down 0

  18. […] installing the XSPF media player plugin by Jose Rodriguez (a.k.a. Boriel) I wanted to be able to use it for background music on my homepage […]

    Like or Dislike: Thumb up 0 Thumb down 0

  19. i must have done something wrong … no matter which layout i selected in the setup page (button, slim, menu, etc.), it’ll always give me the button version which show a play button only …

    Could someone tell me how to fix this problem?
    thank you much

    Like or Dislike: Thumb up 0 Thumb down 0

  20. […] 1.首先到這裡下載並解壓縮。 […]

    Like or Dislike: Thumb up 0 Thumb down 0

  21. wtf! ok, I guess you know what i mean, I see the code including the xspf tags

    Sorry for spamming your comments boriel 😉

    Like or Dislike: Thumb up 0 Thumb down 0

  22. Sorry, forgot to put the code between tags. So what i see on the page where I expected the player is _start() (as text).

    What’s the problem here?

    Like or Dislike: Thumb up 0 Thumb down 0

  23. I am trying to embed the xspf player into a page of my website but instead of showing me a flash player on the page I see _start() (as text). What’s the problem here?

    Like or Dislike: Thumb up 0 Thumb down 0

  24. Just a personal note:
    I’m not a fan of websites that use players that start without the user interaction. The old midi system doesn’t work in Linux, and the current fashion in the web is live radio streams, mp3 players, and other kinds of stream players. This makes the navigation on some websites very annoying and very bandwidth consuming.

    I prefer websites that have something like.
    “Listen to our music selection – click here” and a pop-up shows up or players that start loading the songs only if user wants it.

    Improper use includes players that are hidden, start playing and user can’t stop them, start downloading stuff from the web automatically, caching data and whatever…(wasting bandwidth) Even youtube is annoying because starts caching the videos as soon as you enter the video page, pausing it won’t stop the download process and there is no way to stop it except leaving the page. If you want to read a comment, you have to download the movie too.

    It’s a wise choice to leave the decision to the user, specially if they are only looking for something to read.

    Like or Dislike: Thumb up 0 Thumb down 0

  25. SDark (#475):

    Thanks, SDark. 🙂 You’re right. It’s exactly what you say.

    This feature it’s not related to the plugin, but to the way WP and HTTP protocol works. The only way I can figure out to make the player not to stop is using an WP-AJAX theme.

    It’s beyond of the scope of this page. So people interested on it should investigate themselves. I’m redesigning my theme to become AJAX-aware but it’s a rather tedious process. 🙁

    This is why you don’t see my music player in the front page. I stop using it until I enable AJAX in my site.

    Like or Dislike: Thumb up 0 Thumb down 0

  26. Roxx the current flash player doesn’t have the capabilities to resume play where it was left. There is an enchanced version to be tested in the next release, but it only allows you to resume the place where the song last stopped. You can read the latest comments for more info.

    Aside from this, it’s impossible to keep a player running if the page is reloaded. I know that using frames you can achieve results, however this is not the way things work in wordpress and still the frame cannot be reloaded or else the player will restart…
    Even if you use the code in the sidebar, since is not a frame, it’s reloaded whenever you navigate to anywhere else. This is not a limitation of this plugin nor the player but the way things work.

    I have seen websites that have some sort of dynamic code but can still keep the players or streamers running even if you change pages, but I have no idea how that works and if those are camouflaged frames…

    Like or Dislike: Thumb up 0 Thumb down 0

  27. Hi,

    Really nice plugin i love its, but ive a big problem,
    Always when I click to a other page in my site the player stop and reload altough i included the player in my siedebar, do you have an idear what i can do ?
    maybe open the player in a a pop up but i dont know how i could make that…
    Thank you for helping me :mrgreen:

    Like or Dislike: Thumb up 0 Thumb down 0

  28. […] I use, update the music page with my latest favourite albums and figure out how to add this mp3 player to the my music […]

    Like or Dislike: Thumb up 0 Thumb down 0

  29. This plugin is exactly what I was looking for!!! I have a question though. Is it possible to have the player embedded in a text widget and then adding that text widget to my sidebar? This would be the easiest way to add it and have it exactly where I want it on my site? Otherwise I’m not sure how to embed this into the home page of my wordpress site. Thanks for any help

    Like or Dislike: Thumb up 0 Thumb down 0

  30. Conor, I haven’t tried because I’m not interested in this functionality at the moment. However Boriel will take a look at this whenever he has some free time. In the meantime you can either try to understand the code yourself or wait for the beta update.

    If you want to give it a try yourself I think the code for this is on xspf_player_class.php, but since different options have different parsing codes, it may not be that easy if you don’t know where to insert the modifications.

    Like or Dislike: Thumb up 0 Thumb down 0

  31. SDark, have you managed to use the Enhanced XSPF player in conjunction with this plugin? I replaces the swf, but I can’t get the plugin to pass the autoresume argument. If I add it is just doesn’t get put in the webpage code, although if I put other args they do get put in the webpage code. Do you know where the plugin code passing the arguments is?

    Like or Dislike: Thumb up 0 Thumb down 0

  32. The use of the player in http://www.boutell.com/xspf/ might solve some of the issues mentioned here but has some limitations, if improperly used, that the original doesn’t.

    Anyway, Boriel I suggest you give it a try but default autoresume to 0. This way the player will work the way the old one does but has the capability of resume if the user needs it.

    I’m not using this plugin to have sound always playing on my website and so I don’t need the autoresume feature at the moment. But for those who are this is a very neat feature.

    Anyway, since other users, like me, use the plugin with several copies on the same page, having autoresume defaulted to 1 can be quite a big problem.

    With that said. Thumbs up for Enhanced XSPF but with default autoresume=0

    Cheers

    Like or Dislike: Thumb up 0 Thumb down 0

  33. Hendy, as far as I know this version doesn’t support continous play across pages. The version here does: http://www.boutell.com/xspf/

    Like or Dislike: Thumb up 0 Thumb down 0

  34. […] Visit […]

    Like or Dislike: Thumb up 0 Thumb down 0

  35. […] XSPF Player […]

    Like or Dislike: Thumb up 0 Thumb down 0

  36. […] XSPF Player […]

    Like or Dislike: Thumb up 0 Thumb down 0

  37. I’m having problems passing parameters to the player. This works fine _start(FALSE, ‘order=3′) but when I try this _start(FALSE, ‘autoresume=1′) nothing gets passed. (autoresume is the command to let a modified player continue from where it left off when the user moves from page to page.)
    Does XSPF Player Plugin only allow certain arguments to be passed? Is there any other way I can pass the argument (where is the plugin code? I could maybe modify that)?

    Like or Dislike: Thumb up 0 Thumb down 0

  38. I have WP v. 2.1.3 and the latest version of the plugin (v 3.2), but I’m still having an issue when trying to insert [xspf]_start()[/xspf], as soon as I save the post, the [xspf] tags are removed.

    any ideas?

    p.s., the DOES work.

    Like or Dislike: Thumb up 0 Thumb down 0

  39. I have WP v. 2.1.3 and the latest version of the plugin (v 3.2), but I’m still having an issue when trying to insert [xspf]_start()[/xspf], as soon as I save the post, the [xspf] tags are removed.

    any ideas?

    p.s., DOES work.

    Like or Dislike: Thumb up 0 Thumb down 0

  40. I have this up and running on my site, located in the sidebar.php file, but it wont continuously play. The track keeps stopping and starting when I move from page to page. Any ideas?

    Like or Dislike: Thumb up 0 Thumb down 0

  41. […] (唔知ken鐘唔鐘意lee個樣呢??) 先作簡單介紹, 它XSPF Player是一個flash player, 由boriel修改後, 變成一個經wordpress管理的flash player, The WordPress XSPF Player Plugin […]

    Like or Dislike: Thumb up 0 Thumb down 0

  42. […] 先作簡單介紹, 它XSPF Player是一個flash player, 由boriel修改後, 變成一個經wordpress管理的flash player, The WordPress XSPF Player Plugin […]

    Like or Dislike: Thumb up 0 Thumb down 0

  43. I have this up and running on my site, located in the sidebar.php file, but it wont continuously play. The track keeps stopping and starting. Any ideas?

    Like or Dislike: Thumb up 0 Thumb down 0

  44. Works fine with WP 2.2 !

    Warning : I deactivated all plug-ins before updating to WP 2.2 ( as required ) and then lost all sidebar code under the XSPF plug-in position : an XSPF PHP error code appeared instead.
    My WP login link had dissappeared as well, so I had to cut the ( slim ) XSPF link code temporarily from my sidebar.php in order to be able to login and reactivate all plugins.
    Pasted XSPF code back in sidebar.php and all was well again …. Pfffff

    Like or Dislike: Thumb up 0 Thumb down 0

  45. […] tumri_ad_server = ‘http://www.tumri.net’;tumri_ad_client = ‘hhalloyy’; tumri_ad_width =120; tumri_ad_height =90; tumri_ad_type =’BUTTON1′; tumri_store_id =’10949′; 应Carrie要求写个我的侧边栏音乐播放器的使用简要说明。此插件地址为:The WordPress XSPF Player Plugin。 […]

    Like or Dislike: Thumb up 0 Thumb down 0

  46. neva (#453):

    The latest version (3.2) fixes this issue (I’m under WP 2.1.3 and works ok). Upgrade to 3.2 to solve this.

    Like or Dislike: Thumb up 0 Thumb down 0

  47. […] admin that is calm and cool. It changes the way you write you posts in WordPress. Next is the XSPF Player plugin. Its like the regular one except you can use http:// links to add music. EX: […]

    Like or Dislike: Thumb up 0 Thumb down 0

  48. it seems that the plugin doesn’t work with the latest wordpress(2.1.3) release.

    the xspf button is lost and so the [xspf]_start()[/xspf] tag doesn’t work.

    i tested it up to wp2.0.6 yet, successfully.

    maybe some hint to update.

    greets nevaforget.net

    Like or Dislike: Thumb up 0 Thumb down 0

  49. ym (#450):
    You can add [xspf]_start()[/xspf] just typping it when writting a message. You can also insert it by pressing the [xspf] button in the editor page.

    If you want to install it into your WP template, then you will have to edit it. This is a rather expert feature of WP. Look for template editing in the wordpress Wiki for info about this topic.

    Like or Dislike: Thumb up 0 Thumb down 0

  50. […] außerdem hinzugefügt werden. Mit Klick auf Hype Machine öffnete sich der bekannte xspf-player und offenbarte mir eine Tracklist von 14 RatM-Songs – […]

    Like or Dislike: Thumb up 0 Thumb down 0