1 <!-- This is a test html file for Youtube video tests. --> 2 <html> 3 <body> 4 <iframe id="yt_frame" type="text/html" width="640" height="390" 5 src="http://www.youtube.com/embed/QNdT65_4xtQ?enablejsapi=1&nohtml5=1" 6 frameborder="0"></iframe> 7 <br> 8 <script> 9 var tag = document.createElement('script'); 10 tag.src = "http://www.youtube.com/iframe_api"; 11 var firstScriptTag = document.getElementsByTagName('script')[0]; 12 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 13 var player; 14 function onYouTubeIframeAPIReady() { 15 new YT.Player('yt_frame', { 16 events: { 17 'onReady': onPlayerReady, 18 } 19 }); 20 } 21 function onPlayerReady(event) { 22 player = event.target; 23 } 24 </script> 25 </body> 26 </html> 27