Tag Archives: 播放器

谷歌的FLASH音乐播放器+一首好听的歌

今天查看别人的博客RSS,发现GOOGLE READER里面有个播放器,还蛮好看。开始以为是朋友博客上面的恶播放器,但是打开文章页面和RSS页面都没有这个播放器,可见是GOOGLE自己重新整理了RSS之后加上了播放器。

下载了下来,感觉不错~虽然比以前那个大了许多,多了一个音量调节功能,还不错啦~要说这个播放器放在文章底部是最好的。

上传一首歌给大家听听,也当作是这个新播放器的展示吧~真没有想到谷歌也出了个flash播放器哦,附件里面有播放器下载。

Walk Me Home

I don’t wanna go all the way alone
baby won’t you walk with me home
baby won’t you take my hand
come with me now to a special land
baby won’t you walk with me home
3 A.M.
you’re on my mind once again
I must have been dreaming
thought I felt your heartbeat just then
and I wonder how it would be
I was your lady
and you were my friend
I would put my heart in your hand and it would never end
CHORUS
Baby won’t you walk with me home (walk me home)
I don’t wanna go all the way alone (all alone)
baby won’t you walk with me me home
baby won’t you take my hand (take my hand)
come with me now to a special land (ohh)
baby won’t you walk with me home
Ohh La la la la la la la la
I hold your picture
next to my heart all the time
ohh yea baby
You’re my dream come true
so then you’re mine?
and I wonder how it would be
if I was your lady
and you were my friend
I would put my heart in your hand
and it would never end
CHORUS
Everyday and night I wanna hold you
understand I am going to love you
in my own special way (in my own special way)
CHORUS x2
Ohh
won’t you walk with me home?

一个很炫的js播放器

一个雅虎的播放器,做的很炫,可以(好像只能)调用雅虎的JS文件实现播放功能。但是“似乎”“好像”还是没有解决FF下没有传递HTTP_REFERER的问题。[face=question]

使用方法简单

将歌曲链接写成这种形式

  1. <a href="http://mediaplayer.yahoo.com/example1.mp3">First link</a> 
  2. <a href="http://mediaplayer.yahoo.com/example2.mp3">Second link</a> 
  3. <a href="http://mediaplayer.yahoo.com/example3.mp3">Third link</a> 

然后在页面任何位置加上

  1. <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> 

最后,就可以播放了,至于播放效果,见这个页面 http://mediaplayer.yahoo.com/ ,强烈建议去看看,顺便听一听上面那三首歌……yahoooooooo!

Sablog-x 2.0 安装给附件的音乐播放器

Sablog-x 论坛里面以前讲过这个用播放器播放附件里面的mp3音乐的方法,我这里写一下 Sablog-x 2.0 的添加方法。

首先,解决上传保留文件后缀名的问题

