src/js/iframe_embed/embedder.js
author veltr
Fri, 04 May 2012 16:56:41 +0200
branchnew-model
changeset 883 d35ad8111c5e
parent 882 61c384dda19e
child 906 4b6e154ae8de
permissions -rw-r--r--
Updated Popcorn and JwPlayer to the latest versions

/* This piece of code is directly requested by the page the player is embedded
   on. It creates the iframe the player is embedded in and it reflects changes
   to the iframe url in the page url.   
*/

(function(_frameId) {
    var _frame = document.getElementById(_frameId);
    
    window.onhashchange = function() {
        frame.contentWindow.postMessage({type: "hashchange", hash: hashvalue}, "*");
    };

    window.addEventListener('message', function(_e) {
        if (e.data.type === "hashchange") {
            document.location.hash = e.data.hash;
        }
    });
    
})("metadataplayer_embed");