Share Posted March 3, 2014 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 More sharing options...
Share Posted March 3, 2014 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 More sharing options...
Author Share Posted March 3, 2014 Hey Carl! , Thank you for your quick response. Also sorry I didn't ask question clearly. I tried upload get.tt but it gave me an error so I uploaded my Dropbox account. My problem is ; LoaderMax loads very slowly and some browser crash my swf. https://dl.dropboxusercontent.com/u/54591390/videoloader_sample.zip Link to comment Share on other sites More sharing options...
Share Posted March 3, 2014 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 1 Link to comment Share on other sites More sharing options...
Author Share Posted March 3, 2014 Aww shoot me ! Thank you Carl! Link to comment Share on other sites More sharing options...
Author Share Posted March 3, 2014 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 More sharing options...
Share Posted March 4, 2014 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 More sharing options...
Author Share Posted March 7, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now