<?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>active6</title>
	<atom:link href="http://active6.com/feed" rel="self" type="application/rss+xml" />
	<link>http://active6.com</link>
	<description></description>
	<lastBuildDate>Sun, 23 Jan 2011 18:56:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Brightcove Videos in Second Life</title>
		<link>http://active6.com/brightcove/brightcove-videos-in-second-life</link>
		<comments>http://active6.com/brightcove/brightcove-videos-in-second-life#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:57:49 +0000</pubDate>
		<dc:creator>admin</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 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://active6.com/wp-content/uploads/2010/03/music_wall.jpg"><img class="alignleft size-full wp-image-184" title="music_wall" src="http://active6.com/wp-content/uploads/2010/03/music_wall.jpg" alt="" width="320" height="330" /></a>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 textured with a player and  some navigation prims that would make sense in a 3D environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/brightcove/brightcove-videos-in-second-life/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Adobe Speech Search Cue Points in a Brightcove Player</title>
		<link>http://active6.com/actionscript/using-adobe-speech-search-cue-points-in-a-brightcove-player</link>
		<comments>http://active6.com/actionscript/using-adobe-speech-search-cue-points-in-a-brightcove-player#comments</comments>
		<pubDate>Tue, 02 Feb 2010 16:35:29 +0000</pubDate>
		<dc:creator>admin</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 [...]]]></description>
			<content:encoded><![CDATA[<p><object id="flashObj" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="790" 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=64497072001&amp;playerID=64461414001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvg49S_ILWj6QshxrjSjFeR&amp;domain=embed&amp;dynamicStreaming=true" /><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?isVid=1" /><param name="name" value="flashObj" /><param name="flashvars" value="@videoPlayer=64497072001&amp;playerID=64461414001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvg49S_ILWj6QshxrjSjFeR&amp;domain=embed&amp;dynamicStreaming=true" /><param name="allowfullscreen" value="true" /><embed id="flashObj" type="application/x-shockwave-flash" width="790" height="412" src="http://c.brightcove.com/services/viewer/federated_f9?isVid=1" name="flashObj" allowscriptaccess="always" swliveconnect="true" allowfullscreen="true" seamlesstabbing="false" base="http://admin.brightcove.com" flashvars="@videoPlayer=64497072001&amp;playerID=64461414001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvg49S_ILWj6QshxrjSjFeR&amp;domain=embed&amp;dynamicStreaming=true" bgcolor="#FFFFFF"></embed></object><br />
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.</p>
<p>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.</p>
<p>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.</p>
<p>If you use SoundBooth, the extracted XML format looks something like this:</p>
<div class="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<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><br />
&nbsp;<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><br />
&nbsp;<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><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameters<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<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><br />
&nbsp; &nbsp;<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><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<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><br />
&nbsp; &nbsp;<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><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<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><br />
&nbsp; &nbsp;<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><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameters<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CuePoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Once we know this, it is easy to build a simple search and index plugin for BEML</p>
<p>Sample code:</p>
<div class="codecolorer-container mxml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;412&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;mx:Script&gt;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;![CDATA[</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mx.collections.ArrayCollection;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import mx.controls.Alert;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import flash.display.Stage;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.components.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.dtos.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.events.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.modules.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.search.*;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; import com.brightcove.api.utils.*;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; [Bindable]</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var Results:ArrayCollection = new ArrayCollection();</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var Speech:XML;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; //Speech XML URL Root</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var SpeechURL:String = &quot;http://active6.com/blog/code/beml_speech/xml/&quot;;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; //Placeholder for BC Player Reference</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var Wrapper:BrightcoveModuleWrapper = null;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; //Placeholder for VideoPlayer Reference</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var VideoPlayer:VideoPlayerModule = null;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; //Placeholder for Experience Reference</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private var Experience:ExperienceModule = null;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; public function &nbsp;setInterface(player:IEventDispatcher):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Save the passed BC player Object reference</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper = new BrightcoveModuleWrapper(player);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience = Wrapper.getModule(APIModules.EXPERIENCE) as ExperienceModule;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Experience == null)</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper.addEventListener(ExperienceEvent.MODULES_LOADED, onModulesLoaded);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper.loadModules();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkReady();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function onModulesLoaded(event:ExperienceEvent):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper.removeEventListener(ExperienceEvent.MODULES_LOADED, onModulesLoaded);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience = Wrapper.getModule(APIModules.EXPERIENCE) as ExperienceModule;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Experience != null)</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkReady();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function checkReady():void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Experience.getReady())</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitApp();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience.addEventListener(ExperienceEvent.TEMPLATE_READY, onTemplateReady);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function onTemplateReady(event:ExperienceEvent):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience.removeEventListener(ExperienceEvent.TEMPLATE_READY, onTemplateReady);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitApp();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function InitApp():void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer = Wrapper.getModule(APIModules.VIDEO_PLAYER) as VideoPlayerModule;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer.addEventListener(MediaEvent.CHANGE, onMediaChange)</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetSpeechFile();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function onMediaChange(evt:Object):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetSpeechFile();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function GetSpeechFile():void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var video:Object = VideoPlayer.getCurrentVideo();</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var request:URLRequest = new URLRequest(SpeechURL + video.id + &quot;.xml&quot;);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; request.method = URLRequestMethod.GET;</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var loader:URLLoader = new URLLoader();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.dataFormat = URLLoaderDataFormat.TEXT;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.addEventListener(Event.COMPLETE, handleResults);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.load(request);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch( e:Error)</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function handleResults(evt:Event):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var response:String = evt.target.data as String;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Speech = new XML(response);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function ioErrorHandler(evt:Event ):void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function SearchClick():void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Results.removeAll();</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for each( var cuepoint:XML in Speech.CuePoint )</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( cuepoint.Name == SpeechSearch.text )</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var o:Object = new Object();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o.Time = cuepoint.Time;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o.Label = SpeechSearch.text + &quot; : Time Index &quot; + cuepoint.Time;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Results.addItem(o);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; private function SkipClick():void</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var o:Object = ResultList.selectedItem;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var index:Number = new Number(o.Time)/1000;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status.text = &quot;Skipping to index &quot; + index.toString();</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer.seek(index);</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; }</span><br />
<br />
<span style="color: #339933;">&nbsp; &nbsp; &nbsp; &nbsp; ]]&gt;</span><br />
<span style="color: #339933;">&nbsp; &nbsp; &lt;/mx:Script&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HBox</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;26&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;Search&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TextInput</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> id=<span style="color: #ff0000;">&quot;SpeechSearch&quot;</span> text=<span style="color: #ff0000;">&quot;house&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;#D6D6D6&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Go&quot;</span> width=<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: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:HBox</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx: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> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span><span style="color: #7400FF;">&lt;/mx:List</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;Status&quot;</span> text=<span style="color: #ff0000;">&quot;Search a term and click in the results&quot;</span> <span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span><br />
<br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/actionscript/using-adobe-speech-search-cue-points-in-a-brightcove-player/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a Visible Brightcove Plugin</title>
		<link>http://active6.com/actionscript/creating-a-visible-brightcove-plugin</link>
		<comments>http://active6.com/actionscript/creating-a-visible-brightcove-plugin#comments</comments>
		<pubDate>Tue, 26 Jan 2010 15:57:33 +0000</pubDate>
		<dc:creator>admin</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 template that loads the external swf. By default, this plugin interface is intended for invisible add-ons, such as an analytics connector. However, it is possible to surface [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="bc_plugin" src="http://active6.com/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 template that loads the external swf.</p>
<p>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><a href="http://link.brightcove.com/services/player/bcpid63347543001?bctid=40028113001" target="_blank">This player</a> receives the plugin that is configured in the screen shot above</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="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> <br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>APIModules<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>CustomModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>ContentModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>ExperienceModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.</span>VideoPlayerModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stage%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stage.html"><span style="color: #004993;">Stage</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> VisiblePlugin <span style="color: #0033ff; font-weight: bold;">extends</span> CustomModule <br />
&nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Statics and variables</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Reference to the videoPlayerModule and experience module. </span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">internal</span> <span style="color: #6699cc; font-weight: bold;">var</span> _videoPlayerModule<span style="color: #000066; font-weight: bold;">:</span>VideoPlayerModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">internal</span> <span style="color: #6699cc; font-weight: bold;">var</span> _experienceModule<span style="color: #000066; font-weight: bold;">:</span>ExperienceModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">internal</span> <span style="color: #6699cc; font-weight: bold;">var</span> _contentModule<span style="color: #000066; font-weight: bold;">:</span>ContentModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> VisiblePlugin<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> initialize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; player<span style="color: #000066; font-weight: bold;">.</span>loadModules<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; _experienceModule = player<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>EXPERIENCE<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ExperienceModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; _videoPlayerModule = player<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>VIDEO_PLAYER<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> VideoPlayerModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; _contentModule = player<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>CONTENT<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ContentModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=stage%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stage.html"><span style="color: #004993;">Stage</span></a> = _experienceModule<span style="color: #000066; font-weight: bold;">.</span>getStage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> textLabel<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> textLabel<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = “Added to <a href="http://www.google.com/search?q=stage%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stage.html"><span style="color: #004993;">Stage</span></a>”<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">textColor</span> = 0xFFFFFF<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">selectable</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; textLabel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/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/actionscript/beml-slow-motion-control</link>
		<comments>http://active6.com/actionscript/beml-slow-motion-control#comments</comments>
		<pubDate>Tue, 01 Dec 2009 15:04:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Brightcove]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=163</guid>
		<description><![CDATA[This screen shot 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; &#160; &#160; &#60;mx:Script&#62; &#160; &#160; &#160; &#160; &#60;!&#91;CDATA&#91; &#160; &#160; &#160; &#160; &#160; import mx.controls.Alert; &#160; &#160; &#160; [...]]]></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=53391829001&amp;playerID=49914045001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvw0-a4DyWwgRtXZgXYsbQ1&amp;domain=embed&amp;dynamicStreaming=true" /><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?isVid=1" /><param name="name" value="flashObj" /><param name="flashvars" value="@videoPlayer=53391829001&amp;playerID=49914045001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvw0-a4DyWwgRtXZgXYsbQ1&amp;domain=embed&amp;dynamicStreaming=true" /><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?isVid=1" name="flashObj" allowscriptaccess="always" swliveconnect="true" allowfullscreen="true" seamlesstabbing="false" base="http://admin.brightcove.com" flashvars="@videoPlayer=53391829001&amp;playerID=49914045001&amp;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvw0-a4DyWwgRtXZgXYsbQ1&amp;domain=embed&amp;dynamicStreaming=true" bgcolor="#FFFFFF"></embed></object></p>
<p>This screen shot shows a slow-motion control incorporated into a Brightcove Player using BEML.</p>
<p>The full code is listed below.<br />
<span id="more-163"></span></p>
<div class="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> showEffect=<span style="color: #990000;">&quot;{FadeIn}&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#888888&quot;</span> backgroundAlpha=<span style="color: #990000;">&quot;0&quot;</span> backgroundGradientAlphas=<span style="color: #990000;">&quot;[0, 0]&quot;</span> backgroundGradientColors=<span style="color: #990000;">&quot;[#000000, #000000]&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;110&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;24&quot;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>local=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html"><span style="color: #004993;">Timer</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span style="color: #004993;">TimerEvent</span></a><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stage%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stage.html"><span style="color: #004993;">Stage</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>dtos<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">search</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>utils<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">timer</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html"><span style="color: #004993;">Timer</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html"><span style="color: #004993;">Timer</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Placeholder for BC Player Reference &nbsp; &nbsp; &nbsp; </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> Wrapper<span style="color: #000066; font-weight: bold;">:</span>BrightcoveModuleWrapper = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Placeholder for VideoPlayer Reference </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> VideoPlayer<span style="color: #000066; font-weight: bold;">:</span>VideoPlayerModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Placeholder for Experience Reference</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> Experience<span style="color: #000066; font-weight: bold;">:</span>ExperienceModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> isFullScreen<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> &nbsp;setInterface<span style="color: #000000;">&#40;</span>player<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=ieventdispatcher%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:ieventdispatcher.html"><span style="color: #004993;">IEventDispatcher</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Save the passed BC player Object reference</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper = <span style="color: #0033ff; font-weight: bold;">new</span> BrightcoveModuleWrapper<span style="color: #000000;">&#40;</span>player<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>EXPERIENCE<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ExperienceModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>MODULES_LOADED<span style="color: #000066; font-weight: bold;">,</span> onModulesLoaded<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span>loadModules<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span> <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onModulesLoaded<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ExperienceEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>MODULES_LOADED<span style="color: #000066; font-weight: bold;">,</span> onModulesLoaded<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>EXPERIENCE<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ExperienceModule<span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience<span style="color: #000066; font-weight: bold;">.</span>getReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>TEMPLATE_READY<span style="color: #000066; font-weight: bold;">,</span> onTemplateReady<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onTemplateReady<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ExperienceEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>TEMPLATE_READY<span style="color: #000066; font-weight: bold;">,</span> onTemplateReady<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">timer</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span style="color: #004993;">TimerEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TIMER</span><span style="color: #000066; font-weight: bold;">,</span> onTimer<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>VIDEO_PLAYER<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> VideoPlayerModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Add a listener for full screen switching</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>ENTER_FULLSCREEN<span style="color: #000066; font-weight: bold;">,</span> onEnterFullScreen<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>EXIT_FULLSCREEN<span style="color: #000066; font-weight: bold;">,</span> onExitFullScreen<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Add a listener for a video being loaded</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>MediaEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> onMediaProgress<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>MediaEvent<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CHANGE</span><span style="color: #000066; font-weight: bold;">,</span> onMediaChange<span style="color: #000000;">&#41;</span> &nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onEnterFullScreen<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isFullScreen = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onExitFullScreen<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isFullScreen = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onMediaChange<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onSlomoChange<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> slomo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span>setVolume<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span>setVolume<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Handler for videoLoad events from the content module</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onMediaProgress<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span>MediaEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">time</span> <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = evt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">position</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> slomo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">timer</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">delay</span> = slomo<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">pause</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">timer</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onTimer<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">timer</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">pause</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onMouseOver<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onPlayClick<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">!</span> VideoPlayer<span style="color: #000066; font-weight: bold;">.</span>isPlaying<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">pause</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; <br />
&nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Fade id=<span style="color: #990000;">&quot;FadeIn&quot;</span> alphaFrom=<span style="color: #990000;">&quot;0&quot;</span> alphaTo=<span style="color: #990000;">&quot;1&quot;</span> duration=<span style="color: #990000;">&quot;500&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span> <br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> cornerRadius=<span style="color: #990000;">&quot;8&quot;</span> borderStyle=<span style="color: #990000;">&quot;solid&quot;</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#474747&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HSlider <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;25&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;1&quot;</span> minimum=<span style="color: #990000;">&quot;0&quot;</span> maximum=<span style="color: #990000;">&quot;100&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;80&quot;</span> id=<span style="color: #990000;">&quot;slomo&quot;</span> <span style="color: #004993;">change</span>=<span style="color: #990000;">&quot;onSlomoChange()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;&amp;gt;&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span> id=<span style="color: #990000;">&quot;PlayButton&quot;</span> <span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;12&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onPlayClick()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp;<br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application<span style="color: #000066; font-weight: bold;">&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/actionscript/beml-slow-motion-control/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multilingual Subtitling Using BEML &amp; External Subtitle Files</title>
		<link>http://active6.com/actionscript/multilingual-subtitling-using-beml-external-subtitle-files</link>
		<comments>http://active6.com/actionscript/multilingual-subtitling-using-beml-external-subtitle-files#comments</comments>
		<pubDate>Tue, 01 Dec 2009 14:08:02 +0000</pubDate>
		<dc:creator>admin</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" 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?isVid=1" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=33356604001&#038;playerID=33281756001&#038;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvIA6GZf0fc0cVDMD48W3Ns&#038;domain=embed&#038;dynamicStreaming=true" /><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?isVid=1" bgcolor="#FFFFFF" flashVars="@videoPlayer=33356604001&#038;playerID=33281756001&#038;playerKey=AQ~~,AAAAAGWqYgA~,9vhCNVZnsOvIA6GZf0fc0cVDMD48W3Ns&#038;domain=embed&#038;dynamicStreaming=true" 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><br/><br />
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/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/brightcove/calling-javascript-from-a-beml-plugin</link>
		<comments>http://active6.com/brightcove/calling-javascript-from-a-beml-plugin#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:49:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flex]]></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 [...]]]></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="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.external</span><span style="color: #000066; font-weight: bold;">.*;</span></div></div>
<p>and the bridge to the external JavaScript:</p>
<div class="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClick<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> javascriptFunction<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;showAlert&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;Hello From BEML!&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=externalinterface%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:externalinterface.html"><span style="color: #004993;">ExternalInterface</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">available</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=externalinterface%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:externalinterface.html"><span style="color: #004993;">ExternalInterface</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span>javascriptFunction<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">message</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></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="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;</span>script <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;text/javascript&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339966; font-weight: bold;">function</span> showAlert<span style="color: #000000;">&#40;</span><span style="color: #004993;">message</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color: #000000;">&#40;</span><span style="color: #004993;">message</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>script<span style="color: #000066; font-weight: bold;">&gt;</span></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="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=stage%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stage.html"><span style="color: #004993;">Stage</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.external</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>dtos<span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>modules<span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">search</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>brightcove<span style="color: #000066; font-weight: bold;">.</span>api<span style="color: #000066; font-weight: bold;">.</span>utils<span style="color: #000066; font-weight: bold;">.*;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Placeholder for BC Player Reference</span><br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> Wrapper<span style="color: #000066; font-weight: bold;">:</span>BrightcoveModuleWrapper = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Placeholder for VideoPlayer Reference</span><br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> VideoPlayer<span style="color: #000066; font-weight: bold;">:</span>VideoPlayerModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Placeholder for Experience Reference</span><br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> Experience<span style="color: #000066; font-weight: bold;">:</span>ExperienceModule = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> &nbsp;setInterface<span style="color: #000000;">&#40;</span>player<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=ieventdispatcher%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:ieventdispatcher.html"><span style="color: #004993;">IEventDispatcher</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Save the passed BC player Object reference</span><br />
&nbsp; &nbsp; Wrapper = <span style="color: #0033ff; font-weight: bold;">new</span> BrightcoveModuleWrapper<span style="color: #000000;">&#40;</span>player<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; Experience = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>EXPERIENCE<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ExperienceModule<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>MODULES_LOADED<span style="color: #000066; font-weight: bold;">,</span> onModulesLoaded<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span>loadModules<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onModulesLoaded<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ExperienceEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Wrapper<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>MODULES_LOADED<span style="color: #000066; font-weight: bold;">,</span> onModulesLoaded<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; Experience = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>EXPERIENCE<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ExperienceModule<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>Experience<span style="color: #000066; font-weight: bold;">.</span>getReady<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>TEMPLATE_READY<span style="color: #000066; font-weight: bold;">,</span> onTemplateReady<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onTemplateReady<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ExperienceEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Experience<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span>ExperienceEvent<span style="color: #000066; font-weight: bold;">.</span>TEMPLATE_READY<span style="color: #000066; font-weight: bold;">,</span> onTemplateReady<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp;<br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> InitApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; VideoPlayer = Wrapper<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span>APIModules<span style="color: #000066; font-weight: bold;">.</span>VIDEO_PLAYER<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> VideoPlayerModule<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClick<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> javascriptFunction<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;showAlert&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;Hello From BEML!&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=externalinterface%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:externalinterface.html"><span style="color: #004993;">ExternalInterface</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">available</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=externalinterface%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:externalinterface.html"><span style="color: #004993;">ExternalInterface</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span>javascriptFunction<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">message</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/brightcove/calling-javascript-from-a-beml-plugin/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Adobe Stratus Beta Sample App and PHP/MySQL</title>
		<link>http://active6.com/actionscript/the-adobe-stratus-beta-sample-app-and-phpmysql</link>
		<comments>http://active6.com/actionscript/the-adobe-stratus-beta-sample-app-and-phpmysql#comments</comments>
		<pubDate>Fri, 03 Apr 2009 04:23:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></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/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="codecolorer-container mysql twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=CREATE"><span style="color: #990099; font-weight: bold;">CREATE</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=TABLE"><span style="color: #990099; font-weight: bold;">TABLE</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=IF%20NOT%20EXISTS"><span style="color: #990099; font-weight: bold;">IF <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> EXISTS</span></a> <span style="color: #008000;">`registrations`</span> <span style="color: #FF00FF;">&#40;</span><br />
&nbsp; <span style="color: #008000;">`id`</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=BIGINT"><span style="color: #999900; font-weight: bold;">BIGINT</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">20</span><span style="color: #FF00FF;">&#41;</span> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=NULL"><span style="color: #9900FF; font-weight: bold;">NULL</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=AUTO_INCREMENT"><span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span></a><span style="color: #000033;">,</span><br />
&nbsp; <span style="color: #008000;">`appid`</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=BIGINT"><span style="color: #999900; font-weight: bold;">BIGINT</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">20</span><span style="color: #FF00FF;">&#41;</span> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=NULL"><span style="color: #9900FF; font-weight: bold;">NULL</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DEFAULT"><span style="color: #990099; font-weight: bold;">DEFAULT</span></a> ’<span style="color: #008080;">0</span>′<span style="color: #000033;">,</span><br />
&nbsp; <span style="color: #008000;">`username`</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=VARCHAR"><span style="color: #999900; font-weight: bold;">VARCHAR</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">60</span><span style="color: #FF00FF;">&#41;</span> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=NULL"><span style="color: #9900FF; font-weight: bold;">NULL</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DEFAULT"><span style="color: #990099; font-weight: bold;">DEFAULT</span></a> ”<span style="color: #000033;">,</span><br />
&nbsp; <span style="color: #008000;">`identity`</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=VARCHAR"><span style="color: #999900; font-weight: bold;">VARCHAR</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">120</span><span style="color: #FF00FF;">&#41;</span> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=NULL"><span style="color: #9900FF; font-weight: bold;">NULL</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DEFAULT"><span style="color: #990099; font-weight: bold;">DEFAULT</span></a> ”<span style="color: #000033;">,</span><br />
&nbsp; <span style="color: #008000;">`updated`</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DATETIME"><span style="color: #999900; font-weight: bold;">DATETIME</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/non-typed-operators.html"><span style="color: #CC0099; font-weight: bold;">NOT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=NULL"><span style="color: #9900FF; font-weight: bold;">NULL</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DEFAULT"><span style="color: #990099; font-weight: bold;">DEFAULT</span></a> ’<span style="color: #008080;">0000</span><span style="color: #CC0099;">-</span><span style="color: #008080;">00</span><span style="color: #CC0099;">-</span><span style="color: #008080;">00</span> <span style="color: #008080;">00</span>:<span style="color: #008080;">00</span>:<span style="color: #008080;">00</span>′<span style="color: #000033;">,</span><br />
&nbsp; <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=PRIMARY%20KEY"><span style="color: #990099; font-weight: bold;">PRIMARY KEY</span></a> &nbsp;<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`id`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><br />
&nbsp; <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=KEY"><span style="color: #990099; font-weight: bold;">KEY</span></a> <span style="color: #008000;">`updated`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`updated`</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #FF00FF;">&#41;</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=ENGINE"><span style="color: #990099; font-weight: bold;">ENGINE</span></a><span style="color: #CC0099;">=</span>MyISAM &nbsp;<a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=DEFAULT"><span style="color: #990099; font-weight: bold;">DEFAULT</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=CHARSET"><span style="color: #FF9900; font-weight: bold;">CHARSET</span></a><span style="color: #CC0099;">=</span>latin1<span style="color: #000033;">;</span></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&#038;identity=1234</p>
<p>Stratus expects you to return a simple XML document:</p>
<div class="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <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><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></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="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <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><br />
&nbsp; &nbsp; <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><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/result<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></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="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Database Configuration</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>‘Database<span style="color: #339933;">.</span>php’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span>‘DB_HOST’<span style="color: #339933;">,</span> ‘localhost’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span>‘DB_USER’<span style="color: #339933;">,</span> ‘stratus’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span>‘DB_PW’<span style="color: #339933;">,</span> ‘<span style="color: #339933;">******</span>’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span>‘DB_DBNAME’<span style="color: #339933;">,</span> ‘db_stratus’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Validation of script call</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//Log the entire request into a log file for easy inspection</span><br />
LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
<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><br />
<span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘friends’<span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; ProcessFriendRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp;<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘username’<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><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘identity’<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><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; ProcessRegistration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp;<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<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><br />
<span style="color: #009900;">&#123;</span> &nbsp;<br />
&nbsp; ProcessError<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Process a friend request</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #000000; font-weight: bold;">function</span> ProcessFriendRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <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: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT id, appid, username, identity, updated FROM registrations WHERE username=’<span style="color: #009933; font-weight: bold;">%s</span>‘&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘friends’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&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><span style="color: #339933;">;</span><br />
&nbsp;<br />
&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><br />
&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> ‘<span style="color: #009900; font-weight: bold;">false</span>’<span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span>‘update<span style="color: #339933;">.</span>xml’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span>‘<span style="color: #000088;">$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: #339933;">;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$reply</span><span style="color: #339933;">;</span> &nbsp; &nbsp;<br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; <span style="color: #009900;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Get the XML Response Template file and format it </span><br />
&nbsp; &nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span>‘friends<span style="color: #339933;">.</span>xml’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span>‘<span style="color: #000088;">$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: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span>‘<span style="color: #000088;">$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><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$reply</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span> &nbsp; &nbsp; &nbsp;<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Process a registration (identity will be 0 when disconnecting)</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #000000; font-weight: bold;">function</span> ProcessRegistration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <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: #339933;">;</span> &nbsp;<br />
&nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT id, appid, username, identity, updated FROM registrations WHERE username=’<span style="color: #009933; font-weight: bold;">%s</span>‘&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘username’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&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><span style="color: #339933;">;</span><br />
&nbsp;<br />
&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><br />
&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Record does not exist yet</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO registrations (appid, username, identity, updated) VALUES ( 0, ‘<span style="color: #009933; font-weight: bold;">%s</span>‘, ‘<span style="color: #009933; font-weight: bold;">%s</span>‘, NOW())&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘username’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘identity’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <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><span style="color: #339933;">;</span> &nbsp;<br />
&nbsp; &nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp;<br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Record already exists</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UPDATE registrations SET updated = NOW(), identity = ‘<span style="color: #009933; font-weight: bold;">%s</span>‘ WHERE username = ‘<span style="color: #009933; font-weight: bold;">%s</span>‘&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘identity’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>‘username’<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <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><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
&nbsp; <span style="color: #666666; font-style: italic;">//Get the XML Response Template file and format it </span><br />
&nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span>‘update<span style="color: #339933;">.</span>xml’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span>‘<span style="color: #000088;">$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: #339933;">;</span> &nbsp;<br />
&nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$reply</span><span style="color: #339933;">;</span> &nbsp; &nbsp;<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Process an error</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #000000; font-weight: bold;">function</span> ProcessError<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> ‘<span style="color: #009900; font-weight: bold;">false</span>’<span style="color: #339933;">;</span> <br />
&nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span>‘update<span style="color: #339933;">.</span>xml’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$reply</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span>‘<span style="color: #000088;">$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: #339933;">;</span> <br />
&nbsp; LogFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reply</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$reply</span><span style="color: #339933;">;</span> &nbsp; &nbsp;<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<span style="color: #666666; font-style: italic;">// Log File function</span><br />
<span style="color: #666666; font-style: italic;">//****************************************************************************</span><br />
<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><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$smsg</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><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: #339933;">;</span> <br />
&nbsp; <span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$REMOTE_ADDR</span><span style="color: #339933;">;</span> <br />
&nbsp; <span style="color: #000088;">$referer</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$HTTP_REFERER</span><span style="color: #339933;">;</span> <br />
&nbsp; <span style="color: #000088;">$browser</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$HTTP_USER_AGENT</span><span style="color: #339933;">;</span> &nbsp; <br />
&nbsp; <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><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: #339933;">;</span> &nbsp; <br />
&nbsp; <a href="http://www.php.net/fputs"><span style="color: #990000;">fputs</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Time: <span style="color: #006699; font-weight: bold;">$time</span> IP: <span style="color: #006699; font-weight: bold;">$ipReferer</span>: <span style="color: #006699; font-weight: bold;">$referer</span> Browser: <span style="color: #006699; font-weight: bold;">$browser</span> | <span style="color: #006699; font-weight: bold;">$smsg</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <br />
&nbsp; <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/actionscript/the-adobe-stratus-beta-sample-app-and-phpmysql/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Using Secured SWFs as BEML Widgets</title>
		<link>http://active6.com/net/using-secured-swfs-as-beml-widgets</link>
		<comments>http://active6.com/net/using-secured-swfs-as-beml-widgets#comments</comments>
		<pubDate>Wed, 01 Apr 2009 13:17:34 +0000</pubDate>
		<dc:creator>admin</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>

		<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 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.fenixstudio.org/swcencrypt/images/swc_codes_protected.gif" alt="" hspace="16" align="left" />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>
<h2><span id="more-107"></span>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><!--more--></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="codecolorer-container actionscript3 twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:960px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=“http<span style="color: #000066; font-weight: bold;">:</span><span style="color: #009900; font-style: italic;">//www.adobe.com/2006/mxml” layout=“absolute” backgroundColor=“#000000″ backgroundGradientAlphas=“[1.0, 1.0]“ backgroundGradientColors=“[#000000, #000000]“&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #009900; font-style: italic;">//Placeholder for BC Player Reference </span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> BCPlayer<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #009900; font-style: italic;">//Placeholder for VideoPlayer Reference &nbsp;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> VideoPlayer<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setInterface<span style="color: #000000;">&#40;</span>player<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Save the passed BC player Object reference &nbsp;</span><br />
&nbsp; &nbsp; BCPlayer = player<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Retrieve the VideoPlayer Module references &nbsp;</span><br />
&nbsp; &nbsp; VideoPlayer = BCPlayer<span style="color: #000066; font-weight: bold;">.</span>getModule<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;videoPlayer&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//Add a listener for a video being loaded &nbsp;</span><br />
&nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span> <span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;streamStart&quot;</span><span style="color: #000066; font-weight: bold;">,</span> streamStart<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> ShowWidget<span style="color: #000000;">&#40;</span>showIt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//If widget is to be shown, go to player view mode &nbsp; &nbsp;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>showIt<span style="color: #000000;">&#41;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span>goFullScreen<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = showIt<span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; VideoPlayer<span style="color: #000066; font-weight: bold;">.</span>setVisible<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>showIt<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #009900; font-style: italic;">//Handler for videoLoad events from the content module &nbsp;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> streamStart<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; ShowWidget<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> ContinueVideo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; ShowWidget<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox <span style="color: #004993;">width</span>=“<span style="color: #000000; font-weight:bold;">400</span>″ <span style="color: #004993;">height</span>=“<span style="color: #000000; font-weight:bold;">180</span>″ horizontalCenter=“<span style="color: #000000; font-weight:bold;">0</span>″ verticalCenter=“<span style="color: #000000; font-weight:bold;">0</span>″ horizontalAlign=“center”<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">color</span>=“#FFFFFF” id=“SecureMessage” <span style="color: #004993;">text</span>=“This widget shows how to integrate a secured SWF widget <span style="color: #0033ff; font-weight: bold;">in</span> BEML” <span style="color: #004993;">height</span>=“<span style="color: #000000; font-weight:bold;">46</span>″<span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=“Continue” id=“ContinueButton” <span style="color: #004993;">click</span>=“ContinueVideo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>”<span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application<span style="color: #000066; font-weight: bold;">&gt;</span></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="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> &nbsp;<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;VideoPlayer</span> <span style="color: #000066;">id</span>=“videoPlayer” <span style="color: #000066;">width</span>=“100%” <span style="color: #000066;">height</span>=“100%” <span style="color: #000066;">x</span>=“0″ <span style="color: #000066;">y</span>=“0″ <span style="color: #000066;">depth</span>=“2″ <span style="color: #000066;">visible</span>=“true”<span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SWFLoader</span> <span style="color: #000066;">id</span>=“Secure” <span style="color: #000066;">width</span>=“100%” <span style="color: #000066;">height</span>=“100%” <span style="color: #000066;">x</span>=“0″ <span style="color: #000066;">y</span>=“0″ <span style="color: #000066;">source</span>=“http://active6.com/blog/code/secure/secure_BEMLSecureSWF.swf” <span style="color: #000066;">depth</span>=“1″ <span style="color: #000066;">visible</span>=“true”<span style="color: #000000; font-weight: bold;">/&gt;</span></span> &nbsp;<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Runtime<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></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><a href="http://active6.com/wp-content/uploads/2009/04/bemlsecureswf01.jpg"><img class="alignnone size-full wp-image-109" title="bemlsecureswf01" src="http://active6.com/wp-content/uploads/2009/04/bemlsecureswf01.jpg" alt="" width="892" height="258" /></a></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><a href="http://active6.com/wp-content/uploads/2009/04/bemlsecureswf02.jpg"><img class="alignnone size-full wp-image-110" title="bemlsecureswf02" src="http://active6.com/wp-content/uploads/2009/04/bemlsecureswf02.jpg" alt="" width="861" height="362" /></a></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/net/using-secured-swfs-as-beml-widgets/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Acid Pong!</title>
		<link>http://active6.com/brightcove/acid-pong</link>
		<comments>http://active6.com/brightcove/acid-pong#comments</comments>
		<pubDate>Mon, 30 Mar 2009 15:08:06 +0000</pubDate>
		<dc:creator>admin</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 [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-105" title="pong" src="http://active6.com/wp-content/uploads/2009/04/pong.jpg" alt="pong" width="641" height="481" /></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. <a href="http://active6-cdn.appspot.com/brightcove/PVPong.swf" target="_blank">This is the way Pong should be played</a>. Gratz to anyone who can beat the computer while the Stakker video is playing!<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/brightcove/acid-pong/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few things to iron out, but&#8230;</title>
		<link>http://active6.com/brightcove/a-few-thing-to-iron-out-but</link>
		<comments>http://active6.com/brightcove/a-few-thing-to-iron-out-but#comments</comments>
		<pubDate>Mon, 16 Mar 2009 08:40:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://active6.com/blog/?p=91</guid>
		<description><![CDATA[Check this out: a progressive download video in a 3D environment, using Flash 10 and the Away3D library. The video player is wrapped as a surface texture on a cube and can be rotated real-time. The hickups in the video occur because this video is served from my own Apache webserver, not as a Brightcove [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://active6.com/wp-content/uploads/2009/03/3dvideo.jpg" alt="3dvideo" title="3dvideo" width="433" height="450" class="alignleft size-full wp-image-99" />Check this out: a progressive download video in a 3D environment, using Flash 10 and the Away3D library. The video player is wrapped as a surface texture on a cube and can be rotated real-time. The hickups in the video occur because this video is served from my own Apache webserver, not as a Brightcove stream, as the MovieClip is not a surfaced property&#8230;.<br />
<span id="more-91"></span><br />
	</p>
]]></content:encoded>
			<wfw:commentRss>http://active6.com/brightcove/a-few-thing-to-iron-out-but/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

