(function (win) { var ratio = 57; var src = "https://player.streaminghouse.ch/Player/Embed?VideoTokenId=22e3512b-8f05-432f-a3c9-4804b6c37cff"; var scriptTag = document.scripts[document.scripts.length - 1]; var container = document.createElement("div"); var frame = document.createElement("iframe"); function resize() { frame.style.display = 'block'; //frame.style.height = container.clientHeight + 'px'; } //container.style.paddingBottom = ratio + '%'; container.style.height = '100%'; frame.style.border = 'none'; frame.style.width = '100%'; frame.style.height = '100%'; var att = document.createAttribute("allowfullscreen"); frame.setAttributeNode(att); container.appendChild(frame); scriptTag.parentElement.insertBefore(container, scriptTag.nextSibling); frame.setAttribute("src", src); win.addEventListener('resize', resize); win.addEventListener('load', resize); })(window);