找到adminuploadfiles.php文件,大概在66行,将

  1. if (!in_array($attach["ext"], array("gif""jpg""jpeg""png"))) { 

替换成

  1. if (!in_array($attach["ext"], array("gif""jpg""jpeg""png","mp3"))) { 

然后为文章添加上播放器

找到modulesshow.php文件,大概在118行,在

  1. else { 
  2. // 如果非图片文件 
  3. $a_size = sizecount($attach["filesize"]); 
  4. $article["file"][$attach["attachmentid"]]=array($attach["attachmentid"],$attach["filename"] ,$a_size,$attach["downloads"]); 

的前面添加上几行代码,如下

  1. elseif ($a_ext == "mp3"){ 
  2. // 是mp3 
  3. $a_size = sizecount($attach["filesize"]);    
  4. $article["mp3"][$attach["attachmentid"]]=array($attach["attachmentid"] ,$attach["filename"],$a_path,$a_size,$attach["downloads"]); 

然后打开你的模板文件夹,找到其中的show.php文件,在其中适当的位置,或者说你想放置MP3播放器的位置添加上以下代码

  1. <!--{if $article["mp3"]}-->  
  2. <!--{loop $article["mp3"] $mp3}-->  
  3. <div class="attach">歌曲名: $mp3[1]<br /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="$options[url]images/dewplayer.swf?son={$options[url]}attachment.php?id={$mp3[0]}&&autoplay=1&&autoreplay=1" width="200" height="20" type="application/x-shockwave-flash" autostart="true"> /*这里重新修改过 */ 
  4. </div>  
  5. <!--{/loop}-->  
  6. <!--{/if}-->  

如果你需要在文章列表那里显示mp3播放器,请打开modulesarticle.php,在190行附近的

  1. else { 
  2. // 如果非图片文件 

前面加上几行代码,如下

  1. elseif ($a_ext == "mp3"){ 
  2.     // 是mp3 
  3.     $a_size = sizecount($attach["filesize"]);    
  4.     $article["mp3"][$attach["attachmentid"]]=array($attach["attachmentid"],$attach["filename"],$a_path,$a_size,$attach["downloads"]); 

然后继续往下,大概210行的位置,找到

  1. $article["content"] = $article["description"];  

把它替换成

  1.     $attachs= unserialize(sax_stripslashes($article["attachments"])); 
  2.     if (is_array($attachs)) { 
  3.         foreach ($attachs AS $attach) { 
  4.             $a_path = $options["attachments_dir"].$attach["filepath"]; 
  5.             if (file_exists($a_path)) { 
  6.                 $a_ext = strtolower(getextension($attach["filename"])); 
  7.                 if ($a_ext == "mp3"){ 
  8.                     // 是mp3 
  9.                     $a_size = sizecount($attach["filesize"]);    
  10.                     $article["mp3"][$attach["attachmentid"]]=array($attach["attachmentid"],$attach["filename"],$a_path,$a_size,$attach["downloads"]); 
  11.                 } 
  12.                 } 
  13.             } 
  14.         } 
  15.         //如果空,释放掉变量 
  16.         $attachmentids=array(); 
  17.  
  18.         foreach($attachmentids as $key => $value){ 
  19.             if($article["image"][$value]){ 
  20.                 unset($article["image"][$value]); 
  21.             } 
  22.             if($article["file"][$value]){ 
  23.                 unset($article["file"][$value]); 
  24.             } 
  25.         } 
  26. $article["content"] = $article["description"]; 

然后打开模板文件夹,打开normal.php文件,在适当的位置(你要放置播放器的地方)加上

  1.                 <!--{if $article["mp3"]}--> 
  2.                     <!--{loop $article["mp3"] $mp3}--> 
  3. <div class="attach">歌曲名: $mp3[1]<br /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="$options[url]images/dewplayer.swf?son={$options[url]}attachment.php?id={$mp3[0]}" width="200" height="20" type="application/x-shockwave-flash" autostart="true">  //这里重新修改过                         <!--{/loop}--> 
  4.                  <!--{/if}--> 

最后将文末附件中的播放器放到博客根目录下的images目录中,就可以了。

最后介绍一下整个修改之后实现的效果

  1. 上传mp3文件不会被改名
  2. 显示文章的页面里面播放器自动播放(自动播放功能,注意看两端模板文件中代码的不同)
  3. 在文章列表页面有播放器,但不自动播放

不过这样修改的代码在文章的歌曲会同时播放,所以,推荐一篇文章只放一首歌。如果按照以上过程修改出现了问题,请速速留言,我尽力帮你解决(最好能够提供你的源代码)。

PS.发现伪静态的页面使用这个有问题,发现是地址路径有问题,稍稍修改了一下,添加上$options[url]作为根目录地址,还有在模板里面,两个变量放在一起的话,必须分别用{}括起来。现在一切都正常了。

BLOG更新,新增音乐随机播放功能

经过好长时间对播放器代码的研究,终于,找到了一个让播放器随机播放的方法,虽然强行改了JS程序,但是至少实现功能了,下次目标,增加一个按钮,人工选择随机/顺序播放。

我这个播放器好多功能都被隐藏了哦!