Jump to content
Search Community

LoaderMax VideoLoader swf terminated

incubus test
Moderator Tag

Recommended Posts

Hey all, I've problem with videoloader when I want to load bunch of video (each video size 2,30 mb and I have 25 videos its total size is 60 mb) I'dont know what problem is.

 

Here is code below. Please take a look at and tell me what I'm doing wrong: 

package
{
    import com.greensock.TweenMax;
    import com.greensock.loading.VideoLoader;
    import com.greensock.loading.LoaderMax;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.XMLLoader;
    import com.greensock.loading.SWFLoader;
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
import flash.system.LoaderContext;


import videos.QueueVideoLoader;

[SWF(frameRate=30, width=1366, height=768)]

    public class Preloader extends MovieClip
    {
        LoaderMax.activate([SWFLoader, XMLLoader, VideoLoader]);

        private var loadermax:LoaderMax;
        private var videosArray:Array;
        private var queue:LoaderMax;
        private var libAssets:PreloaderClass;
        private var loaderContext:LoaderContext;

        public function Preloader()
        {
            stage.align     = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            loaderContext = new LoaderContext();
            loaderContext.checkPolicyFile = false;

            LoaderMax.defaultContext = loaderContext;

            videosArray = [];
           

            loadermax = new LoaderMax({name:"mainQueue", auditSize:false , onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});
            loadermax.append(new XMLLoader("assets/xml/data.xml",{ name: "video_xmldata"}));
            loadermax.append(new SWFLoader("GolKacti.swf", { name:"content_swf" }));
            loadermax.load();
        }

        
        private function completeHandler(event:LoaderEvent):void
        {
            queue = LoaderMax.getLoader("videoListLoader");
            queue.vars = { auditSize:false  };
            videosArray = queue.getChildren();
            queue.load(true);
            queue.addEventListener(LoaderEvent.PROGRESS, onVideoProgress);
            QueueVideoLoader.videoData = videosArray;
        }

        private function onVideoProgress(event:LoaderEvent):void
        {
            if(event.target.progress == 1)
                addChild(LoaderMax.getContent("content_swf"));
        }

        private function progressHandler(event:LoaderEvent):void
        {
            trace("progress");
            
            if(Number(event.target.progress)==1)
            {
              //  addChild(LoaderMax.getContent("content_swf"));
            }
        }

        private function errorHandler(event:LoaderMax):void
        {
            trace("hata");
        }
    }
}
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

Not clear what the problem is so I don't know what to look for in your code.

Are you getting errors? Does it work for a few videos and then fail? Does it not work at all?

 

The best thing to do is create a small demo that only loads 2 or 3 small videos.

Zip it all up and post it here. We just need enough code and assets to replicate the issue.

 

If your zip is too big to attach, feel free to use a file-sharing service like

 

http://ge.tt (free. no sign up, logins or hassles)

Link to comment
Share on other sites

If you add the following bold code to your complete handler

 

 private function completeHandler(event:LoaderEvent):void
        {
            queue = LoaderMax.getLoader("videoListLoader");
trace(queue);
            queue.vars = { auditSize:false  };
            videosArray = queue.getChildren();
            queue.load(true);
            queue.addEventListener(LoaderEvent.PROGRESS, onVideoProgress);
trace("all done");
addChild(videosArray[0].content)
 
        }

 

You will see that the first video is playing, which is odd because you are setting autoplay="false" in your xml. 

 

autoplay should be autoPlay (cap P). 

 

Do a find and replace in your xml and make that change.

When you re-test you should see much less CPU usage as 25 videos are no longer playing at the same time (and also note you will not see the first video playing any more either).

 

To target and play the first video just use:

videosArray[0].playVideo();

after the videos have loaded

  • Like 1
Link to comment
Share on other sites

If you add the following bold code to your complete handler

 

 private function completeHandler(event:LoaderEvent):void
        {
            queue = LoaderMax.getLoader("videoListLoader");
trace(queue);
            queue.vars = { auditSize:false  };
            videosArray = queue.getChildren();
            queue.load(true);
            queue.addEventListener(LoaderEvent.PROGRESS, onVideoProgress);
trace("all done");
addChild(videosArray[0].content)
 
        }

 

You will see that the first video is playing, which is odd because you are setting autoplay="false" in your xml. 

 

autoplay should be autoPlay (cap P). 

 

Do a find and replace in your xml and make that change.

When you re-test you should see much less CPU usage as 25 videos are no longer playing at the same time (and also note you will not see the first video playing any more either).

 

To target and play the first video just use:

videosArray[0].playVideo();

after the videos have loaded

 

But still my IDE (intellijIDE) is terminated.

Link to comment
Share on other sites

Sorry, using Flash Pro all I can say is that my CPU resources are showing no odd behavior. After videos load Flash is only using 15% or so. No spikes, no fans kicking in.

 

I don't know what else to suggest. Have you tried loading less videos? Does that help?

Link to comment
Share on other sites

Sorry, using Flash Pro all I can say is that my CPU resources are showing no odd behavior. After videos load Flash is only using 15% or so. No spikes, no fans kicking in.

 

I don't know what else to suggest. Have you tried loading less videos? Does that help?

Thank you ! it works as you said :) My problem be due to intelliJ idea.

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.
×
×
  • Create New...