<?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"
	>

<channel>
	<title>Jeremy LaCivita &#187; hack</title>
	<atom:link href="http://www.jlacivita.com/category/hack/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jlacivita.com</link>
	<description>skate / hack / teach</description>
	<pubDate>Wed, 16 Apr 2008 00:13:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Race Conditions in Flex VideoDisplay</title>
		<link>http://www.jlacivita.com/2007/11/14/race-conditions-in-flex-videodisplay/</link>
		<comments>http://www.jlacivita.com/2007/11/14/race-conditions-in-flex-videodisplay/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 03:06:34 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[The Fan]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://www.jlacivita.com/2007/11/14/race-conditions-in-flex-videodisplay/</guid>
		<description><![CDATA[The Flex mx.controls.VideoDisplay object is a double edged sword.  If you&#8217;ve used it for anything complex, you&#8217;ve likely noticed that it gets very finicky under certain conditions.  Thats really a shame, since it provides many useful features, like rtmp vs http connection management, bandwidth detection, and various optimizations to connection speeds to name [...]]]></description>
			<content:encoded><![CDATA[<p>The Flex <a href="http://livedocs.adobe.com/flex/201/langref/mx/controls/VideoDisplay.html">mx.controls.VideoDisplay</a> object is a double edged sword.  If you&#8217;ve used it for anything complex, you&#8217;ve likely noticed that it gets very finicky under certain conditions.  Thats really a shame, since it provides many useful features, like rtmp vs http connection management, bandwidth detection, and various optimizations to connection speeds to name a few.</p>
<p>On the Fan, we&#8217;ve occasionally had problems with playing lists of videos with VideoDisplay, and we&#8217;ve had to jump through a few hoops in order to continue to use it so that we&#8217;d still get all its benefits.  The problem generally consists of the VideoDisplay getting into a state where it stops responding to subsequent calls to <code>load()</code> &amp; <code>play()</code>.</p>
<p>We had worked around most of these by moving around our code to avoid apparent race conditions in VideoDisplay, and we even had to <a href="http://en.wikipedia.org/wiki/Monkey_patch">monkey-patch</a> the VideoDisplay &amp; VideoPlayer classes to get around a problem were it would load the netstream twice for the same video and you&#8217;d get a double/echoing audio stream. While working with one of our partners recently, we came up against another bug in VideoDisplay that we couldn&#8217;t get around.  This time it was throwing an error like this:</p>
<pre style="font-size: 12px; width: 450px; height: 80px; overflow-x: scroll; overflow-y: scroll; background-color: #dddddd; border-width: 1px; border-color: black; border-style: solid; padding: 2px">ArgumentError: Error #2126: NetConnection object must be connected.
  at flash.net::NetStream/construct()at flash.net::NetStream()
  at VideoPlayerNetStream()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\videoClasses\VideoPlayer.as:2883]
  at mx.controls.videoClasses::VideoPlayer/createStream()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\videoClasses\VideoPlayer.as:2712]
  at mx.controls.videoClasses::VideoPlayer/_load()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\videoClasses\VideoPlayer.as:2170]
  at mx.controls.videoClasses::VideoPlayer/load()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\videoClasses\VideoPlayer.as:1486]
  at mx.controls::VideoDisplay/load()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\VideoDisplay.as:1361]</pre>
