Errors when attempting to use BitmapData.draw() on a peer-enabled stream
When attempting to take a screen capture using BitmapData.draw() on a Canvas containing a Video Component of an incoming stream, here is the error I encounter:
http://rd05.scs.mysite.com/samples/applications/LiveVideo/LiveVideord05.swf
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://rd05.scs.mysite.com/samples/applications/PeerVideo/PeerVideord05.swf cannot access rtmfp://rd05.scs.mysite.com/PeerVideo/100_200. No policy files granted access.
question 1 - Where is the correct place to load the policy file from for RTMFP connections? here is what I attempted:
on the FMS server :
in /opt/adobe/fms/conf/Server.xml I define the crossdomain path:
<CrossDomainPath>/opt/adobe/fms/webroot/crossdomain.xml</CrossDomainPath>
which points to a crossdomain containing:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
in /opt/adobe/fms/applications/PeerVideo/Application.xml I have the node to permit VideoSampleAccess:
<Application>
<StreamManager>
<VirtualDirectory>
<!-- Specifies application specific virtual directory mapping for recorded streams. -->
<Streams>/;${VOD_COMMON_DIR}</Streams>
<Streams>/;${VOD_DIR}</Streams>
</VirtualDirectory>
</StreamManager>
<!-- Settings specific to runtime script engine memory -->
<ScriptEngine>
<!-- This specifies the max size (Kb.) the runtime can grow to before -->
<!-- garbage collection is performed. -->
<RuntimeSize>20480</RuntimeSize>
</ScriptEngine>
<Client>
<Access>
<VideoSampleAccess enabled="true">/</VideoSampleAccess>
</Access>
...
and finally in the /opt/adobe/fms/applications/PeerVideo/PeerVideo.asc file I allow videoSampleAccess for the connected client when it connects:
application.onConnect = function( currentClient, picURL )
{
application.acceptConnection( currentClient );
currentClient.videoSampleAccess = '/';
...
in the .swf I try every possible policy file combination I can think of. :
Security.loadPolicyFile('rd05.scs.mysite.com/crossdomain.xml');
Security.loadPolicyFile('rd05.scs.mysite.com:843');
Security.loadPolicyFile('rd05.scs.mysite.com:843/crossdomain.xml');
Security.loadPolicyFile('rd05.scs.mysite.com/crossdomain.xml');
Security.loadPolicyFile('http://rd05.scs.mysite.com:843');
Security.loadPolicyFile('http://rd05.scs.mysite.com:843/crossdomain.xml');
Security.loadPolicyFile('http://rd05.scs.mysite.com:1935');
Security.loadPolicyFile('http://rd05.scs.mysite.com:1935/crossdomain.xml');
Security.loadPolicyFile('http://rd05.scs.mysite.com:19351');
Security.loadPolicyFile('http://rd05.scs.mysite.com:19351/crossdomain.xml');
Security.loadPolicyFile('rtmp://rd05.scs.mysite.com/crossdomain.xml');
Security.loadPolicyFile('rtmfp://rd05.scs.mysite.com/crossdomain.xml');
Security.loadPolicyFile('rtmp://rd05.scs.mysite.com:1935/crossdomain.xml');
Security.loadPolicyFile('rtmfp://rd05.scs.mysite.com:19351/crossdomain.xml');
needless to say, all the 'rtmfp' calls fail.
at this point when I establish a p2p connection the video displays fine on poth clients via rtmfp. An attempt a BitmapData.draw() on the Canvas for the far peer's stream generates the error #2123 above.
_camNSIn=newNetStream(_camNC, peerID);
_camNSIn.checkPolicyFile=true;
_camNSIn.videoSampleAccess = true;
_camNSIn.play( inStreamname );
At this point I attempt to set videoSampleAccess = true ( as well as checkPolicyFile = true ) for the streams. Setting this property on either the incoming or outgoing streams gives me a new error:
ArgumentError: Error #2154: The NetStream Object is invalid. This may be due to a failed NetConnection.
at flash.net::NetStream/set videoSampleAccess()
When I set videoSampleAccess = true on the incoming stream this error appears when it attempts to play(). When I do it for the outgoing Stream it occurs when I attempt to publish(). In Both of these scenarios I have a valid and existing NetConnection through which to send the streams, that has already received a status of NetConnection.Connect.Success .
so question #2 - why does NetStream.videoSampleAccess not work the way the docs say it should? Is there something else I need to do that I am not, and if so, should the docs be updated to reflect this?
