Creating a Visible Brightcove Plugin

Written by Bob de Wit. Posted in ActionScript, Brightcove, Developer Blog

  The easiest way for a user to install a Brightcove plugin is through the player property window in Brightcove studio in stead of having to create a BEML template that loads the external swf. By default, this plugin interface is intended for invisible add-ons, such as an analytics connector. However, it is possible to surface plugins added in this way by getting a reference to the player’s Stage. This article provides a sample player with a visible plugin added in this way as well as some sample code. This player receives the plugin that is configured in the screen shot above There are some considerations for the developer: adding visible plugins in this way will not give you the automatic positioning offered through BEML, but getting the player’s dimensions from the Stage reference should give you enough leverage to work around that. Here is the full code for the plugin:
import com.brightcove.api.APIModules;
import com.brightcove.api.CustomModule;
import com.brightcove.api.modules.ContentModule;
import com.brightcove.api.modules.ExperienceModule;
import com.brightcove.api.modules.VideoPlayerModule;
import flash.display.Sprite;
import flash.display.Stage;
import flash.text.TextField;

public class VisiblePlugin extends CustomModule

// Statics and variables

// Reference to the videoPlayerModule and experience module.
internal var _videoPlayerModule:VideoPlayerModule = null;

internal var _experienceModule:ExperienceModule = null;

internal var _contentModule:ContentModule = null;

public function VisiblePlugin()


override protected function initialize():void
_experienceModule = player.getModule(APIModules.EXPERIENCE) as ExperienceModule;
_videoPlayerModule = player.getModule(APIModules.VIDEO_PLAYER) as VideoPlayerModule;
_contentModule = player.getModule(APIModules.CONTENT) as ContentModule;

var stage:Stage = _experienceModule.getStage();

var textLabel:TextField = new TextField()
stage.addChild( textLabel);
textLabel.text = “Added to Stage;
textLabel.textColor = 0xFFFFFF;
textLabel.x = 10;
textLabel.y = 5;
textLabel.selectable = false;
textLabel.visible = true;

Trackback from your site.

Leave a comment