January 26, 2010

Drawing on top of a FLV stream - not as straight forward as you may think

I have spent the last 3 hours trying to make my Flex application draw images on top of a media stream (FLV). It turns out not being as straight forward anymore (since Flash 9 and the new security model).

After plenty of Googling and recompilation I found, what turns out to be, a very simple solution.
To spare you a couple of hours extra work I think it is a nice gesture to share my findings :-)

1. Add the following row in the Flash client:
Security.loadPolicyFile("http:///crossdomain.xml");

2. Add a crossdomain.xml file in the ROOT of your domain, e.g.:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<site-control permitted-cross-domain-policies="all" />
</cross-domain-policy>

Simple enough, isn't it? Well, as long as you put your crossdomain.xml file in the root domain it is... I struggled with understanding this until I found this thread. In the middle of the discussions there a guy writes that it is important to put the file in the root of your domain. Thanks dude! That saved a couple of more hours of work for me.

0 comments: