Client side load balancing
standalone demo
Clustering events appear here
We use the cluster plugin for simple load balancing completely controlled on the client side. This allows us to distribute the load to multiple servers. Click on the splash to see this in action.
HTML
<!-- player container-->
<a href="Extremists.flv" class="player"
style="display:block;width:425px;height:300px;margin:10px auto"
id="balancer">
<!-- splash image inside the container -->
<img src="/media/img/home/flow_eye.jpg"
alt="Search engine friendly content" /></a>
Configuration
We have two different video servers: pseudo01.hddn.com is hosted by HDDN and
stream.flowplayer.org by Amazon. These two are accessed randomly so that
in the end both servers will be loaded evenly. The load balancing is enabled with
the loadBalance property.
// a global variable that references our info box
var infoBox = document.getElementById("balanceInfo");
flowplayer("balancer", "http://releases.flowplayer.org/swf/flowplayer-3.2.11.swf", {
// configuration for the clustering plugin
plugins: {
cluster: {
url: "http://releases.flowplayer.org/swf/flowplayer.cluster-3.2.8.swf",
// two working hosts
hosts: [
'http://pseudo01.hddn.com/vod/demo.flowplayervod',
'http://stream.flowplayer.org'
],
// that are load balanced (accessed randomly)
loadBalance: true,
// callback method that updates our info box
onConnect: function(host, index) {
infoBox.innerHTML += "attempting to connect to: " + host + "<br />";
}
}
},
clip: {
// our clip uses clustering plugin
urlResolvers: 'cluster',
onStart: function(clip) {
infoBox.innerHTML += "started clip: " + clip.url;
}
}
});
