How do I specify a crossdomain policy file to allow Flash to grab a bitmap from an RTMP (Wowza) video stream?

Ken Smith picture Ken Smith · Aug 1, 2009 · Viewed 11.6k times · Source

I'm trying to get a bitmap/snapshot of a Wowza video stream playing on my client, like so:

var bitmapData:BitmapData = new BitmapData(view.videoPlayerComponent.width, view.videoPlayerComponent.height);
bitmapData.draw(view.videoPlayerComponent);

When I do this, I get this error message:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://localhost:51150/Resources/WRemoteWebCam.swf cannot access rtmp://localhost/videochat/smithkl42._default/. No policy files granted access.

I presume the error comes from not being able to locate the appropriate crossdomain.xml file. I'm not quite sure where it's looking for it, and a wireshark sniff was inconclusive, so I've tried placing one in each of the following places:

http://localhost/crossdomain.xml
http://localhost:1935/crossdomain.xml
http://localhost:51150/crossdomain.xml

I can retrieve the file successfully from each of those three locations. (I'm pretty sure that the last one wouldn't have any effect, since it's just the location of the web site which hosts the page that hosts the .swf file, but on the off chance...)

These are the contents of the file that it's grabbing in each instance:

<cross-domain-policy> 
    <allow-access-from domain="*" to-ports="*" /> 
</cross-domain-policy>

And it's still throwing that same error message.

I've also followed the instructions on the Wowza forums, to turn on StreamVideoSampleAccess in the [install]\conf[appname]\Application.xml, with no joy:

<Client>
    <IdleFrequency>-1</IdleFrequency>
    <Access>
        <StreamReadAccess>*</StreamReadAccess>
        <StreamWriteAccess>*</StreamWriteAccess>
        <StreamAudioSampleAccess>*</StreamAudioSampleAccess>
        <StreamVideoSampleAccess>*</StreamVideoSampleAccess>
        <SharedObjectReadAccess>*</SharedObjectReadAccess>
        <SharedObjectWriteAccess>*</SharedObjectWriteAccess>
    </Access>
</Client>

Any thoughts?

Answer

Vinay Sajip picture Vinay Sajip · Aug 1, 2009

It's not a crossdomain.xml issue: Here's the relevant Adobe documentation. I think this post may also be of help.