You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Advanced load balancing with cluster plugin Streaming Extensions - Demo 8 / 13

Introduction

Here we demonstrate a combination of client-side and server-side load balancing. The 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 player first connects to a hardware loadbalancer. If the hardware-based load balancer fails then we dynamically switch to client side load balancing.

Search engine friendly content

Clustering events appear here

HTML coding

The player container and the info box.

<!-- player container-->
<a
	href="flowplayer-700.flv"
	style="display:block;width:425px;height:300px;"
	id="hwBalancer">

	<!-- splash image inside the container -->
	<img src="/img/home/flow_eye.jpg" alt="Search engine friendly content" />

</a>

<!-- info box -->
<div class="box" id="info">
	<h2>Clustering events appear here</h2>
</div>

Flowplayer configuration

We have three hosts on our cluster configured with hosts property. The first host is our server side load balancer. It an imaginary host and will not answer. In normal situations it would serve video files. When this host fails the onConnectFailed event is called and we will dynamically switch to client side load balancing by using setLoadBalancing(true) method.

// a global variable that references our info box
var info = document.getElementById("info");

flowplayer("hwBalancer", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", {	
	
	clip: {
		url: 'flowplayer.flv',
		urlResolvers: 'cluster',
		
		onStart: function(clip) {
			info.innerHTML += "started clip: " + clip.url;
		}
	},
	
	plugins:  {
		cluster: {
			url: 'flowplayer.cluster-3.2.3.swf',
			
			hosts: [
				// server side load balancer
				'http://balance.flowplayer.org/video',
				
				// direct URLs to the servers behind the balancer
				'http://pseudo01.hddn.com/vod/demo.flowplayervod/Extremists.flv',
				'http://pseudo01.hddn.com/vod/demo.flowplayervod/Extremists.flv'
			],
						
			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/>"
					; 
					this.setLoadBalancing(true);
				}
			},
			
			onConnect: function(host, index) {
				info.innerHTML += "attempting to connect to: " + host + "<br />";
			}
		}
	}
});

Take a look at a standalone version of this demo. View its source code to get things going on your page.