<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code!</title>
	<atom:link href="http://active6.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://active6.com/blog</link>
	<description>Bob de Wit's coding blog</description>
	<lastBuildDate>Mon, 01 Mar 2010 06:03:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Brightcove Videos in Second Life</title>
		<link>http://active6.com/blog/flash/brightcove-videos-in-second-life</link>
		<comments>http://active6.com/blog/flash/brightcove-videos-in-second-life#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:57:49 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=183</guid>
		<description><![CDATA[The new Second Life Viewer 2 Beta finally allows integrating Flash-based apps onto Second Life prims (SL lingo for 3D primitives, such as cubes, etc) as textures through a feature called Media Sharing (nothing to do with Brightcove Enterprise Edition Media Sharing).
The nice thing about this is that every visitor will be able to stream [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-184" title="music_wall" src="http://active6.com/blog/wp-content/uploads/2010/03/music_wall.jpg" alt="music_wall" width="320" height="330" />The new Second Life Viewer 2 Beta finally allows integrating Flash-based apps onto Second Life <em>prims </em>(SL lingo for 3D primitives, such as cubes, etc) as textures through a feature called <em>Media Sharing </em>(nothing to do with Brightcove Enterprise Edition Media Sharing).</p>
<p>The nice thing about this is that every visitor will be able to stream individual videos, as opposed to the version 1 viewer that could only set a QuickTime Progressive Download url for all residents in a Second Life location.</p>
<p>Here&#8217;s a sample prim I&#8217;ve made in a sandbox that has been textured with the Sony MyPlay syndicated player and  some navigation prims that would make sense in a 3D environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/flash/brightcove-videos-in-second-life/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Adobe Speech Search Cue Points in a Brightcove Player</title>
		<link>http://active6.com/blog/flex/using-adobe-speech-search-cue-points-in-a-brightcove-player</link>
		<comments>http://active6.com/blog/flex/using-adobe-speech-search-cue-points-in-a-brightcove-player#comments</comments>
		<pubDate>Tue, 02 Feb 2010 16:35:29 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=176</guid>
		<description><![CDATA[
Adobe Speech Search is a function available in Adobe Premiere and SoundBooth CS4 that allows you to automatically transcribe spoken text in a video clip. In the screen shot above, you can see the metadata text transcription window on the right of the video loaded into Premiere.
The metadata can be incorporated into the video file [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-177" title="adobe_speech_search" src="http://active6.com/blog/wp-content/uploads/2010/02/adobe_speech_search-300x123.PNG" alt="adobe_speech_search" width="600" height="400" /></p>
<p>Adobe Speech Search is a function available in Adobe Premiere and SoundBooth CS4 that allows you to automatically transcribe spoken text in a video clip. In the screen shot above, you can see the metadata text transcription window on the right of the video loaded into Premiere.</p>
<p>The metadata can be incorporated into the video file as cue points, or can be exported to an XML file. The latter gives us some interesting possibilities for playback and navigation within a Brightcove Player.</p>
<p><span id="more-176"></span></p>
<p>You can extract the cue point information from an F4V or FLV created with Premiere by using SoundBooth or your own extraction tool based on the Flash media API. If you use SoundBooth, the extracted XML format looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Time<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>44619<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Time<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>event<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>house<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameters<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>source<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>transcription<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>duration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>409<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>confidence<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>36<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameters<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Once we know this, it is easy to build a simple search and index plugin for BEML:</p>
<p><object id="flashObj" width="790" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/64461414001?isVid=1&#038;publisherID=1705665024" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=64497072001&#038;playerID=64461414001&#038;domain=embed&#038;" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9/64461414001?isVid=1&#038;publisherID=1705665024" bgcolor="#FFFFFF" flashVars="@videoPlayer=64497072001&#038;playerID=64461414001&#038;domain=embed&#038;" base="http://admin.brightcove.com" name="flashObj" width="790" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p>
<p>Sample code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;300&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;412&quot;</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">ArrayCollection</span>;
&nbsp;
		<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
		<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">components</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">dtos</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">search</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">utils</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Results:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Speech:<span style="color: #0066CC;">XML</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Speech XML URL Root</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> SpeechURL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;http://active6.com/blog/code/beml_speech/xml/&quot;</span>; 
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for BC Player Reference		</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Wrapper:BrightcoveModuleWrapper = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for VideoPlayer Reference </span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> VideoPlayer:VideoPlayerModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for Experience Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Experience:ExperienceModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span>  setInterface<span style="color: #66cc66;">&#40;</span>player:IEventDispatcher<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Save the passed BC player Object reference</span>
			Wrapper = <span style="color: #000000; font-weight: bold;">new</span> BrightcoveModuleWrapper<span style="color: #66cc66;">&#40;</span>player<span style="color: #66cc66;">&#41;</span>; 
			Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;
&nbsp;
		  	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> 
		  	<span style="color: #66cc66;">&#123;</span> 
		    	Wrapper.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>; 
		    	Wrapper.<span style="color: #006600;">loadModules</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
		  	<span style="color: #66cc66;">&#125;</span> 
		  	<span style="color: #b1b100;">else</span> 
		  	<span style="color: #66cc66;">&#123;</span> 
		     	checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		    <span style="color: #66cc66;">&#125;</span> 
		 <span style="color: #66cc66;">&#125;</span> 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onModulesLoaded<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span> 
			  Wrapper.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>; 
			  Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule; 
			  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> 
			  <span style="color: #66cc66;">&#123;</span> 
			    checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
			  <span style="color: #66cc66;">&#125;</span>			   
		<span style="color: #66cc66;">&#125;</span>		 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span> 
  			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience.<span style="color: #006600;">getReady</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> 
  			<span style="color: #66cc66;">&#123;</span> 
    			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
  			<span style="color: #66cc66;">&#125;</span> 
  			<span style="color: #b1b100;">else</span> 
  			<span style="color: #66cc66;">&#123;</span> 
    			Experience.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>; 
  			<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onTemplateReady<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span> 
  			Experience.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>; 
  			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>	
			VideoPlayer = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">VIDEO_PLAYER</span><span style="color: #66cc66;">&#41;</span> as VideoPlayerModule;
			VideoPlayer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MediaEvent.<span style="color: #006600;">CHANGE</span>, onMediaChange<span style="color: #66cc66;">&#41;</span>	
			GetSpeechFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;										
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onMediaChange<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			GetSpeechFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;							
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> GetSpeechFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
	      	<span style="color: #0066CC;">try</span>
	      	<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">video</span>:<span style="color: #0066CC;">Object</span> = VideoPlayer.<span style="color: #006600;">getCurrentVideo</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>SpeechURL + <span style="color: #0066CC;">video</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&quot;.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
		      	request.<span style="color: #006600;">method</span> = URLRequestMethod.<span style="color: #0066CC;">GET</span>;
&nbsp;
		       	<span style="color: #000000; font-weight: bold;">var</span> loader:URLLoader = <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		      	loader.<span style="color: #006600;">dataFormat</span> = URLLoaderDataFormat.<span style="color: #0066CC;">TEXT</span>;
		      	loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, handleResults<span style="color: #66cc66;">&#41;</span>;
		      	loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, ioErrorHandler<span style="color: #66cc66;">&#41;</span>;
	      		loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;
	      	<span style="color: #66cc66;">&#125;</span>
	      	<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
	      	<span style="color: #66cc66;">&#123;</span>
&nbsp;
	      	<span style="color: #66cc66;">&#125;</span>	      						
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleResults<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>					 
			<span style="color: #000000; font-weight: bold;">var</span> response:<span style="color: #0066CC;">String</span> = evt.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">data</span> as <span style="color: #0066CC;">String</span>;
			Speech = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>response<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> ioErrorHandler<span style="color: #66cc66;">&#40;</span>evt:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> SearchClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			Results.<span style="color: #006600;">removeAll</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">for</span> each<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> cuepoint:<span style="color: #0066CC;">XML</span> <span style="color: #b1b100;">in</span> Speech.<span style="color: #006600;">CuePoint</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> cuepoint.<span style="color: #0066CC;">Name</span> == SpeechSearch.<span style="color: #0066CC;">text</span> <span style="color: #66cc66;">&#41;</span>
				<span style="color: #66cc66;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">var</span> o:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					o.<span style="color: #0066CC;">Time</span> = cuepoint.<span style="color: #0066CC;">Time</span>;
					o.<span style="color: #006600;">Label</span> = SpeechSearch.<span style="color: #0066CC;">text</span> + <span style="color: #ff0000;">&quot; : Time Index &quot;</span> + cuepoint.<span style="color: #0066CC;">Time</span>;
					Results.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>o<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span> 
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>	
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> SkipClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> o:<span style="color: #0066CC;">Object</span> = ResultList.<span style="color: #006600;">selectedItem</span>;
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">index</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>o.<span style="color: #0066CC;">Time</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">1000</span>;
			<span style="color: #0066CC;">Status</span>.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;Skipping to index &quot;</span> + <span style="color: #0066CC;">index</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			VideoPlayer.<span style="color: #0066CC;">seek</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>			
&nbsp;
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:VBox x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:HBox <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;26&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Search&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:TextInput <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> id=<span style="color: #ff0000;">&quot;SpeechSearch&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;house&quot;</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#D6D6D6&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Go&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;49&quot;</span> id=<span style="color: #ff0000;">&quot;ButtonSearch&quot;</span> click=<span style="color: #ff0000;">&quot;SearchClick()&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>mx:HBox<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">List</span> dataProvider=<span style="color: #ff0000;">&quot;{Results}&quot;</span> id=<span style="color: #ff0000;">&quot;ResultList&quot;</span> labelField=<span style="color: #ff0000;">&quot;Label&quot;</span> borderStyle=<span style="color: #ff0000;">&quot;none&quot;</span> click=<span style="color: #ff0000;">&quot;SkipClick()&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #66cc66;">&gt;&lt;/</span>mx:List<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:Label id=<span style="color: #ff0000;">&quot;Status&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Search a term and click in the results&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:VBox<span style="color: #66cc66;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/flex/using-adobe-speech-search-cue-points-in-a-brightcove-player/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test BC/WP Plugin</title>
		<link>http://active6.com/blog/uncategorized/test-bcwp-plugin</link>
		<comments>http://active6.com/blog/uncategorized/test-bcwp-plugin#comments</comments>
		<pubDate>Thu, 28 Jan 2010 15:35:13 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=173</guid>
		<description><![CDATA[
  
]]></description>
			<content:encoded><![CDATA[<p><embed src='http://c.brightcove.com/services/viewer/federated_f9/1911416499?isVid=1&publisherID=1705665024' 
    bgcolor='#FFFFFF' 
    flashVars='@videoPlayer=40028113001&playerID=1911416499&domain=embed&' 
    base='http://admin.brightcove.com' 
    name='flashObj' 
    width='486' 
    height='412' 
    seamlesstabbing='false' 
    type='application/x-shockwave-flash' 
    allowFullScreen='true' 
    swLiveConnect='true' 
    pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>
  </embed></p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/uncategorized/test-bcwp-plugin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Visible Brightcove Plugin</title>
		<link>http://active6.com/blog/actionscript/creating-a-visible-brightcove-plugin</link>
		<comments>http://active6.com/blog/actionscript/creating-a-visible-brightcove-plugin#comments</comments>
		<pubDate>Tue, 26 Jan 2010 15:57:33 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=168</guid>
		<description><![CDATA[
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 templatethat 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 [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="bc_plugin" src="http://active6.com/blog/wp-content/uploads/2010/01/bc_plugin.PNG" alt="bc_plugin" width="546" height="295" /></p>
<p>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 templatethat loads the external swf. By default, this plugin interface is intended for <em>invisible</em> 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&#8217;s Stage.</p>
<p>This article provides a sample player with a visible plugin added in this way as well as some sample code.</p>
<p><span id="more-168"></span></p>
<p>This player receives the plugin that is configured in the screen shot above:</p>
<p><object id="flashObj" width="486" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/63347543001?isVid=1&#038;publisherID=1705665024" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=40028113001&#038;playerID=63347543001&#038;domain=embed&#038;" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9/63347543001?isVid=1&#038;publisherID=1705665024" bgcolor="#FFFFFF" flashVars="@videoPlayer=40028113001&#038;playerID=63347543001&#038;domain=embed&#038;" base="http://admin.brightcove.com" name="flashObj" width="486" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p>
<p>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&#8217;s dimensions from the Stage reference should give you enough leverage to work around that.</p>
<p>Here is the full code for the plugin:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;">&nbsp;
package <span style="color: #66cc66;">&#123;</span>	
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">APIModules</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">CustomModule</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #006600;">ContentModule</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #006600;">ExperienceModule</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #006600;">VideoPlayerModule</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;	
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> VisiblePlugin <span style="color: #0066CC;">extends</span> CustomModule
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">//------------------------------------------------------------------</span>
		<span style="color: #808080; font-style: italic;">// Statics and variables</span>
		<span style="color: #808080; font-style: italic;">//------------------------------------------------------------------		</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// Reference to the videoPlayerModule and experience module.  </span>
		internal <span style="color: #000000; font-weight: bold;">var</span> _videoPlayerModule:VideoPlayerModule = <span style="color: #000000; font-weight: bold;">null</span>;
		internal <span style="color: #000000; font-weight: bold;">var</span> _experienceModule:ExperienceModule = <span style="color: #000000; font-weight: bold;">null</span>;
		internal <span style="color: #000000; font-weight: bold;">var</span> _contentModule:ContentModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> VisiblePlugin<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>   
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
      	override protected <span style="color: #000000; font-weight: bold;">function</span> initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
      	<span style="color: #66cc66;">&#123;</span>
      		player.<span style="color: #006600;">loadModules</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
      		_experienceModule = player.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;
	        _videoPlayerModule = player.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">VIDEO_PLAYER</span><span style="color: #66cc66;">&#41;</span> as VideoPlayerModule;
	        _contentModule = player.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">CONTENT</span><span style="color: #66cc66;">&#41;</span> as ContentModule;
&nbsp;
	        <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">stage</span>:<span style="color: #0066CC;">Stage</span> = _experienceModule.<span style="color: #006600;">getStage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	        <span style="color: #000000; font-weight: bold;">var</span> textLabel:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
	        <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> textLabel<span style="color: #66cc66;">&#41;</span>;
	        textLabel.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;Added to Stage&quot;</span>;
            textLabel.<span style="color: #0066CC;">textColor</span> = 0xFFFFFF;            			
            textLabel.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">10</span>;
            textLabel.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">5</span>;
            textLabel.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;	        
			textLabel.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;			
      	<span style="color: #66cc66;">&#125;</span>	
 	<span style="color: #66cc66;">&#125;</span>			
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/actionscript/creating-a-visible-brightcove-plugin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BEML Slow-Motion Control</title>
		<link>http://active6.com/blog/actionscript/beml-slow-motion-control</link>
		<comments>http://active6.com/blog/actionscript/beml-slow-motion-control#comments</comments>
		<pubDate>Tue, 01 Dec 2009 15:04:32 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=163</guid>
		<description><![CDATA[
The example above shows a slow-motion control incorporated into a Brightcove Player using BEML. The full code is listed below.


&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; showEffect=&#34;{FadeIn}&#34; layout=&#34;absolute&#34; backgroundColor=&#34;#888888&#34; backgroundAlpha=&#34;0&#34; backgroundGradientAlphas=&#34;[0, 0]&#34; backgroundGradientColors=&#34;[#000000, #000000]&#34; width=&#34;110&#34; height=&#34;24&#34; xmlns:local=&#34;*&#34;&#62;
&#160;
	&#60;mx:Script&#62;
		&#60;!&#91;CDATA&#91;
&#160;
		import mx.controls.Alert;
	    import flash.utils.Timer;
    	import flash.events.TimerEvent;		
		import flash.display.Stage;
		import com.brightcove.api.*;
		import com.brightcove.api.components.*;
		import com.brightcove.api.dtos.*;
		import com.brightcove.api.events.*;
		import com.brightcove.api.modules.*;
		import com.brightcove.api.search.*;
		import com.brightcove.api.utils.*;
&#160;
		private var timer:Timer [...]]]></description>
			<content:encoded><![CDATA[<p><object id="flashObj" width="486" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/49914045001?isVid=1&#038;publisherID=1705665024" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=53391829001&#038;playerID=49914045001&#038;domain=embed&#038;" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9/49914045001?isVid=1&#038;publisherID=1705665024" bgcolor="#FFFFFF" flashVars="@videoPlayer=53391829001&#038;playerID=49914045001&#038;domain=embed&#038;" base="http://admin.brightcove.com" name="flashObj" width="486" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p>
<p>The example above shows a slow-motion control incorporated into a Brightcove Player using BEML. The full code is listed below.<br />
<span id="more-163"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> showEffect=<span style="color: #ff0000;">&quot;{FadeIn}&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#888888&quot;</span> backgroundAlpha=<span style="color: #ff0000;">&quot;0&quot;</span> backgroundGradientAlphas=<span style="color: #ff0000;">&quot;[0, 0]&quot;</span> backgroundGradientColors=<span style="color: #ff0000;">&quot;[#000000, #000000]&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;110&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;24&quot;</span> xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
&nbsp;
		<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
	    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Timer</span>;
    	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TimerEvent</span>;		
		<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">components</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">dtos</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">search</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">utils</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> timer:Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for BC Player Reference		</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Wrapper:BrightcoveModuleWrapper = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for VideoPlayer Reference </span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> VideoPlayer:VideoPlayerModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for Experience Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Experience:ExperienceModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> isFullScreen:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>; 
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span>  setInterface<span style="color: #66cc66;">&#40;</span>player:IEventDispatcher<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Save the passed BC player Object reference</span>
			Wrapper = <span style="color: #000000; font-weight: bold;">new</span> BrightcoveModuleWrapper<span style="color: #66cc66;">&#40;</span>player<span style="color: #66cc66;">&#41;</span>; 
			Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;
&nbsp;
		  	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> 
		  	<span style="color: #66cc66;">&#123;</span> 
		    	Wrapper.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>; 
		    	Wrapper.<span style="color: #006600;">loadModules</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
		  	<span style="color: #66cc66;">&#125;</span> 
		  	<span style="color: #b1b100;">else</span> 
		  	<span style="color: #66cc66;">&#123;</span> 
		     	checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		    <span style="color: #66cc66;">&#125;</span> 
		 <span style="color: #66cc66;">&#125;</span> 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onModulesLoaded<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>  
		<span style="color: #66cc66;">&#123;</span> 
			  Wrapper.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>; 
			  Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule; 
			  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> 
			  <span style="color: #66cc66;">&#123;</span> 
			    checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
			  <span style="color: #66cc66;">&#125;</span>			   
		<span style="color: #66cc66;">&#125;</span>		 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span> 
  			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience.<span style="color: #006600;">getReady</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> 
  			<span style="color: #66cc66;">&#123;</span> 
    			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
  			<span style="color: #66cc66;">&#125;</span> 
  			<span style="color: #b1b100;">else</span> 
  			<span style="color: #66cc66;">&#123;</span> 
    			Experience.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>; 
  			<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onTemplateReady<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span> 
  			Experience.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>; 
  			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>	
			timer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>, onTimer<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			VideoPlayer = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">VIDEO_PLAYER</span><span style="color: #66cc66;">&#41;</span> as VideoPlayerModule;
&nbsp;
			<span style="color: #808080; font-style: italic;">//Add a listener for full screen switching</span>
			Experience.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">ENTER_FULLSCREEN</span>, onEnterFullScreen<span style="color: #66cc66;">&#41;</span>;
			Experience.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">EXIT_FULLSCREEN</span>, onExitFullScreen<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//Add a listener for a video being loaded</span>
			VideoPlayer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MediaEvent.<span style="color: #006600;">PROGRESS</span>, onMediaProgress<span style="color: #66cc66;">&#41;</span>;	
			VideoPlayer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MediaEvent.<span style="color: #006600;">CHANGE</span>, onMediaChange<span style="color: #66cc66;">&#41;</span>	
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onEnterFullScreen<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			isFullScreen = <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onExitFullScreen<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			isFullScreen = <span style="color: #000000; font-weight: bold;">false</span>;
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onMediaChange<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onSlomoChange<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> slomo.<span style="color: #006600;">value</span> <span style="color: #66cc66;">&gt;</span> 0 <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				VideoPlayer.<span style="color: #0066CC;">setVolume</span><span style="color: #66cc66;">&#40;</span>0<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">else</span>
			<span style="color: #66cc66;">&#123;</span>
				VideoPlayer.<span style="color: #0066CC;">setVolume</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>			
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #808080; font-style: italic;">//Handler for videoLoad events from the content module</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onMediaProgress<span style="color: #66cc66;">&#40;</span>evt:MediaEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">time</span> : <span style="color: #0066CC;">Number</span> = evt.<span style="color: #0066CC;">position</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> slomo.<span style="color: #006600;">value</span> <span style="color: #66cc66;">&gt;</span> 0 <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				timer.<span style="color: #006600;">delay</span> = slomo.<span style="color: #006600;">value</span>;
				VideoPlayer.<span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;				
				timer.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>		 
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onTimer<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			timer.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			VideoPlayer.<span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onMouseOver<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>	
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onPlayClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span> VideoPlayer.<span style="color: #006600;">isPlaying</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				VideoPlayer.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">else</span>
			<span style="color: #66cc66;">&#123;</span>
				VideoPlayer.<span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>	
&nbsp;
&nbsp;
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Fade id=<span style="color: #ff0000;">&quot;FadeIn&quot;</span> alphaFrom=<span style="color: #ff0000;">&quot;0&quot;</span> alphaTo=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">duration</span>=<span style="color: #ff0000;">&quot;500&quot;</span><span style="color: #66cc66;">/&gt;</span>	
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Canvas <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> cornerRadius=<span style="color: #ff0000;">&quot;8&quot;</span> borderStyle=<span style="color: #ff0000;">&quot;solid&quot;</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#474747&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:HSlider x=<span style="color: #ff0000;">&quot;25&quot;</span> y=<span style="color: #ff0000;">&quot;1&quot;</span> minimum=<span style="color: #ff0000;">&quot;0&quot;</span> maximum=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;80&quot;</span> id=<span style="color: #ff0000;">&quot;slomo&quot;</span> change=<span style="color: #ff0000;">&quot;onSlomoChange()&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;6&quot;</span> y=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&amp;gt;&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span> fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span> id=<span style="color: #ff0000;">&quot;PlayButton&quot;</span> fontSize=<span style="color: #ff0000;">&quot;12&quot;</span> click=<span style="color: #ff0000;">&quot;onPlayClick()&quot;</span><span style="color: #66cc66;">/&gt;</span>		
	<span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/actionscript/beml-slow-motion-control/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multilingual Subtitling Using BEML &amp; External Subtitle Files</title>
		<link>http://active6.com/blog/actionscript/multilingual-subtitling-using-beml-external-subtitle-files</link>
		<comments>http://active6.com/blog/actionscript/multilingual-subtitling-using-beml-external-subtitle-files#comments</comments>
		<pubDate>Tue, 01 Dec 2009 14:08:02 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=158</guid>
		<description><![CDATA[
In some cases, you may need to display subtitles in more than one language, or in different notations &#8211; but not necessarily for the entire video. The music video above illustrates this case: it sometimes has three subtitle text channels: Japanese Kanji, Romaji Transcription, and an English translation, but some of the song&#8217;s lines are [...]]]></description>
			<content:encoded><![CDATA[<p><object id="flashObj" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="486" height="412" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=33356604001&amp;playerID=33281756001&amp;domain=embed&amp;" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://c.brightcove.com/services/viewer/federated_f9/33281756001?isVid=1&amp;publisherID=1705665024" /><param name="name" value="flashObj" /><param name="flashvars" value="@videoPlayer=33356604001&amp;playerID=33281756001&amp;domain=embed&amp;" /><param name="allowfullscreen" value="true" /><embed id="flashObj" type="application/x-shockwave-flash" width="486" height="412" src="http://c.brightcove.com/services/viewer/federated_f9/33281756001?isVid=1&amp;publisherID=1705665024" name="flashObj" allowscriptaccess="always" swliveconnect="true" allowfullscreen="true" seamlesstabbing="false" base="http://admin.brightcove.com" flashvars="@videoPlayer=33356604001&amp;playerID=33281756001&amp;domain=embed&amp;" bgcolor="#FFFFFF"></embed></object></p>
<p>In some cases, you may need to display subtitles in more than one language, or in different notations &#8211; but not necessarily for the entire video. The music video above illustrates this case: it sometimes has three subtitle text channels: Japanese Kanji, Romaji Transcription, and an English translation, but some of the song&#8217;s lines are only in English. In such situations, I believe it&#8217;s more efficient to use time codes and external subtitle text files than cue points, and to &#8220;compose&#8221; a joint subtitle text file server-side.</p>
<p>This BEML player uses a plugin that checks for external .srt file(s) for a video being loaded. As the .srt is a format that can be extracted from DVDs easily, it requires very little configuration other than a base URL and a file naming convention for the subtitles to be pulled in.</p>
<p>To show the per-video dynamic subtitle loading, I&#8217;ve also provided subtitles for the &#8220;Puffy &#8211; Dareka Ga&#8221; listed in related videos for this player.</p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/actionscript/multilingual-subtitling-using-beml-external-subtitle-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling JavaScript from a BEML Plugin</title>
		<link>http://active6.com/blog/uncategorized/calling-javascript-from-a-beml-plugin</link>
		<comments>http://active6.com/blog/uncategorized/calling-javascript-from-a-beml-plugin#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:49:35 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=137</guid>
		<description><![CDATA[This article will show you how to call an external JavaScript function from a BEML plugin loaded into a Brightcove player.
There are two parts to making this work: first, we need to create a BEML plugin, I&#8217;ve done this in Flex, and provided the framework for you to integrate any business logic you may want [...]]]></description>
			<content:encoded><![CDATA[<p>This article will show you how to call an external JavaScript function from a BEML plugin loaded into a Brightcove player.</p>
<p>There are two parts to making this work: first, we need to create a BEML plugin, I&#8217;ve done this in Flex, and provided the framework for you to integrate any business logic you may want to trigger the JavaScript call by getting the references to the Brightcove Player.<br />
<span id="more-137"></span><br />
The main things to include to call external JavaScript are:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">external</span>.<span style="color: #66cc66;">*</span>;</pre></div></div>

<p>and the bridge to the external JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> javascriptFunction:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;showAlert&quot;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Hello From BEML!&quot;</span>;
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>ExternalInterface.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>javascriptFunction, <span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Second, we need to add a JavaScript function for the plugin to call to the embedding HTML page, something like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>mce<span style="color: #339933;">:</span>0<span style="color: #339933;">--&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The full code contains a skeleton for handling loading and setting up the plugin correctly in a Brightcove player:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;">&nbsp;
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
&nbsp;
		<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
		<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;
		<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">external</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">components</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">dtos</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">modules</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">search</span>.<span style="color: #66cc66;">*</span>;
		<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">brightcove</span>.<span style="color: #006600;">api</span>.<span style="color: #006600;">utils</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for BC Player Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Wrapper:BrightcoveModuleWrapper = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for VideoPlayer Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> VideoPlayer:VideoPlayerModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for Experience Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Experience:ExperienceModule = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span>  setInterface<span style="color: #66cc66;">&#40;</span>player:IEventDispatcher<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Save the passed BC player Object reference</span>
			Wrapper = <span style="color: #000000; font-weight: bold;">new</span> BrightcoveModuleWrapper<span style="color: #66cc66;">&#40;</span>player<span style="color: #66cc66;">&#41;</span>;
			Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;
&nbsp;
		  	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
		  	<span style="color: #66cc66;">&#123;</span>
		    	Wrapper.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>;
		    	Wrapper.<span style="color: #006600;">loadModules</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		  	<span style="color: #66cc66;">&#125;</span>
		  	<span style="color: #b1b100;">else</span>
		  	<span style="color: #66cc66;">&#123;</span>
		     	checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		    <span style="color: #66cc66;">&#125;</span>
		 <span style="color: #66cc66;">&#125;</span> 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onModulesLoaded<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			  Wrapper.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">MODULES_LOADED</span>, onModulesLoaded<span style="color: #66cc66;">&#41;</span>;
			  Experience = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;
			  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
			  <span style="color: #66cc66;">&#123;</span>
			    checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			  <span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>		 
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> checkReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
  			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Experience.<span style="color: #006600;">getReady</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  			<span style="color: #66cc66;">&#123;</span>
    			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  			<span style="color: #66cc66;">&#125;</span>
  			<span style="color: #b1b100;">else</span>
  			<span style="color: #66cc66;">&#123;</span>
    			Experience.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>;
  			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onTemplateReady<span style="color: #66cc66;">&#40;</span>event:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
  			Experience.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_READY</span>, onTemplateReady<span style="color: #66cc66;">&#41;</span>;
  			InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> InitApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			VideoPlayer = Wrapper.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">VIDEO_PLAYER</span><span style="color: #66cc66;">&#41;</span> as VideoPlayerModule;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> javascriptFunction:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;showAlert&quot;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Hello From BEML!&quot;</span>;
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>ExternalInterface.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>javascriptFunction, <span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/uncategorized/calling-javascript-from-a-beml-plugin/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Adobe Stratus Beta Sample App and PHP/MySQL</title>
		<link>http://active6.com/blog/flex/the-adobe-stratus-beta-sample-app-and-phpmysql</link>
		<comments>http://active6.com/blog/flex/the-adobe-stratus-beta-sample-app-and-phpmysql#comments</comments>
		<pubDate>Fri, 03 Apr 2009 04:23:26 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=118</guid>
		<description><![CDATA[
There is a new ActionScript 3.0 API in Flash Player 10 to support RTMFP, allowing for some really exciting stuff with regard to C2C (Client-To-Client) communications between Flex apps. This requires you to set up an account and a callback URL with the Adobe Stratus beta. There&#8217;s a really cool Stratus sample application on Adobe [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://active6.com/blog/wp-content/uploads/2009/04/capture.jpg" alt="capture" title="capture" width="543" height="215" class="alignnone size-full wp-image-124" /><br />
There is a new ActionScript 3.0 API in Flash Player 10 to support RTMFP, allowing for some really exciting stuff with regard to C2C (Client-To-Client) communications between Flex apps. This requires you to set up an account and a callback URL with the Adobe Stratus beta. There&#8217;s a really cool Stratus sample application on Adobe Labs, unfortunately the callback script syntax and responses are not described in much detail. This article attempts to reconstruct this and provide some PHP/MySQL code to work with Stratus.<br />
<span id="more-118"></span></p>
<h2>Introduction</h2>
<p>Flash Player 10 and Adobe AIR 1.5 introduce a new communications protocol called the Real-Time Media Flow Protocol (RTMFP). The most important features of RTMFP include low latency, end-to-end peering capability, security and scalability. These properties make RTMFP especially well suited for developing real-time collaboration applications by not only providing superior user experience but also reducing cost for operators.</p>
<p>In order to use RTMFP, Flash Player endpoints must connect to an RTMFP-capable server, such as the Adobe Stratus service. Stratus is a beta, hosted rendezvous service that aids establishing communications between Flash Player endpoints. Unlike Flash Media Server, Stratus does not support media relay, shared objects, scripting, etc. So by using Stratus, you can only develop applications where Flash Player endpoints are directly communicating with each other.</p>
<p>Connecting to the Stratus service and creating end-to-end media streams are analogous to working with Flash Media Server. Please note that you must use ActionScript 3.0 with either Flash Professional CS4 or Flex Builder 3 targeting Flash Player 10 or AIR 1.5.</p>
<p>For details, check these resources:</p>
<ul>
<li><a href="http://labs.adobe.com/technologies/stratus/" target="_blank">Adobe Labs Stratus Home Page</a></li>
</ul>
<ul>
<li> <a href="http://www.adobe.com/devnet/flashplayer/articles/rtmfp_stratus_app.html" target="_blank">Stratus service for developing end-to-end applications using RTMFP in Flash Player</a></li>
</ul>
<ul>
<li><a href="http://labs.adobe.com/technologies/stratus/samples/" target="_blank">Stratus Sample Application</a></li>
</ul>
<p>Please read these carefully as I&#8217;m not going to repeat what&#8217;s described there.</p>
<p>The Callback Script</p>
<p>The python callback script (reg.cgi) included with the sample source is a bit cryptic:</p>
<p>So let&#8217;s see if we can make a better documented PHP/MySQL equivalent of this.</p>
<h2>The Database</h2>
<p>I&#8217;ve created a database in MySQL using the following script:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql mysql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> IF <span style="color: #aa3399; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> `registrations` <span style="color: #66cc66;">&#40;</span>
  `id` <span style="color: #aa9933; font-weight: bold;">BIGINT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">AUTO_INCREMENT</span>,
  `appid` <span style="color: #aa9933; font-weight: bold;">BIGINT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,
  `username` <span style="color: #aa9933; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,
  `identity` <span style="color: #aa9933; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">120</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,
  `updated` <span style="color: #aa9933; font-weight: bold;">DATETIME</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0000-00-00 00:00:00'</span>,
  <span style="color: #993333; font-weight: bold;">PRIMARY KEY</span>  <span style="color: #66cc66;">&#40;</span>`id`<span style="color: #66cc66;">&#41;</span>,
  KEY `updated` <span style="color: #66cc66;">&#40;</span>`updated`<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENG<span style="color: #66cc66;">IN</span>E<span style="color: #66cc66;">=</span>My<span style="color: #66cc66;">IS</span>AM  <span style="color: #aa3399; font-weight: bold;">DEFAULT</span> <span style="color: #aa3399; font-weight: bold;">CHARSET</span><span style="color: #66cc66;">=</span>latin1;</pre></div></div>

<p>The <strong>appid </strong>field is not really required, I plan to use it to distinghuish between connects from various apps.</p>
<h2>Callback Scenarios</h2>
<p>So far I&#8217;ve found three callback scenarios:</p>
<ul>
<li>The user connects</li>
<li>The user disconnects</li>
<li>The user calls another user (by passing the username)</li>
</ul>
<h3>The user connects</h3>
<p>The REST-based call Stratus will make to your callback URL looks like this:</p>
<p>http://your.domain/reg.php?username=foo&amp;identity=1234</p>
<p>Stratus expects you to return a simple XML document:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>where <strong>updated</strong> is true or false depending on whether the database was updated.</p>
<h3>The user disconnects</h3>
<p>Exactly the same REST call as for a connect, except that the identity value will be ZERO.</p>
<h3>The user calls another user</h3>
<p>The REST-based call Stratus will make to your callback URL looks like this:</p>
<p>http://your.domain/reg.php?friends=foo</p>
<p>Stratus expects you to return a simple XML document:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;user<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/user<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;identity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1234<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/identity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>PHP Code</h2>
<p>I&#8217;m using a fairly straightforward Database abstraction class here. There&#8217;s also a simple LogFile() function in the code that dumps the entire callback request to a text file. Zipped code with my database class and XML templates is <a href="http://active6.com/blog/code/stratus/stratus.zip">here</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Database Configuration</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="">'Database.php'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="">'DB_HOST'</span><span style="color: #339933;">,</span> <span style="">'localhost'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="">'DB_USER'</span><span style="color: #339933;">,</span> <span style="">'stratus'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="">'DB_PW'</span><span style="color: #339933;">,</span> <span style="">'******'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="">'DB_DBNAME'</span><span style="color: #339933;">,</span> <span style="">'db_stratus'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Validation of script call</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Log the entire request into a log file for easy inspection</span>
LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//Check if the request contains a value for &quot;friends&quot; or for &quot;username/identity&quot;</span>
<span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'friends'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span>;
  ProcessFriendRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;      
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'identity'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span>;
  ProcessRegistration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;  
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$valid</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>  
  ProcessError<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Process a friend request</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #000000; font-weight: bold;">function</span> ProcessFriendRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Database<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT id, appid, username, identity, updated FROM registrations WHERE username='%s'&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'friends'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
  LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetObject</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="">'false'</span>; 
    <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="">'update.xml'</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'$update'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$update</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;  
    <span style="color: #990000;">echo</span> <span style="color: #000088;">$reply</span>;    
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>  
    <span style="color: #666666; font-style: italic;">//Get the XML Response Template file and format it </span>
    <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="">'friends.xml'</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'$user'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'$identity'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">identity</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;
    LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #990000;">echo</span> <span style="color: #000088;">$reply</span>;
  <span style="color: #009900;">&#125;</span>      
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Process a registration (identity will be 0 when disconnecting)</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #000000; font-weight: bold;">function</span> ProcessRegistration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Database<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;  
  <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT id, appid, username, identity, updated FROM registrations WHERE username='%s'&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span>; 
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">GetObject</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Record does not exist yet</span>
    <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span>;
    <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO registrations (appid, username, identity, updated) VALUES ( 0, '%s', '%s', NOW())&quot;</span><span style="color: #339933;">,</span>
      <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'identity'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>;  
    LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>;    
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//Record already exists</span>
    <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span>;
    <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UPDATE registrations SET updated = NOW(), identity = '%s' WHERE username = '%s'&quot;</span><span style="color: #339933;">,</span>
      <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'identity'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>; 
    LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>;         
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//Get the XML Response Template file and format it </span>
  <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="">'update.xml'</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'$update'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$update</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;  
  LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #990000;">echo</span> <span style="color: #000088;">$reply</span>;    
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Process an error</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #000000; font-weight: bold;">function</span> ProcessError<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="">'false'</span>; 
  <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="">'update.xml'</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="">'$update'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$update</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>; 
  LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span>; 
  <span style="color: #990000;">echo</span> <span style="color: #000088;">$reply</span>;    
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #666666; font-style: italic;">// Log File function</span>
<span style="color: #666666; font-style: italic;">//****************************************************************************</span>
<span style="color: #000000; font-weight: bold;">function</span> LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$smsg</span> <span style="color: #339933;">=</span> <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;F jS Y, h:iA&quot;</span><span style="color: #009900;">&#41;</span>; 
  <span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$REMOTE_ADDR</span>; 
  <span style="color: #000088;">$referer</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$HTTP_REFERER</span>; 
  <span style="color: #000088;">$browser</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$HTTP_USER_AGENT</span>;   
  <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;log.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>;   
  <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Time: $time IP: $ipReferer: $referer Browser: $browser | $smsg&quot;</span><span style="color: #009900;">&#41;</span>;   
  <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;   
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/flex/the-adobe-stratus-beta-sample-app-and-phpmysql/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Secured SWFs as BEML Widgets</title>
		<link>http://active6.com/blog/uncategorized/using-secured-swfs-as-beml-widgets</link>
		<comments>http://active6.com/blog/uncategorized/using-secured-swfs-as-beml-widgets#comments</comments>
		<pubDate>Wed, 01 Apr 2009 13:17:34 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=107</guid>
		<description><![CDATA[This article describes how you can use SWF files as widgets in BEML that have been protected by utilities that prevent decompilation. Before we start, just a couple of things I&#8217;d like to point out:

This article is NOT a review of the effectiveness of SWF Protection tools, there are plenty of (endless) discussions on that [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.fenixstudio.org/swcencrypt/images/swc_codes_protected.gif" alt="" align="left" hspace="16" />This article describes how you can use SWF files as widgets in BEML that have been protected by utilities that prevent decompilation. Before we start, just a couple of things I&#8217;d like to point out:</p>
<ul>
<li>This article is NOT a review of the effectiveness of SWF Protection tools, there are plenty of (endless) discussions on that topic on specialized forums.</li>
<li>This approach is NOT my recommended one for creating User Generated Content upload widgets. I still believe using a secured mid-tier upload server is a better model. Event with a protected SWF, a proxy tool like Charles or WireShark will give a hacker all the information he needs to get your token if you do not protect your sensitive Widget/Server communications.</li>
</ul>
<p></p>
<h2>Why would you do this?</h2>
<p>The short answer is that the SWF format is a pseudo-compiled, documented file format. This implies that it is relatively easy to reverse engineer a SWF file. Just Google &#8220;swf decompilers&#8221; and look at the results. There are literally dozens of tools that allow anyone to retrieve the complete source code of a SWF. Regarding BEML Widgets, this may pose some security threats if for example you want to:</p>
<ul>
<li>Create a video upload widget that uploads straight into your Brightcove account. Again, SWF protection by itself is NOT the approach I would recommend, as this requires including/sending a Write Token to use the Media API in your SWF.</li>
<li>Create a widget that interfaces with your backend and that contains configuration information you want to give some level of protection</li>
<li>Create a widget that represents a considerable investment or effort, and by consequence you want to protect from being duplicated</li>
</ul>
<p>to name but a few.</p>
<p><span id="more-107"></span><br />
<object id="flashObj" width="486" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/18178128001?isVid=1&#038;publisherID=1705665024" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=1906945114&#038;playerID=18178128001&#038;domain=embed&#038;" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9/18178128001?isVid=1&#038;publisherID=1705665024" bgcolor="#FFFFFF" flashVars="@videoPlayer=1906945114&#038;playerID=18178128001&#038;domain=embed&#038;" base="http://admin.brightcove.com" name="flashObj" width="486" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p>
<h2>How does it work?</h2>
<p>There are mainly two kinds of SWF protection mechanisms: <strong>encryption </strong>and <strong>obfuscation</strong>. The better protection tools apply <em>both </em>mechanisms.</p>
<p><strong>Encryption </strong>makes code completely unreadable, but requires to keep the decryption-key with the encrypted data. So, an automated tool could be created to decrypt the code, leaving the fully unencrypted, unobfuscated code in plain view.</p>
<p><strong>Obfuscation </strong>is the concealment of the code&#8217;s meaning, making it confusing and harder to understand. It&#8217;s not encryption, but in the context of code, it might be better.</p>
<p>Note that not even the combo of encrypt+obfuscate is 100 percent waterproof. The goal is to make the process of reverse engineering extremely time consuming and painful so that it is not worth the effort.</p>
<h2>The Widget Code</h2>
<p>The widget we&#8217;ll use in this example is a simple Flex AS3 application:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span>  <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#000000&quot;</span> backgroundGradientAlphas=<span style="color: #ff0000;">&quot;[1.0, 1.0]&quot;</span> backgroundGradientColors=<span style="color: #ff0000;">&quot;[#000000, #000000]&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for BC Player Reference		</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> BCPlayer: <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//Placeholder for VideoPlayer Reference</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> VideoPlayer: <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span>  setInterface<span style="color: #66cc66;">&#40;</span>player:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Save the passed BC player Object reference</span>
			BCPlayer = player;
&nbsp;
			<span style="color: #808080; font-style: italic;">//Retrieve the VideoPlayer Module references</span>
			VideoPlayer = BCPlayer.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;videoPlayer&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//Add a listener for a video being loaded</span>
			VideoPlayer.<span style="color: #006600;">addEventListener</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;streamStart&quot;</span>, streamStart<span style="color: #66cc66;">&#41;</span>;	
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> ShowWidget<span style="color: #66cc66;">&#40;</span>showIt:<span style="color: #0066CC;">Boolean</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//If widget is to be shown, go to player view mode</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>showIt<span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				VideoPlayer.<span style="color: #006600;">goFullScreen</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">visible</span> = showIt;  
			VideoPlayer.<span style="color: #006600;">setVisible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>showIt<span style="color: #66cc66;">&#41;</span>;			
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">//Handler for videoLoad events from the content module</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> streamStart<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			ShowWidget<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> ContinueVideo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			ShowWidget<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>		
&nbsp;
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:VBox <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;400&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;180&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:Label <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span> id=<span style="color: #ff0000;">&quot;SecureMessage&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;This widget shows how to integrate a secured SWF widget in BEML&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;46&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Continue&quot;</span> id=<span style="color: #ff0000;">&quot;ContinueButton&quot;</span> click=<span style="color: #ff0000;">&quot;ContinueVideo()&quot;</span><span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:VBox<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

<h2>The BEML Code</h2>
<p>The BEML with the widget plugged in looks is as simple as it gets:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;VideoPlayer</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;videoPlayer&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">x</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">depth</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">visible</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SWFLoader</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;Secure&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">x</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;http://active6.com/blog/code/secure/secure_BEMLSecureSWF.swf&quot;</span> <span style="color: #000066;">depth</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">visible</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Building a Secured SWF from your AS3 code</h2>
<p>To make a secured version of your BEML widget, you will need a protection tool. For this article, I&#8217;ve used <a href="http://www.kindisoft.com/" target="_blank">KindiSoft&#8217;s SecureSWF</a>, as it has an evaluation version that is not limited in time or number of uses and allowed for easy highlighting of the minor tweakings you will need to do to get a protected SWF working as a BEML widget.</p>
<p>Download and install a demo version of this tool. Run it, and add your SWF file to the empty Project:</p>
<p><img class="alignnone size-full wp-image-109" title="bemlsecureswf01" src="http://active6.com/blog/wp-content/uploads/2009/04/bemlsecureswf01.jpg" alt="bemlsecureswf01" width="892" height="258" /></p>
<p>If you like, click &#8220;Protect SWF Files&#8221; and try running this BEML player with a protected version of your SWF, but it won&#8217;t work. You will see your browser making the load request, but the widget will not manifest. What&#8217;s going on here?</p>
<p>This tool uses the encrypt+obfuscate tandem mentioned earlier. This means that the original variable, component and function names no longer exists in the obfuscated ActionScript. The Brightcove Player you are pluggin this widget into tries to call the setInterface() function, but it has been obfuscated. So your secured widget is loaded, but it is not passed a reference to the player correctly.</p>
<h2>Defining Identifier Renaming Exceptions</h2>
<p><img class="alignnone size-full wp-image-110" title="bemlsecureswf02" src="http://active6.com/blog/wp-content/uploads/2009/04/bemlsecureswf02.jpg" alt="bemlsecureswf02" width="861" height="362" /></p>
<p>What we need to do is exclude the functions that the Brightcove Player needs from being obfuscated. To do this, select the Identifiers Renaming tab in the tool, and select your SWF in the treeview displayed on this page. Then uncheck the setInterface() and streamStart() functions. Now protect your SWF file again and try loading it into a player. It should work now.</p>
<p>I&#8217;ve deliberately taken an example where the widget is adding some listeners, in this case for the VideoPlayer.streamStart event. As you can see, this implies that the exceptions you need to define will vary from widget to widget. Basically, everything that adds a listener function must have the same name as the one you specify in the the event listener registration.</p>
<p>I&#8217;ve also found that in most cases you will need to disable the Additional renaming options (rename protected namespaces, remove function parameters) for a Widget to be manifested properly with a reference to the player.</p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/uncategorized/using-secured-swfs-as-beml-widgets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acid Pong!</title>
		<link>http://active6.com/blog/flex/acid-pong</link>
		<comments>http://active6.com/blog/flex/acid-pong#comments</comments>
		<pubDate>Mon, 30 Mar 2009 15:08:06 +0000</pubDate>
		<dc:creator>Bob de Wit</dc:creator>
				<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=102</guid>
		<description><![CDATA[
Had a little fun with this over the weekend. In another life I used my Amiga to superimpose Pong on MTV. Well, no need for that anymore in the 21st Century. This is the way Pong should be played. Gratz to anyone who can beat the computer while the Stakker video is playing!

	
WARNING: This WILL [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://active6.com/blog/wp-content/uploads/2009/03/pong.jpg" alt="pong" title="pong" width="641" height="481" class="alignnone size-full wp-image-105" /></p>
<p>Had a little fun with this over the weekend. In another life I used my Amiga to superimpose Pong on MTV. Well, no need for that anymore in the 21st Century. This is the way Pong should be played. Gratz to anyone who can beat the computer while the Stakker video is playing!</p>
<p><span id="more-102"></span><br />
<embed src="http://active6.com/blog/code/pong/PVPong.swf" quality="high" bgcolor="#000000" width="640" height="480" name="AcidPong" align="middle" play="true" loop="false" quality="high" 			allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">	</embed><br />
<strong>WARNING: This WILL fry your brain…do not play this if you have epilepsy.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/blog/flex/acid-pong/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
