We recently encountered SecurityError #2122 when trying to capture BitmapData from a video file. Crossdomain.xml files were being requested as required for using BitmapData.draw on content loaded into a SWF. Everything had been working well until we tried using a video hosted by Vimeo using their Pro service that allows you to use them as a CDN — they deliver video files and you play them in your own player.
[For an excellent background description about this redirect problem, read the posts linked below]
We determined that the media file returned to FlashPlayer was coming from a different domain than the domain we were requesting the video from. We considered detecting the domain of the redirected media file and following up our media file request with a Security.loadPolicyFile call using the new domain. [Read More…]
Over-The-Shoulder Quick Tip
You have a Debug SWF uploaded to your server and want to use Flash Builder’s debugger features on it. You need to debug it from within its server environment for whatever reason. How do you initiate a debugger session in Flash Builder that connects with the debug-enabled SWF running from your server in the browser?
Answer: in Flash Builder’s Debug Configurations panel, set the *URL or path to launch* to “about:Blank”. Launch that debug configuration. Flash Builder begins listening for a debug SWF to be launched. Now launch the html page on the web that is hosting the debug-enabled SWF (in a browser with the debug version of the Flash Player installed). Flash Builder detects the SWF and begins debugging.
Over-The-Shoulder Quick Tip
Accessing VideoSurface in OSMF is useful if you want to capture a snapshot of the playing video, but it can be difficult to locate the video display object. I found a tip in the comments section of a post by Nils Thingvall that helped:
var tVideoSurface : VideoSurface = ( view.mediaPlayerCore.media.getTrait( MediaTraitType.DISPLAY_OBJECT ) as DisplayObjectTrait ).displayObject as VideoSurface;
var tBitmapData : BitmapData = new BitmapData( tVideoSurface.width, tVideoSurface.height, true, 0 );
tBitmapData.draw( tVideoSurface );
[UPDATE 03/09/2015] Several readers have reported difficulty capturing BitmapData using this technique despite being able to see the video. If you can play a video but not capture BitmapData from it, chances are you have a problem with security permissions. Check out another post regarding security limitations for help solving that issue: http://www.roguish.com/blog/?p=667.
Over-The-Shoulder Quick Tip
The solution to this error was simple but didn’t reveal itself easily.
unexpected argument –migrate
The hyphen/dash is the wrong character! I must have copied/pasted it from somewhere.
The solution was found here: http://forums.adobe.com/message/2404728
Flash Player can send images to web services like Amazon AWS. The built-in behavior requires the user to browse to an image on the user’s system using a system dialog to select the image for sending. It is possible to send an image from Flash Player without requiring the use of a system dialog to locate the image file, and even without the requirement of saving the image to the system before sending it! In fact, images can be sent without any user interaction whatsoever.
In a recent application we developed, we deployed a solution for capturing BitmapData of a playing video and sent the image to Amazon AWS. The thumbnail could be retrieved later for populating a display of the user’s video bookmarks.
- Capture a BitmapData object of something being displayed in a SWF – any display object
- Convert it to JPG. Several methods are available, we used: https://github.com/LeeBurrows/Async-Image-Encoders
- Using HTTP POST, send the image to Amazon (or anywhere) for storage. This is the difficult part. We derived our solution from Open Booth: https://github.com/obsesh/openbooth/
Tip 1: playing an FLV from your local machine.
To play a local video you must modify your config XML file to include a baseURL. Otherwise, the video fails to load.
When publishing a mobile application with Adobe AIR, it’s possible to access the information in your application’s application descriptor xml file at runtime on a mobile device. Below is an example of accessing the versionNumber and renderMode from the application descriptor.
I’ve been doing ActionScript 3.0 development for over 10 years, making games and applications for mobile devices and Mac/Win desktops. I’ve recently been expanding my skills and learning Unity3D with C#. This post lists some of my discoveries and the resources that I’ve encountered along the way. These notes may be especially interesting to other ActionScript developers as they also begin to dabble in Unity3D and look for areas of similarity and difference between these 2 great development platforms. [Read More…]
Recently I was unable to access Facebook while travelling in another country. I got an error message that DNS lookup failed. A friend using the same wireless router could access it. I rebooted and tried multiple browsers. My friend pinged facebook to detect their IP address and I tried entering it manually. Still no luck.
Finally, the solution was to change the DNS server to use Google’s DNS server. Who knew Google offered that service? https://developers.google.com/speed/public-dns/docs/using#setup
Using Flash Builder 4.6, Flex 4.6.0, AIR 3.5. If you get errors where the flash.data package cannot be imported, it suggests you have not included the AIR files in your project. In Flash Builder, when configuring your project when you create it, you must check the extra checkbox in the area near your Flex API selection for *Include Adobe AIR libraries*, or alternatively, after setting up your project, you can edit the project > Flex Library Compiler pane, at the top in the Flex SDK version configuration area you can check the *Include Adobe AIR libraries*.
Also, you may need to include the defaults.css file in the library manually:
Properties >> Flex Library Build Path >> Assets tab >> unfurl the src folder and check the box next to defaults.css.