So I've got a programming challenge.

I've got audio/video streaming in, and I've got an XML document 
converted to an Array (each node is an index of the array), each 
value in the array in the contains a cuepoint in Ms.

What's the most efficient way to find the cuepoints in the array 
which are within range (with a fuzziness of say +/- 50ms) of the 
current position of the playhead on my audio/video?

At the moment I've simply got a for (var i:Number = 0; i < 
cuePoints.length; i++) {}

That's not really a robust way to check the array of cuepoints for 
matching values of the current media's playhead position - as the 
more cuepoints in the array, the lower the chance is of finding 
matches accurately.

So to reiterate - say my media's playhead is at a position of 2300Ms.
My swf is 30FPS - and in my onEnterFrame for the mediaplayer in that 
SWF I check to see if there are any cue points (with values of say, 
2250, 2300, 2325) within range of the current playhead position.

I'm hunting for the most efficient way to achieve that.

I've got some ideas - which will work "ok" - but this has to be a 
common programming challenge - and there has to be a more efficient 
way than a loop through an array reading all cue point values that 
are within range of my current playhead's position.

Have at it - homies.


Grae Hall
Senior Art Director
Singleton Ogilvy Interactive

Reply via email to