1 Reply Latest reply on Oct 26, 2010 11:00 AM by DanelKirch

    List all CuePoints

    DanelKirch

      Hello,

       

      i got a project where all video files are in same folder as my player (its a USB-stick project and not web)

      and i got FLV file filled with navigation cuepoints.

       

      Now, i need to list ALL these somehow.

       

      I found a example code where numMarkers is used, so i tested this:

       

      private function onMetadataAdd(event:MediaElementEvent):void{
                  if (event.namespaceURL == CuePoint.EMBEDDED_CUEPOINTS_NAMESPACE){
                      var timelineMetadata:TimelineMetadata = mediaElement.getMetadata(CuePoint.EMBEDDED_CUEPOINTS_NAMESPACE) as TimelineMetadata;
                      timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint);
                      trace("CP: "+ timelineMetadata.numMarkers); // returns: CP: 0
                  }
              }

       

      but it returns always 0

      Ive also tested this in onCuePoint function but nothing happend there eighter.

       

      Anyone having any idea what im missing out here ?

       

      this is how my onCuePoint looks like, and its working fine, ive tested with trace(event.currentTarget.numMarkers) but with no luck

      private function onCuePoint(event:TimelineMetadataEvent):void{
                  var cuePoint:CuePoint = event.marker as CuePoint;

                  this.dispatchEvent(new CuePointEvent(cuePoint.name)); // Custom event
              }

        • 1. Re: List all CuePoints
          DanelKirch Level 1

          Found the solution:

           

          Step by step code that is relevant:

           

          Eventlistener on videoElement:

          mediaElement = new VideoElement(new URLResource(url));
          mediaElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd);

           

          Function which is called on metadata:

          private function onMetadataAdd(event:MediaElementEvent):void{
              if (event.namespaceURL == CuePoint.EMBEDDED_CUEPOINTS_NAMESPACE){
                  var timelineMetadata:TimelineMetadata = mediaElement.getMetadata(CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) as TimelineMetadata;
                  timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint);
                  trace("CP: "+ timelineMetadata.numMarkers); // Returned 16 - number of curepoints i had in flv
              }
          }

           

          Difference in this code and in first one (first post) is DYNAMIC_CUEPOINTS_NAMESPACE instead of EMBEDDED_CUEPOINTS_NAMESPACE

           

          Hope this helps anyone