Flowplayer Clip URLResolver Plugin

Flowplayer is widely recognized Video player in the industry. This article provides details of plugin developed for Flowplayer and its usage i.e. Clip URLResolver plugin. Plugin is based on standard AS3 Flash plugin which satisfy the Flowplayer modular architecture. Now lets proceed further to explore more about Clip URLResolver plugin.

Flowplayer

Click here to see Live Demo of Clip URLResolver plugin.

In the release of version 1.0.1 of ClipURLResolver plugin – It supports URL resolver callback with Status Code via JavaScript function urlResolverProgress. How it works is,  ClipURLResolver invokes a callback during its progress of retrieving Media URL.


Progress Status Code

Progress Code Description
CLIP_RESOLVER_INVOKED ClipURLResolver Invoked successfully
CLIP_RESOLVER_URLPROVIDER_EMPTY Server URL provider is empty/not provided
CLIP_URL_PROVIDER_INVOKED Server URL provider invoked successfully
CLIP_URL_PROVIDER_RECEIVEDURL ClipURLResolver received the Media URL from Server
CLIP_URL_PROVIDER_SUCCESSLISTENER_CALLED ClipURLResolver given media URL to Flowplayer clip
CLIP_URL_PROVIDER_ERROROCCURED ClipURLResolver encountered while execution

Prerequisites

  • URLResolver plugin download myjeeva.flowplayer.urlresolver-1.0.1.swf from GitHub
  • Server Side Media URL Provider it provides media URL dynamically from application end, on business term; this may calculate user subscription or any business logic on geo location for URL
  • Simple HTML and JavaScript Snippet – You will see code snippet below, as well as you will get example along with URLResolver plugin

Code Snippets

HTML code

<div id="progress" style="font-size: 9px; text-align: left; height: 50px; color: orange; font-weight: bold;"></div>

<a id="player" style="display:block; width:520px; height:330px;"></a>

Javascript Code

// Variable declaration
var baseUrl = "http://demo.myjeeva.com/flowplayer-plugins/urlresolver";
var mediaUrlProvider = baseUrl + "/get_media_url.php";
var urlResolver = baseUrl + "/myjeeva.flowplayer.urlresolver-1.0.1.swf";
var flowControls = baseUrl + "/flowplayer.controls-3.2.5.swf";

// Clip URLResolver plugin invokes this method to share its current progress
function urlResolverProgress(statusCode) {
	var progress = document.getElementById('progress');
	progress.innerHTML = progress.innerHTML + '
 =>  ' + statusCode;
}

flowplayer("player", baseUrl + "/flowplayer-3.2.7.swf", {

	// configure clip details
	clip: {
		urlProvider: mediaUrlProvider,
		autoPlay: false,
		autoBuffering: true,
		urlResolvers: [ 'myjeeva' ]
	},

	// configure plugins here
	plugins: {
		myjeeva: {
			url: urlResolver
		},
		controls: {
		        url: flowControls,
			autoHide: false
		}
	}
});


Live Demo of Clip URLResolver plugin

Click on Play button to see sample running!  Video URL is getting resolved dynamically on click of Play button.