Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Multi-Task

Sufficient removal?

Recommended Posts

Video presenter made with VideoLoader... 

 

I made a video presenter that loads videos (mp4) and cycles through them.  There are 8 videos in total around 30MB combined.

 

Everything loads in perfectly and plays for awhile, however, for some reason after a certain number of cycles, the screen will go black and the video complete listener never fires.  It does this on random videos and is never the same video that it happens to.  The managePlayer function will fire and load the video but it never fires the complete event.

 

Is this sufficient addition/removal of videoLoader?  Am I missing something?

 

Any ideas why the screen would go black and the complete event never fires?

 

Per memory usage would it be better to make swfs rather than MP4s?

private function managePlayer():void {
	//this just traces out to a window where we are at
	addToDisplayIt("managePlayer");
	var currAsset = media.getChildAt(mediaTracker-1);
	if(currAsset.vars.type!=null) {
					
		if(currAsset is VideoLoader){
			container_mc.addChild(currAsset.content);
			currAsset.playVideo();
			currAsset.addEventListener(VideoLoader.VIDEO_COMPLETE, videoComplete);
		}    
	}
}

private function  videoComplete(e:Event):void {
        //this just traces out to a window where we are at
	addToDisplayIt("videoComplete");
	var currAsset:VideoLoader = VideoLoader(e.target);
	currAsset.removeEventListener(VideoLoader.VIDEO_COMPLETE, videoComplete);
	currAsset.gotoVideoTime(0, false);
	container_mc.removeChildAt(0);
	currAsset=null;
	managePlayBack();
}
Link to comment
Share on other sites

Not really sure were the error may be. This is the type of thing where you would have to use some profiling tools to keep track of how the memory is being managed.  I can't tell if you are ever calling unload() on your VideoLoader though, nor can I see how you are loading new videos.

 

Are you flushing the content when you call load() or ever calling unload()?

Link to comment
Share on other sites

Thanks Carl for responding.

 

So per my set up I am loading everything into the var media:LoaderMax;  This is referenced in the first function where I am setting; var currAsset = media.getChildAt(mediaTracker-1);  

 

I am also harnessing the XMLLoader and once that is done I am calling media.load();

 

I am cycling through these per a var mediaTracker:int;

 

As the files play over and over, I am just incrementing the mediaTracker ++ and then if its at the end setting it back to 1.

 

Now when the videoComplete function is called per the Event; VideoLoader.VIDEO_COMPLETE

 

Do I actually want to unload(); given I am going to play the file again?  I thought that would empty out all content and then I would have to reload? 

 

Thanks in advance!

Link to comment
Share on other sites

Ok, thanks for the clarification. The way you are doing it is absolutely fine. I don't think there is a need to unload() the files, its just that I've seen a lot of folks think they are unloading them, but they really aren't. 

 

If the files are loaded only once, there really is no reason for there to be a memory leak. Once they are loaded, LoaderMax just makes it very easy to find the next video using your mediaTracker value. 

 

At this stage of the game, I would recommend building a very similar file where you load all your videos without LoaderMax / VideoLoader and see if you get the same behavior. I really don't think this is a LoaderMax issue, but removing it entirely from the equation will help offer some more definitive proof.

 

I wish I had some better help to offer, but this seems like something deeper in the Flash Player code that is causing problems.

Link to comment
Share on other sites

Thanks Carl! 

 

I was also curious per one of my initial questions;

 

Have you guys noticed whether with the LoaderMax by itself and/or AIR/Flash Player, is it better (memory speaking) to use  FLVs within swfs or MP4s?

 

Thanks in advance!

Link to comment
Share on other sites

Have you guys noticed whether with the LoaderMax by itself and/or AIR/Flash Player, is it better (memory speaking) to use  FLVs within swfs or MP4s?

 

 

I haven't done any extensive testing. I have not used FLVs inside swfs in a very long time though.

 

If you are concerned about video performance you might want to look into stageVideo

http://www.adobe.com/devnet/flashplayer/stagevideo.html

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.
×