-
-
Save danyn/d2932de8d94cbf8292915086853ea765 to your computer and use it in GitHub Desktop.
sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title></title> | |
| </head> | |
| <body style="border: 0; margin:0; padding:0; background-color:#000000"> | |
| <script src="http://www.youtube.com/iframe_api"></script> | |
| <script type="text/javascript"> | |
| var player; | |
| function onPlayerReady(event) { | |
| player = event.target; | |
| player.setPlaybackQuality('default'); | |
| player.setOption('cc', 'reload', true); | |
| setInterval("getCurrentTime()",1000); | |
| } | |
| function getCurrentTime() { | |
| log(player.getCurrentTime()); | |
| } | |
| function onPlayerStateChange(event) { | |
| if(event.data == 1) { | |
| log(player.getAvailableQualityLevels()); | |
| } | |
| } | |
| function onPlaybackQualityChange(event) { | |
| } | |
| function onPlayerError(event) { | |
| } | |
| function log(msg) { | |
| document.getElementById('log').innerHTML = msg; | |
| } | |
| function playVideo() { | |
| player.playVideo(); | |
| } | |
| function pauseVideo() { | |
| player.pauseVideo(); | |
| } | |
| function stopVideo() { | |
| player.seekTo(0,true); | |
| player.stopVideo(); | |
| } | |
| function seektoDuration(target){ | |
| player.seekTo(target, true); | |
| } | |
| function onYouTubeIframeAPIReady() { | |
| player = new YT.Player('ytplayer', { | |
| events: { | |
| 'onReady': onPlayerReady, | |
| 'onStateChange': onPlayerStateChange, | |
| 'onPlaybackQualityChange': onPlaybackQualityChange, | |
| 'onError': onPlayerError | |
| } | |
| }); | |
| } | |
| </script> | |
| <iframe class="youtube-player" style="border: 0; width: 300px; height: 300px; margin:0; padding:0; background-color:#000000" id="ytplayer" type="text/html" | |
| src="http://www.youtube.com/embed/MYsOboRflqQ?enablejsapi=1&hd=1&showinfo=0&controls=0&fs=1" frameborder="0"> | |
| </iframe> | |
| <div id="log" style="background-color:#fff"></div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment