[flexcoders] Re: Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy
I am testing the video player Flex app over 'file:///C:/' but the Flash CS4 demo is technically on 'file:///C:/' as well. Both are in subdirectories of my desktop/document folder and both are trying to access the very same file over RTMP. Here's the official error from the video player: - Security sandbox violation: BitmapData.draw: file:///C:/.../bin- debug/BaseFLVPlayer.swf cannot access rtmp://.../vod/. No policy files granted access. at flash.display::BitmapData/draw() - I think I'm going test the video player SWF online instead of on my desktop. I don't think it will help but I've got no other ideas at this point. --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: Are you testing this over http:// or file:// If file:// crossdomain.xml may not be in play. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of jwebbsuccess Sent: Friday, January 16, 2009 11:50 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy.xml Take a look at this video player; notice there is an image on screen before the video begins playback: http://www.huffingtonpost.com/2009/01/14/obama-on-inauguration- you_n_157881.html I'm trying to create similar 'preview frame' functionality in my own custom-built Flex/AS3-based RTMP video player... I need my the player to seek ahead to a given point in video, grab a snapshot for display as a preview frame, then seek back to the beginning before the user initiates playback... Or something like that. I've already got demo code (AS2) for taking a snapshot of a video after it has started playing. The problem is when I try to write code to do the same thing in my AS3 player, I get sandbox violation error as if I were running the demo SWF and my video player SWF on different servers. Both SWFs are in document folders on my computer... The RTMP host and I have confirmed that the permissions for using 'BitmapData.draw( obj )' on a video stream are in place (the demo works) so I've got no idea why I'm getting the sandbox violation error. Can anyone help me to get a snapshot of a video stream and then return the stream to the beginning before the user initiates playback? I've included the FLA for the demo in Flash CS4 and CS3 format: http://www.futurewebstudios.com/bitMapViewer2.zip The demo code is attached separately: --- import flash.display.BitmapData; var nc:NetConnection = new NetConnection(); var ns:NetStream; var myBitmapData:BitmapData = new BitmapData( 160, 120, false, 0x00CC ); var mc_1:MovieClip = this.createEmptyMovieClip( mc, this.getNextHighestDepth() ); btnCap.addEventListener( click, captureVid ); nc.connect( rtmp://okojcizj1r.rtmphost.com/vod ); //nc.connect( rtmp://localhost/vod ); nc.onStatus = function( p_o ) { var code = p_o.code; trace( code ); if ( code == NetConnection.Connect.Success ) { playLive(); } }; function playLive() { trace( playLive ); mc_1._x = 195; mc_1._y = 15; ns = new NetStream( nc ); myVideo.attachVideo( ns ); myVideo.attachAudio( ns ); ns.play( kaye_400 ); ns.onStatus = function( p_o ) { trace( p_o.code ); }; mc_1.attachBitmap( myBitmapData,this.getNextHighestDepth() ); } function captureVid() { trace( captureVid ); myBitmapData.draw( myVideo ); } --- I've also attached a piece of the code in my video player app so you can see what I'm trying to do; if you need to see more of the code, let me know and I'll send it to you: --- public function getScreenCaptureData( seekTime:Number, vidWidth:Number, vidHeight:Number ):Bitmap { var startAt:Number = _netStream.time; trace( this + getScreenCaptureData -- startAt: + startAt + , seekTime: + seekTime + , vidWidth: + vidWidth + , vidHeight: + vidHeight ); _netStream.seek( seekTime ); var tempVid:Video = new Video( vidWidth, vidHeight ); tempVid.attachNetStream( _netStream ); var bd:BitmapData = new BitmapData( vidWidth, vidHeight ); bd.draw( tempVid ); _netStream.seek( startAt ); //to be continued... return new Bitmap(); } --- Thanks in advance for your help.
[flexcoders] Re: Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy
I tested the video player SWF online... Just as I thought; it didn't make a difference. I need to figure out how the Flash CS4/AS2 demo is able to successfully get a snapshot and why the Flex/AS3 video player is not. --- In flexcoders@yahoogroups.com, jwebbsuccess jw...@... wrote: I am testing the video player Flex app over 'file:///C:/' but the Flash CS4 demo is technically on 'file:///C:/' as well. Both are in subdirectories of my desktop/document folder and both are trying to access the very same file over RTMP. Here's the official error from the video player: - Security sandbox violation: BitmapData.draw: file:///C:/.../bin- debug/BaseFLVPlayer.swf cannot access rtmp://.../vod/. No policy files granted access. at flash.display::BitmapData/draw() - I think I'm going test the video player SWF online instead of on my desktop. I don't think it will help but I've got no other ideas at this point. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Are you testing this over http:// or file:// If file:// crossdomain.xml may not be in play. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of jwebbsuccess Sent: Friday, January 16, 2009 11:50 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy.xml Take a look at this video player; notice there is an image on screen before the video begins playback: http://www.huffingtonpost.com/2009/01/14/obama-on-inauguration- you_n_157881.html I'm trying to create similar 'preview frame' functionality in my own custom-built Flex/AS3-based RTMP video player... I need my the player to seek ahead to a given point in video, grab a snapshot for display as a preview frame, then seek back to the beginning before the user initiates playback... Or something like that. I've already got demo code (AS2) for taking a snapshot of a video after it has started playing. The problem is when I try to write code to do the same thing in my AS3 player, I get sandbox violation error as if I were running the demo SWF and my video player SWF on different servers. Both SWFs are in document folders on my computer... The RTMP host and I have confirmed that the permissions for using 'BitmapData.draw( obj )' on a video stream are in place (the demo works) so I've got no idea why I'm getting the sandbox violation error. Can anyone help me to get a snapshot of a video stream and then return the stream to the beginning before the user initiates playback? I've included the FLA for the demo in Flash CS4 and CS3 format: http://www.futurewebstudios.com/bitMapViewer2.zip The demo code is attached separately: --- import flash.display.BitmapData; var nc:NetConnection = new NetConnection(); var ns:NetStream; var myBitmapData:BitmapData = new BitmapData( 160, 120, false, 0x00CC ); var mc_1:MovieClip = this.createEmptyMovieClip( mc, this.getNextHighestDepth() ); btnCap.addEventListener( click, captureVid ); nc.connect( rtmp://okojcizj1r.rtmphost.com/vod ); //nc.connect( rtmp://localhost/vod ); nc.onStatus = function( p_o ) { var code = p_o.code; trace( code ); if ( code == NetConnection.Connect.Success ) { playLive(); } }; function playLive() { trace( playLive ); mc_1._x = 195; mc_1._y = 15; ns = new NetStream( nc ); myVideo.attachVideo( ns ); myVideo.attachAudio( ns ); ns.play( kaye_400 ); ns.onStatus = function( p_o ) { trace( p_o.code ); }; mc_1.attachBitmap( myBitmapData,this.getNextHighestDepth() ); } function captureVid() { trace( captureVid ); myBitmapData.draw( myVideo ); } --- I've also attached a piece of the code in my video player app so you can see what I'm trying to do; if you need to see more of the code, let me know and I'll send it to you: --- public function getScreenCaptureData( seekTime:Number, vidWidth:Number, vidHeight:Number ):Bitmap { var startAt:Number = _netStream.time; trace( this + getScreenCaptureData -- startAt: + startAt + , seekTime: + seekTime + , vidWidth: + vidWidth + , vidHeight: + vidHeight ); _netStream.seek( seekTime ); var tempVid:Video = new Video( vidWidth, vidHeight ); tempVid.attachNetStream( _netStream ); var bd:BitmapData = new BitmapData( vidWidth, vidHeight ); bd.draw( tempVid ); _netStream.seek( startAt ); //to be continued... return new Bitmap(); } --- Thanks in advance for your help.
RE: [flexcoders] Re: Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy
Did you try AS3 with CS4? There might be tighter security in AS3. Also check the code that does the load. You might need to set some security options in AS3 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of jwebbsuccess Sent: Friday, January 16, 2009 4:45 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy I tested the video player SWF online... Just as I thought; it didn't make a difference. I need to figure out how the Flash CS4/AS2 demo is able to successfully get a snapshot and why the Flex/AS3 video player is not. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, jwebbsuccess jw...@... wrote: I am testing the video player Flex app over 'file:///C:/file:///C:\' but the Flash CS4 demo is technically on 'file:///C:/file:///C:\' as well. Both are in subdirectories of my desktop/document folder and both are trying to access the very same file over RTMP. Here's the official error from the video player: - Security sandbox violation: BitmapData.draw: file:///C:/file:///C:\.../bin- debug/BaseFLVPlayer.swf cannot access rtmp://.../vod/. No policy files granted access. at flash.display::BitmapData/draw() - I think I'm going test the video player SWF online instead of on my desktop. I don't think it will help but I've got no other ideas at this point. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Alex Harui aharui@ wrote: Are you testing this over http:// or file:// If file:// crossdomain.xml may not be in play. From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On Behalf Of jwebbsuccess Sent: Friday, January 16, 2009 11:50 AM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Security sandbox violation on Bitmapdata.draw( rtmpVid ) despite crosspolicy.xml Take a look at this video player; notice there is an image on screen before the video begins playback: http://www.huffingtonpost.com/2009/01/14/obama-on-inauguration- you_n_157881.html I'm trying to create similar 'preview frame' functionality in my own custom-built Flex/AS3-based RTMP video player... I need my the player to seek ahead to a given point in video, grab a snapshot for display as a preview frame, then seek back to the beginning before the user initiates playback... Or something like that. I've already got demo code (AS2) for taking a snapshot of a video after it has started playing. The problem is when I try to write code to do the same thing in my AS3 player, I get sandbox violation error as if I were running the demo SWF and my video player SWF on different servers. Both SWFs are in document folders on my computer... The RTMP host and I have confirmed that the permissions for using 'BitmapData.draw( obj )' on a video stream are in place (the demo works) so I've got no idea why I'm getting the sandbox violation error. Can anyone help me to get a snapshot of a video stream and then return the stream to the beginning before the user initiates playback? I've included the FLA for the demo in Flash CS4 and CS3 format: http://www.futurewebstudios.com/bitMapViewer2.zip The demo code is attached separately: --- import flash.display.BitmapData; var nc:NetConnection = new NetConnection(); var ns:NetStream; var myBitmapData:BitmapData = new BitmapData( 160, 120, false, 0x00CC ); var mc_1:MovieClip = this.createEmptyMovieClip( mc, this.getNextHighestDepth() ); btnCap.addEventListener( click, captureVid ); nc.connect( rtmp://okojcizj1r.rtmphost.com/vod ); //nc.connect( rtmp://localhost/vod ); nc.onStatus = function( p_o ) { var code = p_o.code; trace( code ); if ( code == NetConnection.Connect.Success ) { playLive(); } }; function playLive() { trace( playLive ); mc_1._x = 195; mc_1._y = 15; ns = new NetStream( nc ); myVideo.attachVideo( ns ); myVideo.attachAudio( ns ); ns.play( kaye_400 ); ns.onStatus = function( p_o ) { trace( p_o.code ); }; mc_1.attachBitmap( myBitmapData,this.getNextHighestDepth() ); } function captureVid() { trace( captureVid ); myBitmapData.draw( myVideo ); } --- I've also attached a piece of the code in my video player app so you can see what I'm trying to do; if you need to see more of the code, let me know and I'll send it to you: --- public function getScreenCaptureData( seekTime:Number, vidWidth:Number, vidHeight:Number ):Bitmap { var startAt:Number = _netStream.time; trace( this + getScreenCaptureData -- startAt: + startAt + , seekTime: + seekTime + , vidWidth: + vidWidth + , vidHeight