No policy files granted access - java.io.FileNotFoundException

I am trying to stream into a mySWF.swf a myFLV.flv located in wowza/content/myContentDirectory.

I`m getting the following error in flash output window:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: mySWF.swf cannot access rtmp://localhost/myContentDirectory. No policy files granted access

The wowza server throws me this error:

java.io.FileNotFoundException

the system cannot find the file specified

I do have:

wowza/content/myContentDirectory/myFLV.flv

wowza/applications/myContentDirectory

and this is my wowza/conf/myContentDirectory/application.xml file:

<Root>
	<Application>
		<!-- Uncomment to set application level timeout values
		<ApplicationTimeout>60000</ApplicationTimeout>
		<PingTimeout>12000</PingTimeout>
		<ValidationFrequency>8000</ValidationFrequency>
		<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
		<MaximumSetBufferTime>60000</MaximumSetBufferTime>
		<MaximumStorageDirDepth>25</MaximumStorageDirDepth>
		-->
		<Connections>
			<AutoAccept>true</AutoAccept>
			<AllowDomains></AllowDomains>
		</Connections>
		<!--
			StorageDir path variables
			
			${com.wowza.wms.AppHome} - Application home directory
			${com.wowza.wms.ConfigHome} - Configuration home directory
			${com.wowza.wms.context.VHost} - Virtual host name
			${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory
			${com.wowza.wms.context.Application} - Application name
			${com.wowza.wms.context.ApplicationInstance} - Application instance name
			
		-->
		<Streams>
			<StreamType>default</StreamType>
			<StorageDir>${com.wowza.wms.AppHome}/content</StorageDir>
			<Properties>
				<!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application -->
				<!--
				<Property>
					<Name></Name>
					<Value></Value>
				</Property>
				-->
			</Properties>
		</Streams>
		<SharedObjects>
			<StorageDir></StorageDir>
		</SharedObjects>
		<Client>
			<IdleFrequency>-1</IdleFrequency>
			<Access>
				<StreamReadAccess>*</StreamReadAccess>
				<StreamWriteAccess>*</StreamWriteAccess>
				<StreamAudioSampleAccess></StreamAudioSampleAccess>
				<StreamVideoSampleAccess></StreamVideoSampleAccess>
				<SharedObjectReadAccess>*</SharedObjectReadAccess>
				<SharedObjectWriteAccess>*</SharedObjectWriteAccess>
			</Access>
		</Client>
		<RTP>
			<!-- RTP/Authentication/Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
			<Authentication>
				<Method>digest</Method>
			</Authentication>
			<!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
			<AVSyncMethod>senderreport</AVSyncMethod>
			<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
			<Properties>
				<!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
				<!--
				<Property>
					<Name></Name>
					<Value></Value>
				</Property>
				-->
			</Properties>
		</RTP>
		<MediaCaster>
			<Properties>
				<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
				<!--
				<Property>
					<Name></Name>
					<Value></Value>
				</Property>
				-->
			</Properties>
		</MediaCaster>
		<MediaReader>
			<Properties>
				<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
				<!--
				<Property>
					<Name></Name>
					<Value></Value>
				</Property>
				-->
			</Properties>
		</MediaReader>
		<!-- 
		<Repeater>
			<OriginURL></OriginURL>
			<QueryString></QueryString>
		</Repeater> 
		-->
		<Modules>
			<Module>
				<Name>base</Name>
				<Description>Base</Description>
				<Class>com.wowza.wms.module.ModuleCore</Class>
			</Module>
			<Module>
				<Name>properties</Name>
				<Description>Properties</Description>
				<Class>com.wowza.wms.module.ModuleProperties</Class>
			</Module>
			<Module>
				<Name>logging</Name>
				<Description>Client Logging</Description>
				<Class>com.wowza.wms.module.ModuleClientLogging</Class>
			</Module>
			<Module>
				<Name>flvplayback</Name>
				<Description>FLVPlayback</Description>
				<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
			</Module> 
		</Modules>
		<Properties>
			<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
			<!--
			<Property>
				<Name></Name>
				<Value></Value>
			</Property>
			-->
		</Properties>
	</Application>
</Root>

This is my AS3 streaming class:

package {
	import flash.display.MovieClip;
	import flash.events.NetStatusEvent;
	import flash.events.AsyncErrorEvent;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.media.Video;
	public class whole extends MovieClip {
		public var connection_nc:NetConnection = new NetConnection();
		public var stream_ns:NetStream;
		public var my_video:Video=new Video(123.4, 191);
		public function asyncErrorHandler(event:AsyncErrorEvent):void {
			trace("BRK problem: "+event.text);
		}
		public function NCasyncErrorHandler(event:AsyncErrorEvent):void {
			trace("BRK NC problem: "+event.text);
		}
		public function onBWDone():void {
			//trace ( "onBWDone! : " + args );
		}
		public function netStatusHandler(e:NetStatusEvent):void {
			var code:String=e.info.code;
			if (code=="NetConnection.Connect.Success") {
				var customClient:Object = new Object();
				stream_ns=new NetStream(connection_nc);
				stream_ns.client=customClient;
				stream_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
				customClient.onCuePoint=cuePointHandler;
				this.addChild(my_video);
				my_video.attachNetStream(stream_ns);
				stream_ns.play("myFLV");
			} else {
				trace(code);
			}
		}
		function whole() {
			connection_nc.client=this;
			// Put the RTMP URL here, leaving off the name of the video:
			connection_nc.connect("rtmp://localhost/myContentDirectory");
			connection_nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
			connection_nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, NCasyncErrorHandler);
		}
		function cuePointHandler(CuePoint:Object):void {
			trace(CuePoint.name);
			
		}
	}
}

Where am I erring, please ?

You are confusing contentDirectory with application. But, the way you have it now will work if you move the video to here:

wowza/content/myFLV.flv

Because that’s where your Application.xml /Streams /StorageDir points to.

Richard

Is your swf trying to do something with the video?

In the Application.xml, try changing these lines:

From this:

To this:

Richard

You could take a look at the SimpleVideoStreaming Wowza player, in the examples folder if you install Wowza locally.

Richard

It’s probably happening in the function camControl.

You are sure you have modified these? in the Application.xml /Client /Access

Try also putting a permissive crossdomain.xml in [wowza-install-dir]/conf/crossdomain.xml

<?xml version="1.0"?>

You should then see the file in browser:

http://wowza-ip:1935/crossdomain.xml

(You have to view source in netscape, ff, chrome)

Richard

I`ve moved the myFLV.flv file from wowza/content/myContanetDirectoy to wowza/content and now the FLV does play, thank you, rrlanham !!! But, I still get an endless list of the same flash output error ever repeating itself ( throughout and all along the FLV playback) which is the following message:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: mySWF.swf cannot access rtmp://localhost/myContentDirectory. No policy files granted access

