videos

http://link.brightcove.com/services/player/bcpid3884271551001?bckey=AQ~~,AAAAut5OTtk~,8GbJutk5SyntodL7Je-JT7UUZEVz93WJ

Video player for Endo PC



{

import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.system.SecurityDomain;
import flash.system.Security;

/*
* To use this class to load your Brightcove player instance, save this code into the root directory
* of your project as BrightcovePlayer.as. Then, within your application, you can instantiate this player
* using the following syntax:
*
* var player:BrightcovePlayer = new BrightcovePlayer();
* addChild(player); /// must be added to a display object container, such as a Sprite instance
*
*/
public class BrightcovePlayer extends Sprite {

private var bcPlayer:Object;

/**
* Constructor. Pass in different configuration parameters if you wish to reuse this snippet
* for other player instances. The config object passed must have a playerID, playerKey, width and height.
* In addition, pass isUI=true if you are using UI elements other than the VideoPlayer, isVid=true if
* you are using the video player or isSlim=true if you are using the VideoDisplay.
*
* var config = {};
* config.playerID = 12345;
* config.playerKey = “abcdefg1234567”;
* config.width = 486;
* config.height = 412;
* config.isVid = true;
* var player:BrightcovePlayer = new BrightcovePlayer(config);
*
* @param config The configuration object of parameters to use for the player.
*/
public function BrightcovePlayer(config:Object=null) {
init(config);
}

private function init(config:Object=null):void {
Security.allowDomain(“http://admin.brightcove.com”);

var originalConfig:Object = {};
// change the playerID and playerKey to load a different player
originalConfig.playerID = 3884271551001;
originalConfig.playerKey = “AQ~~,AAAAut5OTtk~,8GbJutk5SyntodL7Je-JT7UUZEVz93WJ”;
originalConfig.width = 960;
originalConfig.height = 445;

if (config == null) {
createPlayer(originalConfig);
} else {
var justContent:Boolean = true;
for (var i:String in config) {
if (i.charAt(0) != “@”) {
justContent = false;
break;
}
}
if (justContent) {
for (i in config) {
originalConfig[i] = config[i];
}
createPlayer(originalConfig);
} else {
createPlayer(config, true);
}
}
}

private function onPlayerLoadInit(event:Event):void {
var loaderInfo:LoaderInfo = event.target as LoaderInfo;
var loader:Loader = loaderInfo.loader;
var player:Sprite = loaderInfo.content as Sprite;
if (bcPlayer && player != bcPlayer) {
if (bcPlayer.parent) {
bcPlayer.parent.removeChild(bcPlayer);
}
}
bcPlayer = player;
addChild(bcPlayer as Sprite);
if (contains(loader)) removeChild(loader);
}

private function onPlayerLoadProgress(event:ProgressEvent):void {
dispatchEvent(event);
}

private function createPlayer(config:Object, freshConfig:Boolean=false):void {
var cacheServerServices:String = “http://c.brightcove.com/services”;

var configItems:String = “”;
for (var i:String in config) {
if (i == “width” || i == “height”) continue;
configItems += “&” + i + “=” + escape(config[i]);
}

var file:String = cacheServerServices + “/viewer/federated_f9?” +
“&playerWidth=”+escape(config[“width”])+
“&playerHeight=”+escape(config[“height”])+
“&dynamicStreaming=true”+
configItems;

if (!freshConfig) {
file += “&isVid=1&isUI=1”;
}

var player:Loader = new Loader();
addChild(player);
player.contentLoaderInfo.addEventListener(Event.INIT, onPlayerLoadInit);
player.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onPlayerLoadProgress);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
player.load(new URLRequest(file), context);
}

public function onTemplateLoaded():void {
dispatchEvent(new Event(“templateLoaded”));
}

public function getModule(module:String):Object {
return Object(bcPlayer).getModule(module);
}

}

}