Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.controlls = {
- clickPub:Ink.bind(function(){
- /*
- //fire a pub event for KPI's
- customEvent.fire('video.pub_click',{
- channel:this.currentChannel,
- video:this.currentVideo
- });
- */
- this.videoPlayer.stop();
- this.videoPlayer.unload();
- this.videoPlayer.load(this.currentVideo.location,true);
- setTimeout(this.videoPlayer.pause,500);
- },this),
- load: Ink.bind(function(str){
- if(str==this.videoPlayer.getCurrentRequestURL()){
- this.videoPlayer.setCurrentTime(0);
- return;
- }
- this.videoPlayer.stop();
- //this.videoPlayer.unload();
- this.videoPlayer.load(str);
- },this),
- autoload: Ink.bind(function(str){
- //TODO: might be wise to use getCurrentVideoSource() instead
- if(str==this.videoPlayer.getCurrentRequestURL()){
- this.videoPlayer.setCurrentTime(0);
- this.videoPlayer.play();
- return;
- }
- this.videoPlayer.stop();
- //this.videoPlayer.unload();
- this.videoPlayer.load(str,true);
- },this),
- next: Ink.bind(function(){
- if(this.playerState().isAd) return;
- customEvent.fire('video.next');
- if(this.currentChannel.playlist.length===1){
- //1 video playlists special case
- this.controlls.replay();
- return;
- }
- var nextIndex = this.currentVideoIndex+1;
- this._loadVideo((this.currentChannel.playlist[nextIndex]) ? nextIndex : 0);
- },this),
- prev: Ink.bind(function(){
- if(this.playerState().isAd) return;
- customEvent.fire('video.prev');
- if(this.currentChannel.playlist.length===1){
- //1 video playlists special case
- this.controlls.replay();
- return;
- }
- var prevIndex = this.currentVideoIndex-1;
- this._loadVideo((this.currentChannel.playlist[prevIndex]) ? prevIndex : this.currentChannel.playlist.length-1);
- },this),
- togglePlay: Ink.bind(function(){
- if(this.playerState().isAd) return;
- this.videoPlayer.togglePlay();
- },this),
- play: Ink.bind(function(){
- if(this.playerState().isAd) return;
- this.videoPlayer.play();
- },this),
- replay: Ink.bind(function(){
- if(this.playerState().isAd) return;
- this.videoPlayer.setCurrentTime(0);
- this.videoPlayer.play();
- },this),
- pause: Ink.bind(function(){
- if(this.playerState().isAd) return;
- this.videoPlayer.pause();
- },this),
- stop: Ink.bind(function(){
- if(this.playerState().isAd) return;
- this.videoPlayer.stop();
- },this),
- mute: Ink.bind(function(){
- this.videoPlayer.toggleMute()
- },this),
- unmute: Ink.bind(function(){
- if(this.playerState().isMuted){
- this.videoPlayer.unmute()
- }
- },this),
- volume: Ink.bind(function(vol){
- this.videoPlayer.setVolume((vol/100).toFixed(2));
- },this),
- setZoneId:Ink.bind(function(){
- this.videoPlayer.setZoneId(this.currentChannel.zoneId,this.currentChannel.zoneHash);
- },this),
- fullscreen: Ink.bind(function(){
- var _ = this.pageHead;
- InkCss.addClassName(document.body,'fullscreen');
- this.videoFrame.parentNode.style.height = '';
- this.videoFrame.style.height = screen.height+"px"//'100%';
- this.videoFramePlayer.style.height = screen.height+"px"//'100%';
- if(_.requestFullscreen) {
- _.requestFullscreen();
- }else if(_.requestFullscreenWithKeys) {
- _.requestFullscreenWithKeys();
- }else if(_.mozRequestFullScreen) {
- _.mozRequestFullScreen();
- }else if(_.webkitRequestFullscreen) {
- _.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
- }else if(_.msRequestFullscreen) {
- _.msRequestFullscreen();
- }
- },this),
- fullscreenOff: Ink.bind(function(){
- InkCss.removeClassName(document.body,'fullscreen');
- if(document.exitFullscreen) {
- document.exitFullscreen();
- }else if(document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- }else if(document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- }
- setTimeout(Ink.bind(function(){
- this._ajustPlayerSize();
- },this),333);
- },this),
- goTo: Ink.bind(function(percent){
- if(this.playerState().isAd) return;
- var duration = this.videoPlayer.getDuration();
- var timeAtPercent = ((duration/100)*percent).toFixed(3);
- this.videoPlayer.setCurrentTime(timeAtPercent);
- },this),
- //
- _null:null
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement