Documentation

Keyboard navigation

Keyboard navigation works fine in the top level window. But if the player is embedded in the iframe, you should send the post message from the window with the player to the parent window.

For example, in order to send the post message, your code can look like the one below:

function getOpener() {
    var parent = null;
    if (window.parent != null && window.parent.postMessage != null) {
        parent = window.parent;
    }
    if (window.opener != null && window.opener.postMessage != null) {
        parent = window.opener;
    }
    return parent;
}

player.onPageScrollTo(function (top) {
    var parent = getOpener();
     if (parent) {
         parent.postMessage('SCROLLTOP:' + top, "*");
     }
 });

and to receive the message in the main(top) window, you should add the following code:

window.addEventListener("message", receiveMessage, false);

function receiveMessage(event) {
    var data;
    if (data.indexOf("SCROLLTOP:") == 0) {
        onScrollMessage(event.data.substring('SCROLLTOP:'.length));
    }
}