Jump to content


2nd child video does not play in latest version of Maxloader

Recommended Posts

As a result of fixing a bug(large video's delayed loading in chrome) by upgrading to the latest version of GreenSock I have now introduced a second bug where additional flv loads in an xml sheet do not play.


If I use the old GreenSock environment they all play with no problems unless of course an flv is large and then i have the original bug back.


The current calling script is enclosed and the symptom can be seen at http://www.facebook....121837131257077 by searching for and clicking on video test20 which plays 1 image and then should play 2 consecutive flv's in the player. These are :-




and the second which does not play. (I have checked the xml which is all working in older version of greensocks..




I have tried a 1000 permutations in the enclosed script to fix this bug but to no avail. The script however works with older version of Greensocks.


Please can you help.




xml script is http://videocastit.com/images/tmp/2091/17c7047e6784107dc00d504df6e5a160/banner.xml


Calling script for Maxloader is as follows....


package fh{


import flash.display.*;

import flash.net.URLRequest;

import flash.net.URLLoader;

import flash.net.navigateToURL;

import flash.errors.IOError;

import flash.events.IOErrorEvent;

import flash.events.*;

import flash.utils.*;

import flash.events.TimerEvent;

import flash.events.FocusEvent;

import flash.utils.*;

import flash.net.*;



import com.greensock.loading.*;

import com.greensock.loading.display.*;

import com.greensock.*;

import com.greensock.events.LoaderEvent;

import com.greensock.TweenLite;




public class fhvideo extends Sprite {


public var video:VideoLoader; //the object which will have the player loaded to

//private var loader:Loader; //the loader which will load the player


private var src:String; //the video's id

private var __width:Number;

private var __height:Number;

private var startSec:Number;

public var loaded:Boolean = false;

public var error:Number=0;

public var oldvolume:Number = 0;

public var volumechanger:Object = new Object;

public var cont:MovieClip = new MovieClip();

private var queue:LoaderMax = new LoaderMax({allowMalformedURL:true });



public var ismuted:Boolean;






function fhvideo(SRC:String,dwidth:Number, dheight:Number, startat:Number, quality:String) {


__width = dwidth;

__height = dheight;

startSec = startat;



if (SRC.length>0)





public function init(SRC:String,dwidth:Number, dheight:Number, startat:Number, quality:String):void {


__width = dwidth;

__height = dheight;

startSec = startat;




private function onPlayerError(event:Event):void {





//onInit:function(){ error=18},



private function createVideo():void {

video = new VideoLoader(src, {onInit:function(){ error=18}, name:"myVideo", container:cont, width:__width, height:__height, bufferTime:5, noCache:true, scaleMode:"proportionalInside", bgColor:0x000000, autoAdjustBuffer:false, bufferMode:true, estimatedBytes:70000});


//start loading









public function setStage(__width:Number, __height:Number) {



cont.width= __width;

cont.height= __height;



public function destroy():void {



try{stop();} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}


var obj = cont.getChildAt(0);








} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}






public function getTime():Number


return video.videoTime;





public function getDuration():Number


return video.duration;




public function setPlaybackQuality(quality:String)






private function onPlayerStateChange(evt:Event) {






public function getProgress():Number {

return getTime()/getDuration();




public function getBuffer():Number {

return queue.bytesLoaded / queue.bytesTotal;





public function play():void {





public function pause():void {






public function stop():void {






public function gotoAndPlay(time:Number) {





public function gotoAndStop(time:Number) {






public function mute() {


try{oldvolume = video.volume;} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}

try{video.volume=0;} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}



public function unMute() {


try{video.volume=1;} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}



public function volume(_vol:Number) {

try{video.volume=_vol;} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}



public function getVolume():Number {

var vv=0;

try{vv= video.volume;} catch(error:IOErrorEvent) { } catch(error:TypeError) {} catch(error:Error) {} finally {}

return vv;



public function state():String {


case -1: unstarted

case 0 : ended

case 1 : playing;

case 2 : pauses;


var state=-1;

if (video.videoPaused) state=2;

if (!video.videoPaused) state=1;

if (video.playProgress==1) state=0;


return state;





private function onPlayerReady(event:Event):void {

//video = loader.content; //sets the player

//video.setSize(__width, __height); //sets the display size


//video.loadVideoById(id,startSec); //loads the video by the id

//loaded = true;






Link to comment
Share on other sites

Hi Paul Anthony,


Sorry to hear you are experiencing problems. We would certainly like to make sure that any issues in the new version of VideoLoader are fixed.


In order to do so quickly it is very important that we have files that we can use to easily replicate the issue.


It would be of great help if you can provide a complete set of files that ONLY contains the functionality of 2 videos not playing consecutively. If the videos are too big to upload, the links to the flvs you provided above should suffice. it is very important that we can easily replicate the issue so that we can verify exactly when it occurs and be able to assure you that it is fixed.


Thank you

Link to comment
Share on other sites

I echo Carl's request for a sample set of files that we can publish, but I also have a few questions for you:

  1. Are you calling your class's init() function anywhere? I noticed you're calling createVideo() both in the constructor AND in init() which seems odd to me - it could create multiple VideoLoaders for the same file, both with the same name.
  2. Why are you setting bufferMode:true?
  3. Does it solve things if you remove noCache:true?

Also, when you send us the sample file(s), please include the old version of VideoLoader/LoaderMax that DOES work.



Link to comment
Share on other sites

The old version I was using for LoaderMax was VERSION: 1.761

* DATE: 2010-12-07


I have just marked out the second createVideo() call and tried again but still same error..


The reference to buffermode:true is legacy code from trying to solve the first bug but it has been removed / switched to false many times as have many other parameters and It seems to have no relevance to this latest bug.


Also I have tried noCache:true - it had no effect on the error.


It seems to me that the second FLV is not initialising but I have a feeling it is not being found in the xml loader because the holder for the 2nd flv has a black image background and this is being loaded but the flvvideo call is not being understood.


The problem I have here is that Greensocks is sitting behind a 3rd party flash slider product that was not created with your latest version in mind and I am fearful that I do not have all of your updates migrated properly..


if I reset the old version could you help me with the original bug? - i think it will be easier for this moment in time as I think to upgrade properly I would need to commission you guys at a later date to embed the update properly with the 3rd party flash player.


The original BUG ( In chrome, large flv's are severely delayed when loading second time after the swf call.)


This is an example for error repeat using older version of Greensock in SWF.


#1 load Google browser


#2 call http://www.facebook....121837131257077


#3 click play on first video called "welcome" - result, ok


#4 abort video by searching and selecting alternative video from magnifying glass.


#5 abort and reselect "welcome" video - result, Video takes 2 mins to load.


#6 delete browser cache and reload url and run "welcome" video and ok again..


Each time the cache is reset the video plays fine.. but users will not know how to do this..


This older SWF uses same fh code shown above.


as mentioned the new LoaderMax fixes this problem but introduces a second child video bug there fore i think its will be easier to resolve original bug.


Can you help?


Your help will be gladly appreciated as it is already.






P.S Have set up the original error for repeat as described which can be seen at http://www.facebook....121837131257077



what we have now....



private function createVideo():void {

video = new VideoLoader(src, {onInit:function(){error=18}, name:"myVideo", container:cont, width:__width, height:__height, bufferTime:7, scaleMode:"proportionalInside", bgColor:0x000000, autoAdjustBuffer:false, noCache:false, bufferMode:true});

//start loading





on VERSION: 1.761

* DATE: 2010-12-07

Link to comment
Share on other sites

Hoorah!! I have managed to fix bug the reported google bug.


old GreenSock code VERSION: 1.761 with new version of "VideoLoader" only compiled ok and resolves the kill and restart same video problem I was having.




How do I close this support request ?

Link to comment
Share on other sites

Wait, are you saying that the new VideoLoader is good, but the new version of LoaderMax (or something else in the package) is bad? So dumping the newer VideoLoader into the older set of GreenSock files resolved your problem?

Link to comment
Share on other sites

Yeh.. I added the new version of VideoLoader to the loading directory of the old environment and and it resolved the issue. My application allows user to load another video without first stopping the current video in the loader and the next time the first video loaded it was getting a bit confused seemingly because it was previously aborted.. However, the later VideoLoader script dealt with the crash event ok..




P.S Strangely though, the second play of the same video although starting well, for some reason always pauses for a moment at around point 14 seconds and then starts again.. The first time the video is run after the flash player swf is loaded it runs perfect.


I have tried unload() and Dispose() via the onchildcancel event to get rid of the content when user chooses to play a diff video but the second play of the same video still pauses for a while.. I don't know what it is but a clue is to do with caching.


The noCache value = true in the loader script but in chrome I can only get it to run 100% perfect if I switch caching off in the chrome browser but clearly I can not control what users have set or not set in their chrome browser.. if I load another video and the first is aborted what event is this ? I assume it is onchildCancel ?

Link to comment
Share on other sites

Yep, it sounds like you're looking for onChildCancel (if you're adding the listener to the LoaderMax instance) or onCancel (if you're adding it to the loader itself).


As for the brief pause the 2nd time through, that sounds like either a Flash Player bug or garbage collection trigger, both of which would be unrelated to LoaderMax/VideoLoader. If you see any evidence to the contrary, though, please let us know.

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.