一直很想给我的WP加个音乐插件,几经挑选决定使用XSPF Player,歌曲及分类信息放在数据库里,前台显示有4种模式,而且在后台还可以设置播放器宽度和高度,嗯,不错。
载下来后发现是个non-widget版的,就是说要在页面中使用,必须禁用widget机制,修改template,虽然我还没发现widget到底除了设置方便外还有什么好处,不过这么非重用的方法显然要唾弃!
然后决定凭这些天对WP的研究自己写个widget把它包含在侧边栏里。。结果是写出来了。。不过天亮了。。
废话不说了,包含 Widget的XSPF Player Plugin:
Download(879 times)
安装说明:
- 解压.rar到plugins目录,这样你就会有个wp-content/plugins/xspf_player/目录了对吧
- 到admin界面,插件里把xspf_player和xspf_player-widget依次激活
- 到外观的Widgets里把xspf_player-widget拖上去!可以设置title
- 这时在主页里应该就有播放器栏了
- 顺便再把管理面板的位置介绍下吧,反正不想睡了^^对歌曲/分类管理是在管理->XSPF Player下,对外观管理是在选项->XSPF Player下(真不知道干嘛不做到一起去)
Additional:
This widget has been enhanced by others so that when a visiter open two posts of your blog, he/she will hear the same music!
好了就是这样。
不过有几个XSPF Player的小问题,如果作者不更新的话我就自己修改解决了
- 音量过大
- 不提供排序功能
- 放在数据库里是不是对效率影响太大?是不是不如作为变量放在.php文件里?(对PHP文件引用和数据库查询效率的疑问一直困扰我)
- 不能设置一首歌是否可以播放,如果你想暂时把它从播放列表上取下,唯一的办法就是删除它!
另外给对XSPF Player的分类功能有兴趣的朋友一个Hint:其实可以默认选择只播放一个分类的,只不过要改PHP,而不是放在Wordpress的Options里,为了简化Widget的安装我就没有定制这个选项。
如果有任何问题请回复或发邮件到hjrgenius(_a_)163.com,有任何更新我也会发布在这篇日志里,thanks!






Hallo, thank you very much for your effort do make it Widgetized!
Did you heard about the "enhanced" Version XSPF Player Plugin?
How can I solve to use it also in Widget, I read in a forum, the is a Code to invoke the PLayer with:
[xspf]_start(FALSE, autoresume=’1′)[/xspf]
How I can implement the code in your "xspf_player-widget.php"?
Did you have any solution?
Thank you in advance for a answer!!
Lejlagirl
To Lejlagirl:
Thank you for sharing the "enhanced" Versin XSPF Player Plugin with me! Well, I noticed that plugin before. It's great enough to let different parts of your site play the same music, but I also found out that was a beta version so I want to wait for the release version~
Sorry that these days I'm being driven crazy to exams>.< and in July I shall have time to look into the solution.
Thanks again!! ( You are the first foreigner commenting my blog except for spams~haha~)
I tried to overwrite the file xspf_player_class.php and change line 48 of xspf_player-widget.php to xspf_player::start(FALSE, 'autoresume=1');
But it doesn't work.
Forget above, It seems working!
Simple though:
1.Download from
http://www.boriel.com/files/xspf_player_autoresume.zip and replace the xspf_player_class.php with the downloaded one.
2.Download from
http://www.boutell.com/xspf/xspf-boutell.zip and replace the xspf_player_slim.swf and xspf_player.swf with the downloaded ones.
3.Change line 48 of xspf_player-widget.php to xspf_player::start(FALSE, ‘autoresume=1′);
Try it!
I have updated the file in the main post. Just REPLACE THE ORIGINAL ONE WITH IT shall be fine.
WOWOWOWO, it works without problem!!


You deserve honor!
Thank you very, very much to give us a solution (in your stress situation!) you are so great!!
For the info, Boriel made a new board for the XSPF Player, maybe would be a good way to inform other people!!!!
http://www.boriel.com/phpbb2/
So long
Lejla
I find out that this new feature doesn't work in firefox tabs, but it does work fine in ie windows or ie&firefox windows.
Well, let's wait for boutell's release version.
好像在ie下显示有问题,firefox就没事
显示的问题?在我这儿没问题啊……不都是个FLASH的小播放器么?
IE和FIREFOX显示上的唯一区别就是那个该死的Calendar
请问下你用的虚拟主机操作系统是:windows还是unix的?
ls那位朋友可以看这里。。http://www.512j.com/host/show_detail.php?flag=php
jerry我想请问一下你,这个插放器怎样设置才能像你的主页一样可以
开启页面时自动播放,并且转换页面时,能从刚刚停顿的地方开始自动接着播放呢.
@ohyeahok
自动播放设置在wordpress后台的settings->XSPF Player里
转换自动播放涉及到FLASH的原理,应该是不需要设置就可以达成的……
好像复杂了一点,我刚好正在寻找wordpress的播放器插件,主要是用在文章中。
膜拜达人。。。
达人啊。。。我装上了。。能听歌了,后台也是选了您这样的播放样式,但为什么我前台没有像后台那样显示呢?Enter the URL of your XSPF flash player.这是什么意思啊?
您好,请问您播放器里的For Love那首钢琴曲实际是叫什么名字,我在网上找了很久都没有找到。
如果可以,是否可以把它发到我的信箱:42348031@vip.qq.com
万分感谢。。。
thank so much for sharing!!!!!
Having been looking for ages
谢谢你作好这些工作!