Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.controlls = {
  2.  
  3.  
  4.                     clickPub:Ink.bind(function(){
  5.                         /*
  6.                             //fire a pub event for KPI's
  7.                             customEvent.fire('video.pub_click',{
  8.                                 channel:this.currentChannel,
  9.                                 video:this.currentVideo
  10.                             });
  11.                         */
  12.                             this.videoPlayer.stop();
  13.                             this.videoPlayer.unload();
  14.                             this.videoPlayer.load(this.currentVideo.location,true);
  15.                             setTimeout(this.videoPlayer.pause,500);
  16.                         },this),
  17.  
  18.                     load: Ink.bind(function(str){
  19.                             if(str==this.videoPlayer.getCurrentRequestURL()){
  20.                                 this.videoPlayer.setCurrentTime(0);
  21.                                 return;
  22.                             }
  23.  
  24.                             this.videoPlayer.stop();
  25.                             //this.videoPlayer.unload();
  26.                             this.videoPlayer.load(str);
  27.                         },this),
  28.  
  29.                     autoload: Ink.bind(function(str){
  30.                             //TODO: might be wise to use getCurrentVideoSource() instead
  31.                             if(str==this.videoPlayer.getCurrentRequestURL()){
  32.                                 this.videoPlayer.setCurrentTime(0);
  33.                                 this.videoPlayer.play();
  34.                                 return;
  35.                             }
  36.                             this.videoPlayer.stop();
  37.                             //this.videoPlayer.unload();
  38.                             this.videoPlayer.load(str,true);
  39.                         },this),
  40.  
  41.                     next: Ink.bind(function(){
  42.                         if(this.playerState().isAd) return;
  43.  
  44.                         customEvent.fire('video.next');
  45.                         if(this.currentChannel.playlist.length===1){
  46.                             //1 video playlists special case
  47.                             this.controlls.replay();
  48.                             return;
  49.                         }
  50.                         var nextIndex = this.currentVideoIndex+1;
  51.                         this._loadVideo((this.currentChannel.playlist[nextIndex]) ? nextIndex : 0);
  52.                     },this),
  53.  
  54.                     prev: Ink.bind(function(){
  55.                         if(this.playerState().isAd) return;
  56.  
  57.                         customEvent.fire('video.prev');
  58.                         if(this.currentChannel.playlist.length===1){
  59.                             //1 video playlists special case
  60.                             this.controlls.replay();
  61.                             return;
  62.                         }
  63.                         var prevIndex = this.currentVideoIndex-1;
  64.                         this._loadVideo((this.currentChannel.playlist[prevIndex]) ? prevIndex : this.currentChannel.playlist.length-1);
  65.                     },this),
  66.  
  67.                     togglePlay: Ink.bind(function(){
  68.                             if(this.playerState().isAd) return;
  69.  
  70.                             this.videoPlayer.togglePlay();
  71.                         },this),
  72.                     play: Ink.bind(function(){
  73.                             if(this.playerState().isAd) return;
  74.  
  75.                             this.videoPlayer.play();
  76.                         },this),
  77.  
  78.                     replay: Ink.bind(function(){
  79.                             if(this.playerState().isAd) return;
  80.  
  81.                             this.videoPlayer.setCurrentTime(0);
  82.                             this.videoPlayer.play();
  83.                         },this),
  84.  
  85.                     pause: Ink.bind(function(){
  86.                             if(this.playerState().isAd) return;
  87.  
  88.                             this.videoPlayer.pause();
  89.                         },this),
  90.  
  91.                     stop: Ink.bind(function(){
  92.                             if(this.playerState().isAd) return;
  93.  
  94.                             this.videoPlayer.stop();
  95.                         },this),
  96.  
  97.  
  98.                     mute: Ink.bind(function(){
  99.                             this.videoPlayer.toggleMute()
  100.                         },this),
  101.  
  102.                     unmute: Ink.bind(function(){
  103.                             if(this.playerState().isMuted){
  104.                                 this.videoPlayer.unmute()
  105.                             }
  106.                         },this),
  107.  
  108.                     volume: Ink.bind(function(vol){
  109.                             this.videoPlayer.setVolume((vol/100).toFixed(2));
  110.                         },this),
  111.  
  112.                     setZoneId:Ink.bind(function(){
  113.                          this.videoPlayer.setZoneId(this.currentChannel.zoneId,this.currentChannel.zoneHash);
  114.                         },this),
  115.  
  116.                     fullscreen: Ink.bind(function(){
  117.                             var _ = this.pageHead;
  118.                             InkCss.addClassName(document.body,'fullscreen');
  119.  
  120.  
  121.                             this.videoFrame.parentNode.style.height = '';
  122.                             this.videoFrame.style.height = screen.height+"px"//'100%';
  123.                             this.videoFramePlayer.style.height = screen.height+"px"//'100%';
  124.  
  125.                             if(_.requestFullscreen) {
  126.                                 _.requestFullscreen();
  127.                             }else if(_.requestFullscreenWithKeys) {
  128.                                 _.requestFullscreenWithKeys();
  129.                             }else if(_.mozRequestFullScreen) {
  130.                                 _.mozRequestFullScreen();
  131.                             }else if(_.webkitRequestFullscreen) {
  132.                                 _.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
  133.                             }else if(_.msRequestFullscreen) {
  134.                                 _.msRequestFullscreen();
  135.                             }
  136.  
  137.                         },this),
  138.  
  139.                     fullscreenOff: Ink.bind(function(){
  140.                             InkCss.removeClassName(document.body,'fullscreen');
  141.  
  142.                             if(document.exitFullscreen) {
  143.                                document.exitFullscreen();
  144.                             }else if(document.mozCancelFullScreen) {
  145.                                document.mozCancelFullScreen();
  146.                             }else if(document.webkitExitFullscreen) {
  147.                                document.webkitExitFullscreen();
  148.                             }
  149.  
  150.                             setTimeout(Ink.bind(function(){
  151.                                 this._ajustPlayerSize();
  152.                             },this),333);
  153.  
  154.  
  155.                        },this),
  156.  
  157.  
  158.                     goTo: Ink.bind(function(percent){
  159.                             if(this.playerState().isAd) return;
  160.  
  161.                             var duration = this.videoPlayer.getDuration();
  162.                             var timeAtPercent = ((duration/100)*percent).toFixed(3);
  163.                             this.videoPlayer.setCurrentTime(timeAtPercent);
  164.  
  165.                         },this),
  166.  
  167.  
  168.                     //
  169.                     _null:null
  170.  
  171.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement