| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|---|
| 2 | <html>
|
|---|
| 3 | <head>
|
|---|
| 4 | <style type="text/css">
|
|---|
| 5 | body {
|
|---|
| 6 | padding: 0;
|
|---|
| 7 | margin: 0;
|
|---|
| 8 | }
|
|---|
| 9 | </style>
|
|---|
| 10 |
|
|---|
| 11 | <script type="text/javascript">
|
|---|
| 12 | /* Taken from https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player */
|
|---|
| 13 | var tag = document.createElement('script');
|
|---|
| 14 | tag.src = "https://www.youtube.com/iframe_api";
|
|---|
| 15 | var firstScriptTag = document.getElementsByTagName('script')[0];
|
|---|
| 16 | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
|---|
| 17 |
|
|---|
| 18 | /* gup function by R.D. Vaughan */
|
|---|
| 19 | function gup( name )
|
|---|
| 20 | {
|
|---|
| 21 | name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
|---|
| 22 | var regexS = "[\\?&]"+name+"=([^&#]*)";
|
|---|
| 23 | var regex = new RegExp( regexS );
|
|---|
| 24 | var results = regex.exec( window.location.href );
|
|---|
| 25 | if( results == null )
|
|---|
| 26 | return "";
|
|---|
| 27 | else
|
|---|
| 28 | return results[1];
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | var myth_player = null;
|
|---|
| 32 | var videocode = gup('videocode');
|
|---|
| 33 |
|
|---|
| 34 | function onYouTubeIframeAPIReady() {
|
|---|
| 35 | myth_player = new YT.Player('myth_player', {
|
|---|
| 36 | height: window.innerHeight,
|
|---|
| 37 | width: window.innerWidth,
|
|---|
| 38 | iv_load_policy: 3,
|
|---|
| 39 | videoId: videocode,
|
|---|
| 40 | /* videoId: 'u1zgFlCw8Aw', <-- for testing */
|
|---|
| 41 | events: {
|
|---|
| 42 | 'onReady': onYouTubePlayerReady }
|
|---|
| 43 | });
|
|---|
| 44 | myth_player.setPlaybackQuality('hd720');
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | function onYouTubePlayerReady(event) {
|
|---|
| 48 | event.target.setVolume(50);
|
|---|
| 49 | event.target.playVideo();
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | function play() {
|
|---|
| 53 | if (myth_player) {
|
|---|
| 54 | var state = myth_player.getPlayerState();
|
|---|
| 55 | if (state == 1) // Playing
|
|---|
| 56 | myth_player.pauseVideo();
|
|---|
| 57 | else if (state != 3) // Video is either unstarted, ended, paused or cued
|
|---|
| 58 | myth_player.playVideo();
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | function seek(amount) {
|
|---|
| 63 | if (myth_player) {
|
|---|
| 64 | myth_player.seekTo(myth_player.getCurrentTime() + amount, true);
|
|---|
| 65 | }
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | function adjustVolume(amount) {
|
|---|
| 69 | if (myth_player) {
|
|---|
| 70 | myth_player.setVolume(myth_player.getVolume() + amount);
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | window.onresize = function() {
|
|---|
| 75 | document.body.style.width = window.innerWidth;
|
|---|
| 76 | document.body.style.height = window.innerHeight;
|
|---|
| 77 | if (myth_player) {
|
|---|
| 78 | // myth_player.setSize(window.innerWidth, window.innerHeight);
|
|---|
| 79 | document.getElementById("myytplayer").width = window.innerWidth;
|
|---|
| 80 | document.getElementById("myytplayer").height = window.innerHeight;
|
|---|
| 81 | }
|
|---|
| 82 | };
|
|---|
| 83 | </script>
|
|---|
| 84 | </head>
|
|---|
| 85 | <body>
|
|---|
| 86 | <div id="myth_player"/>
|
|---|
| 87 | </body>
|
|---|
| 88 | </html>
|
|---|