December 2007


Adobe & Flash & WIWTW07 Dec 2007 11:51 pm

Its been a while since I’ve done a Why It Works That Way. My apologies, it has been a busy time working on the new Flash Player and doing lots of things for Adobe Max.

One of the questions I’ve gotten a few times has been about security and BitmapData.draw. In Flash Player there are restrictions on BitmapData.draw to prevent content theft. Recently, a “workaround” was found for the restriction on snapshotting RTMP content (streamed video). Unfortunately, one person’s workaround is another’s exploit or bug.

To maintain the protection on streamed content, the bug that enabled the workaround was closed as of Flash Player 9.0.115. However, the Flash Player and Flash Media Server teams recognize the benefits of the functionality and so we’ve created a way to keep the protections while allowing content owners to relax permissions when they want.

This new permissions system for RTMP snapshotting is a two-part solution. It requires a change in Flash Player and also a change in Flash Media Server. The change in player went out this week. On the same day, Adobe announced Flash Media Server 3. Content streamed through the new server can have a flag added that Flash Player 9.0.115 can recognize and then permit the snapshotting code to run.

I apologize for the inconvenience that you may experience during the time between Flash Player 9.0.115 launching and the launch of Flash Media Server 3, but I hope you agree that having the functionality as an actual supported feature is a good thing for building applications.

As a rule of thumb though, using workarounds for security or protection features is not a good idea. You can generally count on the workaround being closed in the next release of the player. The good news is that Adobe listens to its community and we try to provide new solutions that let you do what you want in a supported and safe way.

Future WIWTWs:
If there is a question you want me to ask about the inner workings of Flash Player or ActionScript, go to this page and submit a comment. I’d like to keep comments on this post relevant to the post itself.

Adobe & Flash06 Dec 2007 02:20 pm

I’ve had several questions since we launched Flash Player 9.0.115.0 about what new APIs need to be called to play back H.264 video. The short answer is that you don’t need to do anything to use H.264 other than have the new player and some H.264 content.

Well, that is pretty much the long answer too. The cool thing though is that you just don’t need to re-build your SWFs at all. If you have a video player SWF that is exported for Flash Player 7, it can play H.264 media files just the same as it can play FLV files. The “magic” is all in the new player.

I think some of the confusion comes in the form of just what the heck a compatible H.264 file is. There are a few topics that when I try to wrap my brain around them, I feel less informed than when I started. During the development process for 9.0.115, I added video to that list. Let me try and explain what I’ve learned so far in hopes that you can avoid some of the confusion I was suffering from.

Up until this version of Flash Player, we supported two codecs (Sorenson Spark and On2 VP6). Both of these were packaged in an FLV container (how the video bits are organized in a file). Now we have added support for a new codec, H.264, but we require that H.264 content to be in an Mpeg 4 container.

The good news is that this is a really common configuration. Many .mov, .3Gp, and .M4V files are H.264 content in MP4 containers. However, there are times where a .mov file or .m4v file may contain something different. In those cases, Flash Player can’t do anything with them. If you are encoding your files it is pretty easy to get it encoded correctly, but if you are working with already encoded content, the easiest way to see if the file is compatible is to just try playing it in Flash Player and see if it plays back.

Now, if all of that about video codecs and container types (file formats) made sense, thanks for reading, but please stop now. I don’t want to bring yopu back into confusion. For those that are still scratching their heads, let me try a metaphor. :D

Let’s say that I wanted to communicate the concept of “hello” from a server down to a SWF. The concept gets “encoded” into the English word “hello.” If I had chosen to speak Spanish, I could encode the concept into language as “hola.” Think of this choice as the codec. I started with a raw mental concept of a greeting and chose either an English or Spanish codec.

Now, I need to get that actual word down to a running SWF. That could be through XML or it could be through AMF (remoting). Either way I am sending the English word “hello” but for the SWF to correctly process it and use it in the application I need to serialize the data in a format like XML:

<message>hello</message>

This XML wrapper is like the MP4 file format where FLV might be something more like AMF. Both are great but you can’t use them interchangeably.

For bonus points, There are also things called “profiles” of H.264. Flash Player supports a lot of them, but if you want to extend the metaphor above, a profile is like the character encoding of the text. The concept is still the same, it is still English, and it still will be delivered in HTML, but the way the system turns the characters back into the specific characters h-e-l-l-o is different.

If that last bit lost you don’t worry, you’ll probably get a deeper dive on it should you run into the issue head first. Luckily as a Flash developer that should be a rare case since Flash Player supports such a wide range of profiles.

Adobe & Flash04 Dec 2007 12:38 am

This evening the Flash Player team launched Flash Player 9 Update 3 (9,0,115,0) for Windows, Mac and Linux. Flash Player 9.0.115 is now available through all of the normal distribution means.

There is a LOT packed in to this dot release, so let me point you to our overview article. But some of the big ticket items are:

Flash Player Cache - A new mechanism for caching the Flex framework to make Flex applications small and fast.

H.264 and HE-AAC - Support for playback of H.264 content including many MP4, MOV, and 3GP files.

Hardware scaling - Using the GPU to scale any rectangular portion of the screen to fill the monitor (and fast!). David Hassoun also wrote an amazing article on H.264 support in Flash Player.

Multicore support - Getting more of those processors to pull their own weight and make Flash playback even better.

Leopard support - We official start supporting Mac OS X 10.5 Leopard with this release.

As part of the launch, we’ve updated the Flash Player homepage to make is easier to find new articles and technotes relevant to Flash development. We’ve also updated the Flash Player feature demo to show off some of the new features that are available in 9.0.115. As always, for a full list of features and known issues, please check the Release Notes.

Finally, there are some security model changes that needed to be made in Flash Player 9.0.115. To understand how this may impact your work, take a took at Deneb Meketa’s article on the Flash Player Developer Center.