no commit message

This commit is contained in:
niandeng
2022-03-24 10:53:12 +08:00
parent c3c6862931
commit 0a255721c0
2 changed files with 40 additions and 2 deletions
+39 -1
View File
@@ -130,7 +130,8 @@
playbackrateList:[0.75,1,1.25,1.5,2,4],//倍速配置值 playbackrateList:[0.75,1,1.25,1.5,2,4],//倍速配置值
cookie:null,//开启cookie功能 cookie:null,//开启cookie功能
domain:null,//指定cookie保存的域 domain:null,//指定cookie保存的域
cookiePath:'/'//指定cookie保存路径 cookiePath:'/',//指定cookie保存路径
documentFocusPause:false//窗口失去焦点后暂停播放
}; };
function ckplayerEmbed(videoObj){ function ckplayerEmbed(videoObj){
/* /*
@@ -193,6 +194,7 @@
var cookieName='';//cookie名称 var cookieName='';//cookie名称
var cookieTime=0;//cookie保存时间,单位:秒 var cookieTime=0;//cookie保存时间,单位:秒
var cookieArray=[];//保存当前所有记录 var cookieArray=[];//保存当前所有记录
var focusPause=true;//失去焦点前是否是暂停状态
/* /*
* into * into
* 功能:初始化,调用播放器则首先调用该函数 * 功能:初始化,调用播放器则首先调用该函数
@@ -1457,6 +1459,19 @@
replaceInformation('videoHeight',CT.videoHeight); replaceInformation('videoHeight',CT.videoHeight);
replaceInformation('volume',parseInt(CT.volume*100)); replaceInformation('volume',parseInt(CT.volume*100));
replaceInformation('duration',parseInt(duration)); replaceInformation('duration',parseInt(duration));
documentHidden(function(state){
if(vars['documentFocusPause']){
if(state=='show'){
if(!focusPause && paused){
player.play();
}
}
else{
focusPause=paused;
player.pause();
}
}
});
}; };
/* /*
* videoHandler * videoHandler
@@ -3401,6 +3416,16 @@
} }
return null; return null;
}, },
/*
* visibilityState
* 功能:监听当前文档是否处于焦点状态
*/
visibilityState:function(fn){
if(!isUndefined(fn) && valType(fn)=='function'){
documentHidden(fn);
}
return this;
},
/* /*
* remove * remove
* 功能:卸载播放器 * 功能:卸载播放器
@@ -7269,5 +7294,18 @@
} }
return newArr; return newArr;
} }
/*
* documentHidden
* 功能,监听页面切换到其它标签,执行fn函数
*/
function documentHidden(fn){
if(!isUndefined(document.visibilityState)){
fn(document.visibilityState === 'visible'?'show':'hidden');
addListener(document,'visibilitychange',function(){
fn(document.visibilityState === 'visible'?'show':'hidden');
});
}
}
return ckplayerEmbed; return ckplayerEmbed;
})); }));
+1 -1
View File
File diff suppressed because one or more lines are too long