Skip to Content

ccPlayer Help

Using Javascript to Interact with ccPlayer

It is now possible to control the functionality of ccPlayer using Javascript commands. This feature makes it possible to do such things as have controls for the player in HTML, or have ccPlayer react to dynamic changes in the HTML content.

Initializing the Javascript access of ccPlayer

In order set up Javascript access, follow these steps:

ccPlayerReady() example

var player;
function ccplayerReady(){
    player=document.getElementById("ccPlayerAS3");
}

// add ccPlayer to page
var flashvars = {};
flashvars.ccMediaName = "video.flv";
flashvars.ccMediaHeight = "360";
flashvars.ccMediaWidth = "480";
flashvars.ccCaptionSource = "captions.xml";
flashvars.ccPosterImage = "poster.png";
flashvars.ccJSConnect = "true";
var params = {};
params.bgcolor = "#ffffff";
params.allowfullscreen = "true";
params.allowScriptAccess = "sameDomain";
var attributes = {};
attributes.id = "ccPlayerAS3";
attributes.name = "ccPlayerAS3";
swfobject.embedSWF("ccPlayerAS3.swf", "videoplayerDiv", "480", "412", "9.0.0", false, flashvars, params, attributes);

When the ccJSConnect parameter is set to true, ccPlayer calls the Javascript function ccPlayerReady(), once it has been loaded and is ready to be accessed. In the sample code above, a pointer to the ccPlayer object has been set up in this function. The content to be played can either be given to ccPlayer through its usaul Flashvars parameters or through the methods described below.

Please note: The ability to activate the fullscreen feature in the player is not available for Javascript control. This is a security feature with FlashPlayer plug-in.

Methods

Last updated: February 28, 2012