Jeremy LaCivita

hack

Rich Media Hacker

Illustrations

USFSA Kayak theSlalom Cookies Free Skate BattleUS

Sketch

jawa mooch squash monkey chainsaw claws dragon hand2 head spread hand spidey hand marvin hand closed

Interactive

Carcassone Game Funky Valentine
preface

When I was younger I always enjoyed sketching. I also got into computer programming at a fairly young age. I enjoy working with Digital/Rich Media because it allows me to solve problems programatically as well as work on projects that connect to the user on some level.

I’ve been lucky enough to work on interactive projects for most of my career, but most recently I’m very excited to be working on the Fan at Comcast Interactive Media. The Fan 4 is a complete rewrite of the popular Fan media player, but developed completely in Flex, which is ideal for the geek in me (as much as I love ActionScript/Timeline coding, lets face it, you can’t do real software design that way).

Nov 14, 2007

Race Conditions in Flex VideoDisplay

The Flex mx.controls.VideoDisplay object is a double edged sword. If you’ve used it for anything complex, you’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.

On the Fan, we’ve occasionally had problems with playing lists of videos with VideoDisplay, and we’ve had to jump through a few hoops in order to continue to use it so that we’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 load() & play().

We had worked around most of these by moving around our code to avoid apparent race conditions in VideoDisplay, and we even had to monkey-patch the VideoDisplay & VideoPlayer classes to get around a problem were it would load the netstream twice for the same video and you’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’t get around. This time it was throwing an error like this:

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]

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’t seeing this error in his test environment, but eventually we realized what the crucial difference was: autoplay was set to false in the Fan, while it was left to its default (true) in his test player.

Since he had it working with no problem, i decided to see what would happen if i left autoplay at its default value of true.

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’m pretty happy with the solution (although i think VideoDisplay should do that anyway if it was written properly)

Update: here’s the code we used to patch mx.controls.videoClasses.VideoPlayer:

public function ncConnected():void {
  if (_ncMgr == null || _ncMgr.netConnection == null)
    setState(CONNECTION_ERROR);
  else{
    if (!alreadyLoaded) {
      alreadyLoaded = true;
      createStream();
      setUpStream();
    }
  }
}

Obviously we also added a variable declaration for alreadyLoaded, and we also reset it to false in the _load function (you can’t miss it, there’s a ton of variables getting reset in the function)

Update: here’s a screenshot of my project structure showing how to “underride” the adobe class.mx_packages.png 

tags
The Fan, flex, hack

13 Comments

Aug 24, 2007

Milestones: Team and Individual

Well, we launched the Fan 4.0 with an extremely low amount of friction. Other than M$ gimping Adobe’s Flash auto updater code in Vista, there weren’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)

Not only was the launch uneventful (which is good) but it was also right on time. We’ve really got a great team, and I don’t just mean tech. Our Project Manager1 is great at managing the ebb and flow of daily issues, and our business manager1 is a geek at heart who totally gets tech and development in a way i’ve never seen a “suit” ( ;) ) do before. Obviously our tech team rocks too, since Arpit is one of the premier flex custom component writers. (The Fan has a freakin Circular scrolling list, need i say more?)

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:

arpit jeremy

No i’m not talking about our horrid spelling/typos (i’ll let you guess which those are) but the passing of the torch on the Fan.

Call me a geek, but I’m quite proud :)

[1] Both left unnamed, as i’m not sure if they’re ok being in the blogosphere

tags
Comcast, The Fan, hack

Add Comment

Aug 3, 2007

Fruit of my labor - Fan 4

We just uploaded the latest Fan 4 Beta to the preview servers. I’ve spent lots of hours implementing the design, so check it out and tell me what you think!

(Be sure to check out “Square” view, as thats were most of the changes are)

tags
Comcast, The Fan, flex, hack

5 Comments

Jul 29, 2007

At Comcast for a month

Well, its been about a month since I started working at Comcast Interactive Media. The first thing i’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. I’m getting to learn Flex and also work on a very high profile consumer entertainment app at the same time. I can’t wait until we release the latest version to the public. Until then, you can check out our regular preview releases at CIM|Labs

tags
Comcast, The Fan

Add Comment

Jul 28, 2007

Hello world!

This is my first post. Well thats not actually true. Its the default post that wordpress puts into a new installation. I’ve changed the text here to make it my own though. I’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.

tags
hack, teach

2 Comments

More in Rich Media Hacker