3 Replies Latest reply on May 19, 2010 1:13 AM by JackFrost21

    CuePoints vs Timer vs Other for Per Frame events


      Just wondering what the standard approach to this problem would be.


      I need to position an image per frame on a FLV streaming to a player. I have been through the mill a bit on finding the right development environment, version of dev env (which is now Flex 4) version of Video player to use and what type of cue points or other event triggering mechanism to use and I am hoping someone with more experience in this than me can point me in the right direction.


      As stated I need to place an image dynamically into a media stream on a per frame basis (not always at the same point).


      The problem reduces to being able to do something at the per frame level. Research led me to believe cue points where the way to go. I tried embedded cue points but either the player could not read them (or I had to use onMetaData received and then create them manually) or the fact that I had to do multiple image positions per frame was causing an issue.


      My research tells me I can either have embedded or actionscript cuepoints - the latter set at run-time apparently have a drawback of not being as acurate as the embedded (or so I read) and also don't appear to have the capability of allowing custom data to be associated with the cue point - which means maintaining a separate structure to keep the data in.


      Timers are another option but then there is how to synch the timer exactly with the stream - if the stream is paused or delayed for whatever reason your timing is out.


      When I started this I was convinced it would be straight forward - read a stream - wait for a cue point - position image - go to sleep until next cue point event fires. 8 weeks later I am still trying to find the right fit.


      Flex 4 VideoPlayer does not seem to support CuePoints and VideoDisplay docs say to use the VideoPlayer. OSMF seems to have some support but docs say that implementation could change before feature release in which case anything I build now is suspect - already some of the samples I have seen don't work when I try and build them.


      I would appreciate any insight into what the accepted "right" way is of doing per frame manipulations on a downloaded media stream. I am puzzled as to why this should be so difficult when in theory it seems pretty straight forward.

        • 1. Re: CuePoints vs Timer vs Other for Per Frame events
          charles_newman-cSBPmR Level 1

          You are correct that AS cuepoints are not going to be frame accurate.  If you need that, you need embedded cue points.  However, in OSMF, the AS cue points (AKA TimelineMetadata) are accurate within 250 milliseconds and very reliable when the user seeks or pauses, and you can add custom data (see the CuePoint class).


          The only gotcha on the embedded cue points is if you are using H.264, you won't get the instream onCuePoint, you'll get them all at once in an array via the onMetadata callback.  OSMF knows how to grab these and dispatch events, so you don't need to write any special code in this case.


          Take a look at the CuePointSample app in OSMF.


          If you are only using progressive download FLV, then your embedded cue points will trigger a frame accurate onCuePoint instream event which you can listen for like this:


          videoElement.netClient.addHandler("onCuePoint",  myHandlerFunc);



          - charles

          1 person found this helpful
          • 2. Re: CuePoints vs Timer vs Other for Per Frame events
            FTQuest Level 3

            Also, you can change the default 250 milliseconds to smaller value via 'currenttimeUpdateInterval' property.



            1 person found this helpful
            • 3. Re: CuePoints vs Timer vs Other for Per Frame events
              JackFrost21 Level 1

              Hi Charles,


              Firstly, thank you for the replay - I really appreciate you taking the time

              to respond to my question.


              I have had a look at OSMF but it appears that it is still in development and

              many of the samples I have looked at don't work - is this the only option

              going forward if I have H.264 encoded material?


              Also the accuracy to 250ms - if I want it to be frame accurate - does it not

              need to be accurate to 40ms - I will need to have 1 cuePoint per frame and

              it will need to load multiple images in that frame.


              I think what I am trying to find out is if I want to do something on a per

              frame basis - is this the only solution available or is there some other

              option such as the EVENT_FRAME event - which if I understand things

              correctly is not available for the actual FLV?


              Thanks again