repeated hundreds of times over and over again.

The server window on the other hand doesn`t display any errors.

Trying to get another angle on the problem I Have followed your guidance about my confusion between application and content directory and so I also tried changing the Application.xml /Streams /StorageDir so that instead of pointing to /content it points to content/myContnetDirectoy

and then when I relocate myFLV.flv to it`s previous position:

wowza/content/myContentDirectory/myFLV.flv

It gives the exact same result as above, the video DOES play but with infinite errors.

So, many thanks rrlanham for the video playback but why do I still get errors ?

Thank you rrlanham.

I Did what you said:

From this:

To this:

It helped some - now I get the above mentioned error only 3 times, instead of repeating itself perpetually !

You asked:

Is your swf trying to do something with the video?

I`m not sure I understand your question.

My swf presents the 8 minutes FLV within a MovieClip nested inside a MovieClip which is nested inside a Movieclip. To the innermost nested MovieClip it assigns advanced color settings changes of the red blue and green values (all in the properties menu of the Flash authoring environement) That`s all the manipulation the FLV undergoes.

Thank you.

Thanks for your advice, Richard, I know now what element is involved in causing this error but nevertheless, I still have no idea how to solve this…

In mySWF.swf where myFLV.flv is located I have a flash camera. It`s Vcam - (The AS version by Brian Heisi.)

This camera is a piece of AS3 code that allows for display area manipulation of anything that resides in the same time line where it does. Manipulation like zooming, panning, rotating, filtering etc just as a real camera would.

The FLV is not Within the Vcam MovieClip but it`s being affected by it , as the camera controls which part of the stage is visible to the viewer.

I noticed the error I get mentions this camera:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Users/myUSER/AppData/Local/Temp/mySWF.swf cannot access rtmp://localhost/myContentDirectory. No policy files granted access.
	at flash.display::BitmapData/draw()
	at myFLA_fla::camera1_57/camControl()

So, as a test, I removed the Vcam and as aresult the error stopped appearing !

But I do badly need to use this Vcam in my SWF.

Are there any known issues between Wowza and Vcam ?

Do you have any idea how to fix this without dumping Vcam ?

