Last active
          July 22, 2021 04:26 
        
      - 
      
- 
        Save jlind0/18c1302a4a5c207a3e9bfbb577f64719 to your computer and use it in GitHub Desktop. 
    The Space Force
  
        
  
    
      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
    
  
  
    
  | <script type="module" src="js/player.js"></script> | |
| <script type="text/javascript"> | |
| var tag = document.createElement('script'); | |
| tag.src = "https://www.youtube.com/iframe_api"; | |
| var firstScriptTag = document.getElementsByTagName('script')[0]; | |
| firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
| </script> | |
| <script> | |
| function onYouTubeIframeAPIReady(){ | |
| StartVideo = new YouTubePlayer($("#topPlayer").get(0), "M6bumUQwQIU", 16.0/9.0); | |
| } | |
| </script> | 
  
    
      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
    
  
  
    
  | var YouTubePlayer = (function () { | |
| function YouTubePlayer(panel, videoId, aspectRatio) { | |
| var _this = this; | |
| this.panel = panel; | |
| this.aspectRatio = aspectRatio; | |
| var size = this.CalcVideoSize(); | |
| this.Player = new YT.Player(panel, { | |
| videoId: videoId, | |
| height: size.Height, | |
| width: size.Width, | |
| events: { | |
| onReady: function () { | |
| _this.Player.playVideo(); | |
| } | |
| }, | |
| playerVars: { | |
| autoplay: YT.AutoPlay.AutoPlay, | |
| playsinline: YT.PlaysInline.Inline | |
| } | |
| }); | |
| window.onresize = function () { | |
| if (_this.Player != null) { | |
| size = _this.CalcVideoSize(); | |
| _this.Player.setSize(size.Width, size.Height); | |
| } | |
| }; | |
| } | |
| YouTubePlayer.prototype.CalcVideoSize = function () { | |
| var width = Math.floor($(this.panel).width() * 0.98); | |
| var height = Math.floor(width * this.aspectRatio); | |
| return { | |
| Width: width, | |
| Height: height | |
| }; | |
| }; | |
| return YouTubePlayer; | |
| }()); | |
| export { YouTubePlayer }; | |
| //# sourceMappingURL=player.js.map | 
  
    
      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
    
  
  
    
  | ///<reference path="../node_modules/@types/jquery/index.d.ts"/> | |
| ///<reference path="../node_modules/@types/knockout/index.d.ts"/> | |
| ///<reference path="../node_modules/@types/youtube/index.d.ts"/> | |
| ///<reference path="../node_modules/@types/youtube-player/index.d.ts"/> | |
| declare var StartVideo : YouTubePlayer; | |
| /*export function onYouTubeIframeAPIReady() : void{ | |
| StartVideo = new YouTubePlayer($("#topPlayer").get(0), "M6bumUQwQIU", 16.0/9.0); | |
| }*/ | |
| export class YouTubePlayer{ | |
| protected Player : YT.Player; | |
| constructor(protected panel : HTMLElement, videoId: string, protected aspectRatio : number){ | |
| var size = this.CalcVideoSize(); | |
| this.Player = new YT.Player(panel, { | |
| videoId: videoId, | |
| height: size.Height, | |
| width: size.Width, | |
| events: { | |
| onReady: () =>{ | |
| this.Player.playVideo(); | |
| } | |
| }, | |
| playerVars:{ | |
| autoplay: YT.AutoPlay.AutoPlay, | |
| playsinline: YT.PlaysInline.Inline | |
| } | |
| }); | |
| window.onresize = ()=>{ | |
| if(this.Player != null){ | |
| size = this.CalcVideoSize(); | |
| this.Player.setSize(size.Width, size.Height); | |
| } | |
| }; | |
| } | |
| protected CalcVideoSize() : VideoSize{ | |
| var width = Math.floor($(this.panel).width() * 0.98); | |
| var height = Math.floor(width*this.aspectRatio) | |
| return{ | |
| Width: width, | |
| Height: height | |
| } | |
| } | |
| } | |
| export interface VideoSize{ | |
| Width: number; | |
| Height: number; | |
| } | |
  
    
      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
    
  
  
    
              Show hidden characters
| { | |
| "forceConsitentCasingInFileNames": true, | |
| "noImplicitReturns": true, | |
| "strict": true, | |
| "noUnusedLocals": true, | |
| "compilerOptions": { | |
| "module": "es6", | |
| "noImplicitAny": true, | |
| "removeComments": true, | |
| "preserveConstEnums": true, | |
| "sourceMap": true | |
| }, | |
| "include": ["js", "**/*.ts"], | |
| "exclude": ["node_modules", "**/*.d.ts"] | |
| } | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment