Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
MGT_Jose

Loading videos dynamically works only when compiled using relative directory

Recommended Posts

Hello fellow Greensockers,

 

I have ran in to this issue where I am trying to load a video dynamically based on an xml file. The file should load dynamically without having to compile the Air application.

 

It works just fine for Swf loading with the same method other than it loading a video. It works for both compile time and when opening the Air or swf file like this:

public function createSwf(swf:String, clipName:String, xPos:Number = 0, yPos:Number = 0):void
{
    _swfLoader = new SWFLoader("./swf/" + swf, { onComplete: onSWFLoaded, name: clipName, x: xPos, y:xPos, container:StarlingEntry.getInstance().loadedSWFContainer } );
    _swfLoader.load();
			
     if (CONFIG::DEBUG)
     {
	trace(this, "Loading swf...");
     }
}

However it does not work doing the same thing but with loading videos via the VideoLoader utility:

public function createVideo(fileName:String, videoName:String = "videoName", scaleX:Number = 1, scaleY:Number = 1, xPos:Number = 0, yPos:Number = 0):void
{
    	_videoLoader = new VideoLoader("./video/" + fileName, { name: videoName, container: StarlingEntry.getInstance().loadedVideoContainer, scaleX: scaleX, scaleY: scaleY, x:0, y:0, onComplete: onVideoLoaded, repeat: -1 } );
     	//_videoLoader = new VideoLoader("video.flv", { name: videoName, container: StarlingEntry.getInstance().loadedVideoContainer, scaleX: scaleX, scaleY: scaleY, x:0, y:0, onComplete: onVideoLoaded, repeat: -1 } );
    	_videoLoader.load();
			
	 if (CONFIG::DEBUG)
	 {
            trace(this, "Loading video...");
    	 }
}

For organizational purposes I need to use relative directory's. It works just fine when I stick the video right next to the swf. Has anybody seen anything like this before? Another thing I noticed is when remote debugging

I get the error where the file is not loading "Error on VideoLoader 'video' (./video/video.flv): NetStream.Play.StreamNotFound". I am 100% sure the file is there and also like I mentioned it workes when I compile with no errors.  Thanks in advanced for any replies.

Link to comment
Share on other sites

Not sure what is happening with Air but flvs would always load relative to the swf whereas everything else would load relative to the html page that embedded the swf.

 

more:

http://stackoverflow.com/questions/1700343/fl-video-videoplayer-loads-flv-relative-to-swf

http://upshots.org/actionscript-3/as3-video-load-path-relative-to-swf

Link to comment
Share on other sites

That explains. Thanks for the reply Carl. This was very helpful.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×