11 Replies Latest reply: Mar 19, 2013 7:15 AM by sinious RSS

    Problems Using Cue points to Loop Video

    EverestJ Community Member

      Ok, so I want to use cue points to navigate through video.  I want to start by simply looping the video from the end back to the beginning.  I keep getting an invalid seek error 1003.  Here is my code.  Any help would be much appreciated.  Thanks

       

      import fl.video.MetadataEvent;

       

       

       

      Movie.addEventListener(MetadataEvent.CUE_POINT, loopFunction);

      function loopFunction(e:MetadataEvent):void

      {

          if (e.info.name == "end1")

          {

              Movie.seekToNavCuePoint("beginning1");

              Movie.play();

          }

      }

        • 1. Re: Problems Using Cue points to Loop Video
          sinious Community Member

          If you're literally trying to seek to the 00:00 of the video you don't need to incur the extra cycles necessary to loop through available valid cuepoints, just use: Movie.seek(0); to seek second 0. Note, when you seek it will not be a seamless loop, it will take a brief delay before looping. This is a very long standing issue that fluxuates between being an issue, getting resolved, then reappearing. You can search for seamless looping in here and see tons of lengthy threads on the issue.

          • 2. Re: Problems Using Cue points to Loop Video
            EverestJ Community Member

            Thanks, it worked!  But why would using cuepoints return an invalid seek?  I am not sure what is happening simply because I have used it in the past and it seems to have worked fine.  In one page I made over a year ago, I used a customized button that when clicked, it would seek to "beginning".  Just curious why it wouldn't work.  Thanks

            • 3. Re: Problems Using Cue points to Loop Video
              sinious Community Member

              I believe it's a faulty metadata to be honest because after a certain duration you can no longer set cue points (I have a bug report on it). Perhaps 00:00 is a 'special' time or something so easily accessed by just seek(0) that they didn't feel the need to implement it. Either way I'm glad you got it working. If you're all set please mark any helpful/correct to close the thread. Good luck!

              • 4. Re: Problems Using Cue points to Loop Video
                EverestJ Community Member

                OK, so, this was helpful, and I thank you for that.  Of course a new problem has come forth.  I wanted to loop from the end back to the middle, with cue points, simlar code.  I still get an invalid seek.  This has worked for me in past projects.  Was there some change between flash 5.5 and flash 6 what would cause this error?  I am completely lost and need to come through for my team in grad school.  Here is the code, and still getting a seek error:

                 

                stop();

                 

                 

                import fl.video.MetadataEvent;

                 

                 

                Movie.addEventListener(MetadataEvent.CUE_POINT, loopFunction);

                function loopFunction(e:MetadataEvent):void{

                if (e.info.name=="introEnd") {

                Movie.seekToNavCuePoint("introMiddle");

                Movie.play();

                }

                }

                   

                   

                Movie.addEventListener(MetadataEvent.CUE_POINT,cuepointF);

                function cuepointF(e:MetadataEvent):void{

                trace(e.info.name);

                }

                 

                all the cue points are showing up, but no go.

                • 5. Re: Problems Using Cue points to Loop Video
                  sinious Community Member

                  Let's start by seeing if your loopFunction is being fired off. Put a trace in it:

                   

                  function loopFunction(e:MetadataEvent):void

                  {

                       trace("Cue point hit, name[" + e.info.name + "] time[" + e.info.time + "] type[" + e.info.type + "]");

                  }

                  Are the cuepoints firing off at all? I'm trying to determine if the condition isn't being met so it's not seeking (e.g. e.info.name == "introEnd"). Also how long is this movie and what exactly is the "Movie" var representing, a FLVPlayback component?

                  • 6. Re: Problems Using Cue points to Loop Video
                    EverestJ Community Member

                    So I went home and was using CS 5.5 for premiere and for flash.  When I opened up the FLV (that was rendered in premiere CS 6) in flash CS 5.5, it read all the cue points as event cue points.  I thought I messed it up and just pulled a bone head mistake.  I went back to school, and opened up the old files in CS 6 to see if I screwed up, and they were showing as nav cue points, not event cue points.  I am not sure if Adobe messed something up, but it does not work in CS 6.  Looks like I will be doing a lot of work from home.  I ran a trace statement and it is showing the cue points.  I am not sure what happened exactly, but I can not get it to work in CS 6, but CS 5.5 it works splendidly

                    • 7. Re: Problems Using Cue points to Loop Video
                      sinious Community Member

                      There are different cue point types. Some encoders know this (like Sorenson Squeeze) and when you're encoding you specify the type it should be.

                       

                      You said the trace is working. Does that mean just in CS5.5 or in both CS5.5 and CS6? If it's working in CS6 then put the same trace inside your comparison and see if it still traces:

                       

                      function loopFunction(e:MetadataEvent):void

                      {

                         if (e.info.name=="introEnd")

                         {

                            trace("introEnd cue point hit, name[" + e.info.name + "] time[" + e.info.time + "] type[" + e.info.type + "]");

                            Movie.seekToNavCuePoint("introMiddle");

                            Movie.play();

                         }

                      }

                       

                      If not you know the issue is the comparison. It can help to be strict in "type" by casting e.info.name to a String before comparison, e.g.: String(e.info.name) == "introEnd"

                       

                      Let me know where exactly the trace is working.

                      • 8. Re: Problems Using Cue points to Loop Video
                        EverestJ Community Member

                        Apparently Adobe is aware of the issue.  It has nothing to do with the code, but rather the FLV.  When exporting in premiere cs 6, or media encoder, the type of cue point will always be an event cue point.  I took a FLV that I rendered at school in premiere CS6 and took it home and imported it into flash cs 5.5, and it read as all event cue points.  I conversely took a video I rendered in Premiere CS 5.5 and imported it into a Flash CS 6 project, and everything worked perfectly.  I am thinking the problem is with Premiere and not Flash.  This was confirmed by my IT guys at Carnegie Mellon who have talked to the people at Adobe apparently, who gave this response:

                        "I can't give specifics about fixes or features coming in future versions, but I did want to give an update on this. We are working on a fix for this, and we are hoping to make it available in the near future. Again, I need to stress that I can't make specific promises about what will be in which version and when, but I wanted to make sure that you knew that we are absolutely not ignoring this issue."

                         

                        Hopefully they will have it fixed soon.

                        • 9. Re: Problems Using Cue points to Loop Video
                          sinious Community Member

                          At least you are getting notified even if the seek doesn't work.

                           

                          A brief workaround could be to iterate over the cue points you detect in metadata, assigning each cue point name and time in an object. Once you hit the cue point you desire, see if the object has the time value and seek() to the time for that cue point rather than seeking for it by name.

                           

                          e.g. (written briefly, you get the idea):

                           

                          // object to hold time values

                          var cuePointArr:Object = new Object();

                           

                          function onMetaData(infoObject:Object):void

                          {

                              var cueIndex:String;

                              for (cueIndex in infoObject.cuePoints)

                              {

                                  trace("Adding cue name[" + infoObject.cuePoints[cueIndex].name + "] at time[" + infoObject.cuePoints[cueIndex].time + "]");

                                              // store as name = time

                                              cuePointArr[infoObject.cuePoints[cueIndex].name] = infoObject.cuePoints[cueIndex].time;

                              }

                          }

                           

                          function loopFunction(e:MetadataEvent):void

                          {

                                    // correct cue point and has a value in cuePointArr?

                              if ((e.info.name == "end1")&&(curPointArr[e.info.name] != null))

                              {

                                              // seek to time value

                                  Movie.seek(Number(cuePointArr[e.info.name]));

                                  Movie.play();

                              }

                          }

                           

                          Moving 900mph here so forgive any typos but turning it into a normal seek based on the time value should work for now.

                          • 10. Re: Problems Using Cue points to Loop Video
                            EverestJ Community Member

                            You are awesome!  Thanks!  This seems like it will do the trick while I am at school here.  Luckily, I never upgraded from CS 5.5 at home, so I will probably just get remote access to my home computer, and use the cs 5.5 files.  Thanks again for all your help!

                            • 11. Re: Problems Using Cue points to Loop Video
                              sinious Community Member

                              There's no shortage of workarounds so the lesson to learn there at school on that project is expect the worst to happen, right before deadline, out of the blue . You're welcome and good luck!