Jump to content
GreenSock

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

VideoLoader Handles Leak

Recommended Posts

{EDIT: How and to whom do I contact about an old account. I had to make a new user for the forums in order to post this. I see no email link to an "Admin@greensock.com".}

 

I am having issues with handles leaking in a VideoLoader.  I made a test swf that loads external flvs and plays them in a loop. Over time, the memory and handles will rise, then garbage collection will run - the memory will come down, but the handles will continue to rise.

If I compile with my "old" NetConnection/NetStream code, it will play back fine and the memory/handles will not budge.  I am assuming I am missing something basic in the VideoLoader.

Here is the VideoLoader code:

	public function StartVideo(WhichType:Number){
            trace("<%BW%> StartVideo>"+WhichType);
            //
            var tmpstring:String="Win"+WhichType;
            var tmpfullstring:String="_Game/Bonus/_flvs/"+tmpstring+".flv";
            if(IsStandAlone){
                tmpfullstring="_flvs/"+tmpstring+".flv";
            }
            //create a VideoLoader

            bigwinvideo = new VideoLoader(tmpfullstring, {name:"VID", container:VIDBASE,visible:true,x:-640,y:-720, width:1280, height:720,repeat:tmprepeat, scaleMode:"proportionalInside",  autoPlay:false, volume:0});
            //start loading
            bigwinvideo.load();           
            bigwinvideo.addEventListener(VideoLoader.VIDEO_COMPLETE, VidDoneCheck);           
            bigwinvideo.playVideo();
        }
        private function VidDoneCheck(event:Event) {
            trace("<%BW%> VidDoneCheck");
            //
            event.target.removeEventListener(VideoLoader.VIDEO_COMPLETE, VidDoneCheck);           
            //all off
            RESET();
        }
        public function RESET(){
            trace("<%BW%> RESET");
            bigwinvideo.dispose(true);               
            testINC++
            if(testINC>=3){
                testINC=0;
            }
            TweenMax.delayedCall(1, StartVideo,[testINC]);
        }

And here is the NetConnection/NetStream code:

	public function BW_HD_Tester_alt() {
            trace("<%BW%> BW_HD_Tester_alt");
            //
            var pType:String=String(Capabilities.playerType);
            if (pType=="External") {
                //swf is running in the Flash IDE preview player
               
                //need to activate those classes once in the swf
                LoaderMax.activate([VideoLoader]);
                //
                CreateBWTestBTNS();
            } else if (pType=="StandAlone") {
                //swf is running in a standalone Flash Player
                LoaderMax.activate([VideoLoader]);
                //
                CreateBWTestBTNS();
            } else if (pType == "PlugIn" || pType == "ActiveX") {
                //if it is local or on the web, but not using any web settings, then it's the PLATFORM
            } else if (pType == "Desktop") {
                //swf is running in a desktop AIR application
            }
            VIDBASE = new MovieClip();
            VIDBASE.name="VIDBASE";
            VIDBASE.x=320;
            VIDBASE.y=360;
            this.addChild(VIDBASE);
            //
            nc=new NetConnection();
            nc.connect(null);
            ns=new NetStream(nc);
            ns.client=this;
            ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            //
            bigwinvideo=new Video(1280,720);
            VIDBASE.addChild(bigwinvideo);
            bigwinvideo.attachNetStream(ns);
            //
           
        }
    
        public function StartVideo(WhichType:Number){
            trace("<%BW%> StartVideo>"+WhichType);
            //
            var tmpstring:String="Win"+WhichType;
            var tmpfullstring:String="_Game/Bonus/_flvs/"+tmpstring+".flv";
            if(IsStandAlone){
                tmpfullstring="_flvs/"+tmpstring+".flv";
            }           
            ns.play(tmpfullstring);
        }
       
        public function onMetaData(infoObject:Object):void{
             if(infoObject.duration != null){
                  trace("our video is "+infoObject.duration+" seconds long");
             }         
             if(infoObject.height != null && infoObject.width != null){
                  trace("our video is "+infoObject.width+"x"+infoObject.height+" pixels");
             }
        }
        public function onXMPData(infoObject:Object):void{
           
        }
        private function netStatusHandler(evt:NetStatusEvent):void {
            trace("netStatusHandler>>"+evt.info.code);
            if (evt.info.code == "NetStream.Play.Stop") {
                // do loop...
                RESET();
            }
        }

        public function RESET(){
            trace("<%BW%> RESET");
            testINC++
            if(testINC>=3){
                testINC=0;
            }
            TweenMax.delayedCall(1, StartVideo,[testINC]);
        }

Any comments or suggestions are appreciated! Mark

Link to comment
Share on other sites

Hi,

 

Sorry to hear about the problems.

Its hard to troubleshoot memory consumption issues by just looking at some code.

 

It would really help if you could provide a reduced test case that clearly illustrates the problem and whatever instructions necessary to see the memory usage.

 

Sorry to hear you had an issue with your account too. In the footer we have a contact form http://greensock.com/contact-us/which you can use for any purpose. 

We will contact you via email about helping you with your old account.

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