我有一个修改过的jPlayer,它连接到shoutcast/icecast源。jPlayer中的随机数据流链接
我想让jPlayer在打开页面时随机连接2个或多个url。
例如,如果我有2个链接:
- www.example.com:8000/live
- www.example.com:8000/live2
然后我需要jPlayer到在打开页面时随机选择其中一个。 目的是为了防止在一台服务器上过载。
我该如何去jQuery代码中去呢?
的jQuery:
$("#jquery_jplayer_1").jPlayer({
ready: function(event) {
$(this).jPlayer("setMedia", {
mp3: "http://www.example.com:8000/live"
}).jPlayer("play");
},
swfPath: "js/",
wmode: "window",
solution: "flash,html",
supplied: "mp3",
preload: "none",
volume:0.75,
cssSelectorAncestor: "",
cssSelector: {
play: "#play",
pause: "#pause"
}
});
$("#jquery_jplayer_1").bind($.jPlayer.event.pause, function(event) {
$(this).jPlayer("clearMedia");
$(this).jPlayer("setMedia", {
mp3: "http://www.example.com:8000/live"
});
});
为什么不让服务器决定呢?一个使用基本负载平衡逻辑重定向的url。 – MikeM