Jump to content
Search Community

VideoLoader autoPlay problem

AlDev test
Moderator Tag

Recommended Posts

I been checking out the new loader max and I think it's awesome. But I am having a small problem trying to control a VideoLoader.

 

Basically all I am trying to do is to load an flv and play it only when is completely loaded. I figure all I had to do was to turn bufferMode and autoPlay to false. But I am getting a weird behavior. Basically it works most of the time, but randomly, it starts playing before is done loading without never telling it to play, and it never fires the complete event.

 

Any idea?

 

Here is an example:

private function createVideoLoader():void{
		var objData:Object = new Object();
		objData.container = this.videoContainer;
		objData.width = 1024;
		objData.height = 768;
		objData.scaleMode = "proportionalInside";
		objData.bgColor = 0x000000;
		objData.autoPlay = false;
		objData.bufferMode = false;
		objData.centerRegistration = true;
		objData.onProgress = this.onVideoLoadProgress;
		objData.onComplete = this.onVideoLoadComplete;
		this._objVideoLoader = new VideoLoader("http://www.trademarktalent.com/flv/BFfartthemovie.flv",objData);
}

//Event Handlers
private function onVideoLoadProgress($event:LoaderEvent):void{
		var percent:Number = Math.round(this._objVideoLoader.progress*100)
		trace(percent);
}

private function onVideoLoadComplete($event:LoaderEvent):void{
		trace("complete")
		this._objVideoLoader.playVideo();
}

Link to comment
Share on other sites

Looks like your code is fine - do you have the latest version of VideoLoader? Make sure you snag the latest and greatest at http://www.LoaderMax.com. If you're still having trouble, would you be so kind as to upload an example FLA that demonstrates the issue? The simpler the better. I'm not aware of any problems that could cause VideoLoader never to fire its COMPLETE event (unless your video literally never finishes loading, like because of a server problem).

Link to comment
Share on other sites

Yes I downloaded the latest version and the problem is still there, I was trying to create an intro section in flash but i wanted the video to play smoothly thats why i needed it to load all before starting. I was able to create a small example (Please see attached). And I also noticed that the problem might have something to do with the Netstream being paused. If you have a fast connection, it works pretty well but when things slow down it starts happening. I believe maybe flash has a problem pausing a video right off the bat, sometimes it works and sometimes it doesn't. I was able to replicate the problem by throttling my internet connection and it keeps happing randomly so please check on a more realistic connection, obviously if the internet speed its too fast it wont have time to bug out lol. I recommend using http://www.charlesproxy.com/.

Link to comment
Share on other sites

Well, you're correct about Flash having a hard time with pausing a NetStream right away but VideoLoader has always worked around that internally - you'll notice it won't allow it to be paused until either the buffer is full or the NetStream's NetStream.Play.Start NetStatusEvent has been dispatched, so I kinda doubt that's the problem. I tried about 8 times and couldn't replicate the issue on my end - could you give me some instructions about how to replicate the problem?

Link to comment
Share on other sites

Well actually to replicate the issue there is not much to it, just try to load a video with autoPlay and bufferMode set to FALSE on a realistic internet connection. I was able to screencap what its happening, I ran the same swf I sent you and on the first try I got the bug. Please see the link bellow:

 

http://www.screencast.com/t/MjNmMmQ3

 

 

To recap, I have autoPlay and bufferMode set to false. But it still starts playing before its completely done loading. I never tell it to play until I hear the complete event, so I know for a fact its not my code.

 

Hope this helps

 

Al

Link to comment
Share on other sites

Wow, is that ever odd - I even tried at a 64kbps connection and it worked perfectly. I cannot for the life of me get this to break, but obviously you can so I'm wondering what's different between our setups. Yours is acting as though the NetStream never dispatches any NetStatusEvents - that's the only thing I can think of that could explain the issue. Can you set up a NetStream for that video manually (not using VideoLoader) and see if it dispatches NetStatusEvents properly? Sure seems like a Flash bug.

 

What environment are you in exactly? Windows XP? I noticed you just double-clicked the swf to play it but if I do that on my system, it throws up a Flash Player Security message saying it stopped a "potentially unsafe operation" when it tries to go out to the web to get that video file. Basically, it's throwing a security sandbox error because the local file is trying to load a network file. How were you able to avoid that? Did you tweak your security settings?

Link to comment
Share on other sites

Yes I was able to get the NetStatusEvents fine, I even put a trace inside the event handler for the VideoLoader.as class and it also did it just fine. For some reason the pause is just not working sometimes.

 

I am on a windows 7 machine but I also tested on a mac and on a windows XP machine before I decided to write to the forum. As for the sandbox error. Yes I went to adobe "http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html" and allowed access to my whole desktop since they let you do folders. I also tried this on a local host with the same result.

 

Please help :(

 

Al

Link to comment
Share on other sites

Alright, would you try the attached VideoLoader.as file and let me know if that solves things for you? If not, please trace the following values inside the _statusHandler method for me (line 480-ish):

 

trace("pauseOnBufferFull: "+_pauseOnBufferFull+", code: "+event.info.code+", bufferProgress: "+this.bufferProgress);

 

(obviously I'd only need those values for the times that it FAILS to function properly).

Link to comment
Share on other sites

You tricky gypsy lol!

You crushed that bug! Even better now it doesn't show the first screen of the video when it does pause.

It works correctly. During my years in flash I do recall something about NetStream.Play.Start firing before the buffer is full. I just assumed that adobe would have addressed this by now, but you know what happens when u assume...

 

 

NICE JOB MAN!

 

borat-high-five.jpg

 

Thanks for the quick response/fix, ill let u know if i find any other weird bugs ;)

 

 

AL

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