Problem with API callback functions; using "addCuePoint" / "onCuePoint" functions

Hi,

I'm searching for a solution to a very specific problem.
I have Flash videos that I play with FlowPlayer which is fine so far(and the player plays them w/o any problem). But I want to develop a feature - once the player played 30% of a video, a callback function will call a script(a PHP script in my case) which script make a record in a MySQL that this video has been viewed 1 time.
I guess I have to use addCuePoint and onCuePoint functions for this but I'm not really sure how exactly.
I'm not making a request for an entire solution - I just want to ask for a sample code, using addCuePoint / onCuePoint function(one of them or both).
I really appreciate if somebody out there can help.

Thanks!

alam's picture

onFlowPlayerReady() call back method does not work

Any one can help me by telling , how does onFlowPlayerReady() callback method work???

Thanks
ALAM

Anybody...?

Well, seriously - can anybody help with this?
Is this impossible to be done?

api's picture

cuepoints

You can add a cuepoint like this:

var flowPlayer = document.getElementById("myPlayer");
flowPlayer.addCuePoints([ {time: 2, name: "cue1", parameters: { foo: 1, bar: "foobar" }}, { time: 5, name: "cue2", parameters: { foo: 2, bar: "foobar2" }} ]);
}

The first cuepoint is triggered at 2 seconds in the video's timeline and the second one at 5 seconds. To make it trigger at 30% you need to calculate what time value 30% corresponds from the video's total duration.

The cuepoint callback looks like this:

function onCuePoint(cuePoint) {
alert("cue point received, time: " + cuePoint.time + ", type '" + cuePoint.type + "', name: '" + cuePoint.name + "'" + ", parameters: " + cuePoint.parameters);
}

The player will call this callback function 2 times when it reaches the 2 cuepoints. You can do the PHP server script requesting from inside this function.