Reputation: 3631
First of all, I made a JSFiddle, you can see it here. The code basically loads jquery and frogaloop lib, and then tries to get current time on the video. It looks like this:
var listener = function (event) {
$("#output").html($("#output").html() + "<BR>" + "Event got to MY listener: " + event.data);
}
if (window.addEventListener) {
window.addEventListener("message", listener, false);
} else {
window.attachEvent("onmessage", listener, false);
}
$(window).load(function () {
var player = $f($("#vmtest")[0]);
setTimeout(function () {
player.api("pause");
player.api("getCurrentTime", function (value, player_id) {
$("#output").html($("#output").html() + "<BR>" + "get current time callback");
$("#output").html($("#output").html() + "<BR>" + value);
});
}, 5000);
});
The problem: my window listener gets the callback, but not the frogaloop listener (otherwise I would expect to see the callback fire).
Second problem: there's no indication of which player it was that fired the event (like playerid), so there's no way for me to figure that out if there's more than one player on the page (which is the case in my more complex scenario, not shown here).
Has anyone had any success with this? What am I doing wrong?
Upvotes: 1
Views: 1548
Reputation: 74
Actually they say in the doc that even if you have only one player, if you are using froogaloop you need to put the &player_id=whateveryouridis in the url.
Upvotes: 0
Reputation: 3631
Aha! I figured it out (when all else fails, RTFM!)
I had to add &player_id=vmtest to the video url so that vimeo will know which player it is referring to! They say you need this only when embedding more than one player, but they're wrong! You have to do it even for one player!
Well, now it works :)
Upvotes: 3