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:
因此,这里分两个简单步骤:
Grab the bookmarklet:
抓住书签:
Right-click, add to favorites
右键单击,添加到收藏夹
Y! player! 播放器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
在Facebook和Twitter上告诉您的朋友有关此帖子的信息
翻译自: https://www.phpied.com/mp3-player-from-yahoo-bookmarklet/