Or perhaps you can tell by the following Vcam AS3 code what may cause this error, please ?

Here is the Vcam AS3 code (it is located in the first frame of a MovieClip that resides in the same Timeline as the MovieClip that containes the FLV stream):

// * VCam AS3 v1.0
// Get stage width and height //////////////////////////////////////////////
var oldScaleMode:String=stage.scaleMode;
stage.scaleMode="exactFit";
var sW:Number=stage.stageWidth;
var sH:Number=stage.stageHeight;
stage.scaleMode=oldScaleMode;
// Get Vcam width and height ///////////////////////////////////////////////
var bounds_obj:Object=this.getBounds(this);
var camH:Number=bounds_obj.height;
var camW:Number=bounds_obj.width;
////////////////////////////////////////////////////////////////////////////
// Creat Point for dynamic registration point //////////////////////////////
var rp:Point=new Point(x,y);
////////////////////////////////////////////////////////////////////////////
// Add Event Listeners /////////////////////////////////////////////////////
addEventListener(Event.ENTER_FRAME,camControl);
addEventListener(Event.REMOVED_FROM_STAGE,reset);
////////////////////////////////////////////////////////////////////////////
// Create BitmapData ///////////////////////////////////////////////////////
var bmp:Bitmap;
var myBitmapData:BitmapData=new BitmapData(sW,sH,true,0);
bmp=new Bitmap(myBitmapData);
camControl();
stage.addChild(bmp);
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
function camControl(...event):void {
	parent.visible=true;
	////////////////////////////////////////////////////////////////////////////
	// Move the registration point to the vCams current position ///////////////
	rp.x=x;
	rp.y=y;
	////////////////////////////////////////////////////////////////////////////
	// Gets the current scale of the vCam //////////////////////////////////////
	var h:Number=camH * scaleY;
	var w:Number=camW * scaleX;
	////////////////////////////////////////////////////////////////////////////
	// Gets the stage to vCam scale ratio //////////////////////////////////////
	var _scaleY:Number=sH / h;
	var _scaleX:Number=sW / w;
	////////////////////////////////////////////////////////////////////////////
	// Positions the parent ////////////////////////////////////////////////////
	x2=w / 2 * _scaleX;
	y2=h / 2 * _scaleY;
	scaleX2=_scaleX;
	scaleY2=_scaleY;
	rotation2=- rotation;
	////////////////////////////////////////////////////////////////////////////
	// Draw bitmap of parent////////////////////////////////////////////////////
	myBitmapData.lock();
	myBitmapData.fillRect(myBitmapData.rect,0x00);
	myBitmapData.unlock();
	myBitmapData.draw(stage);
	////////////////////////////////////////////////////////////////////////////
	// Apply vCam filters to bitmap ////////////////////////////////////////////
	bmp.filters=this.filters;
	bmp.transform.colorTransform=this.transform.colorTransform;
	parent.visible=false;
}
function reset(e:Event):void {
	////////////////////////////////////////////////////////////////////////////
	// Cleans up data for garbage collection ///////////////////////////////////
	removeEventListener(Event.ENTER_FRAME,camControl);
	removeEventListener(Event.REMOVED_FROM_STAGE,reset);
	stage.removeChild(bmp);
	myBitmapData.dispose();
	bmp=null;
	////////////////////////////////////////////////////////////////////////////
	// Resets parent properties ////////////////////////////////////////////////
	parent.scaleX=1;
	parent.scaleY=1;
	parent.x=0;
	parent.y=0;
	parent.rotation=0;
	parent.visible=true;
}
function set x2(value:Number):void {
	var p:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	parent.x+= value - p.x;
}
function get x2():Number {
	var p:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	return p.x;
}
function set y2(value:Number):void {
	var p:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	parent.y+= value - p.y;
}
function get y2():Number {
	var p:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	return p.y;
}
function get scaleX2():Number {
	return parent.scaleX;
}
function set scaleX2(value:Number):void {
	setProperty2("scaleX",value);
}
function get scaleY2():Number {
	return parent.scaleY;
}
function set scaleY2(value:Number):void {
	setProperty2("scaleY",value);
}
function get rotation2():Number {
	return parent.rotation;
}
function set rotation2(value:Number):void {
	setProperty2("rotation",value);
}
function setProperty2(prop:String,n:Number):void {
	var a:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	parent[prop]=n;
	var b:Point=parent.parent.globalToLocal(parent.localToGlobal(rp));
	parent.x-= b.x - a.x;
	parent.y-= b.y - a.y;
}