Jump to content
GreenSock

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

Problems with VideoLoader.addASCuePoint();

Recommended Posts

Hello,

 

I'm using the VideoLoader.addAsCuePoint functionality:

	public function init():void
	{
		var videoData:VideoLoaderVars = new VideoLoaderVars();
		videoData.smoothing(true);
		videoData.width(1024);
		videoData.height(634);
		videoData.bufferTime(2);

		var url:String = "url";

		_video = new VideoLoader(url, videoData);
		_video.addEventListener(VideoLoader.VIDEO_CUE_POINT, _onCuePoint);
		_video.addEventListener(VideoLoader.VIDEO_COMPLETE, _onVideoComplete);
		addChild(_video.content);

		_video.addASCuePoint(10, "one");
		_video.addASCuePoint(20, "two");

		_video.load();
	}

	private function _onVideoComplete(event:Event):void
	{
		_video.gotoVideoTime(0, true, true);
	}

	protected function _onCuePoint(event:LoaderEvent):void
	{

		trace(_video.videoTime);
	}

 

What happens is, that during normal playback all cuepoints fire correctly. But when I rewind the video on VIDEO_COMPLETE. All cuepoints will fire again. The videotime is still at the end of the video (videotime = duration).

 

Am I doing anything wrong?

 

Thanks for your help!

Link to comment
Share on other sites

I can't seem to reproduce this behavior - are you using the latest version of LoaderMax/VideoLoader? If you're still having trouble and wouldn't mind posting a simple FLA and any support files necessary to reproduce the problem, that'd be swell.

Link to comment
Share on other sites

Yes I'm using the latest swc.

See attached zip for demonstration.

 

If you still can't reproduce the problem, it might be worth checking it out on different machines / os. I'm on a mac...

I also seems to behave different for different videos (encoding, length)...

 

thanks for investigating...

Link to comment
Share on other sites

Aha, I found the issue. It would only show itself if the swf's frame rate was high enough and it has to do with a problem with Adobe's NetStream class - it incorrectly reports its time after its seek() method is called until it dispatches a RENDER event in FP10 or after about 50ms in FP9. I implemented a workaround in the latest version of VideoLoader. Please download it from

Link to comment
Share on other sites

thanks for your quick reply, but....

 

I found another bug, I don't know if it was already there before your fix.

 

now you have: if you set autoplay = false, no cuepoint will fire before the video ends. then all cuepoints will fire straight through.

 

again find example attached (just click stage to start video playback)

Link to comment
Share on other sites

Umm....you sure? I just tried on my own file and the file you posted and both worked perfectly even with autoPlay:false. What am I missing? The sample file had autoPlay set to true, so I set it to false - could you explain how I can get the funky behavior you described?

 

I wonder if maybe you need to clear your ASO files or something - it almost sounds like maybe you had an old version cached (just a guess).

Link to comment
Share on other sites

I just double checked with ASO files and also donwloaded the latest swc again. The issue still exists.

On the other side I discovered the bug developing on a different project using FDT and the Flex Compiler. Also a different FLV is used.

 

If you still can't reproduce the bug and I'll find some time I will investigate it by myself. For now find the demo attached again.

Link to comment
Share on other sites

For the life of me, I cannot reproduce the problem you're describing. Are you saying that when you publish that attached file, it exhibits the funky behavior? Are you on a Mac or a PC? I tried publishing to different Flash Player versions, different frame rates, different videos, and it worked flawlessly every time. [scratching head]

 

Can anyone else reproduce the problem with the file(s) attached or with a different set of files?

Link to comment
Share on other sites

yep. I just publish the fla and the traces are as follows:

 

with autoplay(true);

======================

cupoint: 2.033 one at 2 sec

cupoint: 4.04 two at 4 sec

video complete

 

 

 

with autoplay(false);

======================

cupoint: 8.333 one at 2 sec

cupoint: 8.333 two at 4 sec

video complete

 

I'm on a mac. flash cs 5, FDT 4.1, Flex SDK 4.5.

Link to comment
Share on other sites

Aha, thanks for the confirmation toytonic. I found the issue that was apparently Mac-specific (and was introduced in the last update). It is fixed in the latest version. Sorry about the confusion. http://www.greensock.com/loadermax/

Link to comment
Share on other sites

no worries. thanks for both the fix and the whole loadermax lib!

Link to comment
Share on other sites

  • 1 year later...

FYI, this is happening to me currently.

 

I am using robotlegs and storing the VideoLoader in the Model. At first I thought having a second reference to the VideoLoader might be firing my cuepoints twice but that doesn't seem to be the case. I've made sure I have only one instance of the VideoLoader. I'm using it to play a main content video on a site. The video calls about 15 cuepoints over the course of 3 minutes.

 

This works flawlessly on the first play through. When the user clicks replay, I don't need to reload the video so I just use gotoVideoTime(0) and then wait until some other clips are reset and start the video playing again. For the purposes of testing, I left off the video playing bit on the replay. Using gotoVideoTime(0) fires all of the cuepoints again.

 

I tried removing the listener for the cue points before calling gotoVideoTime and it still calls all my cue points at once. Could it be that another update has broke this again? I'm on a Mac if that matters.

 

Appreciate your library and any help on this matter.

Link to comment
Share on other sites

Can you please post a sample set of files that we can publish to see the problem reproduced? And you are using the latest version, right?

Link to comment
Share on other sites

It's a large FlashBuilder project and I can't post it under NDA. I can show you relelvant pieces of the code if you think it would help but I tested for about 6 hours last night and I've narrowed it down to the gotoVideoTime call.

Link to comment
Share on other sites

No need to post your production files - just a separate FLA with only the essential code to reproduce the problem would be great.

Link to comment
Share on other sites

Well, wouldn't you know it that I set up a simple FLA for you to test and it works beautifully in there. I'm guessing this has to do with how I am using the VideoLoader with the robotlegs framework. Oh well, thanks anyways will keep digging through my code.

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