Reply
Visitor
eltio
Posts: 2
Registered: 08-20-2010
0

Dynamic text Overlay on video players

[ Edited ]

Hi,

 

Apologies if this has already been covered but I need to understand the best way in order to create a text overlay over a video player and I am new to both Brightcove and ActionScript.

 

I found the following article :
 

http://active6.wordpress.com/2010/01/26/creating-a-visible-brightcove-plugin/

 

Which produces the result I am looking for with static text, but how can I access Dynamic text using this Plugin method as the SWF is linked to the player ID.

 

Is there a way I can pass customised parameters (containing dynamic text) into the player and retrieve them via the Plugin SWF?

 

Is it possible to achieve the same functionality using the JavaScript API?

 

Would be grateful if anyone could point me in the right direction.

 

Thanks

 

 

Brightcove Team
BC-Oscar
Posts: 455
Registered: 12-11-2008
0

Re: Dynamic text Overlay on video players

 

If you want to pass the text as a flash parameter in the embed, you can. Then you can read it with the ExperienceModule.getPlayerParameter (parameterName) API. 

 

Overlays are easier to do with ActionScript, so that the AS API is your best option in this case. 

 

Do not forget that since you would be using AS, you can always load external XML files into your swf. This could be an alternative in the case you want to store the overlay text in an XML file in a server and then have some logic to retrieve in your plugin swf.

Visitor
eltio
Posts: 2
Registered: 08-20-2010
0

Re: Dynamic text Overlay on video players

[ Edited ]

Many thanks for this, am I right to assume that i could use the following code, compile it to SWF then upload it as a plugin?

 

 

player.loadModules();

_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 = _experienceModule.getPlayerParameter (MyCustomTextParam) ;
textLabel.textColor = 0xFFFFFF;

textLabel.x = 10;

textLabel.y = 5;

textLabel.selectable = false;

textLabel.visible = true;

 

 

Brightcove Team
BC-Oscar
Posts: 455
Registered: 12-11-2008
0

Re: Dynamic text Overlay on video players

Yes, that should work. 

New Member
karl_nerd
Posts: 2
Registered: 03-31-2011
0

Re: Dynamic text Overlay on video players

Hi!

I've tried exactly this technique. I want to add a text, and eventually a link on top of my video on a certain cuePoint.

I can fire a function on my cuepoint and so, and this compiles without errors, but my text-field isn't showing up.

Any tips would be helpful.

 

package {

	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.CuePointsModule;
	import com.brightcove.api.events.*;
	import LinkField;
	
	import flash.external.ExternalInterface;
	import flash.system.Security;
	import flash.events.Event;
	
	import flash.text.TextField;

public class examplePlugin extends CustomModule {

		private var exp:ExperienceModule;
		
		override protected function initialize():void {
			
			exp = player.getModule(APIModules.EXPERIENCE) as ExperienceModule;
			var cueP:CuePointsModule = player.getModule(APIModules.CUE_POINTS) as CuePointsModule;
			cueP.addEventListener(CuePointEvent.CUE, onCuePoint);
			
		}
		
		private function onCuePoint(evt:Event):void {
			
			var myLink:TextField = new TextField();
			exp.getStage().addChild(myLink);
			myLink.text = "hello from Plugin";
			myLink.textColor = 0xFFFFFF;
			myLink.x = 10;
			myLink.y = 10;
			myLink.visible = true;
			//ExternalInterface.call("alert","cue");			
		
		}
		
}
// package ending
}

 

 

New Member
karl_nerd
Posts: 2
Registered: 03-31-2011
0

Re: Dynamic text Overlay on video players

Sorry the code works. It was just that the plugin wasn't loading properly...

Have to look more into that guys!