This is a message.

Advanced load balancing

Combine client side and server side load balancing

standalone demo

Clustering events appear here

Server-side load balancing is usually done using a load balancer running in front of the RTMP or HTTP streaming servers. In this example the plugin first connects this server-side load balancer. If this connection fails the plugin switches to client side load balancing.


<!-- player container-->
<a href="Extremists.flv" class="player"
style="display:block;width:425px;height:300px;margin:10px auto"
<!-- splash image inside the container -->
<img src="/media/img/home/flow_eye.jpg"
alt="Search engine friendly content" /></a>



We have three hosts on our cluster configured in our hosts property. The first host is our server side load balancer. It's an imaginary host and will never answer in reality. In normal situations it would serve video files when it's up and running. When this host fails the onConnectFailed event is called and we will dynamically switch to client side load balancing by using setLoadBalancing(true) method. The plugin remembers the failing host and will not use that after the first failed connection attempt.

// a global variable that references our info box
var info = document.getElementById("balanceInfo");
flowplayer("hwBalancer", "", {
clip: {
url: 'Extremists.flv',
urlResolvers: 'cluster',
onStart: function(clip) {
info.innerHTML += "started clip: " + clip.url;
plugins: {
cluster: {
url: "flowplayer.cluster-3.2.10.swf",
hosts: [
// server side load balancer
// direct URLs to the servers behind the balancer
onConnectFailed: function(host, index) {
// host at index 0 is the load balancer
if (index == 0) {
info.innerHTML += "server-side load balancer failed, " +
"enabling client-side load balancing<br/>"
onConnect: function(host, index) {
info.innerHTML += "attempting to connect to: " + host + "<br />";