Qt/QML App for Friendiqa
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

yplayer.html 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <html>
  2. <head>
  3. <title>-1</title>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  5. </head>
  6. <body bgcolor="black" marginwidth="0" marginheight="0">
  7. <div id="player"></div>
  8. <script>
  9. function getVideoId() {
  10. return window.location.href.slice(window.location.href.indexOf('?') + 1);
  11. }
  12. var tag = document.createElement('script');
  13. tag.src = "https://www.youtube.com/iframe_api";
  14. var firstScriptTag = document.getElementsByTagName('script')[0];
  15. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  16. var player;
  17. function onYouTubeIframeAPIReady() {
  18. player = new YT.Player('player', {
  19. playerVars: { 'html5': 1, 'iv_load_policy': 3 },
  20. frameborder: '0',
  21. height: '100%',
  22. width: '100%',
  23. videoId: getVideoId(),
  24. events: {
  25. 'onReady': onPlayerReady,
  26. 'onStateChange': onPlayerStateChange
  27. }
  28. });
  29. }
  30. function onPlayerReady(event) {
  31. document.title = 0;
  32. }
  33. function onPlayerStateChange(event) {
  34. if (event.data == YT.PlayerState.PLAYING) {
  35. document.title = 1;
  36. } else if (event.data == YT.PlayerState.ENDED || event.data == YT.PlayerState.PAUSED) {
  37. document.title = 2;
  38. }
  39. }
  40. </script>
  41. </body>
  42. </html>