F4V Cue Point Solution
I have produced a simple to use workaround (you saw it here first) to enable cue points in F4V files.
I came up with the solution after the same question came up in the office twice on separate occasions:
Why are my F4V cue points not working?
The first time it came up I was shown CS4 media encoder with cue points clearly in place, but the cue point events did not appear to be firing in flash.
With a bit of googling we found the following article from adobe entitled “Cue points for FLV and F4V video files”, perhaps we were doing something wrong?
But then at the at the bottom of the page in the comments we found a link to the adobe tech note:
“F4V-format video exported from Adobe Media Encoder CS4 does not contain cue points”
Reason:
“The F4V format is based on the format specified by ISO/IEC 14496-12: ISO base media file format which is not specific to Flash and does not have native support for the cue points that the FLV format uses.”
So we gave up and used a FLV.
Then the question came up again this time it was pointed out to me the fact that when imported to flash the FLVPlayback component inspector clearly showed the cue points added in CS4 encoder showing up in the component inspector! The cue point events still where not working but this finding meant the data had to be in the file.
After some experimentation I found that the cue point information was being stored in the XMP metadata, this data is available in flash at runtime using the onXMPData event.
Whilst researching XMP I came across this useful adobe page “Using cue points and metadata” whilst detailing how to parse cue points from the XML it also further reinforced by use of a table f4v not supporting the onCuePoint event.
| Runtime | F4V | FLV |
|---|---|---|
| Flash Player 9/ AIR1.0 | OnCuePoint | |
| OnMetaData | ||
| Flash Player 10 | OnCuePoint | |
| OnMetaData | OnMetaData | |
| OnXMPData | OnXMPData |
The Solution
I wanted to come up with a simple fix for non-codey types to use.
The solution uses a single action script class file XMPCuePointClient.as that you can place with your FLA it can then be enabled using two lines of code:
import fl.video.VideoPlayer; VideoPlayer.netStreamClientClass = XMPCuePointClient;
The class works by parsing the XMP data and inserting FLVPlayback action script versions of the cue points. Cue points can then be consumed using usual code something like:
import fl.video.MetadataEvent;
function onCuePoint(e:MetadataEvent):void
{
trace(e.info.time,e.info.name,e.info.parameters.typeConverted);
}
myFLVPlayback.addEventListener(MetadataEvent.CUE_POINT, onCuePoint);
Worth noting with this solution is the cue point types are converted to actionscript, but the class does store the original type (event|navigation) in parameters.typeConverted.
A sample fla, f4v video, and the XMPCuePointClient.as file can be downloaded here:
If you find this code useful please return the favour by giving us a web link on your site or blog.



