Jump to content
Search Community

VideoLoader Cue Points and Loops

Dimitris test
Moderator Tag

Recommended Posts

There seems to be an issue/bug with cuepoints and gotoVideoCuePoint() function.


So there's a movie, with two cue points, 'startLoop' - 'endLoop'... now when the video hits on the 'endLoop' cuepoint we want to go back to 'startLoop'... simple enough! 


Well, instead of going back to 'startLoop', the video stays at 'endLoop' and the trace function reports backgroundVideo cuepoint name is endLoop in a loop and after a while it goes back to 'startLoop'... Really weird issue! 


I'm using the latest version of your library. Any thoughts?


The video was encoded with Adobe Media Encoder CS6, just in case!

protected function _onBackgroundVideoCuePoint(event:LoaderEvent):void
   var cue:String = event.data.name;
   trace('backgroundVideo cuepoint name is', cue);
   if (cue == 'startLoop') {
       _backgroundVideo.gotoVideoCuePoint('endLoop', true);
   if (cue == 'startGame') {
      // TODO 

Link to comment
Share on other sites

I don't know if it is just an oversight in your code or description but you state:


now when the video hits on the 'endLoop' cuepoint we want to go back to 'startLoop'... simple enough! 


but your code clearly detects if cue == 'startLoop' then gotoVideoCuePoint('endLoop', true)


Is it possible you have similar duplicate functions in there? Is there something I'm not understanding correctly?


Can you verify that both cue points exist and that events fire when they are reached properly (without any looping code)?

Link to comment
Share on other sites

if (cue == 'backgroundVideoLoopEnd') {
    TweenLite.delayedCall(0.1, function():void {
    _backgroundVideo.gotoVideoCuePoint('backgroundVideoLoopStart', true);

That was my bad, I changed the actual cue point names just for reading purposes, and accidentally, made that error! Sorry for that! 


Both cue points exists, I've also attached a screenshot of the console! 


Now the above code did the trick... By just delaying 0.1 sec it played fine! 


It works, but it's not the best solution!


Any more thoughts? Thanks


Link to comment
Share on other sites

Hmm...any chance you could post a very simple example FLA that demonstrates the issue (and your video file) so that we can publish on our end and look under the hood a bit? 


If I understand your code and intent properly, I'd actually expect to only send the "end" in the loop because when you go back to the start, it skips any cue points inbetween, so it'd just start playing again from there and eventually hit the "end" and loop back again. But maybe I'm misunderstanding something. That's why the sample FLA would be so helpful. 

Link to comment
Share on other sites

Actually, it's better if you don't use your production files anyway - just create a super simple isolated FLA that only demonstrates this issue. That's really helpful for us as we don't have to dig through a bunch of [probably] unrelated code. 


If you're still worried about privacy, you can "Private Message" me with a link to download a zip or something. 

Link to comment
Share on other sites

Well I created a simple fla, as you suggested, in Flash CS6! Now Flash CS6 gives you may options for the target flash player! I've tested with 10.3, 11.1 and 11.2!


With 10.3 as the target the issue didn't appear, with 11.1 and 11.2 it did appeared with the latter version to be less significant (the loop issue of the cue points)!


Here's the interesting thing, by removing bufferTimer in the videoloader vars the issue dissapeared despite the selected target!


I will send the link to fla and assets in a private message!

Link to comment
Share on other sites

Yep, it looks like it's definitely another Flash bug (not VideoLoader). It doesn't handle cue points accurately in some cases (firing them at the wrong time or multiple times in some scenarios). Fun!


I think the best way to work around this is to convert the embedded cue points to ActionScript cue points when the metadata is received so that everything is consistent and VideoLoader can manage the logic internally, ignoring the funky dispatches. I've attached a revised version of VideoLoader with that workaround in place - would you mind giving it a shot and letting me know if it works well for you?


Link to comment
Share on other sites

  • 1 month later...

Jack, thanks a ton for this update! Totally fixed the issue I was running into as well. Funny thing is, I wasn't having any trouble when previewing in the IDE, but (often, though not always) saw the issue when running in the browser. Am thinking that in the browser the performance degraded, which impacts the video playback, and if frames are dropped during playback it's possible to miss the cue point. Whether my guess is right or wrong, converting the embedded cue point to an AS one seems to have done the trick. Thanks again!

  • Like 1
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...