title: How do I specify a crossdomain policy file to allow Flash to grab a bitmap from an RTMP (Wowza) video stream?
body: <p>I'm trying to get a bitmap/snapshot of a Wowza video stream playing on my client, like so:</p>
  
  <pre><code>var bitmapData:BitmapData = new BitmapData(view.videoPlayerComponent.width, view.videoPlayerComponent.height);
  bitmapData.draw(view.videoPlayerComponent);
  </code></pre>
  
  <p>When I do this, I get this error message:</p>
  
  <p>SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: <a href="http://localhost:51150/Resources/WRemoteWebCam.swf" rel="nofollow noreferrer">http://localhost:51150/Resources/WRemoteWebCam.swf</a> cannot access rtmp://localhost/videochat/smithkl42._default/. No policy files granted access.</p>
  
  <p>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:</p>
  
  <p><a href="http://localhost/crossdomain.xml" rel="nofollow noreferrer">http://localhost/crossdomain.xml</a><br/>
  <a href="http://localhost:1935/crossdomain.xml" rel="nofollow noreferrer">http://localhost:1935/crossdomain.xml</a><br/>
  <a href="http://localhost:51150/crossdomain.xml" rel="nofollow noreferrer">http://localhost:51150/crossdomain.xml</a></p>
  
  <p>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...)</p>
  
  <p>These are the contents of the file that it's grabbing in each instance:</p>
  
  <pre><code>&lt;cross-domain-policy&gt; 
      &lt;allow-access-from domain="*" to-ports="*" /&gt; 
  &lt;/cross-domain-policy&gt;
  </code></pre>
  
  <p>And it's still throwing that same error message. </p>
  
  <p>I've also followed the instructions on the <a href="http://www.wowzamedia.com/forums/showthread.php?t=4750" rel="nofollow noreferrer">Wowza forums</a>, to turn on StreamVideoSampleAccess in the [install]\conf[appname]\Application.xml, with no joy:</p>
  
  <pre><code>&lt;Client&gt;
      &lt;IdleFrequency&gt;-1&lt;/IdleFrequency&gt;
      &lt;Access&gt;
          &lt;StreamReadAccess&gt;*&lt;/StreamReadAccess&gt;
          &lt;StreamWriteAccess&gt;*&lt;/StreamWriteAccess&gt;
          &lt;StreamAudioSampleAccess&gt;*&lt;/StreamAudioSampleAccess&gt;
          &lt;StreamVideoSampleAccess&gt;*&lt;/StreamVideoSampleAccess&gt;
          &lt;SharedObjectReadAccess&gt;*&lt;/SharedObjectReadAccess&gt;
          &lt;SharedObjectWriteAccess&gt;*&lt;/SharedObjectWriteAccess&gt;
      &lt;/Access&gt;
  &lt;/Client&gt;
  </code></pre>
  
  <p>Any thoughts?</p>