LOCAL_WITH_NETWORK sandbox and SecurityError: Error #2121: BitmapData.draw

We have an application we run in a localWithNetwork security sandbox.  This application loads many assets from an off-site web server.  In spite of a very permissive crossdomain.xml, swfs downloaded from site give a 2121 error when we convert them to bitmaps at runtime.
  <?xml version="1.0" ?>
  <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
  <cross-domain-policy>
    <allow-access-from domain="*" />
    <site-control permitted-cross-domain-policies="all"/>
  </cross-domain-policy>
Now, I understand why this restriction with BitmapData.Draw exists in general, and from what I've read in other discussion threads the general solution is to allow less restrictive access via crossdomain.xml.  This is the most permissive I know how to make it, although the documentation on the subject is not the most concise.  Are there details I'm missing here?
For the moment we're just running this as LOCAL_TRUSTED, but this requires folks to be setup with the debug plugin which is a maintenance problem.
Thanks in advance for any guidance.
jv

Crossdomain isn’t used in localWithNetwork because there is no “domain” for the request.
I didn’t think you needed a debug plugin for LOCAL_TRUSTED, I thought any trust file would work.  Did you try creating an AIR app instead?  It might have different security rules.

Similar Messages

  • !!Still unresolved error #2123: BitmapData.draw(), videosampleaccess, No policy files granted access

    Hello,
    I have looked all over the forums, google etc. and not found any reliable and working solution to be able to retrieve the stream bitmapdata from RTMP  or HTTPDynamicStreaming source. Please find the details below.
    I have tried everything:
    NetStream.checkPolicyFile = true
    Security.loadPolicyFile(...);
    /applications/live/main.asc has the code below:
    application.onConnect = function( client )
        client.videoSampleAccess = "/";
        this.acceptConnection(client) ;
    The Application.xml has the tag:
    <Client>
         <access>
              <VideoSampleAccess enabled="true">/</VideoSampleAccess>
         </access>
    </Client>
    But constantly, I receive this error ( both on FMS3.5 and FMS4.0 RTMP & HttpLiveDynamicStreaming):
    securityerror:Error #2123: Security sandbox violation: BitmapData.draw: http://localhost/xxyy.swf cannot access rtmpt://localhost:1935/live. No policy files granted access.
    The problem persists wherever the player.swf is placed.
    Since I'm using OSMF the video display object had to be retrieved in the way like this:
    var mediaDisplayObjectTrait:DisplayObjectTrait;
    mediaDisplayObjectTrait = media.getTrait(MediaTraitType.DISPLAY_OBJECT) as DisplayObjectTrait;
    v = new Video(mediaDisplayObjectTrait.mediaWidth,mediaDisplayObjectTrait.mediaHeight);
    loadable.netStream.checkPolicyFile = true;
    v.attachNetStream(loadable.netStream);
    The new Video part is a must because when using ( the only working http - vod setup ) the BitmapData of the DisplayObject defaults to 320x240 even though the mediaWidth and mediaHeight properties are set fine and the video itself has much higher resolution. I must note at this point its far weird and worths another post.
    Seems like the player simply doesn't know anything about where and how to obtain any kind of policy information from the stream.
    I think this issue must be resolved once and for all, it's simply not acceptable to have this poor documentation floating around an essential feature without any professional help involved.

    You don't need crossdomain policy files, you need to do the following;
    1)      Edit the Application.xml file in the host folder, within install directory/conf/... , edit the client tag, adding the attribute override=”yes”
    <Client override=”yes”>
    In a default install of Flash Media Server, the Client class is set to prevent overriding values in the application folder. This was why the settings we were trying were not holding.
    We do not need to alter anything else of the conf Application.xml
    2)      Add the client/access nodes to the root Application.xml within the content folder  ( we have already done this as far as I am aware ).
    <Application>
      <Client>
       <Access>
        <VideoSampleAccess enabled="true">/</VideoSampleAccess>
        <AudioSampleAccess enabled="true">/</AudioSampleAccess>
       </Access>
      </Client>
    </Application>
    3)      Restart the Media Server by using the administration console. This will enable the client>access values to be overridden to true.

  • SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: cannot access

    When we try to print the Google Map API for Flash component, it is throwing the Security Sandbox Violation
          SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://ps6143:8080/aa/XYZ/Main.swf/[[DYNAMIC]]/1 cannot access  http://mt1.google.com/vt/lyrs=m@171000000&hl=en&src=api&x=1&y=1&z=1&s=Gali&flc=x3t. No policy files granted access.
    at flash.display::BitmapData/draw()
    To avoid this error we tried to use the alternate API provided by library. But that also causing cross domain issue as it loading some 3d library internally which is not able to access our application.
    SecurityError: Error #2121: Security sandbox violation: BitmapData.draw: http://maps.googleapis.com/mapfiles/lib/map_1_20_10_3d.swf cannot access http://ps6143.persistent.co.in:8080/dv/SiteOptimizer/SiteOptimizer.swf/%5b%5bDYNAMIC%5d%5d /1http://ps6143:8080/aa/XYZ/Main.swf/[[DYNAMIC]]/1. This may be worked around by calling Security.allowDomain.
    at flash.display::BitmapData/draw()
    Please help us in resolving this issue.
    Thanks & Regrds,
    Ravi Darji

    There is no redirect... Charles is a web proxy so it will look completely legitimate to the browser.
    According to the help, it's getting the access request from the SWF itself and not the crossdomain.xml file:
    In the case of a source object other than a loaded bitmap, the source object and (in the case of a Sprite or MovieClip object) all of its child objects must come from the same domain as the object calling the draw() method, or they must be in a SWF file that is accessible to the caller by having called the Security.allowDomain()method.
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7d1b.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7c4a
    So the default state accessing a SWF on a different domain is protected, unless that SWF allows some or all domains to access it via the Security.allowDomain() method.

  • Security issue with NetStream.appendBytes() and BitmapData.draw()

    Iuse appendBytes to continuously and seamlessly stream video data into a netStream. since we're NOT playing the video files directly from a web domain, there is no meaning to the checkPolicyFile property of our netStream object and therefore - we cannot BitmapData.draw() our Video instance with the netStream attached.
    Is there any possibility to get images from the netStream in order to manipulate them on-the-fly?

    I ran into the same problem.  Have you managed to find a solution to get around the security violation?

  • Help solving error ERROR#2121(Security exception)

    hi genius people there,
    a security error is eatin me up since a couple of days. i m
    workin on designing a MP3 player. All i have done is made 3
    classes: Controller,Player and Songs. The Songs class loads a song
    and extracts its ID3 tags and sets the corresponding property of
    the class. the Controller class calls the Song class functions and
    does all controlling jobs.
    now when i try linking the Controller class with a blank FLA
    (i.e contains nothing) my code works fine. But as i try using it
    with Fla containig movieClip, i get the following Error.
    SecurityError: Error #2121: Security sandbox violation:
    Sound.id3: app:/phase3.swf cannot access . This may be worked
    around by calling Security.allowDomain.
    at flash.media::Sound/get id3()
    at Song/getTags()[D:\Flash Projects\MP3
    player\phase3\Song.as:55]
    i thought my movie clip might be loopin and thus tryin to
    call the id3 tags a multiple no of times(mark it: my movie clip is
    not calling any function related to ID3 tags or songs they were
    just for decoration things. still i thought as they were in
    parallel time frame.) i removed the movie clip and again it worked
    fine.
    Now i have 2 List components,one self made Button and few
    dynamic text boxes. now if i try debugging it(shift+ctrl+enter), i
    get the same above error. If i try debugging a number of time
    (approx 10-12 times), the code works but in next run again the same
    problem. i dont understand if there was some bug then it would not
    run a single time too but after a lot of try it works. i end up
    thinkin if theres a bug in AIR itself .
    plz help me out of this. if its AIR flaw plz let me know and
    tell me where should i post this comment
    desperately seekin for help
    would worship u if u could help me out of this

    You probably have more than one copy of the JavaMail classes available
    in your class path.

  • BitmapData.draw Security Sandbox and LocalTrusted not working?

    Hello there, wondering if anyone else is having the same
    problem -- I have a LocalTrusted security sandboxType -- and when i
    try to access a BitmapData.draw method on a progressive flv, i get
    the error message:
    SecurityError: Error #2135: Security sandbox violation:
    BitmapData.draw: file://file.swf may not access null. RTMP content
    cannot be accessed using this API.
    I've rechecked my sandbox type a zillion times, as well as
    tried putting allow="*" in the crossdomain policy file ....
    is this an error in my security settings -- or is
    bitmapdata.draw on video objects now "gone"?

    Could you try this - Open and swf, rightClick - Goto
    settings, then click Advanced. On the webPage click on "Global
    Security settings panel".
    If you don't find your local directory in there, add it and
    see if things work?
    If not, it would be good if you could post the chunk of code
    which is creating problems.

  • BitmapData.draw() SecurityError: Security sandbox violation

    i am loading and playing a local video file with appendBytes() and when i call a bitmapData.draw() function
    below exception comes up.
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw
    cannot access null. No policy files granted access.
    what should i do???....

    Sir i already mention in my last message i test it with both relative and absolute.
    Yes i khow relative paths works fine when i do some thing like this
    <mx:VideoDisplay x="0" y="0" width="516" height="379" source="../user_data/uploads/cd73502828457d15655bbd7a63fb0bc8/v/1345023450-Action_.flv"/>
    bitmap.draw works fine in above case but my scenario is different i am loading a complete video as bytearray before playing and play video from that bytes
    private function fileLoaderComplete(event:Event):void
         //Pass the loaded bytes to player
           player.AddVideo(urlLoader.data);
    //This is Add video Function in Player.mxml
    public function AddVideo(VideobyteArray:ByteArray):void
                    if(ns == null)
                        var nc:NetConnection = new NetConnection();
                        nc.connect(null);
                        ns = new NetStream(nc);
                       // ns.checkPolicyFile = true;
                        ns.soundTransform = new SoundTransform(0.0);
                        ns.client = this;
                        ns.addEventListener(NetStatusEvent.NET_STATUS, nsStatus);
                    videoData = VideobyteArray;
                    GetTags(videoData);
                    ns.play(null);
                    ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
                    ns.appendBytes(VideobyteArray);
                    video.attachNetStream(ns);
                    playBar.TogglePlay(true);
    i think its a bug in flash sdk 4.6 (Flash Player 11)
    bitmap.draw function somehow conflicts with the appendBytesAction or appendBytes
    this question is posted  on ActionScript 3.0 forum before
    http://forums.adobe.com/message/4650890#4650890
    http://flash.bigresource.com/flash-use-BitmapData-draw-with-NetStream-appendBytes--iTNz6LV JM.html
    http://stackoverflow.com/questions/5607047/how-can-i-use-bitmapdata-draw-with-netstream-ap pendbytes

  • HTTP Streaming and BitmapData.draw

    Hi OSMF Experts,
    I've tried to duplicate segments of a Video with BitmapData.draw.
    It's working with RTMP (set videoSampleAccess server side).
    Progressive is also working (crossdomain.xml is ok).
    BitmapData.draw doesn't work with HTTP Streaming! (Using *.f4m). What's the way to get this working? Following Error is thrown:
    SecurityError: Error #2123: Verletzung der Sicherheits-Sandbox: BitmapData.draw: file:///C|/players/myVideoTestHTTP.swf kann nicht auf null zugreifen. Es haben keine Richtliniendateien Zugriff gewährt.
    I've used OSMF 2.0 for the Tests. And I've testet with the sample.mp4/manifest.f4m example.
    Thanks for your answers.
    Greets
    Martin

    Have you seen bug CSCdx31582- Macintosh wont play WMT from CE (ecdn). Guess this is similar to the issue that you have.

  • BitmapData.draw Security error

    I am drawing to bitmap from MediaContainer:
    var mediaContainer:MediaContainer = new MediaContainer();
    bitmapData.draw(mediaContainer);
    This works, but when I switch video, an error occurs:
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw
    cannot access unknown URL. No policy files granted access.
    Any ideas?

    Here you go:
    http://flashboard.info/files/DrawTest.fxp
    It has both HTTP and RTMP ways.
    I've tried launching from http:// and file:// - both work fine for me.
    Links inside app are to our production servers.
    Regards!

  • Security Sandbox violation bitmapData.draw() cant access null

    very strange.  I am testing with two different HD streams.  One an akamai stream and another one of our clients not on akamai and using an F4M manifest file.  I have tried allowing the domain and they have a crossdomain.xml file on their side but i still get this error.  
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://web.mobilerider.com/flash/osmflive/OSMF_Live.swf?mediaID=190&vendorID=513&extras=vs :1,skin:osmf_live,muteOn:0,autoplay:1,live:1,showArchive:1,&serviceID=2&jsID=1316213568052 cannot access null. No policy files granted access.
    any help would be very appreciated, thanks

    Hello!
    This seems to be relevant:
    http://forums.adobe.com/message/3759490#3759490

  • Security sandbox violation: BitmapData.draw on CloudFront/S3.

    I'm using Cloudfront/AS3 to stream some video in RTMP.
    When I try to do a Bitmap.draw, I get this error:
    [Fault] exception, information=SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: [my_url] cannot access unknown URL. No policy files granted access.
    Since there is no Application.xml, I can't change the <VideoSampleAccess />.
    My crossdomain.xml is available.
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="master-only"/> 
    <allow-access-from domain="*"/>
    <allow-http-request-headers-from domain="*" headers="SOAPAction"/>
             </cross-domain-policy>
    My bucket policy is:
      "Version": "2008-10-17",
      "Statement": [
          "Sid": "AddPerm",
          "Effect": "Allow",
          "Principal": {
            "AWS": "*"
          "Action": "s3:GetObject",
          "Resource": "arn:aws:s3:::[my url]/*",
          "Condition": {}
    And this is my CORS configuration:
    <CORSConfiguration>
        <CORSRule>
            <AllowedOrigin>*</AllowedOrigin>
            <AllowedMethod>GET</AllowedMethod>
            <MaxAgeSeconds>3000</MaxAgeSeconds>
            <AllowedHeader>Authorization</AllowedHeader>
        </CORSRule>
    </CORSConfiguration>
    Not sure what I must change to give myself access.
    Thanks
    Martin

    If you don't have access to the server - you will not be able to accomplish BitmapData.draw() on the video or any of its parents. The policy error refers to streaming server side policy. If you look into RTMP traffic - you will see at what point security request goes.
    I don't know what range of services Amazon cloud offers but I could imagine that, since they do offer pretty granular access to application instances, at some level it is possible to gain access to the server or engage their support to help you. I may be wrong though.

  • This bug has been around for over a year: SecurityError: Error #2123: Security sandbox violation

    Hi,
    The bug of 'SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///xxx/xxx.swf cannot access rtmfp://fms4.acrobat.com/cocomo/na2-sdk-xxx/xxx. No policy files granted access.' was first reported in lccs forum over a year ago:
    http://forums.adobe.com/message/2803074
    But the bug is still around. The bug can be generated by calling BitmapData.draw() on a flash.media.Video object which is attached to a p2p stream. It looks like the solution is to have the publisher to call:
    send("|RtmpSampleAccess", true, true)
    on the NetStream object _before_ the subscriber calls NetStream.play(), in order to give the permission to subscribers for audio and video streams.
    In lccs library, the above permission authorisation happens in WebcamPublisher:
    protected function onNetStatus(p_evt:NetStatusEvent):void
    if (p_evt.info.code=="NetStream.Connect.Success") {
    setTimeout(sendSnapShotPermission, 500);
    _stream.send("|RtmpSampleAccess", true, true);
    protected function sendSnapShotPermission():void
    _stream.send("|RtmpSampleAccess", true, true);
    but it doesn't help the problem. In fact, it is not clear to me when this 'snap shot permission' is sent to the subscriber.
    One more note: This is not a critisism for the lccs development quality, but rather a question on how ready lccs is for production use. After encountering this bug, I had to go through the lccs code (the open source parts), and found out that the library is not really written, well, carefully, and it is full of temporary quick-n-dirty fixes.
    For instance in the above example, sendSnapShotPermission() is called after 500 milliseconds, probably to allow something to happen before calling the method, but how can you be sure that it will happen in 500 milliseconds? Probably,an event listener should have been used. Immediately in the next line, we see:
    _stream.send("|RtmpSampleAccess", true, true);
    which is a duplicate of sendSnapShotPermission(). many examples like this can be found throughout the library.
    Aureliano

    Hi Nigel,
    Two questions:
    1. When the publisher sends the access permission to the subcriber by:
    netStream.send("|RtmpSampleAccess", true, true)
    , on the subscriber side, what event or function can handle the guaranteed receipt of the access permission? Currently it is possible to draw the incoming stream video upon receiving NetStream.Play.Star and waiting for 5 seconds or so:
    public class MyWebcamSubscriber extends WebcamSubscriber {
    override protected function layoutCameraStreams():void
    // trying the event listener seems to work here.
    _streamManager.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
    override protected function onNetStatus(e:NetStatusEvent):void
    super.onNetStatus(e);
    case "NetStream.Play.Start":
    setTimeout(function():void {
    // draw the video from the incoming stream here.
    }, 5000);
    The questions is, which event can let the subscriber know that it has the access permission to the video stream?
    2. In WebcamPublisher, why is that the access permission is sent 3 times?
    a. Once on receiving NetStream.Connect.Success with 0.5 second delay, as in below.
    b. Once immediately upon receiving NetStream.Connect.Success, as in below.
    protected function onNetStatus(p_evt:NetStatusEvent):void
    if (p_evt.info.code=="NetStream.Connect.Success") {
    setTimeout(sendSnapShotPermission, 500);
    _stream.send("|RtmpSampleAccess", true, true);
    protected function sendSnapShotPermission():void
    _stream.send("|RtmpSampleAccess", true, true);
    c. Once in onConnectionTypeChange() with 2 seconds delay:
    protected function onConnectionTypeChange(p_evt:StreamEvent):void
    if ( _streamManager.isP2P) {
    _stream= new NetStream(_connectSession.sessionInternals.session_internal::connection as NetConnection,NetStream.DIRECT_CONNECTIONS);
    setTimeout(sendSnapShotPermission, 2000);

  • Security sandbox violation: BitmapData.draw

    Hello,
    I got this error:
    SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: A policy file is required, but the checkPolicyFile flag was not set when this media was loaded. 
    when I try to draw a frame of a movie that is downloading from another server. Crossdomain.xml is set. Another Jpgs are correctly drawn but only a movie causes an error.
    I need to checkPolicyFile but where should I do this? I have no direct access  to Loader to set up LoaderContext(true) ...
    Thanks,
    Michal

    I too would love to know how we can pass in our own LoaderContext to set the security domain. I'm receiving the same error after snapshotting a loaded SWFElement bug/watermark.
    e.g.
    var bug:MediaElement = new SWFElement(new URLResource(url));
    var bugTrait:LoadTrait = bug.getTrait(MediaTraitType.LOAD) as LoadTrait;
    bugTrait.load();

  • Getting Security Error when trying to use bitmapdata.draw method on youtube videos

    Hi All ,
    I am playing youtube videos in UIComponet of flex, but when I trying to capture the image using bitmapdata.draw() method it gives me an secutity error on server  , It works well locally in flex editor.
    Is any one knows how to resolve this bug??
    Thanks in advance
    sujit Rai

    Try nesting the clips and then adding the warp stabiliser to the nest.

  • ParallelElement, BitmapData and SecurityError

    Hi all,
    I've been trying to do something and I think I might be making it harder than it actually is, so I thought I'd ask.
    I have a ParallelElement that loads 2 videos, this ParallelElement is about 600 * 480 pixels.
    After that I add a Bitmap instance that displays one of the two videos on top of that, and it's size is about 200 * 150 pixels. I'm doing this because I want the user to be able to be able to drag and move the "Bitmap" with his mouse, I'm pretty sure I could do this with OSMF but I haven't found how and this was the workaround I used.
    However, since I'm often loading videos from different domains, when I call the BitmapData.draw method to render my video in that Bitmap, I get security errors. I using a crossdomain file on the server that allows those domains, In my main app, I call
    Security.allowDomain(
        "mydomain.com",
        "theirdomain.com",
        "foobar.theirdomain.com",
        "anotherdomain.org"
    Security.loadPolicyFile("http://mydomain.com/crossdomain.xml");
    The Security Error tells me that the checkPolicyFile hasn't been set in my code, but the thing is, no where in my code am I using a "Loader" (at least a flash.display.Loader) I'm just using a BitmapData instance that draws the 'video' in my ParallelElement to render the Bitmap ...
    Thanks for your help
    Julien    

    Hi Brian,
    Actually after searching a bit, I found that setting the NetStream.checkPolicyFile to true (in a  NetLoader subclass) fixed the issue but thanks again
    Cheers,
    Julien

Maybe you are looking for