Yahoo!的MP3播放器! –小书签

Update Jan 30, 2008: updated code based on comments and code from Carl Update Dec 11, 2008: updated the code thanks to the comment from Nolan

2008年1月30日更新:基于Carl的注释和代码更新了代码2008年12月11日:由于Nolan的注释而更新了代码

Here's the scenario: you have a page that links to some .mp3 files. You add a line of code in your page and lo and behold, there's a nice media player embedded into the page. Your visitors no longer have to download the MP3s, they can just stream it right there. All the mp3s on the page become part of a playlist.

场景如下:您有一个页面链接到一些.mp3文件。 您在页面中添加了一行代码,然后瞧,页面中嵌入了一个不错的媒体播放器。 您的访客不再需要下载MP3,他们可以直接在此处流媒体。 页面上的所有mp3都将成为播放列表的一部分。

The line in question you need to add to your page is:

您需要添加到页面的相关行是:

<script src = "http://mediaplayer.yahoo.com/js"></script>

More about the player here - yahoomediaplayer.wikia.com

有关播放器的更多信息,请点击此处-yahoomediaplayer.wikia.com

For examples of sites using this player in the wild, try aurgasm.us

有关在野外使用此播放器的网站的示例,请尝试aurgasm.us

书签 (A bookmarklet)

Now, here's what you can do if you want to use the player, but the web site owner haven't incorporated it yet. Take the player with you. Run my bookmarklet that will simply insert the required javascript into the page.

现在,如果您想使用播放器,可以执行以下操作,但是网站所有者尚未将其合并。 随身携带玩家。 运行我的书签,将书签简单地插入页面即可。

So here goes in two easy steps:

因此,这里分两个简单步骤:

  1. Grab the bookmarklet:

    抓住书签:

    Right-click, add to favorites

    右键单击,添加到收藏夹

    Y! player
    ! 播放器
  2. Go to any page that links to MP3s and click your new shiny bookmarklet

    转到任何链接到MP3的页面,然后单击新的闪亮书签。

    Enjoy!

    请享用!

资源 (Source)

The readable source code of the bookmarklet:

小书签的可读源代码:

javascript:(function(){
 
  var start = function(){YAHOO.mediaplayer.loadPlayerScript()};
 
  var script = document.createElement('script');
  script.src = 'http://mediaplayer.yahoo.com/js';
 
 
  if(script.addEventListener){
    script.addEventListener("load", start, false);
  } else{
    script.onreadystatechange = function(){
      if(this.readyState=="complete"){ 
        start(); 
        script = null;
      } 
    }
  }
  script.type="text/javascript";
  document.getElementsByTagName('head')[0].appendChild(script);
  
})();

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/mp3-player-from-yahoo-bookmarklet/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值