<p>It actually involves not only VideoDisplay but also VideoPlayer (which VideoDisplay has an instance of) and even NCManager (which does some of the stuff mentioned above).  My counterpart at the other company wasn&#8217;t seeing this error in his test environment, but eventually we realized what the crucial difference was: <code>autoplay</code> was set to false in the Fan, while it was left to its default (<code>true</code>) in his test player.</p>
<p>Since he had it working with no problem, i decided to see what would happen if i left autoplay at its default value of <code>true</code>.</p>
<p>Well, there were some side effects related to videos playing before i was ready for them, however the broken state of VideoDisplay went away!  Now I simply pause the VideoDisplay right after i set the source to simulate having autoplay set to false.  This has the added benefit of buffering the movie right away instead of later on, so i&#8217;m pretty happy with the solution (although i think VideoDisplay should do that anyway if it was written properly)</p>
<p><strong>Update</strong>: here&#8217;s the code we used to patch mx.controls.videoClasses.VideoPlayer:</p>
<p><code style="font-size: 12px">public function ncConnected():void {<br />
<span style="font-family: 'Lucida Grande';"><code style="font-size: 12px">  if (_ncMgr == null || _ncMgr.netConnection == null)<br />
    setState(CONNECTION_ERROR);<br />
  else{<br />
    if (!alreadyLoaded) {<br />
      alreadyLoaded = true;<br />
      createStream();<br />
      setUpStream();<br />
    }<br />
  }<br />
}<br />
</code></span></code></p>
<p><code style="font-size: 12px"><span style="font-family: 'Lucida Grande';">Obviously we also added a variable declaration for alreadyLoaded, and we also reset it to false in the _load function (you can&#8217;t miss it, there&#8217;s a ton of variables getting reset in the function)</span></code></p>
<p><code style="font-size: 12px"><span style="font-family: 'Lucida Grande';"><strong>Update</strong>: here&#8217;s a screenshot of my project structure showing how to &#8220;underride&#8221; the adobe class.<img src="http://www.jlacivita.com/wp-content/uploads/2008/04/mx_packages.png" alt="mx_packages.png" /> </span></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlacivita.com/2007/11/14/race-conditions-in-flex-videodisplay/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Milestones: Team and Individual</title>
		<link>http://www.jlacivita.com/2007/08/24/milestones-team-and-individual/</link>
		<comments>http://www.jlacivita.com/2007/08/24/milestones-team-and-individual/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 01:03:40 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Comcast]]></category>

		<category><![CDATA[The Fan]]></category>

		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://www.jlacivita.com/2007/08/24/milestones-team-and-individual/</guid>
		<description><![CDATA[Well, we launched the Fan 4.0 with an extremely low amount of friction.  Other than M$ gimping Adobe&#8217;s Flash auto updater code in Vista, there weren&#8217;t any problems.  We pushed a quick HTML only fix, and within 24 hours, Adobe had fixed their installer anyway (well, they did the same thing we did [...]]]></description>
			<content:encoded><![CDATA[<p>Well, we <a href="http://www.arpitonline.com/blog/?p=82">launched the Fan 4.0</a> with an extremely low amount of friction.  Other than M$ gimping Adobe&#8217;s Flash auto updater code in Vista, there weren&#8217;t any problems.  We pushed a quick HTML only fix, and within 24 hours, Adobe had fixed their installer anyway (well, they did the same thing we did and put up a message saying Vista sucks)</p>
<p>Not only was the launch uneventful (which is good) but it was also right on time.  We&#8217;ve really got a great team, and I don&#8217;t just mean tech.  Our Project Manager<sup>1</sup> is great at managing the ebb and flow of daily issues, and our business manager<sup>1</sup> is a geek at heart who totally gets tech and development in a way i&#8217;ve never seen a &#8220;suit&#8221; ( <img src='http://www.jlacivita.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) do before. Obviously our tech team rocks too, since <a href="http://www.arpitonline.com">Arpit</a> is one of the premier flex custom component writers.  (<a target="_new" href="http://www.comcast.net/providers/fan/popup.html?viewMode=ClassicMode">The Fan</a> has a freakin Circular scrolling list, need i say more?)</p>
<p>Which brings me to my personal milestone. When i got home today, i noticed an IM reply from Arpit that I had missed at work.  We were talking about some code of his I had to change:</p>
<div style="text-align: center"><img align="center" border="1" src='http://www.jlacivita.com/wp-content/uploads/2007/08/arpit_jeremy.png' alt='arpit jeremy' /></div>
<p>No i&#8217;m not talking about our horrid spelling/typos (i&#8217;ll let you guess which those are) but the passing of the torch on the Fan.</p>
<p>Call me a geek, but I&#8217;m quite proud <img src='http://www.jlacivita.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><small>[1] Both left unnamed, as i&#8217;m not sure if they&#8217;re ok being in the blogosphere</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlacivita.com/2007/08/24/milestones-team-and-individual/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fruit of my labor - Fan 4</title>
		<link>http://www.jlacivita.com/2007/08/03/fruit-of-my-labor/</link>
		<comments>http://www.jlacivita.com/2007/08/03/fruit-of-my-labor/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 22:51:53 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Comcast]]></category>

		<category><![CDATA[The Fan]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://www.jlacivita.com/2007/08/03/fruit-of-my-labor/</guid>
		<description><![CDATA[We just uploaded the latest Fan 4 Beta to the preview servers.  I&#8217;ve spent lots of hours implementing the design, so check it out and tell me what you think!
(Be sure to check out &#8220;Square&#8221; view, as thats were most of the changes are)
]]></description>
			<content:encoded><![CDATA[<p>We just uploaded the <a href="http://preview.comcast.net/fan4/">latest Fan 4 Beta</a> to the preview servers.  I&#8217;ve spent lots of hours implementing the design, so check it out and tell me what you think!</p>
<p>(Be sure to check out &#8220;Square&#8221; view, as thats were most of the changes are)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlacivita.com/2007/08/03/fruit-of-my-labor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>At Comcast for a month</title>
		<link>http://www.jlacivita.com/2007/07/29/at-comcast-for-a-month/</link>
		<comments>http://www.jlacivita.com/2007/07/29/at-comcast-for-a-month/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 01:37:16 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Comcast]]></category>

		<category><![CDATA[The Fan]]></category>

		<guid isPermaLink="false">http://www.jlacivita.com/2007/07/30/at-comcast-for-a-month/</guid>
		<description><![CDATA[Well, its been about a month since I started working at Comcast Interactive Media.  The first thing i&#8217;ve noticed is that there is a distinction between Comcast and CIM. The culture at CIM is not at all like your typical workplace, and thats a good thing.
Working on the Fan is really fun and interesting. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, its been about a month since I started working at Comcast Interactive Media.  The first thing i&#8217;ve noticed is that there is a distinction between <em>Comcast</em> and <em>CIM</em>. The culture at CIM is not at all like your typical workplace, and thats a good thing.</p>
<p>Working on the Fan is really fun and interesting. I&#8217;m getting to learn Flex and also work on a very high profile consumer entertainment app at the same time. I can&#8217;t wait until we release the latest version to the public.  Until then, you can check out our regular preview releases at <a target="_blank" href="http://labs.comcast.net">CIM|Labs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlacivita.com/2007/07/29/at-comcast-for-a-month/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://www.jlacivita.com/2007/07/28/hello-world/</link>
		<comments>http://www.jlacivita.com/2007/07/28/hello-world/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 23:17:02 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[hack]]></category>

		<category><![CDATA[teach]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is my first post. Well thats not actually true.  Its the default post that wordpress puts into a new installation.  I&#8217;ve changed the text here to make it my own though.  I&#8217;ve also imported all my old skating posts from theSlalom.com.  I need to find a way to keep this [...]]]></description>
			<content:encoded><![CDATA[<p>This is my first post. Well thats not actually true.  Its the default post that wordpress puts into a new installation.  I&#8217;ve changed the text here to make it my own though.  I&#8217;ve also imported all my old skating posts from theSlalom.com.  I need to find a way to keep this blog and that one in sync.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlacivita.com/2007/07/28/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
