Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way you are using the iframe api now does nothing, the api is made to bind on an empty element, like <code>&lt;div id="player"&gt;&lt;/div&gt;</code>, the id is the first argument in the <code>new YT.Player</code> function.</p> <p>In order to load a youtube video with the iframe api you need this in the body:</p> <pre><code>&lt;div id="player"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: 480, width: 640, videoId: "36XdO9Iv9ew", }); } &lt;/script&gt; </code></pre> <p>There is no need to explicitely specify you want to enable fullscreen when using the iframe api.</p> <p>You can also just use the iframe without the api, you'll need to specify you want fullscreen when you use it.</p> <pre><code>&lt;iframe width="640" height="480" frameborder="0" id="player" allowfullscreen="1" title="YouTube video player" src="http://www.youtube.com/embed/36XdO9Iv9ew?enablejsapi=1"&gt;&lt;/iframe&gt; </code></pre> <p>Just using the iframe tag is a bit faster, but if you want to use the extra features of the iframe api you have no choice.</p> <p>A page with examples (also check the source): <a href="http://qnet.co/yt" rel="nofollow">http://qnet.co/yt</a></p> <p>You can also implement the fullscreen feature yourself (not needed for Youtube, but still cool):</p> <pre><code>var goFullscreen = function(id) { var el = document.getElementById(id); if (el.requestFullScreen) { el.requestFullScreen(); } else if (el.mozRequestFullScreen) { el.mozRequestFullScreen(); } else if (el.webkitRequestFullScreen) { el.webkitRequestFullScreen(); } } var leaveFullscreen = function() { if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } } </code></pre> <p>and to make the Youtube player go fullscreen with: <code>goFullscreen('player')</code>, and leave fullscreen with: <code>leaveFullscreen()</code></p> <p>The different versions of requestFullscreen and cancelFullscreen are for different browsers, because the standard is not yet completely finished</p> <p>More info on Javascript Fullscreen: <a href="http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/" rel="nofollow">http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/</a> (relative old document, but still valid)</p> <p>off-topic: It is useless to echo such a string with php, you can just paste it in the body the file outside of the php tags.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload