diff --git a/README.en.md b/README.en.md deleted file mode 100644 index fc7e808..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# ckplayer - -#### Description -ckplayer-一款用于在网页端播放视频的软件,支持mp4,flv,m3u8及rtmp协议的直播,支持移动端,PC端 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 5e9d8f9..c04f88d 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,16 @@ -# ckplayer - +ckplayer #### 介绍 -ckplayer-一款用于在网页端播放视频的软件,支持mp4,flv,m3u8及rtmp协议的直播,支持移动端,PC端 +一款用于在网页端播放视频的软件,支持mp4,flv,m3u8及rtmp协议的直播,支持移动端,PC端 #### 软件架构 -软件架构说明 - +软件分为两部分,1:javascript构建支持HTML5环境的播放器,2:actionscript3.0构建支持ie9以前支持flashplayer环境的播放器 #### 安装教程 - -1. xxxx -2. xxxx -3. xxxx +ckplayer不存在安装过程,将下载包里的ckplayer文件夹(该文件夹包含ckplayer.js,ckplayer.swf,ckplayer.json等文件)上传到网站环境中即可使用 #### 使用说明 - -1. xxxx -2. xxxx -3. xxxx +使用过程中碰到问题,请至官网查看手册:http://www.ckplayer.com/manual/ #### 参与贡献 +niandeng -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/ckplayer/ckplayer.js b/ckplayer/ckplayer.js new file mode 100644 index 0000000..96548ea --- /dev/null +++ b/ckplayer/ckplayer.js @@ -0,0 +1,9013 @@ +/* + 软件名称:ckplayer + 软件版本:X2 + 软件作者:niandeng + 软件网站:http://www.ckplayer.com + -------------------------------------------------------------------------------------------------------------------- + 开发说明: + 使用的主要程序语言:javascript(js)及actionscript3.0(as3.0)(as3.0主要用于flashplayer部分的开发,不在该页面呈现) + 功能:播放视频 + 特点:兼容HTML5-VIDEO(优先)以及FlashPlayer + -------------------------------------------------------------------------------------------------------------------- + 使用开源代码部分: + 1:flashls-http://flashls.org/ + ===================================================================================================================== +*/ + +!(function() { + var ckplayerPath = ''; + !function() { + var scriptList = document.scripts, + thisPath = scriptList[scriptList.length - 1].src; + for(var i=0;i 1) { + if (videoStringTemp[0][0].substr(0, 3) == 'CK:' || videoStringTemp[0][0].substr(0, 3) == 'CE:' || videoStringTemp[0][0].substr(8, 3) == 'CK:' || videoStringTemp[0][0].substr(8, 3) == 'CE:') { + this.vars['flashplayer'] = true; + } + } + } + this.videoString=videoStringTemp; + + this.checkUpConfig(); + }, + /* + 内部函数 + 加载config文件 + */ + checkUpConfig:function(){ + var thisTemp=this; + var configPath=''; + var jsTemp=null; + if (this.vars['config']) { + if (this.vars['config'].substr(0, 8) != 'website:') { + jsTemp= eval(this.vars['config'] + '()'); + if(!this.isUndefined(jsTemp)){ + this.ckConfig=this.newObj(jsTemp); + this.jsonConfig=this.newObj(jsTemp); + this.loadConfig(null); + } + else{ + this.loadConfig(ckplayerPath+this.vars['config']); + } + + } + else{ + this.loadConfig(ckplayerPath+this.vars['config'].substr(8)); + } + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerConfig)==='function'){ + isFun=true; + } + } + catch(e){} + if(isFun) { + jsTemp= ckplayerConfig(); + if(jsTemp){ + this.ckConfig=this.newObj(jsTemp); + this.jsonConfig=this.newObj(jsTemp); + this.loadConfig(null); + } + else{ + this.loadConfig(ckplayerPath+'ckplayer.json'); + } + } + else { + this.loadConfig(ckplayerPath+'ckplayer.json'); + } + } catch(e) { + thisTemp.sysError(thisTemp.errorList[12],e);//系统错误 + } + + } + }, + loadConfig:function(file){ + var thisTemp=this; + if(file){ + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.ckConfig=data; + thisTemp.jsonConfig=thisTemp.newObj(data); + if(!thisTemp.isUndefined(data['flashvars'])){ + thisTemp.vars=thisTemp.objectAssign(data['flashvars'],thisTemp.vars); + } + thisTemp.checkUpLanguage(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'Config');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.checkUpLanguage(); + } + }, + /* + 内部函数 + 加载语言文件 + */ + checkUpLanguage:function(){ + var thisTemp=this; + var languagePath=''; + var jsTemp=null; + if (this.vars['language']) { + languagePath=this.vars['language']; + } + else{ + if (this.ckConfig['languagePath']) { + languagePath=this.ckConfig['languagePath']; + } + } + if (languagePath) { + if (languagePath.substr(0, 8) != 'website:') { + jsTemp = eval(languagePath + '()'); + if(jsTemp){ + this.ckLanguage=this.newObj(jsTemp); + this.jsonLanguage=this.newObj(jsTemp); + this.loadLanguage(null); + } + else{ + this.loadLanguage(ckplayerPath+languagePath); + } + + } + else{ + this.loadLanguage(ckplayerPath+languagePath.substr(8)); + } + + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerLanguage)==='function'){ + isFun=true; + } + } + catch(e){} + if(isFun) { + jsTemp = ckplayerLanguage(); + if(jsTemp){ + this.ckLanguage=this.newObj(jsTemp); + this.jsonLanguage=this.newObj(jsTemp); + this.loadLanguage(null); + } + else{ + this.loadLanguage(ckplayerPath+'language.json'); + } + } + else { + this.loadLanguage(ckplayerPath+'language.json'); + } + } catch(e) { + thisTemp.sysError(thisTemp.errorList[12],e);//系统错误 + } + + } + }, + loadLanguage:function(file){ + var thisTemp=this; + if(file){ + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.ckLanguage=data; + thisTemp.jsonLanguage=thisTemp.newObj(data); + thisTemp.checkUpStyle(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'language.json');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.checkUpStyle(); + } + }, + /* + 内部函数 + 加载皮肤文件 + */ + checkUpStyle:function(){ + var thisTemp=this; + var stylePath=''; + var jsTemp=null; + var configJs=this.newObj(this.ckConfig); + if (this.vars['style']) { + stylePath=this.vars['style']; + } + else{ + if (this.ckConfig['stylePath']) { + stylePath=''+this.ckConfig['stylePath']; + } + } + if (stylePath) { + if (stylePath.substr(0, 8) != 'website:') { + jsTemp = eval(stylePath + '()'); + if(!this.isUndefined(jsTemp)){ + this.jsonStyle=this.newObj(jsTemp); + this.ckStyle=this.newObj(jsTemp); + this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']); + this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle); + this.loadStyle(null); + } + else{ + this.loadStyle(ckplayerPath+stylePath); + } + } + else{ + this.loadStyle(ckplayerPath+stylePath.substr(8)); + } + + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerStyle)==='function'){ + isFun=true; + } + } + catch(e){isFun=false;} + if(isFun) { + jsTemp= ckplayerStyle(); + if(!this.isUndefined(jsTemp)){ + this.jsonStyle=this.newObj(jsTemp); + this.ckStyle=this.newObj(jsTemp); + this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']); + this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle); + this.loadStyle(null); + } + else{ + this.loadStyle(ckplayerPath+'style.json'); + } + } + else { + this.loadStyle(ckplayerPath+'style.json'); + } + } catch(e) {} + + } + }, + loadStyle:function(file){ + var thisTemp=this; + if(file){ + var configJs=this.newObj(this.ckConfig); + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.jsonStyle=thisTemp.newObj(data); + thisTemp.ckStyle=thisTemp.newObj(data); + thisTemp.ckStyle['advertisement']=thisTemp.objectAssign(configJs['style']['advertisement'],thisTemp.ckStyle['advertisement']); + thisTemp.ckStyle=thisTemp.objectAssign(configJs['style'],thisTemp.ckStyle); + thisTemp.loadConfigHandler(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'Style');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.loadConfigHandler(); + } + }, + /* + 内部函数 + 当config,language,style三个文件或函数处理完成后执行的动作 + */ + loadConfigHandler:function(){ + if ((!this.supportVideo() && this.vars['flashplayer'] != '') || (this.vars['flashplayer'] && this.uploadFlash()) || !this.isMsie()) { + this.html5Video = false; + this.getVideo(); + } + else if (this.videoString) { + //判断视频数据类型 + this.analysedVideoUrl(this.videoString); + } + else { + this.eject(this.errorList[2]); + } + }, + /* + 内部函数 + 根据外部传递过来的video开始分析视频地址 + */ + analysedVideoUrl: function(video) { + var i = 0, + y = 0; + var thisTemp = this; + this.VA = [];//定义全局变量VA:视频列表(包括视频地址,类型,清晰度说明) + if (this.varType(video) == 'string') { //如果是字符形式的则判断后缀进行填充 + if (video.substr(0, 8) != 'website:') { + this.VA = [[video, '', '', 0]]; + var fileExt = this.getFileExt(video); + switch (fileExt) { + case '.mp4': + this.VA[0][1] = 'video/mp4'; + break; + case '.ogg': + this.VA[0][1] = 'video/ogg'; + break; + case '.webm': + this.VA[0][1] = 'video/webm'; + break; + default: + break; + } + this.getVideo(); + } else { + if (this.html5Video) { + var ajaxObj = { + url: video.substr(8), + success: function(data) { + if (data) { + thisTemp.analysedUrl(data); + } else { + thisTemp.eject(thisTemp.errorList[5]); + this.VA = video; + thisTemp.getVideo(); + } + }, + error:function(data){ + thisTemp.eject(thisTemp.errorList[12],data);//系统错误 + } + }; + this.ajax(ajaxObj); + } else { + this.VA = video; + this.getVideo(); + } + + } + } + else if(this.varType(video)=='array'){//如果视频地址是数组 + if (this.varType(video[0])=='array') { //如果视频地址是二维数组 + this.VA = video; + } + this.getVideo(); + } + else if(this.varType(video)=='object'){ + /* + 如果video格式是对象形式,则分二种 + 如果video对象里包含type,则直接播放 + */ + if (!this.isUndefined(video['type'])) { + this.VA.push([video['file'], video['type'], '', 0]); + this.getVideo(); + } else { + this.eject(this.errorList[5]); + } + } + else { + this.eject(this.errorList[4]); + } + }, + /* + 对请求到的视频地址进行重新分析 + */ + analysedUrl: function(data) { + this.vars = this.standardization(this.vars, data); + if (!this.isUndefined(data['video'])) { + this.vars['video'] = data['video']; + } + this.analysedVideoUrl(this.vars['video']); + }, + /* + 内部函数 + 检查浏览器支持的视频格式,如果是则将支持的视频格式重新分组给播放列表 + */ + getHtml5Video: function() { + var va = this.VA; + var nva = []; + var mobile = this.isMobile(); + var video = document.createElement('video'); + var codecs = function(type) { + var cod = ''; + switch (type) { + case 'video/mp4': + cod = 'avc1.4D401E, mp4a.40.2'; + break; + case 'video/ogg': + cod = 'theora, vorbis'; + break; + case 'video/webm': + cod = 'vp8.0, vorbis'; + break; + default: + break; + } + return cod; + }; + var supportType = function(vidType, codType) { + if (!video.canPlayType) { + this.html5Video = false; + return; + } + var isSupp = video.canPlayType(vidType + ';codecs="' + codType + '"'); + if (isSupp == '') { + return false + } + return true; + }; + if (this.vars['flashplayer'] || !this.isMsie()) { + this.html5Video = false; + return; + } + for (var i = 0; i < va.length; i++) { + var v = va[i]; + if (v) { + if (v[1] != '' && !mobile && supportType(v[1], codecs(v[1])) && v[0].substr(0, 4) != 'rtmp') { + nva.push(v); + } + if ((this.getFileExt(v[0]) == '.m3u8' || this.vars['type'] == 'video/m3u8' || this.vars['type'] == 'm3u8' || v[1] == 'video/m3u8' || v[1] == 'm3u8') && this.vars['html5m3u8'] && !mobile) { + this.isM3u8 = true; + nva.push(v); + } + } + } + if (nva.length > 0) { + this.VA = nva; + } else { + if (!mobile) { + this.html5Video = false; + } + } + }, + /* + 内部函数 + 根据视频地址开始构建播放器 + */ + getVideo: function() { + var thisTemp = this; + var v = this.vars; + //如果存在广告字段则开始分析广告 + if (!this.adAnalysisEnd && (v['adfront'] != '' || v['adpause'] != '' || v['adinsert'] != '' || v['adend'] != '' || v['advertisements'] != '')) { + this.adAnalysisEnd = true; + this.adAnalysis(); + return; + } + //如果存在字幕则加载 + if (this.V) { //如果播放器已存在,则认为是从newVideo函数发送过来的请求 + this.changeVideo(); + return; + } + if (this.vars['cktrack']) { + this.loadTrack(); + } + if (this.supportVideo() && !this.vars['flashplayer']) { + this.getHtml5Video(); //判断浏览器支持的视频格式 + } + var src = '', + source = '', + poster = '', + loop = '', + autoplay = '', + track = '', + crossorigin=''; + var video = v['video']; + var i = 0; + var vBg=this.ckStyle['background']['backgroundColor'].replace('0x','#'); + this.CD = this.getByElement(v['container']); + volume = v['volume']; + if (this.isUndefined(this.CD)) { + this.eject(this.errorList[6], v['container']); + return false; + } + + //开始构建播放器容器 + this.V = undefined; + var thisPd = null; + if (v['h5container'] != '') { + thisPd = this.getByElement(v['h5container']); + if (this.isUndefined(thisPd)) { + thisPd = null; + } + } + var isVideoH5 = null; //isUndefined thisPd + if (v['playerID'] != '') { + isVideoH5 = this.getByElement('#' + v['playerID']); + if (this.isUndefined(isVideoH5)) { + isVideoH5 = null; + } + } + if (thisPd != null && isVideoH5 != null) { + this.PD = thisPd; //PD:定义播放器容器对象全局变量 + } else { + var playerID = 'ckplayer-' + this.randomString(); + var playerDiv = document.createElement('div'); + playerDiv.className = playerID; + this.CD.innerHTML = ''; + this.CD.appendChild(playerDiv); + this.PD = playerDiv; //PD:定义播放器容器对象全局变量 + } + this.css(this.CD, { + backgroundColor: vBg, + overflow: 'hidden', + position: 'relative' + }); + this.css(this.PD, { + backgroundColor: vBg, + width: '100%', + height: '100%', + fontFamily: this.fontFamily + }); + if (this.html5Video) { //如果支持HTML5-VIDEO则默认使用HTML5-VIDEO播放器 + + //禁止播放器容器上鼠标选择文本 + this.PD.onselectstart = this.PD.ondrag = function() { + return false; + }; + //播放器容器构建完成并且设置好样式 + //构建播放器 + if (this.VA.length == 1) { + this.videoTemp['src'] = decodeURIComponent(this.VA[0][0]); + src = ' src="' + this.videoTemp['src'] + '"'; + + } else { + var videoArr = this.VA.slice(0); + videoArr = this.arrSort(videoArr); + for (i = 0; i < videoArr.length; i++) { + var type = ''; + var va = videoArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + if (type == ' type="video/m3u8"' || type == ' type="m3u8"') { + type = ''; + } + } + source += ''; + } + this.videoTemp['source'] = source; + } + //分析视频地址结束 + if (v['autoplay']) { + autoplay = ' autoplay="autoplay"'; + } + if (v['poster']) { + poster = ' poster="' + v['poster'] + '"'; + } + if (v['loop']) { + loop = ' loop="loop"'; + } + if (v['seek'] > 0) { + this.needSeek = v['seek']; + } + if (v['track'] != null && v['cktrack'] == null) { + var trackArr = v['track']; + var trackDefault = ''; + var defaultHave = false; + for (i = 0; i < trackArr.length; i++) { + var trackObj = trackArr[i]; + if (trackObj['default'] && !defaultHave) { + trackDefault = ' default'; + defaultHave = true; + } else { + trackDefault = ''; + } + track += ''; + } + } + if(v['crossorigin']){ + crossorigin=' crossorigin="'+v['crossorigin']+'"'; + } + var autoLoad = this.ckConfig['config']['autoLoad']; + var preload = ''; + if (!autoLoad) { + preload = ' preload="meta"'; + } + var vid = this.randomString(); + var controls = ''; + var mobileAutoFull = v['mobileAutoFull']; + var mobileautofull = ''; + if (!mobileAutoFull) { + mobileautofull = ' x-webkit-airplay="true" playsinline webkit-playsinline="true" x5-video-player-type="h5"'; + } + if(this.isMobile()){ + controls = ' controls="controls"'; + } + if (isVideoH5 != null && thisPd != null) { + this.V = isVideoH5; + if (v['poster']) { + this.V.poster = v['poster']; + } + } else { + var html = ''; + if (!this.isM3u8) { + html = ''; + + } else { + html = ''; + } + this.PD.innerHTML = html; + this.V = this.getByElement('#' + vid); //V:定义播放器对象全局变量 + } + try { + this.V.volume = volume; //定义音量 + if (this.playbackRateArr && this.vars['playbackrate'] > -1) { + if (this.vars['playbackrate'] < this.playbackRateArr.length) { + this.playbackRateDefault = this.vars['playbackrate']; + } + this.V.playbackRate = this.playbackRateArr[this.playbackRateDefault][0]; //定义倍速 + } + } catch(error) {} + this.css(this.V, { + backgroundColor: vBg, + width: '100%', + height: '100%' + }); + if (this.isM3u8) { + var loadJsHandler = function() { + thisTemp.embedHls(thisTemp.VA[0][0], v['autoplay']); + }; + this.loadJs(ckplayerPath + 'hls/hls.min.js', loadJsHandler); + } + this.css(this.V, 'backgroundColor', vBg); + //创建一个画布容器 + if (this.ckConfig['config']['videoDrawImage']) { + var canvasDiv = document.createElement('div'); + this.PD.appendChild(canvasDiv); + this.MD = canvasDiv; //定义画布存储容器 + this.css(this.MD, { + backgroundColor: vBg, + width: '100%', + height: '100%', + position: 'absolute', + display: 'none', + cursor: 'pointer', + left: '0px', + top: '0px', + zIndex: '10' + }); + var cvid = 'ccanvas' + this.randomString(); + this.MD.innerHTML = this.newCanvas(cvid, this.MD.offsetWidth, this.MD.offsetHeight); + this.MDC = this.getByElement(cvid + '-canvas'); + this.MDCX = this.MDC.getContext('2d'); + } + this.playerType = 'html5video'; + //播放器构建完成并且设置好样式 + //建立播放器的监听函数,包含操作监听及事件监听 + this.addVEvent(); + if (this.conBarShow) { + //根据清晰度的值构建清晰度切换按钮 + this.definition(); + if (!this.vars['live'] && this.playbackRateArr && this.vars['playbackrate'] > -1) { + this.playbackRate(); + } + if (v['autoplay']) { + this.loadingStart(true); + } + this.subtitleSwitch(); + } + this.playerLoad(); + } else { //如果不支持HTML5-VIDEO则调用flashplayer + this.embedSWF(); + } + }, + /* + 分析广告数据 + */ + adAnalysis: function() { + var thisTemp = this; + var v = this.vars; + var isAdvShow = []; + var i = 0; + if (v['advertisements'] != '' && v['advertisements'].substr(0, 8) == 'website:') { + var ajaxObj = { + url: v['advertisements'].substr(8), + success: function(data) { + if (data) { + var newData = {}; + var val = null; + //对广告进行分析 + try { + if (!thisTemp.isUndefined(data['front']) || !thisTemp.isUndefined(data['pause']) || !thisTemp.isUndefined(data['end']) || !thisTemp.isUndefined(data['insert']) || !thisTemp.isUndefined(data['other'])) { + val = thisTemp.arrayDel(data['front']); + if (!thisTemp.isUndefined(val)) { + newData['front'] = val; + } + val = thisTemp.arrayDel(data['pause']); + if (!thisTemp.isUndefined(val)) { + newData['pause'] = val; + } + val = thisTemp.arrayDel(data['insert']); + if (!thisTemp.isUndefined(val)) { + newData['insert'] = val; + if (!thisTemp.isUndefined(data['inserttime'])) { + newData['inserttime'] = thisTemp.arrayInt(data['inserttime']); + isAdvShow = []; + for (i = 0; i < newData['inserttime'].length; i++) { + isAdvShow.push(false); + } + newData['insertPlay'] = isAdvShow; + } + } + val = thisTemp.arrayDel(data['end']); + if (!thisTemp.isUndefined(val)) { + newData['end'] = val; + } + val = thisTemp.arrayDel(data['other']); + if (!thisTemp.isUndefined(val)) { + newData['other'] = val; + isAdvShow = []; + var arrTemp = []; + for (i = 0; i < val.length; i++) { + isAdvShow.push(false); + arrTemp.push(parseInt('0' + val[i]['startTime'])); + } + newData['othertime'] = arrTemp; + newData['otherPlay'] = isAdvShow; + } + } + } catch(event) { + thisTemp.log(event) + } + thisTemp.advertisements = newData; + //对广告进行分析结束 + } + thisTemp.getVideo(); + }, + error:function(data){} + }; + this.ajax(ajaxObj); + } else { + //根据广告分析 + this.adAnalysisOne('front', 'adfront', 'adfronttime', 'adfrontlink', 'adfronttype'); + this.adAnalysisOne('pause', 'adpause', 'adpausetime', 'adpauselink', 'adpausetype'); + this.adAnalysisOne('insert', 'adinsert', 'adinserttime', 'adinsertlink', 'adinserttype'); + this.adAnalysisOne('end', 'adend', 'adendtime', 'adendlink', 'adendtype'); + if (!this.isUndefined(this.advertisements['insert'])) { + if (!this.isUndefined(v['inserttime'])) { + thisTemp.advertisements['inserttime'] = v['inserttime']; + } + } + if (!this.isUndefined(thisTemp.advertisements['inserttime'])) { + thisTemp.advertisements['inserttime'] = thisTemp.arrayInt(thisTemp.advertisements['inserttime']); + isInsert = []; + for (i = 0; i < thisTemp.advertisements['inserttime'].length; i++) { + isInsert.push(false); + } + thisTemp.advertisements['insertPlay'] = isInsert; + } + thisTemp.getVideo(); + } + }, + /* + 将广告数组数据里不是视频和图片的去除 + */ + arrayDel: function(arr) { + if(this.isUndefined(arr)){ + return arr; + } + if (arr.length == 0) { + return null; + } + var newArr = []; + for (var i = 0; i < arr.length; i++) { + var type = arr[i]['type']; + if (type == 'mp4' || type == 'mov' || this.isStrImage(type)) { + newArr.push(arr[i]); + } + } + if (newArr.length > 0) { + return newArr; + } + return null; + }, + /*分析单个类型的广告*/ + adAnalysisOne: function(adType, adName, adTime, adLink, adStype) { + var v = this.vars; + if (this.isUndefined(v[adName])) { + v[adName] = ''; + } + if (this.isUndefined(v[adTime])) { + v[adTime] = ''; + } + if (this.isUndefined(v[adLink])) { + v[adLink] = ''; + } + if (this.isUndefined(v[adStype])) { + v[adStype] = ''; + } + if (v[adName] != '') { + var adList = []; + var ad = v[adName].split(','); + var adtime = v[adTime].split(','); + var adlink = v[adLink].split(','); + var adstype = v[adStype].split(','); + var i = 0; + if (ad.length > 0) { + var adLinkLen = adlink.length, + adTimeLen = adtime.length; + if (v[adLink] == '') { + adLinkLen = 0; + adlink = []; + } + if (v[adTime] == '') { + adTimeLen = 0; + adtime = []; + } + if (adLinkLen < ad.length) { + for (i = adLinkLen; i < ad.length; i++) { + adlink.push(''); + } + } + if (adTimeLen < ad.length) { + for (i = adTimeLen; i < ad.length; i++) { + adtime.push(''); + } + } + var adstypeLen = adstype.length; + if (v[adStype] == '') { + adstypeLen = 0; + adstype = []; + } + if (adstypeLen < ad.length) { + for (i = adstypeLen; i < ad.length; i++) { + adstype.push(this.getFileExt(ad[i]).replace('.', '')); + } + } + for (i = 0; i < ad.length; i++) { + var type = adstype[i]; + if (type == 'mp4' || type == 'mov' || this.isStrImage(type)) { + var obj = { + file: ad[i], + type: type, + time: parseInt(adtime[i]) > 0 ? parseInt(adtime[i]) : this.ckStyle['advertisement']['time'], + link: adlink[i] + }; + adList.push(obj); + } + + } + if (this.isUndefined(this.advertisements)) { + this.advertisements = {}; + } + if (adList.length > 0) { + this.advertisements[adType] = adList; + } + } + } + }, + /* + 内部函数 + 发送播放器加载成功的消息 + */ + playerLoad: function() { + var thisTemp = this; + if (this.isFirst) { + this.isFirst = false; + setTimeout(function() { + thisTemp.loadedHandler(); + },1); + } + }, + /* + 内部函数 + 建立播放器的监听函数,包含操作监听及事件监听 + */ + addVEvent: function() { + var thisTemp = this; + var duration=0; + //监听视频单击事件 + var eventVideoClick = function(event) { + thisTemp.videoClickXy={x:event.clientX,y:event.clientY}; + thisTemp.videoClick(); + }; + this.addListenerInside('click', eventVideoClick); + this.addListenerInside('click', eventVideoClick, this.MDC); + //延迟计算加载失败事件 + this.timerErrorFun(); + //监听视频加载到元数据事件 + var eventJudgeIsLive = function(event) { + thisTemp.sendJS('loadedmetadata'); + if (thisTemp.varType(thisTemp.V.duration) == 'number' && thisTemp.V.duration > 1) { + duration = thisTemp.V.duration; + if(!duration){ + if(thisTemp.vars['duration']>0){ + duration=thisTemp.vars['duration']; + } + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + thisTemp.sendJS('duration', duration); + thisTemp.formatInserttime(duration); + if (thisTemp.adPlayerPlay) { + thisTemp.advertisementsTime(duration + 1); + } + thisTemp.durationSendJS = true; + } + if (thisTemp.conBarShow) { + thisTemp.V.controls=null; + thisTemp.videoCss(); + } + thisTemp.judgeIsLive(); + }; + //监听视频播放事件 + var eventPlaying = function(event) { + thisTemp.playingHandler(); + thisTemp.sendJS('play'); + thisTemp.sendJS('paused', false); + if (!thisTemp.durationSendJS && thisTemp.varType(thisTemp.V.duration) == 'number' && thisTemp.V.duration > 0) { + duration = thisTemp.V.duration; + if(!duration){ + if(thisTemp.vars['duration']>0){ + duration=thisTemp.vars['duration']; + } + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + thisTemp.durationSendJS = true; + thisTemp.sendJS('duration', duration); + thisTemp.formatInserttime(duration); + } + }; + this.addListenerInside('playing', eventPlaying); + //监听视频暂停事件 + var eventPause = function(event) { + thisTemp.pauseHandler(); + thisTemp.sendJS('pause'); + thisTemp.sendJS('paused', true); + }; + this.addListenerInside('pause', eventPause); + //监听视频播放结束事件 + var eventEnded = function(event) { + thisTemp.endedHandler(); + }; + this.addListenerInside('ended', eventEnded); + //监听视频播放时间事件 + var eventTimeupdate = function(event) { + if (thisTemp.loadingShow) { + thisTemp.loadingStart(false); + } + if (thisTemp.time) { + if (!thisTemp.adPlayerPlay) { + thisTemp.sendJS('time', thisTemp.time); + //监听中间插入广告是否需要播放 + if (!thisTemp.isUndefined(thisTemp.advertisements['insert'])) { + thisTemp.checkAdInsert(thisTemp.time); + } + //监听其它广告 + if (!thisTemp.isUndefined(thisTemp.advertisements['other'])) { + thisTemp.checkAdOther(thisTemp.time); + } + if (thisTemp.time < 3 && thisTemp.adReset) { + thisTemp.adReset = false; + thisTemp.endedAdReset(); + } + } else { //如果是广告则进行广告倒计时 + thisTemp.adPlayerTimeHandler(thisTemp.time); + } + + } + }; + this.addListenerInside('timeupdate', eventTimeupdate); + //监听视频缓冲事件 + var eventWaiting = function(event) { + thisTemp.loadingStart(true); + }; + this.addListenerInside('waiting', eventWaiting); + //监听视频seek开始事件 + var eventSeeking = function(event) { + thisTemp.sendJS('seek', 'start'); + }; + this.addListenerInside('seeking', eventSeeking); + //监听视频seek结束事件 + var eventSeeked = function(event) { + thisTemp.seekedHandler(); + thisTemp.sendJS('seek', 'ended'); + }; + this.addListenerInside('seeked', eventSeeked); + //监听视频音量 + var eventVolumeChange = function(event) { + try { + thisTemp.volumechangeHandler(); + thisTemp.sendJS('volume', thisTemp.volume || thisTemp.V.volume); + } catch(event) {} + }; + this.addListenerInside('volumechange', eventVolumeChange); + //监听全屏事件 + var eventFullChange = function(event) { + var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; + thisTemp.sendJS('full', fullState); + }; + this.addListenerInside('fullscreenchange', eventFullChange); + this.addListenerInside('webkitfullscreenchange', eventFullChange); + this.addListenerInside('mozfullscreenchange', eventFullChange); + //建立界面 + if (this.conBarShow) { + this.interFace(); + } + this.addListenerInside('loadedmetadata', eventJudgeIsLive); + }, + /* + 内部函数 + 重置界面元素 + */ + resetPlayer: function() { + this.timeTextHandler(); + if (this.conBarShow) { + this.timeProgress(0, 1); //改变时间进度条宽 + this.changeLoad(0); + this.initPlayPause(); //判断显示播放或暂停按钮 + this.definition(); //构建清晰度按钮 + this.deletePrompt(); //删除提示点 + this.deletePreview(); //删除预览图 + this.trackHide(); //重置字幕 + this.resetTrack(); + this.trackElement = []; + this.track = []; + } + }, + /* + 内部函数 + 构建界面元素 + */ + interFace: function() { + this.conBarShow = true; + var thisTemp = this; + var html = ''; //控制栏内容 + var i = 0; + var thisStyle=this.ckStyle; + var styleC=thisStyle['controlBar']; + var styleCB=styleC['button']; + var styleAS=thisStyle['advertisement']; + var styleDF=styleC['definition']; + var bWidth = 38;//按钮的宽 + + //var timeInto = this.formatTime(0) + ' / ' + this.formatTime(this.vars['duration']); //时间显示框默认显示内容 + var timeInto = this.formatTime(0,this.vars['duration'],this.ckLanguage['vod']); //时间显示框默认显示内容 + /* + 构建一些PD(播放器容器)里使用的元素 + */ + /* + 构建播放器内的元素 + */ + this.CB={menu:null}; + var divEle={ + controlBarBg:null, + controlBar:null, + pauseCenter:null, + errorText:null, + promptBg:null, + prompt:null, + promptTriangle:null, + definitionP:null, + playbackrateP:null, + subtitlesP:null, + loading:null, + logo:null, + adBackground:null, + adElement:null, + adLink:null, + adPauseClose:null, + adTime:null, + adTimeText:null, + adMute:null, + adEscMute:null, + adSkip:null, + adSkipText:null, + adSkipButton:null + }; + var k=''; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.PD.appendChild(this.CB[k]); + } + /* + 构建鼠标右键容器 + */ + this.CB['menu']=document.createElement('div'); + this.body.appendChild(this.CB['menu']); + if (this.vars['live']) { //如果是直播,时间显示文本框里显示当前系统时间 + timeInto = this.formatTime(0,0,this.ckLanguage['live']); //时间显示框默认显示内容 + } + /* + 构建控制栏的按钮 + */ + divEle={ + play:null, + pause:null, + mute:null, + escMute:null, + full:null, + escFull:null, + definition:null, + playbackrate:null, + subtitles:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + this.CB[k].dataset.title=this.ckLanguage['buttonOver'][k]; + } + this.CB['controlBar'].appendChild(this.CB[k]); + } + divEle={ + timeProgressBg:null, + timeBoBg:null, + volume:null, + timeText:null + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['controlBar'].appendChild(this.CB[k]); + } + this.CB['timeText'].innerHTML=timeInto;//初始化时间 + divEle={ + loadProgress:null, + timeProgress:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['timeProgressBg'].appendChild(this.CB[k]); + } + this.CB['timeButton']=document.createElement('div'); + this.CB['timeBoBg'].appendChild(this.CB['timeButton']); + divEle={ + volumeBg:null, + volumeBO:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['volume'].appendChild(this.CB[k]); + } + this.CB['volumeUp']=document.createElement('div'); + this.CB['volumeBg'].appendChild(this.CB['volumeUp']); + //构建loading图标 + var imgTemp=null; + var imgFile=''; + var imgFile=thisStyle['loading']['file']; + if(!this.isUndefined(thisStyle['loading']['fileH5'])){ + imgFile=thisStyle['loading']['fileH5']; + } + if(imgFile){ + imgTemp=document.createElement('img'); + imgTemp.src=imgFile; + imgTemp.border=0; + this.CB['loading'].appendChild(imgTemp); + } + //构建logo图标 + imgFile=thisStyle['logo']['file']; + if(!this.isUndefined(thisStyle['logo']['fileH5'])){ + imgFile=thisStyle['logo']['fileH5']; + } + if(imgFile){ + imgTemp=document.createElement('img'); + imgTemp.src=imgFile; + imgTemp.border=0; + this.CB['logo'].appendChild(imgTemp); + } + //定义界面元素的样式 + if(this.ckConfig['config']['buttonMode']['player']){ + this.css(this.PD, {cursor: 'pointer'}); + } + //控制栏背景 + this.controlBar(); //改变控制栏 + var cssTemp=null; + //定义提示语的样式 + var promptCss=thisStyle['prompt']; + cssTemp=this.getEleCss(promptCss,{overflow: 'hidden',zIndex: 900,display:'none'}); + this.css(this.CB['promptBg'],cssTemp); + this.css(this.CB['promptBg'],'padding','0px'); + cssTemp['backgroundColor']=''; + cssTemp['border']=''; + cssTemp['borderRadius']=''; + cssTemp['whiteSpace']='nowrap'; + this.css(this.CB['prompt'],cssTemp); + //定义提示语下方的三解形的样式 + cssTemp={ + width: 0, + height: 0, + borderLeft: promptCss['triangleWidth']*0.5+'px solid transparent', + borderRight: promptCss['triangleWidth']*0.5+'px solid transparent', + borderTop: promptCss['triangleHeight']+'px solid '+promptCss['triangleBackgroundColor'].replace('0x','#'), + overflow: 'hidden', + opacity:promptCss['triangleAlpha'], + filter:'alpha(opacity:'+promptCss['triangleAlpha']+')', + position:'absolute', + left:'0px', + top:'0px', + zIndex: 900, + display:'none' + }; + this.css(this.CB['promptTriangle'],cssTemp); + this.elementCoordinate();//中间播放按钮,出错文本框,logo,loading + this.css([this.CB['pauseCenter'],this.CB['loading'],this.CB['errorText']],'display','none'); + this.carbarButton();//控制栏按钮 + this.playerCustom();//播放器界面自定义元件 + this.carbarCustom();//控制栏自定义元件 + this.timeProgressDefault();//进度条默认样式 + this.videoCss();//计算video的宽高和位置 + //初始化判断播放/暂停按钮隐藏项 + this.initPlayPause(); + if (this.vars['volume'] > 0) { + this.css(this.CB['escMute'], 'display', 'none'); + } else { + this.css(this.CB['mute'], 'display', 'none'); + } + if (!this.ckConfig['config']['mobileVolumeBarShow'] && this.isMobile()) { + this.css([this.CB['mute'], this.CB['escMute'], this.CB['volume']], { + display: 'none' + }); + } + this.css(this.CB['escFull'],'display', 'none'); + //设置广告背景层样式 + var cssObj={ + align: 'top', + vAlign:'left', + width:'100%', + height:'100%', + offsetX: 0, + offsetY: 0, + zIndex: 910, + display: 'none' + }; + cssTemp=this.getEleCss(styleAS['background'],cssObj); + this.css(this.CB['adBackground'],cssTemp); + this.css(this.CB['adElement'], { + position: 'absolute', + overflow: 'hidden', + top: '0px', + zIndex: 911, + float: 'center', + display: 'none' + }); + //广告控制各元素样式,用一个函数单独定义,这样在播放器尺寸变化时可以重新设置样式 + this.advertisementStyle(); + //初始化广告控制各元素-隐藏 + this.css([this.CB['adTime'],this.CB['adTimeText'],this.CB['adMute'],this.CB['adEscMute'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink'],this.CB['adPauseClose']],'display','none'); + //定义鼠标经过控制栏只显示完整的进度条,鼠标离开进度条则显示简单的进度条 + var timeProgressOut = function(event) { + thisTemp.timeProgressMouseOut(); + }; + this.addListenerInside('mouseout', timeProgressOut, this.CB['timeBoBg']); + var timeProgressOver = function(event) { + thisTemp.timeProgressDefault(); + }; + this.addListenerInside('mouseover', timeProgressOver, this.CB['controlBar']); + //定义各按钮鼠标经过时的切换样式 + this.buttonEventFun(this.CB['play'],styleCB['play']);//播放按钮 + this.buttonEventFun(this.CB['pause'],styleCB['pause']);//暂停按钮 + this.buttonEventFun(this.CB['mute'],styleCB['mute']);//静音按钮 + this.buttonEventFun(this.CB['escMute'],styleCB['escMute']);//恢复音量按钮 + this.buttonEventFun(this.CB['full'],styleCB['full']);//全屏按钮 + this.buttonEventFun(this.CB['escFull'],styleCB['escFull']);//退出全屏按钮 + this.buttonEventFun(this.CB['adMute'],styleAS['muteButton']);//广告静音按钮 + this.buttonEventFun(this.CB['adEscMute'],styleAS['escMuteButton']);//恢复广告音量按钮 + this.buttonEventFun(this.CB['adSkipButton'],styleAS['skipAdButton']);//跳过广告按钮 + this.buttonEventFun(this.CB['adLink'],styleAS['adLinkButton']);//广告查看详情按钮 + this.buttonEventFun(this.CB['adPauseClose'],styleAS['closeButton']);//播放暂停时的广告的关闭按钮 + this.buttonEventFun(this.CB['pauseCenter'],thisStyle['centerPlay']);//播放器中间暂停时的播放按钮 + this.buttonEventFun(this.CB['volumeBO'],styleC['volumeSchedule']['button']);//音量调节框按钮样式 + this.buttonEventFun(this.CB['timeButton'],styleC['timeSchedule']['button']);//时间进度调节框按钮样式 + + this.addButtonEvent(); //注册按钮及音量调节,进度操作事件 + this.controlBarHide(); //单独注册控制栏隐藏事件 + this.newMenu(); //设置右键的样式和事件 + this.keypress(); //注册键盘事件 + //初始化音量调节框 + this.changeVolume(this.vars['volume']); + setTimeout(function() { + thisTemp.elementCoordinate(); //调整中间暂停按钮/loading的位置/error的位置 + }, + 100); + this.checkBarWidth(); + var resize = function() { + thisTemp.log('window.resize'); + thisTemp.playerResize(); + }; + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + var observer = new MutationObserver(function(){ + thisTemp.log('video.resize'); + var cdW=parseInt(thisTemp.css(thisTemp.CD,'width')),cdH=parseInt(thisTemp.css(thisTemp.CD,'height')); + if(cdW!=thisTemp.cdWH['w'] || cdH!=thisTemp.cdWH['h']){ + thisTemp.cdWH={ + w:cdW, + h:cdH + }; + thisTemp.changeSize(cdW,cdH); + } + }); + observer.observe(this.CD, {attributes: true, attributeFilter: ['style'], attributeOldValue: true }); + this.addListenerInside('resize', resize, window); + }, + /* + 内部函数 + 进间进度条默认样式 + */ + timeProgressDefault:function(){ + var styleCT=this.ckStyle['controlBar']['timeSchedule']; + var cssObj=this.newObj(styleCT['default']); + var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg']; + var cssTemp=null; + this.css(this.CB['timeBoBg'],'display','block'); + //时间进度条背景容器 + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow: 'hidden',zIndex: 2},this.CB['controlBarBg']); + this.css(this.CB['timeProgressBg'], cssTemp); + //加载进度 + cssObj={ + align:'left', + vAlign:'top', + width:1, + height:cssObj['height'], + backgroundImg:loadBackImg + }; + //加载进度和时间进度 + if(this.CB['loadProgress'].offsetWidth>1){ + cssObj['width']=this.CB['loadProgress'].offsetWidth; + } + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']); + this.css(this.CB['loadProgress'],cssTemp); + cssObj['width']=0; + if(this.CB['timeProgress'].offsetWidth>1 && parseInt(this.css(this.CB['timeButton'],'left'))>0){ + cssObj['width']=this.CB['timeProgress'].offsetWidth; + + } + cssObj['backgroundImg']=playBackImg; + cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2}); + this.css(this.CB['timeProgress'],cssTemp); + //时间进度按钮容器 + cssTemp=this.getEleCss(styleCT['buttonContainer'],{position: 'absolute',overflow: 'hidden',zIndex: 3},this.CB['controlBar']); + if(this.ckConfig['config']['buttonMode']['timeSchedule']){ + cssTemp['cursor']='pointer'; + } + this.css(this.CB['timeBoBg'],cssTemp); + //时间进度按钮 + cssTemp=this.getEleCss(styleCT['button'],{cursor: 'pointer',overflow: 'hidden',zIndex: 4},this.CB['timeBoBg']); + this.css(this.CB['timeButton'], cssTemp); + }, + /* + 内部函数 + 进间进度条鼠标离开样式 + */ + timeProgressMouseOut:function(){ + var styleCT=this.ckStyle['controlBar']['timeSchedule']; + var cssObj=this.newObj(styleCT['mouseOut']); + var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg']; + var cssTemp=null; + this.css(this.CB['timeBoBg'],'display','block'); + //时间进度条背景容器 + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow: 'hidden',zIndex: 2},this.CB['controlBarBg']); + this.css(this.CB['timeProgressBg'], cssTemp); + //加载进度 + cssObj={ + align:'left', + vAlign:'top', + width:1, + height:cssObj['height'], + backgroundImg:loadBackImg + }; + //加载进度和时间进度 + if(this.CB['loadProgress'].offsetWidth>1){ + cssObj['width']=this.CB['loadProgress'].offsetWidth; + } + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']); + this.css(this.CB['loadProgress'],cssTemp); + cssObj['width']=1; + if(this.CB['timeProgress'].offsetWidth>1 && parseInt(this.css(this.CB['timeButton'],'left'))>0){ + cssObj['width']=this.CB['timeProgress'].offsetWidth; + cssObj['backgroundImg']=playBackImg; + } + cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2}); + this.css(this.CB['timeProgress'],cssTemp); + this.css(this.CB['timeBoBg'],'display','none'); + }, + /* + 统一注册按钮鼠标经过和离开时的切换动作 + */ + buttonEventFun:function(ele,cssEle){ + var thisTemp=this; + var overFun = function(event) { + thisTemp.css(ele,{ + backgroundImage:'url('+cssEle['mouseOver']+')' + }); + thisTemp.promptShow(ele); + }; + var outFun = function(event) { + thisTemp.css(ele,{ + backgroundImage:'url('+cssEle['mouseOut']+')' + }); + thisTemp.promptShow(false); + }; + outFun(); + this.addListenerInside('mouseover', overFun, ele); + this.addListenerInside('mouseout', outFun, ele); + if(!this.isUndefined(cssEle['clickEvent'])){ + var clickFun=function(event){ + thisTemp.runFunction(cssEle['clickEvent']); + }; + this.addListenerInside('click', clickFun, ele); + } + }, + /* + 内部函数 + 格式化样式用的数字 + */ + formatNumPx:function(str,z){ + if(!str){ + return 0; + } + if(str.toString().indexOf('%')>-1){//说明是根据百分比来计算 + if(!this.isUndefined(z)){//如果有值 + return parseInt(str)*z*0.01+'px'; + } + return str; + } + else{ + return str+'px'; + } + }, + /* + 内部函数 + 格式化样式用的数字,返回类型必需是数字或百分比 + */ + formatZToNum:function(str,z){ + if(!str){ + return 0; + } + if(str.toString().indexOf('%')>-1){//说明是根据百分比来计算 + if(!this.isUndefined(z)){//如果有值 + return parseInt(str)*z*0.01; + } + return str; + } + else{ + return str; + } + }, + /* + 内部函数 + 对对象进行深度复制 + */ + newObj:function(obj) { + if(this.isUndefined(obj)){ + return obj; + } + var str, newobj ={};//constructor 属性返回对创建此对象的数组函数的引用。创建相同类型的空数据 + if (this.varType(obj) != 'object') { + return obj; + } + else { + for (var k in obj) { + if(this.isUndefined(obj[k])){ + newobj[k] = obj[k]; + } + else{ + if(this.varType(obj[k]) == 'object') { //判断对象的这条属性是否为对象 + newobj[k] = this.newObj(obj[k]);//若是对象进行嵌套调用 + } + else{ + newobj[k] = obj[k]; + } + } + } + } + return newobj;//返回深度克隆后的对象 + }, + /* + 内部函数 + 统一的显示图片 + */ + loadImgBg:function(eleid,obj){ + this.css(this.getByElement(eleid),{ + backgroundImage:'url('+obj+')' + }); + }, + /* + 内部函数 + 格式化css + eleObj=样式, + supplement=补充样式, + rrEle=参考对象, + 该函数强制使用position定位的元素 + */ + getEleCss:function(eleObj,supplement,rrEle){ + var eleName=null; + var pdW=this.PD.offsetWidth,pdH=this.PD.offsetHeight; + if(rrEle){ + pdW=rrEle.offsetWidth; + pdH=rrEle.offsetHeight; + } + if(this.isUndefined(eleObj)){ + return null; + } + eleName=this.newObj(eleObj); + var cssObject={}; + if(!this.isUndefined(eleName['width'])){ + cssObject['width']=this.formatZToNum(eleName['width'],pdW)+'px'; + } + if(!this.isUndefined(eleName['height'])){ + cssObject['height']=this.formatZToNum(eleName['height'],pdH)+'px'; + } + if(!this.isUndefined(eleName['background'])){ + var bg=eleName['background']; + if(!this.isUndefined(bg['backgroundColor'])){ + cssObject['backgroundColor']=bg['backgroundColor'].replace('0x','#'); + } + if(!this.isUndefined(bg['backgroundImg'])){ + cssObject['backgroundImage']='url('+bg['backgroundImg']+')'; + } + if(!this.isUndefined(bg['alpha'])){ + cssObject['filter']='alpha(opacity:'+bg['alpha']+')'; + cssObject['opacity']=bg['alpha']; + } + } + if(!this.isUndefined(eleName['backgroundColor'])){ + cssObject['backgroundColor']=eleName['backgroundColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['backgroundImg'])){ + cssObject['backgroundImage']='url('+eleName['backgroundImg']+')'; + } + if(!this.isUndefined(eleName['color'])){ + cssObject['color']=eleName['color'].replace('0x','#'); + } + if(!this.isUndefined(eleName['font'])){ + cssObject['fontFamily']=eleName['font']; + } + if(!this.isUndefined(eleName['size'])){ + cssObject['fontSize']=eleName['size']+'px'; + } + if(!this.isUndefined(eleName['alpha'])){ + cssObject['filter']='alpha(opacity:'+eleName['alpha']+')'; + cssObject['opacity']=eleName['alpha']; + } + if(!this.isUndefined(eleName['lineHeight'])){ + cssObject['lineHeight']=eleName['lineHeight']+'px'; + } + if(!this.isUndefined(eleName['textAlign'])){ + cssObject['textAlign']=eleName['textAlign']; + } + if(!this.isUndefined(eleName['borderRadius'])){ + cssObject['borderRadius']=eleName['borderRadius']+'px'; + } + if(!this.isUndefined(eleName['radius'])){ + cssObject['borderRadius']=eleName['radius']+'px'; + } + if(!this.isUndefined(eleName['padding'])){ + cssObject['padding']=eleName['padding']+'px'; + } + if(!this.isUndefined(eleName['paddingLeft'])){ + cssObject['paddingLeft']=eleName['paddingLeft']+'px'; + } + if(!this.isUndefined(eleName['paddingRight'])){ + cssObject['paddingRight']=eleName['paddingRight']+'px'; + } + if(!this.isUndefined(eleName['paddingTop'])){ + cssObject['paddingTop']=eleName['paddingTop']+'px'; + } + if(!this.isUndefined(eleName['paddingBottom'])){ + cssObject['paddingBottom']=eleName['paddingBottom']+'px'; + } + if(!this.isUndefined(eleName['margin'])){ + cssObject['margin']=eleName['margin']+'px'; + } + if(!this.isUndefined(eleName['marginLeft'])){ + cssObject['marginLeft']=eleName['marginLeft']+'px'; + } + if(!this.isUndefined(eleName['marginRight'])){ + cssObject['marginRight']=eleName['marginRight']+'px'; + } + if(!this.isUndefined(eleName['marginTop'])){ + cssObject['marginTop']=eleName['marginTop']+'px'; + } + if(!this.isUndefined(eleName['marginBottom'])){ + cssObject['marginBottom']=eleName['marginBottom']+'px'; + } + if(!this.isUndefined(eleName['border']) && !this.isUndefined(eleName['borderColor'])){ + cssObject['border']=eleName['border']+'px solid '+eleName['borderColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderLeft']) && !this.isUndefined(eleName['borderLeftColor'])){ + cssObject['borderLeft']=eleName['borderLeft']+'px solid '+eleName['borderLeftColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderRight']) && !this.isUndefined(eleName['borderRightColor'])){ + cssObject['borderRight']=eleName['borderRight']+'px solid '+eleName['borderRightColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderTop']) && !this.isUndefined(eleName['borderTopColor'])){ + cssObject['borderTop']=eleName['borderTop']+'px solid '+eleName['borderTopColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderBottom']) && !this.isUndefined(eleName['borderBottomColor'])){ + cssObject['borderBottom']=eleName['borderBottom']+'px solid '+eleName['borderBottomColor'].replace('0x','#'); + } + if(!this.isUndefined(supplement)){ + for(var k in supplement){ + cssObject[k]=supplement[k]; + } + } + cssObject['position']='absolute'; + var left=-10000,top=-10000,right=-10000,bottom=-10000; + var offsetX=0,offsetY=0; + if(!this.isUndefined(eleName['offsetX'])){ + offsetX=eleName['offsetX']; + } + if(!this.isUndefined(eleName['marginX'])){ + offsetX=eleName['marginX']; + } + if(!this.isUndefined(eleName['offsetY'])){ + offsetY=eleName['offsetY']; + } + if(!this.isUndefined(eleName['marginY'])){ + offsetY=eleName['marginY']; + } + offsetX=this.formatZToNum(offsetX,pdW); + offsetY=this.formatZToNum(offsetY,pdH); + if(!this.isUndefined(eleName['align'])){ + left=0; + switch (eleName['align']) { + case 'left': + left = offsetX; + break; + case 'center': + left = pdW * 0.5 + offsetX; + break; + case 'right': + left = pdW+offsetX; + break; + case 'right2': + left = -10000; + right=offsetX; + break; + } + } + if(!this.isUndefined(eleName['vAlign'])){ + top=0; + switch (eleName['vAlign']) { + case 'top': + top = offsetY; + break; + case 'middle': + top=pdH*0.5+offsetY; + break; + case 'bottom': + top =pdH+offsetY; + break; + case 'bottom2': + top=-10000; + bottom =offsetY; + + break; + } + } + if(left>-10000){ + cssObject['left']=left+'px'; + } + if(right>-10000){ + cssObject['right']=right+'px'; + } + if(top>-10000){ + cssObject['top']=top+'px'; + } + if(bottom>-10000){ + cssObject['bottom']=bottom+'px'; + } + return cssObject; + }, + /* + 内部函数 + 创建按钮,使用canvas画布 + */ + newCanvas: function(id, width, height) { + return ''; + }, + /* + 内部函数 + 注册按钮,音量调节框,进度操作框事件 + */ + addButtonEvent: function() { + var thisTemp = this; + //定义按钮的单击事件 + + //定义各个按钮的鼠标经过/离开事件 + var promptHide = function(event) { + thisTemp.promptShow(false); + }; + var definitionOver = function(event) { + thisTemp.promptShow(thisTemp.CB['definition']); + }; + this.addListenerInside('mouseover', definitionOver, this.CB['definition']); + this.addListenerInside('mouseout', promptHide, this.CB['definition']); + var playbackrateOver = function(event) { + thisTemp.promptShow(thisTemp.CB['playbackrate']); + }; + this.addListenerInside('mouseover', playbackrateOver, this.CB['playbackrate']); + this.addListenerInside('mouseout', promptHide, this.CB['playbackrate']); + var subtitlesOver = function(event) { + thisTemp.promptShow(thisTemp.CB['subtitles']); + }; + this.addListenerInside('mouseover', subtitlesOver, this.CB['subtitles']); + this.addListenerInside('mouseout', promptHide, this.CB['subtitles']); + //定义音量和进度按钮的滑块事件 + var volumePrompt = function(vol) { + var volumeBOXY = thisTemp.getCoor(thisTemp.CB['volumeBO']); + var promptObj = { + title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',vol), + x: volumeBOXY['x'] + thisTemp.CB['volumeBO'].offsetWidth * 0.5, + y: volumeBOXY['y'] + }; + thisTemp.promptShow(false, promptObj); + }; + var volumeObj = { + slider: this.CB['volumeBO'], + follow: this.CB['volumeUp'], + refer: this.CB['volumeBg'], + grossValue: 'volume', + pd: true, + startFun: function(vol) {}, + monitorFun: function(vol) { + thisTemp.changeVolume(vol * 0.01, false, false); + volumePrompt(vol); + }, + endFun: function(vol) {}, + overFun: function(vol) { + volumePrompt(vol); + } + }; + this.slider(volumeObj); + var volumeClickObj = { + refer: this.CB['volumeBg'], + grossValue: 'volume', + fun: function(vol) { + thisTemp.changeVolume(vol * 0.01, true, true); + } + }; + this.progressClick(volumeClickObj); + this.timeButtonMouseDown(); //用单击的函数来判断是否需要建立控制栏监听 + //鼠标经过/离开音量调节框时的 + var volumeBgMove = function(event) { + var volumeBgXY = thisTemp.getCoor(thisTemp.CB['volumeBg']); + var eventX = thisTemp.client(event)['x']; + var eventVolume = parseInt((eventX - volumeBgXY['x']) * 100 / thisTemp.CB['volumeBg'].offsetWidth); + var buttonPromptObj = { + title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',eventVolume), + x: eventX, + y: volumeBgXY['y'] + }; + thisTemp.promptShow(false, buttonPromptObj); + }; + this.addListenerInside('mousemove', volumeBgMove, this.CB['volumeBg']); + this.addListenerInside('mouseout', promptHide, this.CB['volumeBg']); + this.addListenerInside('mouseout', promptHide, this.CB['volumeBO']); + //注册清晰度相关事件 + this.addDefListener(); + //注册倍速相关事件 + this.addPlaybackrate(); + //注册多字幕事件 + this.addSubtitles(); + }, + /* + 内部函数 + 注册单击视频动作 + */ + videoClick: function() { + var thisTemp = this; + var clearTimerClick = function() { + if (thisTemp.timerClick != null) { + if (thisTemp.timerClick.runing) { + thisTemp.timerClick.stop(); + } + thisTemp.timerClick = null; + } + }; + var timerClickFun = function() { + clearTimerClick(); + thisTemp.isClick = false; + thisTemp.sendJS('videoClick',thisTemp.videoClickXy); + if (thisTemp.adPlayerPlay) { + var ad = thisTemp.getNowAdvertisements(); + try { + if (ad['link'] != '') { + window.open(ad['link']); + } + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + } catch(event) {} + } else { + if (thisTemp.ckConfig['config']['click']) { + thisTemp.playOrPause(); + } + } + + }; + clearTimerClick(); + if (this.isClick) { + this.isClick = false; + thisTemp.sendJS('videoDoubleClick',thisTemp.videoClickXy); + if (thisTemp.ckConfig['config']['doubleClick']) { + if (!this.full) { + thisTemp.fullScreen(); + } else { + thisTemp.quitFullScreen(); + } + } + + } else { + this.isClick = true; + this.timerClick = new this.timer(300, timerClickFun, 1) + //this.timerClick.start(); + } + + }, + /* + 内部函数 + 注册鼠标经过进度滑块的事件 + */ + timeButtonMouseDown: function() { + var thisTemp = this; + var timePrompt = function(time) { + if (isNaN(time)) { + time = 0; + } + var timeButtonXY = thisTemp.getCoor(thisTemp.CB['timeButton']); + var promptObj = { + title: thisTemp.formatTime(time,0,thisTemp.ckLanguage['timeSliderOver']), + x: timeButtonXY['x'] - thisTemp.pdCoor['x'] + thisTemp.CB['timeButton'].offsetWidth * 0.5, + y: timeButtonXY['y'] - thisTemp.pdCoor['y'] + }; + thisTemp.promptShow(false, promptObj); + }; + var timeObj = { + slider: this.CB['timeButton'], + follow: this.CB['timeProgress'], + refer: this.CB['timeBoBg'], + grossValue: 'time', + pd: false, + startFun: function(time) { + thisTemp.isTimeButtonMove = false; + }, + monitorFun: function(time) {}, + endFun: function(time) { + if (thisTemp.V) { + if (thisTemp.V.duration > 0) { + thisTemp.needSeek = 0; + thisTemp.videoSeek(parseInt(time)); + } + } + }, + overFun: function(time) { + timePrompt(time); + } + }; + var timeClickObj = { + refer: this.CB['timeBoBg'], + grossValue: 'time', + fun: function(time) { + if (thisTemp.V) { + if (thisTemp.V.duration > 0) { + thisTemp.needSeek = 0; + thisTemp.videoSeek(parseInt(time)); + } + } + } + }; + var timeBoBgmousemove = function(event) { + var timeBoBgXY = thisTemp.getCoor(thisTemp.CB['timeBoBg']); + var eventX = thisTemp.client(event)['x']; + var duration=thisTemp.V.duration; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = thisTemp.vars['duration']; + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + var eventTime = parseInt((eventX - timeBoBgXY['x']) * duration / thisTemp.CB['timeBoBg'].offsetWidth); + var buttonPromptObj = { + title: thisTemp.formatTime(eventTime,0,thisTemp.ckLanguage['timeSliderOver']), + x: eventX, + y: timeBoBgXY['y'] + }; + thisTemp.promptShow(false, buttonPromptObj); + var def = false; + if (!thisTemp.isUndefined(thisTemp.CB['definitionP'])) { + if (thisTemp.css(thisTemp.CB['definitionP'], 'display') != 'block') { + def = true; + } + } + if (thisTemp.vars['preview'] != null && def) { + buttonPromptObj['time'] = eventTime; + thisTemp.preview(buttonPromptObj); + } + }; + var promptHide = function(event) { + thisTemp.promptShow(false); + if (thisTemp.previewDiv != null) { + thisTemp.css([thisTemp.previewDiv, thisTemp.previewTop], 'display', 'none'); + } + }; + if (!this.vars['live']) { //如果不是直播 + this.isTimeButtonDown = true; + this.addListenerInside('mousemove', timeBoBgmousemove, this.CB['timeBoBg']); + this.addListenerInside('mouseout', promptHide, this.CB['timeBoBg']); + } else { + this.isTimeButtonDown = false; + timeObj['removeListenerInside'] = true; + timeClickObj['removeListenerInside'] = true; + } + this.slider(timeObj); + this.progressClick(timeClickObj); + + }, + /* + 内部函数 + 注册调节框上单击事件,包含音量调节框和播放时度调节框 + */ + progressClick: function(obj) { + /* + refer:参考对象 + fun:返回函数 + refer:参考元素,即背景 + grossValue:调用的参考值类型 + pd: + */ + //建立参考元素的mouseClick事件,用来做为鼠标在其上按下时触发的状态 + var thisTemp = this; + var referMouseClick = function(event) { + var referX = thisTemp.client(event)['x'] - thisTemp.getCoor(obj['refer'])['x']; + var rWidth = obj['refer'].offsetWidth; + var grossValue = 0; + if (obj['grossValue'] == 'volume') { + grossValue = 100; + } else { + if (thisTemp.V) { + grossValue = thisTemp.V.duration; + if (isNaN(grossValue) || parseInt(grossValue) < 0.2) { + grossValue = thisTemp.vars['duration']; + } + if(thisTemp.vars['forceduration']>0){ + grossValue=thisTemp.vars['forceduration']; + } + } + } + var nowZ = parseInt(referX * grossValue / rWidth); + if (obj['fun']) { + if (obj['grossValue'] === 'time') { + var sliderXY = thisTemp.getCoor(thisTemp.CB['timeButton']); + sliderLeft = sliderXY['x']; + if (!thisTemp.checkSlideLeft(referX, sliderLeft, rWidth)) { + return; + } + var bimeButtonWB = thisTemp.CB['timeButton'].offsetWidth * 0.5; + thisTemp.css(thisTemp.CB['timeButton'], 'left', (referX - bimeButtonWB) + 'px'); + thisTemp.css(thisTemp.CB['timeProgress'], 'width', (referX) + 'px'); + } + obj['fun'](nowZ); + } + }; + if (this.isUndefined(obj['removeListenerInside'])) { + this.addListenerInside('click', referMouseClick, obj['refer']); + } else { + this.removeListenerInside('click', referMouseClick, obj['refer']); + } + + }, + + /* + 内部函数 + 共用的注册滑块事件 + */ + slider: function(obj) { + /* + obj={ + slider:滑块元素 + follow:跟随滑块的元素 + refer:参考元素,即背景 + grossValue:调用的参考值类型 + startFun:开始调用的元素 + monitorFun:监听函数 + endFun:结束调用的函数 + overFun:鼠标放上去后调用的函数 + pd:是否需要修正 + } + */ + var thisTemp = this; + var clientX = 0, + criterionWidth = 0, + sliderLeft = 0, + referLeft = 0; + var value = 0; + var calculation = function() { //根据滑块的left计算百分比 + var sLeft = parseInt(thisTemp.css(obj['slider'], 'left')); + var rWidth = obj['refer'].offsetWidth - obj['slider'].offsetWidth; + var grossValue = 0; + if (thisTemp.isUndefined(sLeft) || isNaN(sLeft)) { + sLeft = 0; + } + if (obj['grossValue'] == 'volume') { + grossValue = 100; + } else { + if (thisTemp.V) { + grossValue = thisTemp.V.duration; + } + } + return parseInt(sLeft * grossValue / rWidth); + }; + var mDown = function(event) { + thisTemp.addListenerInside('mousemove', mMove, document); + thisTemp.addListenerInside('mouseup', mUp, document); + var referXY = thisTemp.getCoor(obj['refer']); + var sliderXY = thisTemp.getCoor(obj['slider']); + clientX = thisTemp.client(event)['x']; + referLeft = referXY['x']; + sliderLeft = sliderXY['x']; + criterionWidth = clientX - sliderLeft; + if (obj['startFun']) { + obj['startFun'](calculation()); + } + }; + var mMove = function(event) { + clientX = thisTemp.client(event)['x']; + var newX = clientX - criterionWidth - referLeft; + if (newX < 0) { + newX = 0; + } + if (newX > obj['refer'].offsetWidth - obj['slider'].offsetWidth) { + newX = obj['refer'].offsetWidth - obj['slider'].offsetWidth; + } + if (obj['slider'] === thisTemp.CB['timeButton']) { + if (!thisTemp.checkSlideLeft(newX, sliderLeft, obj['refer'].offsetWidth)) { + return; + } + } + thisTemp.css(obj['slider'], 'left', newX + 'px'); + thisTemp.css(obj['follow'], 'width', (newX + obj['slider'].offsetWidth * 0.5) + 'px'); + var nowZ = calculation(); + if (obj['monitorFun']) { + obj['monitorFun'](nowZ); + } + }; + var mUp = function(event) { + thisTemp.removeListenerInside('mousemove', mMove, document); + thisTemp.removeListenerInside('mouseup', mUp, document); + if (obj['endFun']) { + obj['endFun'](calculation()); + } + }; + var mOver = function(event) { + if (obj['overFun']) { + obj['overFun'](calculation()); + } + + }; + if (this.isUndefined(obj['removeListenerInside'])) { + this.addListenerInside('mousedown', mDown, obj['slider']); + this.addListenerInside('mouseover', mOver, obj['slider']); + } else { + this.removeListenerInside('mousedown', mDown, obj['slider']); + this.removeListenerInside('mouseover', mOver, obj['slider']); + } + }, + /* + 内部函数 + 判断是否可以拖动进度按钮或点击进度栏 + */ + checkSlideLeft: function(newX, sliderLeft, refer) { + var timeSA = this.ckConfig['config']['timeScheduleAdjust']; + switch (timeSA) { + case 0: + return false; + break; + case 2: + if (newX < sliderLeft) { + return false; + } + break; + case 3: + if (newX > sliderLeft) { + return false; + } + break; + case 4: + if (!this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = sliderLeft / refer; + } + if (newX < this.timeSliderLeftTemp * refer) { + return false; + } + break; + case 5: + if (!this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = sliderLeft / refer; + } else { + var timeSliderMax = sliderLeft / refer; + if (timeSliderMax > this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = timeSliderMax; + } + } + if (newX > this.timeSliderLeftTemp * refer) { + return false; + } + break; + default: + return true; + break; + } + return true; + }, + /* + 内部函数 + 显示loading + */ + loadingStart: function(rot) { + var thisTemp = this; + if (this.isUndefined(rot)) { + rot = true; + } + if (this.conBarShow) { + this.css(thisTemp.CB['loading'], 'display', 'none'); + this.loadingShow=false; + } + var buffer = 0; + if (rot) { + if (this.conBarShow) { + this.css(thisTemp.CB['loading'], 'display', 'block'); + this.loadingShow=true; + } + } else { + thisTemp.sendJS('buffer', 100); + } + }, + /* + 内部函数 + 显示提示语 + */ + promptShow: function(ele, data) { + if (!this.conBarShow) { + return; + } + var obj = {}; + var eleTitle=''; + if(!this.isUndefined(ele)){ + eleTitle=this.getDataset(ele, 'title'); + if(this.isUndefined(eleTitle)){ + ele=null; + } + } + if (ele || data) { + if (!this.isUndefined(data)) { + obj = data; + } else { + var offsetCoor = this.getCoor(ele); + obj = { + title: eleTitle, + x: offsetCoor['x'] + ele.offsetWidth * 0.5, + y: offsetCoor['y'] + }; + } + this.CB['prompt'].innerHTML = obj['title']; + this.css(this.CB['prompt'], 'display', 'block'); + var promptStye=this.ckStyle['prompt']; + var promoptWidth=this.CB['prompt'].offsetWidth,promoptHeight=this.CB['prompt'].offsetHeight; + this.css(this.CB['promptBg'], {width:promoptWidth + 'px',height:promoptHeight+'px'}); + var x = obj['x'] - (promoptWidth * 0.5); + var y = obj['y'] - this.CB['prompt'].offsetHeight-promptStye['marginBottom']-promptStye['triangleHeight']; + if (x < 0) { + x = 0; + } + if (x > this.PD.offsetWidth - promoptWidth) { + x = this.PD.offsetWidth - promoptWidth; + } + this.css([this.CB['promptBg'], this.CB['prompt']], { + display: 'block', + left: x + 'px', + top: y + 'px' + }); + this.css(this.CB['promptTriangle'], { + display: 'block', + left: x+(promoptWidth-promptStye['triangleWidth'])*0.5+parseInt(promptStye['triangleDeviationX']) + 'px', + top: y +promoptHeight+ 'px' + }); + } else { + this.css([this.CB['promptBg'], this.CB['prompt'],this.CB['promptTriangle']], { + display: 'none' + }); + } + }, + /* + 内部函数 + 监听错误 + */ + timerErrorFun: function() { + var thisTemp = this; + this.errorSend = false; + var clearIntervalError = function(event) { + if (thisTemp.timerError != null) { + if (thisTemp.timerError.runing) { + thisTemp.timerError.stop(); + } + thisTemp.timerError = null; + } + }; + var errorFun = function(event) { + clearIntervalError(); + thisTemp.error = true; + //提取错误播放地址 + thisTemp.errorUrl = thisTemp.getVideoUrl(); + //提取错误播放地址结束 + if (!thisTemp.errorSend) { + thisTemp.errorSend = true; + thisTemp.sendJS('error'); + } + if (thisTemp.conBarShow) { + thisTemp.CB['errorText'].innerHTML=thisTemp.ckLanguage['error']['streamNotFound']; + thisTemp.css(thisTemp.CB['errorText'], 'display', 'block'); + thisTemp.css([thisTemp.CB['pauseCenter'],thisTemp.CB['loading']], 'display', 'none'); + } + thisTemp.V.removeAttribute('poster'); + thisTemp.resetPlayer(); + }; + var errorListenerFun = function(event) { + setTimeout(function() { + if (isNaN(thisTemp.V.duration)) { + errorFun(event); + } + }, + 500); + }; + if (!this.errorAdd) { + this.errorAdd = true; + this.addListenerInside('error', errorListenerFun); + } + clearIntervalError(); + var timerErrorFun = function() { + if (thisTemp.V && parseInt(thisTemp.V.networkState) == 3) { + errorFun(); + } + }; + this.timerError = new this.timer(this.ckConfig['config']['errorTime'], timerErrorFun); + }, + /* + 内部函数 + 构建判断全屏还是非全屏的判断 + */ + judgeFullScreen: function() { + var thisTemp = this; + if (this.timerFull != null) { + if (this.timerFull.runing) { + this.timerFull.stop(); + } + this.timerFull = null; + } + var fullFun = function() { + thisTemp.isFullScreen(); + }; + this.timerFull = new this.timer(20, fullFun); + }, + /* + 内部函数 + 判断是否是全屏 + */ + isFullScreen: function() { + if (!this.conBarShow) { + return; + } + var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement; + if (fullState && !this.full) { + this.full = true; + this.sendJS('full', true); + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//控制栏自定义元件 + this.css(this.CB['full'], 'display', 'none'); + this.css(this.CB['escFull'], 'display', 'block'); + if (this.vars['live'] == 0) { + this.timeUpdateHandler(); + } + this.PD.appendChild(this.CB['menu']); + } + if (!fullState && this.full) { + this.full = false; + this.sendJS('full', false); + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//控制栏自定义元件 + this.css(this.CB['full'], 'display', 'block'); + this.css(this.CB['escFull'], 'display', 'none'); + if (this.timerFull != null) { + if (this.timerFull.runing) { + this.timerFull.stop(); + } + this.timerFull = null; + } + if (this.vars['live'] == 0) { + this.timeUpdateHandler(); + } + this.body.appendChild(this.CB['menu']); + } + }, + /* + 内部函数 + 构建右键内容及注册相关动作事件 + */ + newMenu: function() { + var thisTemp = this; + var i = 0; + this.css(this.CB['menu'], { + backgroundColor: '#FFFFFF', + padding: '5px', + position: 'absolute', + left: '10px', + top: '20px', + display: 'none', + zIndex: '999', + color: '#A1A9BE', + boxShadow: '2px 2px 3px #AAAAAA' + }); + var mArr = this.contextMenu; + var cMenu = this.ckConfig['menu']; + if (cMenu['name']) { + if (cMenu['link']) { + mArr[0] = [cMenu['name'], 'link', cMenu['link']]; + } else { + mArr[0] = [cMenu['name'], 'default']; + } + } + if (cMenu['version']) { + mArr[1] = [cMenu['version'], 'default', 'line']; + } + if (cMenu['more']) { + if (this.varType(cMenu['more']) == 'array') { + if (cMenu['more'].length > 0) { + var moreArr = cMenu['more']; + for (i = 0; i < moreArr.length; i++) { + var mTemp = moreArr[i]; + var arrTemp = []; + if (mTemp['name']) { + arrTemp.push(mTemp['name']); + } + if (mTemp['clickEvent'] && mTemp['clickEvent'] != 'none') { + var eveObj = this.clickEvent(mTemp['clickEvent']); + arrTemp.push(eveObj['type']); + if (eveObj['fun']) { + arrTemp.push(eveObj['fun']); + } + if (eveObj['link']) { + arrTemp.push(eveObj['link']); + } + if (eveObj['target']) { + arrTemp.push(' target="' + eveObj['target'] + '"'); + } + } + if (mTemp['separatorBefore']) { + arrTemp.push('line'); + } + mArr.push(arrTemp); + } + } + } + } + var html = ''; + for (i = 0; i < mArr.length; i++) { + var me = mArr[i]; + switch (me[1]) { + case 'default': + html += '

' + me[0] + '

'; + break; + case 'link': + if (me[3]) { + me[3] = 'target="' + me[3] + '"'; + } + html += '

' + me[0] + '

'; + break; + case 'javaScript': + html += '

' + me[0] + '

'; + break; + case 'actionScript': + html += '

' + me[0] + '

'; + break; + default: + break; + } + } + this.CB['menu'].innerHTML = html; + var pArr = this.CB['menu'].childNodes; + for (i = 0; i < pArr.length; i++) { + this.css(pArr[i], { + height: '30px', + lineHeight: '30px', + margin: '0px', + fontFamily: this.fontFamily, + fontSize: '12px', + paddingLeft: '10px', + paddingRight: '30px' + }); + if (mArr[i][mArr[i].length - 1] == 'line') { + this.css(pArr[i], 'borderBottom', '1px solid #e9e9e9'); + } + var aArr = pArr[i].childNodes; + for (var n = 0; n < aArr.length; n++) { + if (aArr[n].localName == 'a') { + this.css(aArr[n], { + color: '#000000', + textDecoration: 'none' + }); + } + } + } + this.PD.oncontextmenu = function(event) { + var eve = event || window.event; + var client = thisTemp.client(event); + if (eve.button == 2) { + eve.returnvalue = false; + var x = client['x'] + thisTemp.pdCoor['x'] - 2; + var y = client['y'] + thisTemp.pdCoor['y'] - 2; + thisTemp.css(thisTemp.CB['menu'], { + display: 'block', + left: x + 'px', + top: y + 'px' + }); + return false; + } + return true; + }; + var setTimeOutPClose = function() { + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + }; + var setTimeOutP = null; + var mouseOut = function(event) { + setTimeOutPClose(); + setTimeOutP = setTimeout(function(event) { + thisTemp.css(thisTemp.CB['menu'], 'display', 'none'); + }, + 500); + }; + this.addListenerInside('mouseout', mouseOut, thisTemp.CB['menu']); + var mouseOver = function(event) { + setTimeOutPClose(); + }; + this.addListenerInside('mouseover', mouseOver, thisTemp.CB['menu']); + + }, + /* + 内部函数 + 构建控制栏隐藏事件 + */ + controlBarHide: function(hide) { + var thisTemp = this; + var client = { + x: 0, + y: 0 + }, + oldClient = { + x: 0, + y: 0 + }; + var cShow = true, + force = false; + var oldCoor = [0, 0]; + var controlBarShow = function(show) { + if (show && !cShow && thisTemp.controlBarIsShow) { + cShow = true; + thisTemp.sendJS('controlBar', true); + thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'block'); + thisTemp.css(thisTemp.CB['controlBar'], 'display', 'block'); + thisTemp.timeProgressDefault(); + //thisTemp.css(thisTemp.CB['timeProgressBg'], 'display', 'block'); + //thisTemp.css(thisTemp.CB['timeBoBg'], 'display', 'block'); + thisTemp.changeVolume(thisTemp.volume); + thisTemp.changeLoad(); + if (!thisTemp.timerBuffer) { + thisTemp.bufferEdHandler(); + } + } else { + if (cShow) { + cShow = false; + var paused = thisTemp.getMetaDate()['paused']; + if (force) { + paused = false; + } + if (!paused) { + thisTemp.sendJS('controlBar', false); + thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'none'); + thisTemp.css(thisTemp.CB['controlBar'], 'display', 'none'); + thisTemp.promptShow(false); + + } + } + } + thisTemp.videoCss();//计算video的宽高和位置 + }; + var cbarFun = function(event) { + if (client['x'] == oldClient['x'] && client['y'] == oldClient['y']) { + var cdH = parseInt(thisTemp.CD.offsetHeight); + if ((client['y'] < cdH - 50 || client['y'] > cdH - 2) && cShow && !thisTemp.getMetaDate()['paused']) { + controlBarShow(false); + } + } else { + if (!cShow) { + controlBarShow(true); + } + + } + oldClient = { + x: client['x'], + y: client['y'] + } + }; + this.timerCBar = new this.timer(2000, cbarFun); + var cdMove = function(event) { + var getClient = thisTemp.client(event); + client['x'] = getClient['x']; + client['y'] = getClient['y']; + if (!cShow) { + controlBarShow(true); + } + thisTemp.sendJS('mouse',client); + }; + this.addListenerInside('mousemove', cdMove, thisTemp.CD); + this.addListenerInside('ended', cdMove); + this.addListenerInside('resize', cdMove, window); + if (hide === true) { + cShow = true; + force = true; + controlBarShow(false); + } + if (hide === false) { + cShow = false; + force = true; + controlBarShow(true); + } + }, + + /* + 内部函数 + 注册键盘按键事件 + */ + keypress: function() { + var thisTemp = this; + var keyDown = function(eve) { + var keycode = eve.keyCode || eve.which; + if (thisTemp.adPlayerPlay) { + return; + } + switch (keycode) { + case 32: + thisTemp.playOrPause(); + break; + case 37: + thisTemp.fastBack(); + break; + case 39: + thisTemp.fastNext(); + break; + case 38: + now = thisTemp.volume + thisTemp.ckConfig['config']['volumeJump']; + thisTemp.changeVolume(now > 1 ? 1 : now); + break; + case 40: + now = thisTemp.volume - thisTemp.ckConfig['config']['volumeJump']; + thisTemp.changeVolume(now < 0 ? 0 : now); + break; + default: + break; + } + }; + this.addListenerInside('keydown', keyDown, window || document); + }, + /* + 内部函数 + 注册倍速相关 + */ + playbackRate: function() { + if (!this.conBarShow || !this.ckConfig['config']['playbackRate']) { + return; + } + var styleCD=this.ckStyle['controlBar']['playbackrate']; + var cssSup={overflow: 'hidden',display: 'none',zIndex: 995}; + var cssSup2={overflow: 'hidden',align: 'top',vAlign: 'left',offsetX: 0,offsetY: 0,zIndex: 1}; + var thisTemp = this; + var dArr = this.playbackRateArr; + var html = ''; + var nowD = ''; //当前的倍速 + var i = 0,nowI=0; + nowD = dArr[this.playbackRateDefault][1]; + nowI=this.playbackRateDefault; + this.removeChildAll(this.CB['playbackrateP']); + if (dArr.length > 1) { + //设置样式 + this.CB['playbackratePB']=document.createElement('div'),this.CB['playbackratePC']=document.createElement('div'); + this.CB['playbackrateP'].appendChild(this.CB['playbackratePB']); + this.CB['playbackrateP'].appendChild(this.CB['playbackratePC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['playbackratePC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['playbackrateP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['playbackratePB'], cssTemp); + //样式设置结束 + for(i=0;i0){ + this.subtitlesTemp=dArr.length-1; + } + for(i=0;i 1) { + //设置样式 + this.CB['subtitlesPB']=document.createElement('div'),this.CB['subtitlesPC']=document.createElement('div'); + this.CB['subtitlesP'].appendChild(this.CB['subtitlesPB']); + this.CB['subtitlesP'].appendChild(this.CB['subtitlesPC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['subtitlesPC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['subtitlesP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['subtitlesPB'], cssTemp); + //样式设置结束 + for(i=0;i n) { + var arr = vArr[n]; + if (arr.length > 2) { + var title = arr[1]; + if (title) { + this.newSubtitles(title); + } + } + } + }, + /* + 接口函数:修改字幕大小 + 提供给外部api + */ + changeSubtitlesSize:function(n,m){ + if (!this.loaded || n < 0) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeSubtitlesSize(n,m); + return; + } + this.ckStyle['cktrack']['size']=n; + if(!this.isUndefined(m)){ + this.ckStyle['cktrack']['leading']=m; + } + this.trackShowAgain(); + }, + /* + 当切换字幕时的动作 + */ + newSubtitles:function(title){ + var vArr = this.vars['cktrack'];//字幕数组 + var i = 0; + for (i = 0; i < vArr.length; i++) { + var v = vArr[i]; + if (v[1] == title) { + this.subtitlesTemp=i; + if (this.conBarShow) { + this.CB['subtitleButtonText'].innerHTML = v[1]; + this.subtitleSwitch(); + this.loadTrack(i); + } + this.sendJS('subtitles', v); + } + } + }, + /* + 内部函数 + 构建清晰度按钮及切换事件(Click事件) + */ + definition: function() { + if (!this.conBarShow || !this.ckConfig['config']['definition']) { + return; + } + var styleCD=this.ckStyle['controlBar']['definition']; + var cssSup={overflow: 'hidden',display: 'none',zIndex: 995}; + var cssSup2={overflow: 'hidden',align: 'top',vAlign: 'left',offsetX: 0,offsetY: 0,zIndex: 1}; + var thisTemp = this; + var vArr = this.VA; + var dArr = []; + var html = ''; + var nowD = ''; //当前的清晰度 + var i = 0,nowI=0; + for (i = 0; i < vArr.length; i++) { + var d = vArr[i][2]; + if (dArr.indexOf(d) == -1) { + dArr.push(d); + } + if (this.V) { + if (vArr[i][0] == this.V.currentSrc) { + nowD = d; + nowI = i; + } + } + } + if (!nowD) { + nowD = dArr[0]; + } + this.removeChildAll(this.CB['definitionP']); + if (dArr.length > 1) { + //设置样式 + this.CB['definitionPB']=document.createElement('div'),this.CB['definitionPC']=document.createElement('div'); + this.CB['definitionP'].appendChild(this.CB['definitionPB']); + this.CB['definitionP'].appendChild(this.CB['definitionPC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['definitionPC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['definitionP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['definitionPB'], cssTemp); + //样式设置结束 + for(i=0;i=0;i--){ + var childNode=ele.childNodes[i]; + ele.removeChild(childNode); + } + }, + /* + 内部函数 + 注册清晰度相关事件 + */ + addDefListener: function() { + var thisTemp = this; + var setTimeOutP = null; + var defClick = function(event) { + if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block' && !thisTemp.isUndefined(thisTemp.CB['definitionPC'])){ + thisTemp.css(thisTemp.CB['definitionP'],'display','block'); + var tbCss=thisTemp.ckStyle['controlBar']['definition']['background']; + thisTemp.css(thisTemp.CB['definitionPB'], { + width: thisTemp.CB['definitionPC'].offsetWidth+'px', + height: thisTemp.CB['definitionPC'].offsetHeight+'px' + }); + thisTemp.css(thisTemp.CB['definitionP'], { + width: (thisTemp.CB['definitionPC'].offsetWidth+tbCss['triangleDeviationX']+tbCss['triangleWidth'])+'px', + height: (thisTemp.CB['definitionPC'].offsetHeight+tbCss['triangleDeviationY']+tbCss['triangleHeight'])+'px' + }); + thisTemp.promptShow(false); + //设置三角形样式 + var tempELe=thisTemp.CB['definitionPB']; + var tempWidth=tempELe.offsetWidth,tempHeight=tempELe.offsetHeight; + + var x = ((tempWidth-tbCss['triangleWidth']) * 0.5)+tbCss['triangleDeviationX']; + var y = tempELe.offsetHeight+tbCss['triangleDeviationY']; + var cssTemp={ + left:x+'px', + top:y+'px' + }; + thisTemp.css(thisTemp.CB['definitionTriangle'],cssTemp); + } + else{ + thisTemp.css(thisTemp.CB['definitionP'],'display','none'); + } + }; + this.addListenerInside('click', defClick, this.CB['definition']); + var defMouseOut = function(event) { + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + setTimeOutP = setTimeout(function(event) { + thisTemp.css(thisTemp.CB['definitionP'], 'display', 'none'); + }, + 500); + }; + this.addListenerInside('mouseout', defMouseOut, thisTemp.CB['definitionP']); + var defMouseOver = function(event) { + thisTemp.buttonHide=false; + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + }; + this.addListenerInside('mouseover', defMouseOver, thisTemp.CB['definitionP']); + }, + /* + 接口函数 + 提供给外部api + */ + changeDefinition: function(n) { + if (!this.loaded || n < 0) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeDefinition(n); + return; + } + if (this.VA.length > n) { + var arr = this.VA[n]; + if (arr.length > 3) { + var title = arr[2]; + if (title) { + this.newDefinition(title); + } + } + } + }, + /* + 内部函数 + 切换清晰度后发生的动作 + */ + newDefinition: function(title) { + var vArr = this.VA; + var nVArr = []; + var i = 0; + for (i = 0; i < vArr.length; i++) { + var v = vArr[i]; + if (v[2] == title) { + nVArr.push(v); + this.sendJS('definitionChange', i + ''); + } + } + if (nVArr.length < 1) { + return; + } + if (this.V != null && this.needSeek == 0) { + this.needSeek = this.V.currentTime; + } + if (this.getFileExt(nVArr[0][0]) != '.m3u8') { + this.isM3u8 = false; + } + if (!this.isM3u8) { + if (nVArr.length == 1) { + this.V.innerHTML = ''; + this.V.src = nVArr[0][0]; + this.V.currentSrc = nVArr[0][0]; + } else { + var source = ''; + nVArr = this.arrSort(nVArr); + for (i = 0; i < nVArr.length; i++) { + var type = ''; + var va = nVArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + } + source += ''; + } + this.V.removeAttribute('src'); + this.V.innerHTML = source; + this.V.currentSrc = nVArr[0][0]; + } + } else { + this.embedHls(vArr[0][0], this.vars['autoplay']); + } + this.V.autoplay = 'autoplay'; + this.V.load(); + if (this.playbackRateTemp!=1) { + this.V.playbackRate = this.playbackRateTemp; //定义倍速 + } + this.timerErrorFun(); + }, + /* + 内置函数 + 播放hls + */ + embedHls: function(url, autoplay) { + var thisTemp = this; + thisTemp.hlsAutoPlay=autoplay; + if (Hls.isSupported()) { + var hls = new Hls(); + hls.loadSource(url); + hls.attachMedia(this.V); + hls.on(Hls.Events.MANIFEST_PARSED, + function() { + thisTemp.playerLoad(); + if (autoplay) { + thisTemp.videoPlay(); + } + }); + } + }, + /* + 内部函数 + 构建提示点 + */ + prompt: function() { + if (!this.conBarShow) { + return; + } + var thisTemp = this; + var prompt = this.vars['promptSpot']; + if (prompt == null || this.promptArr.length > 0) { + return; + } + var showPrompt = function(event) { + if (thisTemp.promptElement == null) { + var random2 = 'prompte-' + thisTemp.randomString(5); + var ele2 = document.createElement('div'); + ele2.className = random2; + thisTemp.PD.appendChild(ele2); + thisTemp.promptElement = thisTemp.getByElement(random2); + thisTemp.css(thisTemp.promptElement, { + overflowX: 'hidden', + lineHeight: thisTemp.ckStyle['previewPrompt']['lineHeight']+'px', + fontFamily: thisTemp.ckStyle['previewPrompt']['font'], + fontSize: thisTemp.ckStyle['previewPrompt']['size']+'px', + color: thisTemp.ckStyle['previewPrompt']['color'].replace('0x','#'), + position: 'absolute', + display: 'block', + zIndex: '90' + }); + } + var pcon = thisTemp.getPromptTest(); + var pW = pcon['pW'], + pT = pcon['pT'], + pL = parseInt(thisTemp.css(this, 'left')) - parseInt(pW * 0.5); + if (pcon['pL'] > 10) { + pL = pcon['pL']; + } + if (pL < 0) { + pL = 0; + } + thisTemp.css(thisTemp.promptElement, { + width: pW + 'px', + left: ( - pW - 10) + 'px', + display: 'block' + }); + thisTemp.promptElement.innerHTML = thisTemp.getDataset(this, 'words'); + thisTemp.css(thisTemp.promptElement, { + left: pL + 'px', + top: (pT - thisTemp.promptElement.offsetHeight-thisTemp.ckStyle['previewPrompt']['marginBottom']) + 'px' + }); + }; + var hidePrompt = function(event) { + if (thisTemp.promptElement != null) { + thisTemp.css(thisTemp.promptElement, { + display: 'none' + }); + } + }; + var i = 0; + for (i = 0; i < prompt.length; i++) { + var pr = prompt[i]; + var words = pr['words']; + var time = pr['time']; + var random = 'prompttitle-' + this.randomString(5); + var ele = document.createElement('div'); + ele.className = random; + this.CB['timeBoBg'].appendChild(ele); + var div = this.getByElement(random); + try{ + div.setAttribute('data-time', time); + if(this.ckConfig['config']['promptSpotTime']){ + words=this.formatTime(time,0,this.ckLanguage['timeSliderOver'])+' '+words; + } + div.setAttribute('data-words', words); + } + catch(event){} + var pCss=this.getEleCss(this.ckStyle['promptSpotH5'],{marginY:-10000,zIndex: 1}); + try{ + this.css(div, pCss); + } + catch(event){} + this.addListenerInside('mouseover', showPrompt, div); + this.addListenerInside('mouseout', hidePrompt, div); + this.promptArr.push(div); + } + this.changePrompt(); + }, + /* + 内部函数 + 计算提示文本的位置 + */ + getPromptTest: function() { + var pW = this.previewWidth, + pT = this.getCoor(this.CB['timeProgressBg'])['y'], + pL = 0; + if (this.previewTop != null) { + pT = parseInt(this.css(this.previewTop, 'top')); + pL = parseInt(this.css(this.previewTop, 'left')); + } else { + pT -= 35; + } + pL += 2; + if (pL < 0) { + pL = 0; + } + if (pL > this.PD.offsetWidth - pW) { + pL = this.PD.offsetWidth - pW; + } + return { + pW: pW, + pT: pT, + pL: pL + }; + }, + /* + 内部函数 + 删除提示点 + */ + deletePrompt: function() { + var arr = this.promptArr; + if (arr.length > 0) { + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + this.deleteChild(arr[i]); + } + } + } + this.promptArr = []; + }, + /* + 内部函数 + 计算提示点坐标 + */ + changePrompt: function() { + if (this.promptArr.length == 0) { + return; + } + var arr = this.promptArr; + var duration = this.getMetaDate()['duration']; + var bw = this.CB['timeBoBg'].offsetWidth; + for (var i = 0; i < arr.length; i++) { + var time = parseInt(this.getDataset(arr[i], 'time')); + var left = parseInt(time * bw / duration) - parseInt(arr[i].offsetWidth * 0.5); + if (left < 0) { + left = 0; + } + if (left > bw - parseInt(arr[i].offsetWidth * 0.5)) { + left = bw - parseInt(arr[i].offsetWidth * 0.5); + } + this.css(arr[i], { + left: left + 'px', + display: 'block' + }); + } + }, + /* + 内部函数 + 构建预览图片效果 + */ + preview: function(obj) { + var thisTemp = this; + var preview = { + file: null, + scale: 0 + }; + preview = this.standardization(preview, this.vars['preview']); + if (preview['file'] == null || preview['scale'] <= 0) { + return; + } + var srcArr = preview['file']; + if (this.previewStart == 0) { //如果还没有构建,则先进行构建 + this.previewStart = 1; + if (srcArr.length > 0) { + var i = 0; + var imgW = 0, + imgH = 0; + var random = 'preview-'+thisTemp.randomString(10); + var loadNum = 0; + var loadImg = function(i) { + srcArr[i] = thisTemp.getNewUrl(srcArr[i]); + var n = 0; + var img = new Image(); + img.src = srcArr[i]; + img.className = random + i; + img.onload = function(event) { + loadNum++; + if (thisTemp.previewDiv == null) { //如果没有建立DIV,则建 + imgW = img.width; + imgH = img.height; + thisTemp.previewWidth = parseInt(imgW * 0.1); + var ele = document.createElement('div'); + ele.className = random; + thisTemp.PD.appendChild(ele); + thisTemp.previewDiv = thisTemp.getByElement(random); + var eleTop = 0; + eleTop=thisTemp.PD.offsetHeight -thisTemp.ckStyle['preview']['bottom']; + thisTemp.css(thisTemp.previewDiv, { + width: srcArr.length * imgW * 10 + 'px', + height: parseInt(imgH * 0.1) + 'px', + backgroundColor: '#000000', + position: 'absolute', + left: '0px', + top: eleTop + 'px', + display: 'none', + zIndex: '80' + }); + ele.setAttribute('data-x', '0'); + ele.setAttribute('data-y', eleTop); + var ele2 = document.createElement('div'); + ele2.className = random + 'd2'; + thisTemp.PD.appendChild(ele2); + thisTemp.previewTop = thisTemp.getByElement(ele2.className); + thisTemp.css(thisTemp.previewTop, { + width: parseInt(imgW * 0.1) + 'px', + height: parseInt(imgH * 0.1) + 'px', + position: 'absolute', + border: thisTemp.ckStyle['preview']['border']+'px solid ' + thisTemp.ckStyle['preview']['borderColor'].replace('0x','#'), + left: '0px', + top: eleTop + 'px', + display: 'none', + zIndex: '81' + }); + var html = ''; + for (n = 0; n < srcArr.length; n++) { + html += thisTemp.newCanvas(random + n, imgW * 10, parseInt(imgH * 0.1)) + } + thisTemp.previewDiv.innerHTML = html; + } + thisTemp.previewDiv.appendChild(img); + var cimg = thisTemp.getByElement(img.className); + var canvas = thisTemp.getByElement(img.className + '-canvas'); + var context = canvas.getContext('2d'); + var sx = 0, + sy = 0, + x = 0, + h = parseInt(imgH * 0.1); + for (n = 0; n < 100; n++) { + x = parseInt(n * imgW * 0.1); + context.drawImage(cimg, sx, sy, parseInt(imgW * 0.1), h, x, 0, parseInt(imgW * 0.1), h); + sx += parseInt(imgW * 0.1); + if (sx >= imgW) { + sx = 0; + sy += h; + } + thisTemp.css(cimg, 'display', 'none'); + } + if (loadNum == srcArr.length) { + thisTemp.previewStart = 2; + } else { + i++; + loadImg(i); + } + }; + }; + } + loadImg(i); + return; + } + if (this.previewStart == 2) { + var isTween = true; + var nowNum = parseInt(obj['time'] / this.vars['preview']['scale']); + var numTotal = parseInt(thisTemp.getMetaDate()['duration'] / this.vars['preview']['scale']); + if (thisTemp.css(thisTemp.previewDiv, 'display') == 'none') { + isTween = false; + } + thisTemp.css(thisTemp.previewDiv, 'display', 'block'); + var imgWidth = thisTemp.previewDiv.offsetWidth * 0.01 / srcArr.length; + var left = (imgWidth * nowNum) - obj['x'] + parseInt(imgWidth * 0.5), + top=thisTemp.PD.offsetHeight- thisTemp.previewDiv.offsetHeight -thisTemp.ckStyle['preview']['bottom']; + thisTemp.css(thisTemp.previewDiv, 'top', top + 2 + 'px'); + var topLeft = obj['x'] - parseInt(imgWidth * 0.5); + var timepieces = 0; + if (topLeft < 0) { + topLeft = 0; + timepieces = obj['x'] - topLeft - imgWidth * 0.5; + } + if (topLeft > thisTemp.PD.offsetWidth - imgWidth) { + topLeft = thisTemp.PD.offsetWidth - imgWidth; + timepieces = obj['x'] - topLeft - imgWidth * 0.5; + } + if (left < 0) { + left = 0; + } + if (left > numTotal * imgWidth - thisTemp.PD.offsetWidth) { + left = numTotal * imgWidth - thisTemp.PD.offsetWidth; + } + thisTemp.css(thisTemp.previewTop, { + left: topLeft + 'px', + top: top + 2 + 'px', + display: 'block' + }); + if (thisTemp.previewTop.offsetHeight > thisTemp.previewDiv.offsetHeight) { + thisTemp.css(thisTemp.previewTop, { + height: thisTemp.previewDiv.offsetHeight - (thisTemp.previewTop.offsetHeight - thisTemp.previewDiv.offsetHeight) + 'px' + }); + } + if (this.previewTween != null) { + this.animatePause(this.previewTween); + this.previewTween = null + } + var nowLeft = parseInt(thisTemp.css(thisTemp.previewDiv, 'left')); + var leftC = nowLeft + left; + if (nowLeft == -(left + timepieces)) { + return; + } + if (isTween) { + var obj = { + element: thisTemp.previewDiv, + start: null, + end: -(left + timepieces), + speed: 0.3 + }; + this.previewTween = this.animate(obj); + } else { + thisTemp.css(thisTemp.previewDiv, 'left', -(left + timepieces) + 'px') + } + } + }, + /* + 内部函数 + 删除预览图节点 + */ + deletePreview: function() { + if (this.previewDiv != null) { + this.deleteChild(this.previewDiv); + this.previewDiv = null; + this.previewStart = 0; + } + }, + /* + 内部函数 + 修改视频地址,属性 + */ + changeVideo: function() { + if (!this.html5Video) { + this.getVarsObject(); + this.V.newVideo(this.vars); + return; + } + var vArr = this.VA; + var v = this.vars; + var i = 0; + if (vArr.length < 1) { + return; + } + if (this.V != null && this.needSeek == 0) { + this.needSeek = this.V.currentTime; + } + if (v['poster']) { + this.V.poster = v['poster']; + } else { + this.V.removeAttribute('poster'); + } + if (v['loop']) { + this.V.loop = 'loop'; + } else { + this.V.removeAttribute('loop'); + } + if (v['seek'] > 0) { + this.needSeek = v['seek']; + } else { + this.needSeek = 0; + } + if (this.getFileExt(vArr[0][0]) != '.m3u8') { + this.isM3u8 = false; + } + if (!this.isM3u8) { + if (vArr.length == 1) { + this.V.innerHTML = ''; + this.V.src = vArr[0][0]; + } else { + var source = ''; + vArr = this.arrSort(vArr); + for (i = 0; i < vArr.length; i++) { + var type = ''; + var va = vArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + } + source += ''; + } + this.V.removeAttribute('src'); + this.V.innerHTML = source; + } + //分析视频地址结束 + if (v['autoplay']) { + this.V.autoplay = 'autoplay'; + } else { + this.V.removeAttribute('autoplay'); + } + this.V.load(); + } else { + this.embedHls(vArr[0][0], v['autoplay']); + } + if (!this.isUndefined(v['volume'])) { + this.changeVolume(v['volume']); + } + this.resetPlayer(); //重置界面元素 + this.timerErrorFun(); + //如果存在字幕则加载 + if (this.vars['cktrack']) { + this.loadTrack(); + } + }, + /* + 内部函数 + 调整中间暂停按钮,缓冲loading,错误提示文本框的位置 + */ + elementCoordinate: function() { + this.pdCoor = this.getXY(this.PD); + var cssTemp=null; + try { + cssTemp=this.getEleCss(this.ckStyle['centerPlay'],{cursor:'pointer'}); + this.css(this.CB['pauseCenter'], cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['loading']); + this.css(this.CB['loading'],cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['error']); + this.css(this.CB['errorText'], cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['logo']); + this.css(this.CB['logo'], cssTemp); + } catch(event) {this.log(event);} + this.checkBarWidth(); + }, + /* + 内部函数 + 控制栏内各按钮的位置 + */ + carbarButton:function(){ + var styleC=this.ckStyle['controlBar']; + var styleCB=styleC['button']; + var cssTemp=null; + var cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + var cssSup2={overflow: 'hidden',cursor: 'default',zIndex: 1}; + var cssSup4={overflow: 'hidden',cursor: 'pointer',display: 'none',zIndex: 995}; + //播放/暂停按钮 + cssTemp=this.getEleCss(styleCB['play'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['play'],cssTemp); + cssTemp=this.getEleCss(styleCB['pause'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['pause'],cssTemp); + //设置静音/取消静音的按钮样式 + cssTemp=this.getEleCss(styleCB['mute'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['mute'],cssTemp); + cssTemp=this.getEleCss(styleCB['escMute'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['escMute'],cssTemp); + //设置全屏/退出全屏按钮样式 + cssTemp=this.getEleCss(styleCB['full'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['full'],cssTemp); + cssTemp=this.getEleCss(styleCB['escFull'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['escFull'],cssTemp); + cssTemp=this.getEleCss(styleC['timeText']['vod'],cssSup2,this.CB['controlBarBg']); + this.css(this.CB['timeText'], cssTemp); + //音量调节框 + var volumeSchedule=this.newObj(styleC['volumeSchedule']); + volumeSchedule['backgroundImg']=''; + cssTemp=this.getEleCss(volumeSchedule,cssSup2,this.CB['controlBarBg']); + this.css(this.CB['volume'],cssTemp); + cssTemp= { + width: cssTemp['width'], + height: styleC['volumeSchedule']['backgroundHeight']+'px', + overflow: 'hidden', + backgroundRepeat:'no-repeat', + backgroundPosition:'left center' + }; + if(this.ckConfig['config']['buttonMode']['volumeSchedule']){ + cssTemp['cursor']='pointer'; + } + this.css(this.CB['volumeBg'],cssTemp); + this.css(this.CB['volumeBg'], { + position: 'absolute', + }); + cssTemp['width']=(this.CB['volumeBO'].offsetWidth*0.5+parseInt(this.css(this.CB['volumeBO'],'left')))+'px'; + this.css(this.CB['volumeUp'],cssTemp); + this.css(this.CB['volumeBg'], 'backgroundImage', 'url('+styleC['volumeSchedule']['backgroundImg']+')'); + this.css(this.CB['volumeUp'], 'backgroundImage', 'url('+styleC['volumeSchedule']['maskImg']+')'); + //音量调节按钮 + cssTemp=this.getEleCss(styleC['volumeSchedule']['button'],{overflow: 'hidden',cursor: 'pointer',backgroundRepeat:'no-repeat',backgroundPosition:'left center'}); + this.css(this.CB['volumeBO'],cssTemp); + //倍速容器 + if(this.ckConfig['config']['playbackRate']){ + if(!this.CB['playbackrateButtonText']){ + this.textButton(this.CB['playbackrate'],styleC['playbackrate']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['playbackrate']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['playbackrate'],'playbackrateButtonText'); + } + cssTemp=this.getEleCss(styleC['playbackrate']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['playbackrate'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['playbackrateP'],'display','none'); + cssTemp=this.getEleCss(styleC['playbackrate']['backgroundCoorH5'],cssSup4); + this.css(this.CB['playbackrateP'], cssTemp); + } + //初始化清晰度按钮 + if(this.ckConfig['config']['definition']){ + if(!this.CB['defaultButtonText']){ + this.textButton(this.CB['definition'],styleC['definition']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['definition']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['definition'],'defaultButtonText'); + } + cssTemp=this.getEleCss(styleC['definition']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['definition'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['definitionP'],'display','none'); + cssTemp=this.getEleCss(styleC['definition']['backgroundCoorH5'],cssSup4); + this.css(this.CB['definitionP'], cssTemp); + } + //初始化字幕切换按钮 + if(this.ckConfig['config']['subtitle']){ + if(!this.CB['subtitleButtonText']){ + this.textButton(this.CB['subtitles'],styleC['subtitle']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['subtitle']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['subtitle'],'subtitleButtonText'); + } + //字幕按钮列表容器样式 + cssTemp=this.getEleCss(styleC['subtitle']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['subtitles'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['subtitlesP'],'display','none'); + cssTemp=this.getEleCss(styleC['subtitle']['backgroundCoorH5'],cssSup4); + this.css(this.CB['subtitlesP'], cssTemp); + } + }, + /* + 构造一个文字按钮 + ele:当前按钮 + css:样式 + cssSup:补充样式 + upEle:上一级容器对象 + text:显示的文本 + newName:文本框名称 + */ + textButton:function(ele,css,cssSup,upEle,text,newName){ + var thisTemp=this; + var bgCss={ + width:css['width'], + height:css['height'] + }; + if(cssSup){ + bgCss={ + width:css['width'], + height:css['height'], + align:cssSup['align'], + vAlign:cssSup['vAlign'], + marginX: cssSup['marginX'], + marginY: cssSup['marginY'], + offsetX: cssSup['offsetX'], + offsetY: cssSup['offsetY'], + zIndex:2 + }; + } + cssTemp=this.getEleCss(bgCss,null,upEle); + thisTemp.css(ele, cssTemp); + var outCss=this.newObj(css); + var overCss=this.newObj(css); + var textOutCss=this.newObj(css); + var textOverCss=this.newObj(css); + var cssTemp=null; + outCss['alpha']=css['backgroundAlpha']; + overCss['backgroundColor']=css['overBackgroundColor']; + overCss['alpha']=css['backgroundAlpha']; + textOutCss['color']=css['textColor']; + textOverCss['color']=css['overTextColor']; + textOutCss['textAlign']=css['align']; + textOverCss['textAlign']=css['align']; + //修正文字 + textOutCss['backgroundColor']=textOverCss['backgroundColor']=''; + var bgEle=document.createElement('div');//按钮背景层 + this.removeChildAll(ele); + ele.appendChild(bgEle); + if(newName){ + this.CB[newName]=document.createElement('div');//文字层 + ele.appendChild(this.CB[newName]); + this.CB[newName].innerHTML=text; + } + else{ + var newEle=document.createElement('div');//文字层 + ele.appendChild(newEle); + newEle.innerHTML=text; + } + var outFun=function(){ + cssTemp=thisTemp.getEleCss(outCss,{cursor: 'pointer',zIndex:1},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + thisTemp.css(bgEle, cssTemp); + cssTemp=thisTemp.getEleCss(textOutCss,{cursor: 'pointer',zIndex:2},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + if(newName){ + thisTemp.css(thisTemp.CB[newName], cssTemp,bgEle); + } + else{ + thisTemp.css(newEle, cssTemp,bgEle); + } + thisTemp.buttonHide=true;//显示的列表框需要隐藏 + if(thisTemp.timeButtonOver){ + window.clearTimeout(thisTemp.timeButtonOver); + thisTemp.timeButtonOver=null; + } + thisTemp.timeButtonOver=window.setTimeout(function(){thisTemp.buttonListHide()},1000); + }; + var overFun=function(){ + cssTemp=thisTemp.getEleCss(overCss,{zIndex:1},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + thisTemp.css(bgEle, cssTemp); + cssTemp=thisTemp.getEleCss(textOverCss,{zIndex:2},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + if(newName){ + thisTemp.css(thisTemp.CB[newName], cssTemp); + } + else{ + thisTemp.css(newEle, cssTemp); + } + + }; + outFun(); + this.addListenerInside('mouseout', outFun, ele); + this.addListenerInside('mouseover', overFun, ele); + }, + /* + 隐藏所有的列表框 + */ + buttonListHide:function(){ + if(this.buttonHide){ + this.css([this.CB['definitionP'],this.CB['subtitlesP'],this.CB['playbackrateP']],'display','none'); + } + if(this.timeButtonOver){ + window.clearTimeout(this.timeButtonOver); + this.timeButtonOver=null; + } + this.buttonHide=false; + }, + /* + 计算视频的宽高 + */ + videoCss:function(){ + var cssTemp={}; + + if(this.css(this.CB['controlBar'],'display')=='none'){ + cssTemp=this.ckStyle['video']['controlBarHideReserve']; + } + else{ + cssTemp=this.ckStyle['video']['reserve']; + } + var spacingBottom=cssTemp['spacingBottom']; + if(this.V.controls && this.isMobile()){ + spacingBottom-=40; + } + var pW=this.PD.offsetWidth,pH=this.PD.offsetHeight; + var vW=pW-cssTemp['spacingLeft']-cssTemp['spacingRight']; + var vH=pH-cssTemp['spacingTop']-spacingBottom; + if(!this.MD){ + this.css(this.V,{ + width:vW+'px', + height:vH+'px', + marginLeft:cssTemp['spacingLeft']+'px', + marginTop:cssTemp['spacingTop']+'px' + }); + } + else{ + this.css([this.MD,this.MDC],{ + width:vW+'px', + height:vH+'px', + marginLeft:cssTemp['spacingLeft']+'px', + marginTop:cssTemp['spacingTop']+'px' + }); + } + }, + /* + 播放器界面自定义元素 + */ + playerCustom:function(){ + var custom=this.ckStyle['custom']; + var button=custom['button']; + var images=custom['images']; + var cssTemp=null; + var cssSup=null; + var k='',tempID=''; + var b={}; + var tempDiv; + var i=0; + for(k in button){ + b=button[k]; + cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-button',name:k}); + this.PD.appendChild(tempDiv); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]; + } + i++; + this.buttonEventFun(tempDiv,b); + } + for(k in images){ + b=images[k]; + cssSup={overflow: 'hidden',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-images',name:k}); + this.PD.appendChild(tempDiv); + var img=new Image(); + img.src=images[k]['img']; + tempDiv.appendChild(img); + i++ + } + }, + /* + 控制栏自定义元素 + */ + carbarCustom:function(){ + var custom=this.ckStyle['controlBar']['custom']; + var button=custom['button']; + var images=custom['images']; + var cssTemp=null; + var cssSup=null; + var k='',tempID=''; + var b={}; + var tempDiv; + var i=0; + for(k in button){ + b=button[k]; + cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-button',name:k}); + this.CB['controlBar'].appendChild(tempDiv); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]; + } + i++; + this.buttonEventFun(tempDiv,b); + } + for(k in images){ + b=images[k]; + cssSup={overflow: 'hidden',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-images',name:k}); + this.CB['controlBar'].appendChild(tempDiv); + var img=new Image(); + img.src=images[k]['img']; + tempDiv.appendChild(img); + i++; + } + }, + /* + 控制栏自定义元素的位置 + */ + customCoor:function(){ + var cssTemp=null; + if(this.customeElement.length>0){ + for(var i=0;i0){ + for(var i=0;i 0) { + this.videoSeek(this.needSeek); + this.needSeek = 0; + } + if (this.animatePauseArray.length > 0) { + this.animateResume('pause'); + } + if (this.playerType == 'html5video' && this.V != null && this.ckConfig['config']['videoDrawImage']) { + this.sendVCanvas(); + } + if (!this.isUndefined(this.advertisements['pause']) && !this.adPlayStart) { //如果存在暂停广告 + this.closePauseAd(); + } + }, + /*暂停时播放暂停广告*/ + adPausePlayer: function() { + this.adI = 0; + this.adType = 'pause'; + this.adPauseShow = true; + this.loadAdPause(); + this.sendJS('pauseAd','play'); + }, + loadAdPause: function() { + var ad = this.getNowAdvertisements(); + var type = ad['type']; + var thisTemp = this; + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + if (this.isStrImage(type) && this.adPauseShow) { + this.css(this.CB['adElement'], 'display', 'block'); + var imgClass = 'adimg' + this.randomString(10); + var imgHtml = ''; + if (ad['link']) { + imgHtml = '' + imgHtml + ''; + } + this.CB['adElement'].innerHTML = imgHtml; + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css([thisTemp.getByElement(imgClass), thisTemp.CB['adElement']], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + if (thisTemp.ckStyle['advertisement']['closeButtonShow'] && thisTemp.adPauseShow) { + thisTemp.css(thisTemp.CB['adPauseClose'], { + display: 'block' + }); + } + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + thisTemp.adPauseCoor(); + }, + this.getByElement(imgClass)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adElement']); + var newI = this.adI; + if (this.adI < this.advertisements['pause'].length - 1) { + newI++; + } else { + newI = 0; + } + if (ad['time'] > 0) { + setTimeout(function() { + if (thisTemp.adPauseShow) { + thisTemp.adI = newI; + thisTemp.loadAdPause(); + } + }, + ad['time'] * 1000); + } + } + }, + /*调整暂停广告的位置*/ + adPauseCoor: function() { + if (this.css(this.CB['adElement'], 'display') == 'block') { + var w = this.CB['adElement'].offsetWidth, + h = this.CB['adElement'].offsetHeight; + var pw = this.PD.offsetWidth, + ph = this.PD.offsetHeight; + this.css(this.CB['adElement'], { + top: (ph - h) * 0.5 + 'px', + left: (pw - w) * 0.5 + 'px' + }); + if (this.css(this.CB['adPauseClose'], 'display') == 'block') { + var rr=this.ckStyle['advertisement']['closeButton']; + var cxy = this.getPosition(rr,this.CB['adElement']); + this.css(this.CB['adPauseClose'], { + top: cxy['y'] + 'px', + left: cxy['x'] + 'px' + }); + } + } + }, + /* + 关闭暂停广告 + */ + closePauseAd: function() { + this.CB['adElement'].innerHTML = ''; + this.css([this.CB['adElement'], this.CB['adPauseClose']], 'display', 'none'); + this.adPauseShow = false; + this.sendJS('pauseAd','ended'); + }, + /*计算广告时间*/ + advertisementsTime: function(nt) { + if (this.isUndefined(nt)) { + nt = 0; + } + var ad = this.advertisements[this.adType]; + if (nt > 0) { + ad[this.adI]['time'] = Math.ceil(nt); + } + this.adTimeAllTotal = 0; + for (var i = this.adI; i < ad.length; i++) { + if (!this.isUndefined(ad[i]['time'])) { + this.adTimeAllTotal += Math.ceil(ad[i]['time']); + } + } + if (this.adTimeAllTotal > 0) { + this.CB['adTimeText'].innerHTML = this.ckLanguage['adCountdown'].replace('[$second]', this.adTimeAllTotal).replace('[$Second]', this.adTimeAllTotal > 9 ? this.adTimeAllTotal: '0' + this.adTimeAllTotal); + } + if (this.adPauseShow) { + this.closePauseAd(); + } + this.adOtherCloseAll(); + this.adTimeTotal = -1; + }, + /*判断是否需要显示跳过广告按钮*/ + adSkipButtonShow: function() { + var thisTemp = this; + var skipConfig = this.ckStyle['advertisement']; + var delayTimeTemp = skipConfig[this.adType + 'SkipButtonDelay']; + var timeFun = function() { + if (delayTimeTemp >= 0) { + thisTemp.CB['adSkipText'].innerHTML = thisTemp.ckLanguage['skipDelay'].replace('[$second]', delayTimeTemp).replace('[$Second]', delayTimeTemp > 9 ? delayTimeTemp: '0' + delayTimeTemp); + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block'); + thisTemp.css(thisTemp.CB['adSkipButton'],'display','none'); + setTimeout(timeFun, 1000); + } else { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none'); + if(thisTemp.css(thisTemp.CB['adTime'],'display')=='block'){ + thisTemp.css(thisTemp.CB['adSkipButton'],'display','block'); + } + + } + delayTimeTemp--; + }; + if (skipConfig['skipButtonShow']) { + if (skipConfig[this.adType + 'SkipButtonDelay'] > 0 && this.isUndefined(this.adSkipButtonTime)) { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']], 'display', 'block'); + timeFun(); + } else { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none'); + thisTemp.css(thisTemp.CB['adSkipButton'],'display','block'); + } + } + }, + /*播放广告*/ + advertisementsPlay: function() { + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText'], this.CB['adSkip'], this.CB['adSkipText'],this.CB['adSkipButton'], this.CB['adLink']], 'display', 'none'); + this.adPlayerPlay = false; + var ad = this.advertisements[this.adType]; + if (this.adI == 0 && (this.adType == 'front' || this.adType == 'insert' || this.adType == 'end')) { + this.sendJS('process', this.adType + ' ad play'); + this.sendJS(this.adType+'Ad','play'); + } + this.trackHide(); + if (this.adI < ad.length) { + if (!this.isUndefined(ad[this.adI]['time'])) { + this.adTimeTotal = parseInt(ad[this.adI]['time']); + } + this.loadAdvertisements(); + } else { + this.adEnded(); + } + }, + /*清除当前所有广告*/ + eliminateAd: function() { + if (this.adType) { + var ad = this.advertisements[this.adType]; + this.adI = ad.length; + this.advertisementsPlay(); + } + + }, + /*广告播放结束*/ + adEnded: function() { + var thisTemp = this; + this.adPlayStart = false; + if(this.adType=='front'){ + this.time=0; + } + this.adPlayerPlay = false; + if (this.adVideoPlay) { + if (this.videoTemp['src'] != '') { + this.V.src = this.videoTemp['src']; + } else { + if (this.V.src) { + this.V.removeAttribute('src'); + } + } + if (this.videoTemp['source'] != '') { + this.V.innerHTML = this.videoTemp['source']; + } + if (this.videoTemp['currentSrc'] != '') { + this.V.src = this.videoTemp['currentSrc']; + this.V.currentSrc = this.videoTemp['currentSrc']; + } + if (this.videoTemp['loop']) { + this.V.loop = true; + this.videoTemp['loop'] = false; + } + if (this.adType == 'end') { + this.endedHandler(); + } else { + this.videoPlay(); + } + } else { + this.videoPlay(); + } + this.changeVolume(this.vars['volume']); + this.sendJS('process', this.adType + ' ad ended'); + this.sendJS(this.adType+'Ad','ended'); + this.changeControlBarShow(true); + this.css(this.CB['logo'], 'display','block'); + this.customShow(true); + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText'], this.CB['adSkip'], this.CB['adSkipText'],this.CB['adSkipButton'], this.CB['adLink'],this.CB['adMute'], this.CB['adEscMute']], 'display', 'none'); + }, + /*加载广告*/ + loadAdvertisements: function() { + //this.videoTemp + var ad = this.getNowAdvertisements(); + var type = ad['type']; + var thisTemp = this; + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + this.changeControlBarShow(false); + this.adPlayerPlay = true; + this.css(this.CB['logo'], 'display','none'); + this.customShow(false); + if (this.isStrImage(type)) { + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText']], 'display', 'block'); + this.css([this.CB['adMute'], this.CB['adEscMute']], 'display', 'none'); + var imgClass = 'adimg' + this.randomString(10); + var imgHtml = ''; + if (ad['link']) { + imgHtml = '' + imgHtml + ''; + } + this.CB['adElement'].innerHTML = imgHtml; + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css(thisTemp.getByElement(imgClass), { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + thisTemp.css(thisTemp.CB['adElement'], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + top: (height - imgWH['height']) * 0.5 + 'px', + left: (width - imgWH['width']) * 0.5 + 'px' + }); + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + }, + this.getByElement(imgClass)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adElement']); + if (!this.isUndefined(ad['time'])) { + this.adCountDown(); + } + } else { + this.css([this.CB['adTime'], this.CB['adTimeText']], 'display', 'block'); + //判断是否静音 + if (this.adVideoMute) { + this.css(this.CB['adEscMute'], 'display', 'block'); + this.css(this.CB['adMute'], 'display', 'none'); + } else { + this.css(this.CB['adEscMute'], 'display', 'none'); + this.css(this.CB['adMute'], 'display', 'block'); + } + this.CB['adElement'].innerHTML = ''; + if (this.videoTemp['currentSrc'] == '') { + this.videoTemp['currentSrc'] = this.getCurrentSrc(); + } + if (this.V.loop) { + this.videoTemp['loop'] = true; + this.V.loop = false; + } + if (this.V != null && this.V.currentTime > 0 && this.adIsVideoTime && this.adType!='front') { //当有视频广告时而又没有记录下已播放的时间则进行记录 + this.adIsVideoTime = false; + this.needSeek = this.V.currentTime; + } + this.V.src = ad['file']; + this.V.currentSrc = ad['file']; + this.V.innerHTML = ''; + this.V.play(); + this.adVideoPlay = true; + this.ajaxSuccessNull(ad['exhibitionMonitor']); + if (!this.adVideoMute) { + this.escAdMute(); + } + } + if (ad['link']) { + this.css(this.CB['adLink'], 'display', 'block'); + var adLinkClick = function(event) { + thisTemp.sendJS('clickEvent', 'javaScript->adLinkClick'); + }; + this.addListenerInside('click', adLinkClick, this.CB['adLink']); + this.adLinkTemp=ad['link']; + var linkTemp = ''; + this.CB['adLink'].innerHTML = linkTemp; + this.css(this.getByElement('ckadmorelink'), { + color: '#FFFFFF', + textDecoration: 'none' + }); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adLink']); + } else { + this.css(this.CB['adLink'], 'display', 'none'); + } + + }, + /*普通广告倒计时*/ + adCountDown: function() { + var thisTemp = this; + if (this.adTimeTotal > 0) { + if (!this.adIsPause) { + this.adTimeTotal--; + this.showAdTime(); + this.adCountDownObj = null; + this.adCountDownObj = setTimeout(function() { + thisTemp.adCountDown(); + }, + 1000); + } + } else { + this.adI++; + this.advertisementsPlay(); + } + }, + /*视频广告倒计时*/ + adPlayerTimeHandler: function(time) { + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (this.isStrImage(type)) { + return; + } + if (this.adTimeTotal != parseInt(time)) { + this.adTimeTotal = parseInt(time); + this.showAdTime(); + } + }, + /*格式化广告倒计时显示*/ + showAdTime: function() { + this.adTimeAllTotal--; + var n = this.adTimeAllTotal; + if (n < 0) { + n = 0; + } + this.CB['adTimeText'].innerHTML = this.ckLanguage['adCountdown'].replace('[$second]', n).replace('[$Second]', n < 10 ? '0' + n: n); + }, + /* + 单独监听其它广告 + */ + checkAdOther: function(t) { + if (this.adPlayerPlay) { + return; + } + var adTime = this.advertisements['othertime']; + var adPlay = this.advertisements['otherPlay']; + for (var i = 0; i < adTime.length; i++) { + if (t >= adTime[i] && !adPlay[i]) { //如果播放时间大于广告时间而该广告还没有播放,则开始播放 + adPlay[i] = true; + this.newAdOther(i); + } + } + }, + /* + 新建其它广告 + */ + newAdOther: function(i) { + var thisTemp = this; + var ad = this.advertisements['other'][i]; + var randomS = this.randomString(10); //获取一个随机字符串 + var adDivID = 'adother' + randomS; //广告容器 + imgClassName = 'adimgother' + randomS; + var adDiv = document.createElement('div'); + adDiv.className = adDivID; + this.PD.appendChild(adDiv); + ad['div'] = adDivID; + ad['element'] = imgClassName; + var adHtml=''; + if(ad['link']){ + adHtml=''+adHtml+''; + } + this.getByElement(adDivID).innerHTML =adHtml; + this.css(adDivID, { + position: 'absolute', + overflow: 'hidden', + zIndex: '996', + top: '-600px', + left: '-600px', + cursor: 'pointer' + }); + if (this.ckStyle['advertisement']['closeOtherButtonShow']) { + var closeAdDivID = 'adotherclose-' + randomS; //广告容器 + var closeAdDiv = document.createElement('div'); + closeAdDiv.className = closeAdDivID; + this.PD.appendChild(closeAdDiv); + ad['closeDiv'] = closeAdDivID; + ad['close'] = false; + var closeAdDivCss=this.getEleCss(this.ckStyle['advertisement']['closeOtherButton'],{offsetX:-10000,offsetY:-10000,cursor: 'pointer',zIndex: 997}); + this.css(closeAdDivID, closeAdDivCss); + var adOtherCloseOver = function() { + thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOver']); + }; + var adOtherCloseOut = function() { + thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOut']); + }; + adOtherCloseOut(); + this.addListenerInside('mouseover', adOtherCloseOver, this.getByElement(closeAdDivID)); + this.addListenerInside('mouseout', adOtherCloseOut, this.getByElement(closeAdDivID)); + } + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css([thisTemp.getByElement(imgClassName), thisTemp.getByElement(adDivID)], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + thisTemp.advertisements['other'][i] = ad; + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + thisTemp.adOtherCoor(); + }, + this.getByElement(imgClassName)); + this.addListenerInside('click', + function() { + thisTemp.adOtherClose(i); + }, + this.getByElement(closeAdDivID)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.getByElement(imgClassName)); + if (ad['time'] > 0) { + setTimeout(function() { + thisTemp.adOtherClose(i); + }, + ad['time'] * 1000); + } + }, + /* + 关闭其它广告 + */ + adOtherClose: function(i) { + var ad = this.advertisements['other'][i]; + if (!this.isUndefined(ad['close'])) { + if (!ad['close']) { + ad['close'] = true; + this.PD.removeChild(this.getByElement(ad['div'])); + this.PD.removeChild(this.getByElement(ad['closeDiv'])); + } + } + }, + adOtherCloseAll: function() { + if (!this.isUndefined(this.advertisements['other'])) { + var ad = this.advertisements['other']; + for (var i = 0; i < ad.length; i++) { + this.adOtherClose(i); + } + } + }, + /* + 计算其它广告的坐标 + */ + adOtherCoor: function() { + if (!this.isUndefined(this.advertisements['other'])) { + var arr = this.advertisements['other']; + for (var i = 0; i < arr.length; i++) { + var ad = arr[i]; + if (!this.isUndefined(ad['close'])) { + if (!ad['close']) { + var rr=this.ckStyle['advertisement']['closeOtherButton']; + var coor = this.getPosition(ad); + var x = coor['x'], + y = coor['y']; + this.css(this.getByElement(ad['div']), { + left: x + 'px', + top: y + 'px' + }); + var cxy = this.getPosition(rr,this.getByElement(ad['div'])); + if (!this.isUndefined(ad['closeDiv'])) { + this.css(this.getByElement(ad['closeDiv']), { + left: cxy['x'] + 'px', + top: cxy['y'] + 'px' + }); + } + } + } + } + } + }, + /* + 单独监听中间插入广告 + */ + checkAdInsert: function(t) { + if (this.adPlayerPlay) { + return; + } + var adTime = this.advertisements['inserttime']; + var adPlay = this.advertisements['insertPlay']; + var duration = this.getMetaDate()['duration']; + for (var i = adTime.length - 1; i > -1; i--) { + if (t >= adTime[i] && t < duration - 2 && t > 1 && !adPlay[i]) { //如果播放时间大于广告时间而该广告还没有播放,则开始播放 + this.adI = 0; + this.adType = 'insert'; + this.adMuteInto(); + this.adIsVideoTime = true; + this.adPlayStart = true; + this.adVideoPlay = false; + this.videoPause(); + this.advertisementsTime(); + this.advertisementsPlay(); + this.adSkipButtonShow(); + adPlay[i] = true; + for (var n = 0; n < i + 1; n++) { + adPlay[n] = true; + } + break; + } + } + }, + /*格式化中间插入广告的播放时间*/ + formatInserttime: function(duration) { + if (!this.isUndefined(this.advertisements['inserttime'])) { + var arr = this.advertisements['inserttime']; + var newArr = []; + for (var i = 0; i < arr.length; i++) { + if (arr[i].toString().substr( - 1) == '%') { + newArr.push(parseInt(duration * parseInt(arr[i]) * 0.01)); + } else { + newArr.push(parseInt(arr[i])); + } + } + this.advertisements['inserttime'] = newArr; + } + }, + /*获取当前的广告*/ + getNowAdvertisements: function() { + if (this.adI == -1) { + return { + file: '', + time: 0, + link: '' + }; + } + return this.advertisements[this.adType][this.adI]; + }, + /*根据元件尺寸和播放器尺寸调整大小*/ + adjustmentWH: function(w, h) { + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + var nw = 0, + nh = 0; + if (w >= width || h >= height) { + if (width / w > height / h) { + nh = height - 20; + nw = w * nh / h; + } else { + nw = width - 20; + nh = h * nw / w; + } + } else { + nw = w; + nh = h; + } + return { + width: nw, + height: nh + } + }, + /*单独请求一次地址,但不处理返回的数据*/ + ajaxSuccessNull: function(url) { + if (!this.isUndefined(url)) { + var ajaxObj = { + url: url, + success: function(data) {} + }; + this.ajax(ajaxObj); + } + }, + /* + 内部函数 + 运行指定函数 + */ + runFunction: function(s) { + try { + var arr = s.split('->'); + if(arr.length==2){ + switch (arr[0]) { + case 'javaScript': + if(arr[1].substr(0,11)!='[flashvars]'){ + eval(arr[1] + '()'); + } + else{ + eval(this.vars[arr[1].substr(11)] + '()'); + } + break; + case 'actionScript': + eval('this.' + arr[1] + '()'); + break; + } + } + this.sendJS('clickEvent', s); + } catch(event) {} + }, + /* + 内部函数 + 使用画布附加视频 + */ + sendVCanvas: function() { + if (this.timerVCanvas == null) { + this.css(this.V, 'display', 'none'); + this.css(this.MD, 'display', 'block'); + var thisTemp = this; + var videoCanvas = function() { + if (thisTemp.MDCX.width != thisTemp.MD.offsetWidth) { + thisTemp.MDC.width = thisTemp.MD.offsetWidth; + } + if (thisTemp.MDCX.height != thisTemp.MD.offsetHeight) { + thisTemp.MDC.height = thisTemp.MD.offsetHeight; + } + thisTemp.MDCX.clearRect(0, 0, thisTemp.MDCX.width, thisTemp.MDCX.height); + var coor = thisTemp.getProportionCoor(thisTemp.PD.offsetWidth, thisTemp.PD.offsetHeight, thisTemp.V.videoWidth, thisTemp.V.videoHeight); + thisTemp.MDCX.drawImage(thisTemp.V, 0, 0, thisTemp.V.videoWidth, thisTemp.V.videoHeight, coor['x'], coor['y'], coor['width'], coor['height']); + }; + this.timerVCanvas = new this.timer(0, videoCanvas); + } + }, + /* + 内部函数 + 监听暂停 + */ + pauseHandler: function() { + var thisTemp = this; + this.playShow(false); + if (this.animatePauseArray.length > 0) { + this.animatePause('pause'); + } + if (this.playerType == 'html5video' && this.V != null && this.ckConfig['config']['videoDrawImage']) { + this.stopVCanvas(); + } + if (!this.isUndefined(this.advertisements['pause']) && !this.adPlayStart && !this.adPauseShow) { //如果存在暂停广告 + setTimeout(function() { + if (!thisTemp.isUndefined(thisTemp.advertisements['pause']) && !thisTemp.adPlayStart && !thisTemp.adPauseShow && thisTemp.time > 1) { //如果存在暂停广告 + thisTemp.adPausePlayer(); + } + }, + 300); + } + }, + /* + 内部函数 + 停止画布 + */ + stopVCanvas: function() { + if (this.timerVCanvas != null) { + this.css(this.V, 'display', 'block'); + this.css(this.MD, 'display', 'none'); + if (this.timerVCanvas.runing) { + this.timerVCanvas.stop(); + } + this.timerVCanvas = null; + } + }, + /* + 内部函数 + 根据当前播放还是暂停确认图标显示 + */ + playShow: function(b) { + if (!this.conBarShow) { + return; + } + if (b) { + this.css(this.CB['play'], 'display', 'none'); + this.css(this.CB['pauseCenter'], 'display', 'none'); + this.css(this.CB['pause'], 'display', 'block'); + } else { + this.css(this.CB['play'], 'display', 'block'); + if (this.css(this.CB['errorText'], 'display') == 'none') { + if (!this.adPlayerPlay) { + this.css(this.CB['pauseCenter'], 'display', 'block'); + } + + } else { + this.css(this.CB['pauseCenter'], 'display', 'none'); + } + this.css(this.CB['pause'], 'display', 'none'); + } + }, + /* + 内部函数 + 监听seek结束 + */ + seekedHandler: function() { + this.resetTrack(); + this.isTimeButtonMove = true; + if (this.V.paused) { + if(this.hlsAutoPlay){ + this.videoPlay(); + } + else{ + this.hlsAutoPlay=true; + } + } + }, + /* + 内部函数 + 监听播放结束 + */ + endedHandler: function() { + this.sendJS('ended'); + if (this.adPlayerPlay) { + this.adI++; + this.advertisementsPlay(); + return; + } + if (!this.endAdPlay && !this.isUndefined(this.advertisements['end'])) { + this.endAdPlay = true; + this.adI = 0; + this.adType = 'end'; + this.adMuteInto(); + this.adIsVideoTime = true; + this.adPlayStart = true; + this.adVideoPlay = false; + this.videoPause(); + this.advertisementsTime(); + this.advertisementsPlay(); + this.adSkipButtonShow(); + this.adReset = true; + return; + } + this.endedAdReset(); + if (this.vars['loop']) { + this.videoSeek(0); + } + }, + /* + 重置结束后相关的设置 + */ + endedAdReset: function() { + var arr = []; + var i = 0; + if (!this.isUndefined(this.advertisements['insertPlay'])) { + arr = this.advertisements['insertPlay']; + for (i = 0; i < arr.length; i++) { + this.advertisements['insertPlay'][i] = false; + } + } + if (!this.isUndefined(this.advertisements['otherPlay'])) { + arr = this.advertisements['otherPlay']; + for (i = 0; i < arr.length; i++) { + this.advertisements['otherPlay'][i] = false; + } + } + //this.endAdPlay=false; + }, + /* + 内部函数 + 监听音量改变 + */ + volumechangeHandler: function() { + if (!this.conBarShow) { + return; + } + if ((this.ckConfig['config']['mobileVolumeBarShow'] || !this.isMobile()) && this.css(this.CB['volume'], 'display') != 'none') { + try { + var volume=this.volume || this.V.volume; + if (volume > 0) { + this.css(this.CB['mute'], 'display', 'block'); + this.css(this.CB['escMute'], 'display', 'none'); + } else { + this.css(this.CB['mute'], 'display', 'none'); + this.css(this.CB['escMute'], 'display', 'block'); + } + } catch(event) {} + } + }, + /* + 内部函数 + 监听播放时间调节进度条 + */ + timeUpdateHandler: function() { + var duration = 0; + if (this.playerType == 'html5video') { + try { + duration = this.V.duration; + } catch(event) {} + } + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + if (duration > 0) { + this.time = this.V.currentTime; + this.timeTextHandler(); + this.trackShowHandler(); + if (this.isTimeButtonMove) { + this.timeProgress(this.time, duration); + } + } + }, + /* + 内部函数 + 改变控制栏坐标 + */ + controlBar:function(){ + //控制栏背景 + var cb=this.ckStyle['controlBar']; + var cssObjTemp={ + align:cb['align'], + vAlign:cb['vAlign'], + width:cb['width'], + height:cb['height'], + offsetX:cb['offsetX'], + offsetY:cb['offsetY'] + + }; + var bgCss={ + backgroundColor:cb['background']['backgroundColor'], + backgroundImg:cb['background']['backgroundImg'], + alpha:cb['background']['alpha'] + }; + var cssTemp=this.getEleCss(this.objectAssign(cssObjTemp,bgCss),{zIndex:888}); + this.css(this.CB['controlBarBg'], cssTemp); + //控制栏容器 + cssTemp=this.getEleCss(cssObjTemp,{zIndex:889}); + this.css(this.CB['controlBar'], cssTemp); + }, + /* + 内部函数 + 按时间改变进度条 + */ + timeProgress: function(time, duration) { + if (!this.conBarShow) { + return; + } + var timeProgressBgW = this.CB['timeProgressBg'].offsetWidth; + var timeBOW = parseInt((time * timeProgressBgW / duration) - (this.CB['timeButton'].offsetWidth * 0.5)); + if (timeBOW > timeProgressBgW - this.CB['timeButton'].offsetWidth) { + timeBOW = timeProgressBgW - this.CB['timeButton'].offsetWidth; + } + if (timeBOW < 0) { + timeBOW = 0; + } + this.css(this.CB['timeProgress'], 'width', timeBOW + 'px'); + this.css(this.CB['timeButton'], 'left', parseInt(timeBOW) + 'px'); + }, + /* + 内部函数 + 监听播放时间改变时间显示文本框 + */ + timeTextHandler: function() { //显示时间/总时间 + if (!this.conBarShow) { + return; + } + var duration = this.V.duration; + var time = this.V.currentTime; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + this.CB['timeText'].innerHTML = this.formatTime(time,duration,this.ckLanguage['vod']); + + }, + /* + 内部函数 + 监听是否是缓冲状态 + */ + bufferEdHandler: function() { + if (!this.conBarShow || this.playerType == 'flashplayer') { + return; + } + var thisTemp = this; + var clearTimerBuffer = function() { + if (thisTemp.timerBuffer != null) { + if (thisTemp.timerBuffer.runing) { + thisTemp.sendJS('buffer', 100); + thisTemp.timerBuffer.stop(); + } + thisTemp.timerBuffer = null; + } + }; + clearTimerBuffer(); + var bufferFun = function() { + if (!thisTemp.isUndefined(thisTemp.V) && thisTemp.V.buffered.length > 0) { + var duration = thisTemp.V.duration; + var len = thisTemp.V.buffered.length; + var bufferStart = thisTemp.V.buffered.start(len - 1); + var bufferEnd = thisTemp.V.buffered.end(len - 1); + var loadTime = bufferStart + bufferEnd; + var loadProgressBgW = thisTemp.CB['timeProgressBg'].offsetWidth; + var timeButtonW = thisTemp.CB['timeButton'].offsetWidth; + var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); + if (loadW >= loadProgressBgW) { + loadW = loadProgressBgW; + clearTimerBuffer(); + } + thisTemp.changeLoad(loadTime); + } + }; + this.timerBuffer = new this.timer(200, bufferFun); + }, + /* + 内部函数 + 单独计算加载进度 + */ + changeLoad: function(loadTime) { + if (this.V == null) { + return; + } + if (!this.conBarShow) { + return; + } + var loadProgressBgW = this.CB['timeProgressBg'].offsetWidth; + var timeButtonW = this.CB['timeButton'].offsetWidth; + var duration = this.V.duration; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + if (this.isUndefined(loadTime)) { + loadTime = this.loadTime; + } else { + this.loadTime = loadTime; + } + var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); + this.css(this.CB['loadProgress'], 'width', loadW + 'px'); + this.sendJS('loadTime',loadTime); + this.loadTimeTemp=loadTime; + }, + /* + 内部函数 + 判断是否是直播 + */ + judgeIsLive: function() { + var thisTemp = this; + if (this.timerError != null) { + if (this.timerError.runing) { + this.timerError.stop(); + } + this.timerError = null; + } + this.error = false; + if (this.conBarShow) { + this.css(this.CB['errorText'], 'display', 'none'); + } + var timeupdate = function(event) { + thisTemp.timeUpdateHandler(); + }; + if (!this.vars['live']) { + if (this.V != null && this.playerType == 'html5video') { + this.addListenerInside('timeupdate', timeupdate); + thisTemp.timeTextHandler(); + thisTemp.prompt(); //添加提示点 + setTimeout(function() { + thisTemp.bufferEdHandler(); + }, + 200); + } + } else { + this.removeListenerInside('timeupdate', timeupdate); + if (this.timerTime != null) { + window.clearInterval(this.timerTime); + timerTime = null; + } + if (this.timerTime != null) { + if (this.timerTime.runing) { + this.timerTime.stop(); + } + this.timerTime = null; + } + var timeFun = function() { + if (thisTemp.V != null && !thisTemp.V.paused && thisTemp.conBarShow) { + thisTemp.CB['timeText'].innerHTML = thisTemp.formatTime(0,0,thisTemp.ckLanguage['live']); //时间显示框默认显示内容 + } + }; + this.timerTime = new this.timer(1000, timeFun); + //timerTime.start(); + } + this.definition(); + }, + /* + 内部函数 + 加载字幕 + */ + loadTrack: function(def) { + if (this.playerType == 'flashplayer' || this.vars['flashplayer'] == true) { + return; + } + if(this.isUndefined(def)){ + def=-1; + } + var track = this.vars['cktrack']; + var loadTrackUrl=''; + var type=this.varType(track); + var thisTemp = this; + if(type=='array'){ + if(def==-1){ + var index=0; + var indexN=0; + for(var i=0;iindexN){ + indexN=li[2]; + index=i; + } + } + } + else{ + index=def; + } + loadTrackUrl=track[index][0]; + } + else{ + loadTrackUrl=track; + } + var obj = { + method: 'get', + dataType: 'text', + url: loadTrackUrl, + charset: 'utf-8', + success: function(data) { + if(data){ + thisTemp.track = thisTemp.parseSrtSubtitles(data); + thisTemp.trackIndex = 0; + thisTemp.nowTrackShow = { + sn: '' + } + } + + } + }; + this.ajax(obj); + }, + /* + 内部函数 + 重置字幕 + */ + resetTrack: function() { + this.trackIndex = 0; + this.nowTrackShow = { + sn: '' + }; + }, + /* + 内部函数 + 根据时间改变读取显示字幕 + */ + trackShowHandler: function() { + if (!this.conBarShow || this.adPlayerPlay) { + return; + } + if (this.track.length < 1) { + return; + } + if (this.trackIndex >= this.track.length) { + this.trackIndex = 0; + } + var nowTrack = this.track[this.trackIndex]; //当前编号对应的字幕内容 + /* + this.nowTrackShow=当前显示在界面上的内容 + 如果当前时间正好在nowTrack时间内,则需要判断 + */ + if (this.time >= nowTrack['startTime'] && this.time <= nowTrack['endTime']) { + /* + 如果当前显示的内容不等于当前需要显示的内容时,则需要显示正确的内容 + */ + var nowShow = this.nowTrackShow; + if (nowShow['sn'] != nowTrack['sn']) { + this.trackHide(); + this.trackShow(nowTrack); + this.nowTrackTemp=nowTrack; + } + } else { + /* + 如果当前播放时间不在当前编号字幕内,则需要先清空当前的字幕内容,再显示新的字幕内容 + */ + this.trackHide(); + this.checkTrack(); + } + }, + trackShowAgain:function(){ + this.trackHide(); + this.trackShow(this.nowTrackTemp); + }, + /* + 内部函数 + 显示字幕内容 + */ + trackShow: function(track) { + this.nowTrackShow = track; + var arr = track['content']; + for (var i = 0; i < arr.length; i++) { + var obj = { + list: [{ + type: 'text', + text: arr[i], + color: this.ckStyle['cktrack']['color'], + size: this.ckStyle['cktrack']['size'], + fontFamily: this.ckStyle['cktrack']['font'], + lineHeight: this.ckStyle['cktrack']['leading']+'px' + }], + position: [1, 2, null, -(arr.length - i) * this.ckStyle['cktrack']['leading'] - this.ckStyle['cktrack']['marginBottom']] + }; + var ele = this.addElement(obj); + this.trackElement.push(ele); + } + }, + /* + 内部函数 + 隐藏字幕内容 + */ + trackHide: function() { + for (var i = 0; i < this.trackElement.length; i++) { + this.deleteElement(this.trackElement[i]); + } + this.trackElement = []; + }, + /* + 内部函数 + 重新计算字幕的编号 + */ + checkTrack: function() { + var num = this.trackIndex; + var arr = this.track; + var i = 0; + for (i = num; i < arr.length; i++) { + if (this.time >= arr[i]['startTime'] && this.time <= arr[i]['endTime']) { + this.trackIndex = i; + break; + } + } + }, + /* + -----------------------------------------------------------------------------接口函数开始 + 接口函数 + 在播放和暂停之间切换 + */ + playOrPause: function() { + if (!this.loaded) { + return; + } + if (this.V == null) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.playOrPause(); + return; + } + if (this.V.paused) { + this.videoPlay(); + } else { + this.videoPause(); + } + }, + /* + 接口函数 + 播放动作 + */ + videoPlay: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoPlay(); + return; + } + if (this.adPlayerPlay) { + this.eliminateAd(); //清除广告 + return; + } + try { + if (this.V.currentSrc) { + this.V.play(); + } + } catch(event) {} + }, + /* + 接口函数 + 暂停动作 + */ + videoPause: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoPause(); + return; + } + try { + this.V.pause(); + } catch(event) {} + }, + /* + 接口函数 + 跳转时间动作 + */ + videoSeek: function(time) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoSeek(time); + return; + } + var duration = this.V.duration>0.2?this.V.duration:this.getMetaDate()['duration']; + if (duration > 0 && time > duration) { + if(this.vars['forceduration']>0){ + time=0; + this.sendJS('ended'); + } + else{ + time = duration-0.1; + } + } + if (time >= 0) { + this.V.currentTime = time; + this.sendJS('seekTime', time); + } + }, + /* + 接口函数 + 调节音量/获取音量 + */ + changeVolume: function(vol, bg, button) { + if (this.loaded) { + if (this.playerType == 'flashplayer') { + this.V.changeVolume(vol); + return; + } + } + if (isNaN(vol) || this.isUndefined(vol)) { + vol = 0; + } + if (!this.loaded) { + this.vars['volume'] = vol; + } + if (!this.html5Video) { + this.V.changeVolume(vol); + return; + } + try { + if (this.isUndefined(bg)) { + bg = true; + } + } catch(e) {} + try { + if (this.isUndefined(button)) { + button = true; + } + } catch(e) {} + if (!vol) { + vol = 0; + } + if (vol < 0) { + vol = 0; + } + if (vol > 1) { + vol = 1; + } + try { + this.V.volume = vol; + } catch(error) {} + this.volume = vol; + if (bg && this.conBarShow) { + var bgW = vol * this.CB['volumeBg'].offsetWidth; + if (bgW < 0) { + bgW = 0; + } + if (bgW > this.CB['volumeBg'].offsetWidth) { + bgW = this.CB['volumeBg'].offsetWidth; + } + this.css(this.CB['volumeUp'], 'width', bgW + 'px'); + } + + if (button && this.conBarShow) { + var buLeft = parseInt(this.CB['volumeUp'].offsetWidth - (this.CB['volumeBO'].offsetWidth * 0.5)); + if (buLeft > this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth) { + buLeft = this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth + } + if (buLeft < 0) { + buLeft = 0; + } + this.css(this.CB['volumeBO'], 'left', buLeft + 'px'); + } + }, + /* + 接口函数 + 静音 + */ + videoMute: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoMute(); + return; + } + this.volumeTemp = this.V ? (this.V.volume > 0 ? this.V.volume: this.vars['volume']) : this.vars['volume']; + this.changeVolume(0); + }, + /* + 接口函数 + 取消静音 + */ + videoEscMute: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoEscMute(); + return; + } + this.changeVolume(this.volumeTemp > 0 ? this.volumeTemp: this.vars['volume']); + }, + /* + 接口函数 + 视频广告静音 + */ + adMute: function() { + if (!this.loaded) { + return; + } + this.changeVolume(0); + this.adVideoMute = true; + this.css(this.CB['adEscMute'], 'display', 'block'); + this.css(this.CB['adMute'], 'display', 'none'); + }, + /* + 接口函数 + 视频广告取消静音 + */ + escAdMute: function() { + if (!this.loaded) { + return; + } + var v = this.ckStyle['advertisement']['videoVolume']; + this.changeVolume(v); + this.adMuteInto(); + }, + /* + 初始化广告的音量按钮 + */ + adMuteInto: function() { + this.adVideoMute = false; + this.css(this.CB['adEscMute'], 'display', 'none'); + this.css(this.CB['adMute'], 'display', 'block'); + }, + /* + 接口函数 + 快退 + */ + fastBack: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.fastBack(); + return; + } + var time = this.time - this.ckConfig['config']['timeJump']; + if (time < 0) { + time = 0; + } + this.videoSeek(time); + }, + /* + 接口函数 + 快进 + */ + fastNext: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.fastNext(); + return; + } + var time = this.time + this.ckConfig['config']['timeJump']; + if (time > this.V.duration) { + time = this.V.duration; + } + this.videoSeek(time); + }, + /* + 接口函数 + 获取当前播放的地址 + */ + getCurrentSrc: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + return this.V.getCurrentSrc(); + } + return this.V.currentSrc; + }, + /* + 内置函数 + 全屏/退出全屏动作,该动作只能是用户操作才可以触发,比如用户点击按钮触发该事件 + */ + switchFull: function() { + if (this.full) { + this.quitFullScreen(); + } else { + this.fullScreen(); + } + }, + /* + 内置函数 + 全屏动作,该动作只能是用户操作才可以触发,比如用户点击按钮触发该事件 + */ + fullScreen: function() { + if (this.html5Video && this.playerType == 'html5video') { + var element = this.PD; + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else if (element.oRequestFullscreen) { + element.oRequestFullscreen(); + } + this.judgeFullScreen(); + } else { + //this.V.fullScreen(); + } + }, + /* + 接口函数 + 退出全屏动作 + */ + quitFullScreen: function() { + if (this.html5Video && this.playerType == 'html5video') { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.oRequestFullscreen) { + document.oCancelFullScreen(); + } else if (document.requestFullscreen) { + document.requestFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else { + this.css(document.documentElement, 'cssText', ''); + this.css(document.document.body, 'cssText', ''); + this.css(this.PD, 'cssText', ''); + } + this.judgeFullScreen(); + } + }, + /* + 下面列出只有flashplayer里支持的 + */ + videoRotation: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoRotation(n); + return; + } + if (this.isUndefined(n)) { + n = 0; + } + var tf = this.css(this.V, 'transform'); + if (this.isUndefined(tf) && !tf) { + tf = 'rotate(0deg)'; + } + var reg = tf.match(/rotate\([^)]+\)/); + reg = reg ? reg[0].replace('rotate(', '').replace('deg)', '') : ''; + if (reg == '') { + reg = 0; + } else { + reg = parseInt(reg); + } + if (n == -1) { + reg -= 90; + } else if (n == 1) { + reg += 90; + } else { + if (n != 90 && n != 180 && n != 270 && n != -90 && n != -180 && n != -270) { + reg = 0; + } else { + reg = n; + } + } + n = reg; + var y90 = n % 90, + y180 = n % 180, + y270 = n % 270; + var ys = false; + if (y90 == 0 && y180 == 90 && y270 == 90) { + ys = true; + } + if (y90 == 0 && y180 == 90 && y270 == 0) { + ys = true; + } + if (y90 == -0 && y180 == -90 && y270 == -90) { + ys = true; + } + if (y90 == -0 && y180 == -90 && y270 == -0) { + ys = true; + } + tf = tf.replace(/rotate\([^)]+\)/, '').replace(/scale\([^)]+\)/, '') + ' rotate(' + n + 'deg)'; + var cdW = this.CD.offsetWidth, + cdH = this.CD.offsetHeight, + vW = this.V.videoWidth, + vH = this.V.videoHeight; + if (vW > 0 && vH > 0) { + if (ys) { + if (cdW / cdH > vH / vW) { + nH = cdH; + nW = vH * nH / vW; + } else { + nW = cdW; + nH = vW * nW / vH; + } + this.css(this.V, 'transform', 'rotate(0deg)'); + this.css(this.V, 'transform', 'scale(' + nH / cdW + ',' + nW / cdH + ')' + tf); + } else { + this.css(this.V, 'transform', tf); + } + } else { + this.css(this.V, 'transform', tf); + } + return; + }, + videoBrightness: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoBrightness(n); + return; + } + }, + videoContrast: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoContrast(n); + return; + } + }, + videoSaturation: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoSaturation(n); + return; + } + }, + videoHue: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoHue(n); + return; + } + }, + videoZoom: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoZoom(n); + return; + } + if (this.isUndefined(n)) { + n = 1; + } + if (n < 0) { + n = 0; + } + if (n > 2) { + n = 2; + } + var tf = this.css(this.V, 'transform'); + tf = tf.replace(/scale\([^)]+\)/, '') + ' scale(' + n + ')'; + this.videoScale = n; + this.css(this.V, 'transform', tf); + return; + }, + videoProportion: function(w, h) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoProportion(w, h); + return; + } + }, + adPlay: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.adPlay(); + return; + } + if (this.adPlayerPlay) { + this.adIsPause = false; + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (this.isStrImage(type)) { + this.adCountDown(); + } else { + this.V.play(); + } + } + }, + adPause: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.adPause(); + return; + } + if (this.adPlayerPlay) { + this.adIsPause = true; + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (type != 'jpg' && type != 'jpeg' && type != 'png' && type != 'svg' && type != 'gif') { + this.videoPause(); + } + } + }, + videoError: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoError(n); + return; + } + }, + changeConfig: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + var args = Array.prototype.slice.call(arguments); + switch(args.length){ + case 1: + this.V.changeConfig(args[0]); + break; + case 2: + this.V.changeConfig(args[0],args[1]); + break; + case 3: + this.V.changeConfig(args[0],args[1],args[2]); + break; + case 4: + this.V.changeConfig(args[0],args[1],args[2],args[3]); + break; + case 5: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4]); + break; + case 6: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5]); + break; + case 7: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6]); + break; + case 8: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]); + break; + case 8: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]); + break; + } + return; + } + var obj = this.ckConfig; + var arg = arguments; + for (var i = 0; i < arg.length - 1; i++) { + if (obj.hasOwnProperty(arg[i])) { + obj = obj[arg[i]]; + } else { + return; + } + } + var val = arg[arg.length - 1]; + switch (arg.length) { + case 2: + this.ckConfig[arg[0]] = val; + break; + case 3: + this.ckConfig[arg[0]][arg[1]] = val; + break; + case 4: + this.ckConfig[arg[0]][arg[1]][arg[2]] = val; + break; + case 5: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]] = val; + break; + case 6: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]] = val; + break; + case 7: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]] = val; + break; + case 8: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]] = val; + break; + case 9: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]] = val; + break; + case 10: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]][arg[8]] = val; + break; + default: + break; + } + this.sendJS('configChange', this.ckConfig); + }, + custom: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.custom(arguments); + return; + } + if(this.isUndefined(arguments)){ + return; + } + var type='',name='',display=''; + if(arguments.length==4){//控制栏 + type='controlBar-'+arguments[1]; + name=arguments[2]; + display=arguments[3]?'block':'none'; + } + else if(arguments.length==3){//播放器 + type='player-'+arguments[0]; + name=arguments[1]; + display=arguments[2]?'block':'none'; + } + else{ + return; + } + for(var k in this.customeElement){ + var obj=this.customeElement[k]; + if(obj['type']==type && obj['name']==name){ + this.css(obj['ele'],'display',display); + } + } + }, + getConfig: function() { + if (!this.loaded) { + return null; + } + if (this.playerType == 'flashplayer') { + return this.V.getConfig(arguments); + } + else{ + var temp=this.ckConfig; + for(var index in arguments) { + try{ + temp=temp[arguments[index]]; + } + catch(error){ + temp=null; + } + }; + return temp; + } + }, + openUrl: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.openUrl(n); + return; + } + }, + /* + 接口函数 + 清除视频 + */ + videoClear: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoClear(); + return; + } + this.V.innerHTML=''; + this.V.src=''; + }, + /* + 接口函数 + 向播放器传递新的视频地址 + */ + newVideo: function(c) { + if (this.playerType == 'flashplayer') { + this.V.newVideo(c); + return; + } else { + this.embed(c); + } + }, + /* + 接口函数 + 截图 + */ + screenshot: function(obj, save, name) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + try { + this.V.screenshot(obj, save, name); + } catch(error) { + this.log(error); + } + return; + } + if (obj == 'video') { + var newCanvas = document.createElement('canvas'); + newCanvas.width = this.V.videoWidth; + newCanvas.height = this.V.videoHeight; + newCanvas.getContext('2d').drawImage(this.V, 0, 0, this.V.videoWidth, this.V.videoHeight); + try { + var base64 = newCanvas.toDataURL('image/jpeg'); + this.sendJS('screenshot', { + object: obj, + save: save, + name: name, + base64: base64 + }); + } catch(error) { + this.log(error); + } + } + }, + /* + 接口函数 + 改变播放器尺寸 + */ + changeSize: function(w, h) { + if (this.isUndefined(w)) { + w = 0; + } + if (this.isUndefined(h)) { + h = 0; + } + if (w > 0) { + this.css(this.CD, 'width', w + 'px'); + } + if (h > 0) { + this.css(this.CD, 'height', h + 'px'); + } + if (this.html5Video) { + this.playerResize(); + } + }, + /* + 重置播放器界面 + */ + playerResize:function(){ + this.controlBar();//控制栏按钮 + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//自定义元件的位置重置 + this.timeProgressDefault();//进度条默认样式 + this.videoCss();//计算video的宽高和位置 + this.timeUpdateHandler();//修改进度条样式 + this.changeElementCoor(); //修改新加元件的坐标 + this.changePrompt();//重置提示点 + this.advertisementStyle();//广告控制样式 + this.adPauseCoor(); + this.adOtherCoor(); + this.changeLoad(); + this.sendJS('resize'); + }, + /* + 接口函数 + 改变视频播放速度 + */ + changePlaybackRate: function(n) { + if (this.html5Video) { + var arr = this.playbackRateArr; + n = parseInt(n); + if (n < arr.length) { + this.newPlaybackrate(arr[n][1]); + } + } + }, + /* + 内部函数 + 注册控制控制栏显示与隐藏函数 + */ + changeControlBarShow: function(show) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeControlBarShow(show); + return; + } + if (show) { + this.controlBarIsShow = true; + this.controlBarHide(false); + } else { + this.controlBarIsShow = false; + this.controlBarHide(true); + } + }, + /* + ----------------------------------------------------------------------- + 调用flashplayer + */ + embedSWF: function() { + var vid = 'ckplayer-'+this.randomString(); + var flashvars = this.getFlashVars(); + var param = this.getFlashplayerParam(); + var flashplayerUrl = 'http://www.macromedia.com/go/getflashplayer'; + var html = '', + src = ckplayerPath + 'ckplayer.swf'; + id = 'id="' + vid + '" name="' + vid + '" '; + html += ''; + html += param['v']; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + this.PD.innerHTML = html; + this.V = this.getObjectById(vid); //V:定义播放器对象全局变量 + this.playerType = 'flashplayer'; + }, + /* + 判断浏览器是否支持flashplayer + */ + checkShockwaveFlash:function(){ + if(window.ActiveXObject) { + try { + var s = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + if(s) { + return true; + } + } catch(e) {} + } else { + try { + var s = navigator.plugins['Shockwave Flash']; + if(s) { + return true; + } + } catch(e) {} + } + return false; + }, + /* + 内置函数 + 将vars对象转换成字符 + */ + getFlashVars: function() { + this.getVarsObject(); + var v = this.vars; + var z = ''; + for (k in v) { + if (k != 'flashplayer' && k != 'container' && v[k] != '') { + if (z != '') { + z += '&'; + } + var vk = v[k]; + if (vk == true) { + vk = 1; + } + if (vk == false) { + vk = 0; + } + z += k + '=' + vk; + } + + } + if (!v.hasOwnProperty('volume') || !v['volume']) { + if (z != '') { + z += '&'; + } + z += 'volume=0'; + } + return z; + }, + /*判断字符串是否是图片*/ + isStrImage: function(s) { + if (s == 'jpg' || s == 'jpeg' || s == 'png' || s == 'svg' || s == 'gif') { + return true; + } + return false; + }, + /* + 内置函数 + 将vars格式化成flash能接受的对象。再由getFlashVars函数转化成字符串或由newVideo直接使用 + */ + getVarsObject: function() { + var v = this.vars; + var f = '', + d = '', + w = ''; //f=视频地址,d=清晰度地址,w=权重,z=最终地址 + var arr = this.VA; + var prompt = v['promptSpot']; + var i = 0; + var video = this.vars['video']; + if (this.varType(video) == 'array') { //对象或数组 + var arr = video; + for (i = 0; i < arr.length; i++) { + var arr2 = arr[i]; + if (arr2) { + if (f != '') { + f += this.ckConfig['config']['split']; + d += ','; + w += ','; + v['type'] += this.ckConfig['config']['split']; + } + f += encodeURIComponent(decodeURIComponent(arr2[0])); + d += arr2[2]; + w += arr2[3]; + v['type'] += arr2[1].replace('video/', ''); + } + } + } + else if (this.varType(video) == 'object') { //对象或数组 + f = encodeURIComponent(decodeURIComponent(video['file'])); + if (!this.isUndefined(video['type'])) { + v['type'] = video['type']; + } + d = ''; + w = ''; + } + else { + f = encodeURIComponent(decodeURIComponent(video)); + } + if (v['preview'] != null) { + v['previewscale'] = v['preview']['scale']; + v['preview'] = v['preview']['file'].join(','); + + } + if (prompt != null) { + v['promptspot'] = ''; + v['promptspottime'] = ''; + for (i = 0; i < prompt.length; i++) { + if (v['promptspot'] != '') { + v['promptspot'] += ','; + v['promptspottime'] += ','; + } + v['promptspot'] += prompt[i]['words']; + v['promptspottime'] += prompt[i]['time']; + } + + } + if (f != '') { + v['video'] = f; + v['definition'] = d; + v['weight'] = w; + } + if (!v['volume']) { + v['volume'] = 0; + } + var newV = {}; + + for (var k in v) { + if (v[k] != null) { + newV[k] = v[k]; + } + if (k == 'type') { + newV[k] = v[k].replace('video/m3u8', 'm3u8'); + } + } + + this.vars = newV; + }, + /* + 内置函数 + 将embedSWF里的param的对象进行转换 + */ + getFlashplayerParam: function() { + var w = '', + v = '', + o = { + allowScriptAccess: 'always', + allowFullScreen: true, + quality: 'high', + bgcolor: '#000' + }; + for (var e in o) { + w += e + '="' + o[e] + '" '; + v += ''; + } + w = w.replace('movie=', 'src='); + return { + w: w, + v: v + }; + }, + + /* + 操作动作结束 + ----------------------------------------------------------------------- + + 接口函数 + 获取元数据部分 + */ + getMetaDate: function() { + if (!this.loaded || this.V == null) { + return false; + } + if (this.playerType == 'html5video') { + var duration = 0; + try { + duration = !isNaN(this.V.duration) ? this.V.duration: 0; + if (isNaN(duration) || parseInt(duration) < 0.2) { + if(this.vars['duration']>0){ + duration=this.vars['duration']; + } + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + } catch(event) { + this.log(event); + } + var data = { + duration: duration, + volume: this.V.volume, + playbackRate: this.V.playbackRate, + width: this.PD.offsetWidth || this.V.offsetWidth || this.V.width, + height: this.PD.offsetHeight || this.V.offsetHeight || this.V.height, + streamWidth: this.V.videoWidth, + streamHeight: this.V.videoHeight, + videoWidth: this.V.offsetWidth, + videoHeight: this.V.offsetHeight, + paused: this.V.paused, + loadTime:this.loadTimeTemp + }; + return data; + } else { + try { + return this.V.getMetaDate(); + } catch(event) { + this.log(event); + } + } + return false; + }, + /* + 接口函数 + 取当前提供给播放器播放的视频列表 + */ + getVideoUrl: function() { + if (this.playerType == 'flashplayer') { + return this.V.getVideoUrl(); + } + var arr = []; + if (this.V.src) { + arr.push(this.V.src); + } else { + var uArr = this.V.childNodes; + for (var i = 0; i < uArr.length; i++) { + arr.push(uArr[i].src); + } + } + return arr; + }, + /* + 内置函数 + 格式化函数 + */ + clickEvent: function(call) { + if (call == 'none' || call == '' || call == null) { + return { + type: 'none' + }; + } + var callArr = call.split('->'); + var type = '', + fun = '', + link = '', + target = ''; + if (callArr.length == 2) { + var callM = callArr[0]; + var callE = callArr[1]; + if (!callE) { + return { + type: 'none' + }; + } + var val = ''; + var eArr = []; + type = callM; + switch (callM) { + case 'actionScript': + //trace(THIS.hasOwnProperty(callE)); + if (callE.indexOf('(') > -1) { + eArr = callE.split('('); + callE = eArr[0]; + val = eArr[1].replace(')', ''); + } + if (val == '') { + fun = 'thisTemp.' + callE + '()'; + } else { + fun = 'thisTemp.' + callE + '(' + val + ')'; + } + break; + case 'javaScript': + if (callE.substr(0, 11) == '[flashvars]') { + callE = callE.substr(11); + if (this.vars.hasOwnProperty(callE)) { + callE = this.vars[callE]; + } else { + break; + } + + } + if (callE.indexOf('(') > -1) { + eArr = callE.split('('); + callE = eArr[0]; + val = eArr[1].replace(')', ''); + } + if (val == '') { + fun = callE + '()'; + } else { + fun = callE + '(' + val + ')'; + } + break; + case "link": + var callLink = (callE + ',').split(','); + if (callLink[0].substr(0, 11) == '[flashvars]') { + var fl = callLink[0].replace('[flashvars]', ''); + if (this.vars.hasOwnProperty(fl)) { + callLink[0] = this.vars[fl]; + } else { + break; + } + } + if (!callLink[1]) { + callLink[1] = '_blank'; + } + link = callLink[0]; + target = callLink[1]; + break; + } + } + return { + type: type, + fun: fun, + link: link, + target: target + } + }, + /* + 内置函数 + 根据指定的align,valign,offsetX,offsetY计算坐标 + */ + getPosition: function(obj,rEle) { + /* + { + "align": "right", + "vAlign": "right", + "offsetX": -60, + "offsetY": -60 + } + */ + var pw = this.PD.offsetWidth, + ph = this.PD.offsetHeight; + var x = 0, + y = 0; + var left=0,top=0,rw=0,rh=0; + if(!this.isUndefined(rEle)){ + left=parseInt(this.css(rEle,'left')),top=parseInt(this.css(rEle,'top')),rw=rEle.offsetWidth,rh=rEle.offsetHeight; + } + switch (obj['align']) { + case 'left': + x = obj['offsetX']+left; + break; + case 'center': + x = pw * 0.5 + obj['offsetX']; + if(left){ + x-=(pw*0.5-rw*0.5-left); + } + break; + case 'right': + x = pw + obj['offsetX']; + if(left){ + x-=(pw-left-rw); + } + break; + } + switch (obj['vAlign']) { + case 'top': + y = obj['offsetY']+top; + break; + case 'middle': + y = ph * 0.5 + obj['offsetY']-top-(rh*0.5); + if(top){ + x-=(ph*0.5-rh*0.5-top); + } + break; + case 'bottom': + y = ph + obj['offsetY']; + if(top){ + y-=(ph-top-rh); + } + break; + } + return { + x: x, + y: y + }; + }, + /* + 内置函数 + 向播放器界面添加一个文本 + */ + addElement: function(attribute) { + var thisTemp = this; + if (this.playerType == 'flashplayer') { + return this.V.addElement(attribute); + } + var i = 0; + var obj = { + list: null, + x: '100%', + y: "50%", + position: null, + alpha: 1, + backgroundColor: '', + backAlpha: 1, + backRadius: 0, + clickEvent: '' + }; + obj = this.standardization(obj, attribute); + var list = obj['list']; + if (list == null) { + return ''; + } + var id = 'element-' + this.randomString(10); + var ele = document.createElement('div'); + ele.className = id; + if (obj['x']) { + ele.setAttribute('data-x', obj['x']); + } + if (obj['y']) { + ele.setAttribute('data-y', obj['y']); + } + if (obj['position'] != null) { + ele.setAttribute('data-position', obj['position'].join(',')); + } + + this.PD.appendChild(ele); + this.css(ele, { + position: 'absolute', + filter: 'alpha(opacity:' + obj['alpha'] + ')', + opacity: obj['alpha'].toString(), + width: '800px', + zIndex: '20' + }); + var bgid = 'elementbg' + this.randomString(10); + var bgAlpha = obj['alpha'].toString(); + var bgColor = obj['backgroundColor'].replace('0x', '#'); + var html = ''; + var idArr = []; + var clickArr = []; + if (!this.isUndefined(list) && list.length > 0) { + var textObj, returnObj, clickEvent; + for (i = 0; i < list.length; i++) { + var newEleid = 'elementnew' + this.randomString(10); + switch (list[i]['type']) { + case 'image': + case 'png': + case 'jpg': + case 'jpeg': + case 'gif': + textObj = { + type: 'image', + file: '', + radius: 0,//圆角弧度 + width: 30,//定义宽,必需要定义 + height: 30,//定义高,必需要定义 + alpha: 1,//透明度 + paddingLeft: 0,//左边距离 + paddingRight: 0,//右边距离 + paddingTop: 0, + paddingBottom: 0, + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: '', + clickEvent: '' + }; + + list[i] = this.standardization(textObj, list[i]); + clickEvent = this.clickEvent(list[i]['clickEvent']); + clickArr.push(clickEvent); + if (clickEvent['type'] == 'link') { + html += '
'; + } else { + html += '
'; + } + break; + case 'text': + textObj = { + type: 'text',//说明是文本 + text: '',//文本内容 + color: '0xFFFFFF', + size: 14, + fontFamily: this.fontFamily, + leading: 0, + alpha: 1,//透明度 + paddingLeft: 0,//左边距离 + paddingRight: 0,//右边距离 + paddingTop: 0, + paddingBottom: 0, + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: '', + backAlpha: 1, + backRadius: 0,//背景圆角弧度,支持数字统一设置,也支持分开设置[30,20,20,50],对应上左,上右,下右,下左 + clickEvent: '' + }; + list[i] = this.standardization(textObj, list[i]); + clickEvent = this.clickEvent(list[i]['clickEvent']); + clickArr.push(clickEvent); + if (clickEvent['type'] == 'link') { + html += ''; + } else { + html += '
' + list[i]['text'] + '
'; + } + break; + default: + break; + } + idArr.push(newEleid); + } + } + var objClickEvent = this.clickEvent(obj['clickEvent']); + ele.innerHTML = '
' + html + '
'; + if (objClickEvent['type'] == 'javaScript' || objClickEvent['type'] == 'actionScript') { + var objClickHandler = function() { + eval(objClickEvent['fun']); + thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); + }; + this.addListenerInside('click', objClickHandler, this.getByElement(bgid + '_c')) + } + this.css(bgid + '_c', { + position: 'absolute', + zIndex: '2' + }); + for (i = 0; i < idArr.length; i++) { + var clk = clickArr[i]; + if (clk['type'] == 'javaScript' || clk['type'] == 'actionScript') { + var clickHandler = function() { + //clk = clickArr[this.getAttribute('data-i')]; + clk = clickArr[thisTemp.getDataset(this,'i')]; + eval(clk['fun']); + thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); + }; + this.addListenerInside('click', clickHandler, this.getByElement(idArr[i])) + } + switch (list[i]['type']) { + case 'image': + case 'png': + case 'jpg': + case 'jpeg': + case 'gif': + this.css(idArr[i], { + float: 'left', + width: list[i]['width'] + 'px', + height: list[i]['height'] + 'px', + filter: 'alpha(opacity:' + list[i]['alpha'] + ')', + opacity: list[i]['alpha'].toString(), + marginLeft: list[i]['marginLeft'] + 'px', + marginRight: list[i]['marginRight'] + 'px', + marginTop: list[i]['marginTop'] + 'px', + marginBottom: list[i]['marginBottom'] + 'px', + borderRadius: list[i]['radius'] + 'px', + cursor: 'pointer' + }); + this.css(idArr[i] + '_image', { + width: list[i]['width'] + 'px', + height: list[i]['height'] + 'px', + borderRadius: list[i]['radius'] + 'px' + }); + break; + case 'text': + this.css(idArr[i] + '_text', { + filter: 'alpha(opacity:' + list[i]['alpha'] + ')', + opacity: list[i]['alpha'].toString(), + borderRadius: list[i]['radius'] + 'px', + fontFamily: list[i]['font'], + fontSize: list[i]['size'] + 'px', + color: list[i]['color'].replace('0x', '#'), + lineHeight: list[i]['leading'] > 0 ? list[i]['leading'] + 'px': '', + paddingLeft: list[i]['paddingLeft'] + 'px', + paddingRight: list[i]['paddingRight'] + 'px', + paddingTop: list[i]['paddingTop'] + 'px', + paddingBottom: list[i]['paddingBottom'] + 'px', + whiteSpace: 'nowrap', + position: 'absolute', + zIndex: '3', + cursor: 'pointer' + }); + this.css(idArr[i], { + float: 'left', + width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', + height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', + marginLeft: list[i]['marginLeft'] + 'px', + marginRight: list[i]['marginRight'] + 'px', + marginTop: list[i]['marginTop'] + 'px', + marginBottom: list[i]['marginBottom'] + 'px' + }); + this.css(idArr[i] + '_bg', { + width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', + height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', + filter: 'alpha(opacity:' + list[i]['backAlpha'] + ')', + opacity: list[i]['backAlpha'].toString(), + borderRadius: list[i]['backRadius'] + 'px', + backgroundColor: list[i]['backgroundColor'].replace('0x', '#'), + position: 'absolute', + zIndex: '2' + }); + break; + default: + break; + } + } + this.css(bgid, { + width: this.getByElement(bgid + '_c').offsetWidth + 'px', + height: this.getByElement(bgid + '_c').offsetHeight + 'px', + position: 'absolute', + filter: 'alpha(opacity:' + bgAlpha + ')', + opacity: bgAlpha, + backgroundColor: bgColor.replace('0x', '#'), + borderRadius: obj['backRadius'] + 'px', + zIndex: '1' + }); + this.css(ele, { + width: this.getByElement(bgid).offsetWidth + 'px', + height: this.getByElement(bgid).offsetHeight + 'px' + }); + var eidCoor = this.calculationCoor(ele); + this.css(ele, { + left: eidCoor['x'] + 'px', + top: eidCoor['y'] + 'px' + }); + + this.elementArr.push(ele.className); + return ele; + }, + /* + 内置函数 + 获取元件的属性,包括x,y,width,height,alpha + */ + getElement: function(element) { + if (this.playerType == 'flashplayer') { + return this.V.getElement(element); + } + var ele = element; + if (this.varType(element) == 'string') { + ele = this.getByElement(element); + } + var coor = this.getCoor(ele); + return { + x: coor['x'], + y: coor['y'], + width: ele.offsetWidth, + height: ele.offsetHeight, + alpha: !this.isUndefined(this.css(ele, 'opacity')) ? parseFloat(this.css(ele, 'opacity')) : 1, + show: this.css(ele, 'display') == 'none' ? false: true + }; + }, + /* + 内置函数 + 控制元件显示和隐藏 + */ + elementShow: function(element, show) { + if (this.playerType == 'flashplayer') { + this.V.elementShow(element, show); + return; + } + if (this.varType(element) == 'string') { + if (element) { + this.css(ele, 'display', show == true ? 'block': 'none'); + } else { + var arr = this.elementTempArr; + for (var i = 0; i < arr.length; i++) { + this.css(arr[i], 'display', show == true ? 'block': 'none'); + } + } + } + + }, + /* + 内置函数 + 根据节点的x,y计算在播放器里的坐标 + */ + calculationCoor: function(ele) { + if (this.playerType == 'flashplayer') { + return this.V.calculationCoor(ele); + } + if(this.isUndefined(ele)){ + return; + } + if (ele == []) { + return; + } + var x, y, position = []; + var w = this.PD.offsetWidth, + h = this.PD.offsetHeight; + var ew = ele.offsetWidth, + eh = ele.offsetHeight; + if (!this.isUndefined(this.getDataset(ele, 'x'))) { + x = this.getDataset(ele, 'x'); + } + if (!this.isUndefined(this.getDataset(ele, 'y'))) { + y = this.getDataset(ele, 'y'); + } + if (!this.isUndefined(this.getDataset(ele, 'position'))) { + try { + position = this.getDataset(ele, 'position').toString().split(','); + } catch(event) {} + } + if (position.length > 0) { + position.push(null, null, null, null); + var i = 0; + for (i = 0; i < position.length; i++) { + if (this.isUndefined(position[i]) || position[i] == null || position[i] == 'null' || position[i] == '') { + position[i] = null; + } else { + position[i] = parseFloat(position[i]); + } + } + + if (position[2] == null) { + switch (position[0]) { + case 0: + x = 0; + break; + case 1: + x = parseInt((w - ew) * 0.5); + break; + default: + x = w - ew; + break; + } + } else { + switch (position[0]) { + case 0: + x = position[2]; + break; + case 1: + x = parseInt(w * 0.5) + position[2]; + break; + default: + x = w + position[2]; + break; + } + } + if (position[3] == null) { + switch (position[1]) { + case 0: + y = 0; + break; + case 1: + y = parseInt((h - eh) * 0.5); + break; + default: + y = h - eh; + break; + } + } else { + switch (position[1]) { + case 0: + y = position[3]; + break; + case 1: + y = parseInt(h * 0.5) + position[3]; + break; + default: + y = h + position[3]; + break; + } + } + } else { + if (x.substring(x.length - 1, x.length) == '%') { + x = Math.floor(parseInt(x.substring(0, x.length - 1)) * w * 0.01); + } + if (y.substring(y.length - 1, y.length) == '%') { + y = Math.floor(parseInt(y.substring(0, y.length - 1)) * h * 0.01); + } + } + return { + x: x, + y: y + } + + }, + /* + 内置函数 + 修改新增元件的坐标 + */ + changeElementCoor: function() { + for (var i = 0; i < this.elementArr.length; i++) { + if(!this.isUndefined(this.getByElement(this.elementArr[i]))){ + if (this.getByElement(this.elementArr[i]) != []) { + var c = this.calculationCoor(this.getByElement(this.elementArr[i])); + if (c['x'] && c['y']) { + this.css(this.elementArr[i], { + top: c['y'] + 'px', + left: c['x'] + 'px' + }); + } + } + } + } + }, + /* + 内置函数 + 缓动效果集 + */ + tween: function() { + var Tween = { + None: { //均速运动 + easeIn: function(t, b, c, d) { + return c * t / d + b; + }, + easeOut: function(t, b, c, d) { + return c * t / d + b; + }, + easeInOut: function(t, b, c, d) { + return c * t / d + b; + } + }, + Quadratic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t + b; + }, + easeOut: function(t, b, c, d) { + return - c * (t /= d) * (t - 2) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t + b; + return - c / 2 * ((--t) * (t - 2) - 1) + b; + } + }, + Cubic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t + b; + }, + easeOut: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; + return c / 2 * ((t -= 2) * t * t + 2) + b; + } + }, + Quartic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t * t + b; + }, + easeOut: function(t, b, c, d) { + return - c * ((t = t / d - 1) * t * t * t - 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; + return - c / 2 * ((t -= 2) * t * t * t - 2) + b; + } + }, + Quintic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t * t * t + b; + }, + easeOut: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t * t * t + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; + return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; + } + }, + Sine: { + easeIn: function(t, b, c, d) { + return - c * Math.cos(t / d * (Math.PI / 2)) + c + b; + }, + easeOut: function(t, b, c, d) { + return c * Math.sin(t / d * (Math.PI / 2)) + b; + }, + easeInOut: function(t, b, c, d) { + return - c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; + } + }, + Exponential: { + easeIn: function(t, b, c, d) { + return (t == 0) ? b: c * Math.pow(2, 10 * (t / d - 1)) + b; + }, + easeOut: function(t, b, c, d) { + return (t == d) ? b + c: c * ( - Math.pow(2, -10 * t / d) + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if (t == 0) return b; + if (t == d) return b + c; + if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; + return c / 2 * ( - Math.pow(2, -10 * --t) + 2) + b; + } + }, + Circular: { + easeIn: function(t, b, c, d) { + return - c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; + }, + easeOut: function(t, b, c, d) { + return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return - c / 2 * (Math.sqrt(1 - t * t) - 1) + b; + return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; + } + }, + Elastic: { + easeIn: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + return - (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + }, + easeOut: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + return (a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b); + }, + easeInOut: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d / 2) == 2) return b + c; + if (!p) p = d * (.3 * 1.5); + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + if (t < 1) return - .5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; + } + }, + Back: { + easeIn: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * (t /= d) * t * ((s + 1) * t - s) + b; + }, + easeOut: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; + }, + easeInOut: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; + return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; + } + }, + Bounce: { + easeIn: function(t, b, c, d) { + return c - Tween.Bounce.easeOut(d - t, 0, c, d) + b; + }, + easeOut: function(t, b, c, d) { + if ((t /= d) < (1 / 2.75)) { + return c * (7.5625 * t * t) + b; + } else if (t < (2 / 2.75)) { + return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; + } else if (t < (2.5 / 2.75)) { + return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; + } else { + return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; + } + }, + easeInOut: function(t, b, c, d) { + if (t < d / 2) return Tween.Bounce.easeIn(t * 2, 0, c, d) * .5 + b; + else return Tween.Bounce.easeOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b; + } + } + }; + return Tween; + }, + /* + 接口函数 + 缓动效果 + ele:Object=需要缓动的对象, + parameter:String=需要改变的属性:x,y,width,height,alpha, + effect:String=效果名称, + start:Int=起始值, + end:Int=结束值, + speed:Number=运动的总秒数,支持小数 + */ + animate: function(attribute) { + if (this.playerType == 'flashplayer') { + return this.V.animate(attribute); + } + var thisTemp = this; + var animateId = 'animate_' + this.randomString(); + var obj = { + element: null, + parameter: 'x', + static: false, + effect: 'None.easeIn', + start: null, + end: null, + speed: 0, + overStop: false, + pauseStop: false, + //暂停播放时缓动是否暂停 + callBack: null + }; + obj = this.standardization(obj, attribute); + if (obj['element'] == null || obj['speed'] == 0) { + return false; + } + var w = this.PD.offsetWidth, + h = this.PD.offsetHeight; + var effArr = (obj['effect'] + '.').split('.'); + var tweenFun = this.tween()[effArr[0]][effArr[1]]; + var eleCoor = { + x: 0, + y: 0 + }; + if (this.isUndefined(tweenFun)) { + return false; + } + //先将该元件从元件数组里删除,让其不再跟随播放器的尺寸改变而改变位置 + var def = this.arrIndexOf(this.elementArr, obj['element'].className); + if (def > -1) { + this.elementTempArr.push(obj['element'].className); + this.elementArr.splice(def, 1); + } + //var run = true; + var css = {}; + //对传递的参数进行转化,x和y转化成left,top + var pm = this.getElement(obj['element']); //包含x,y,width,height,alpha属性 + var t = 0; //当前时间 + var b = 0; //初始值 + var c = 0; //变化量 + var d = obj['speed'] * 1000; //持续时间 + var timerTween = null; + var tweenObj = null; + var start = obj['start'] == null ? '': obj['start'].toString(); + var end = obj['end'] == null ? '': obj['end'].toString(); + switch (obj['parameter']) { + case 'x': + if (obj['start'] == null) { + b = pm['x']; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(start) * w * 0.01; + } else { + b = parseInt(start); + } + + } + if (obj['end'] == null) { + c = pm['x'] - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) * w * 0.01 - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) - b; + } else { + c = parseInt(end); + } + + } else { + c = parseInt(end) - b; + } + } + break; + case 'y': + if (obj['start'] == null) { + b = pm['y']; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(start) * h * 0.01; + } else { + b = parseInt(start); + } + + } + if (obj['end'] == null) { + c = pm['y'] - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) * h * 0.01 - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) - b; + } else { + c = parseInt(end); + } + } else { + c = parseInt(end) - b; + } + } + break; + case 'alpha': + if (obj['start'] == null) { + b = pm['alpha'] * 100; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(obj['start']); + } else { + b = parseInt(obj['start'] * 100); + } + + } + if (obj['end'] == null) { + c = pm['alpha'] * 100 - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) * 100 - b; + } else { + c = parseInt(obj['end']) * 100; + } + } else { + c = parseInt(obj['end']) * 100 - b; + } + } + break; + } + var callBack = function() { + var index = thisTemp.arrIndexOf(thisTemp.animateElementArray, animateId); + if (index > -1) { + thisTemp.animateArray.splice(index, 1); + thisTemp.animateElementArray.splice(index, 1); + } + index = thisTemp.arrIndexOf(thisTemp.animatePauseArray, animateId); + if (index > -1) { + thisTemp.animatePauseArray.splice(index, 1); + } + if (obj['callBack'] != null && obj['element'] && obj['callBack'] != 'callBack' && obj['callBack'] != 'tweenX' && obj['tweenY'] != 'callBack' && obj['callBack'] != 'tweenAlpha') { + var cb = eval(obj['callBack']); + cb(obj['element']); + obj['callBack'] = null; + } + }; + var stopTween = function() { + if (timerTween != null) { + if (timerTween.runing) { + timerTween.stop(); + } + timerTween = null; + } + }; + var tweenX = function() { + if (t < d) { + t += 10; + css = { + left: Math.ceil(tweenFun(t, b, c, d)) + 'px' + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['top'] = eleCoor['y'] + 'px'; + } + thisTemp.css(obj['element'], css); + + } else { + stopTween(); + try { + var defX = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defX > -1) { + this.elementTempArr.splice(defX, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + var tweenY = function() { + if (t < d) { + t += 10; + css = { + top: Math.ceil(tweenFun(t, b, c, d)) + 'px' + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['left'] = eleCoor['x'] + 'px'; + } + thisTemp.css(obj['element'], css); + } else { + stopTween(); + try { + var defY = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defY > -1) { + this.elementTempArr.splice(defY, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + var tweenAlpha = function() { + if (t < d) { + t += 10; + eleCoor = thisTemp.calculationCoor(obj['element']); + var ap = Math.ceil(tweenFun(t, b, c, d)) * 0.01; + css = { + filter: 'alpha(opacity:' + ap + ')', + opacity: ap.toString() + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['top'] = eleCoor['y'] + 'px'; + css['left'] = eleCoor['x'] + 'px'; + } + thisTemp.css(obj['element'], css); + } else { + stopTween(); + try { + var defA = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defA > -1) { + this.elementTempArr.splice(defA, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + switch (obj['parameter']) { + case 'x': + tweenObj = tweenX; + break; + case 'y': + tweenObj = tweenY; + break; + case 'alpha': + tweenObj = tweenAlpha; + break; + default: + break; + } + timerTween = new thisTemp.timer(10, tweenObj); + timerTween.callBackFunction = callBack; + if (obj['overStop']) { + var mouseOver = function() { + if (timerTween != null && timerTween.runing) { + timerTween.stop(); + } + }; + this.addListenerInside('mouseover', mouseOver, obj['element']); + var mouseOut = function() { + var start = true; + if (obj['pauseStop'] && thisTemp.getMetaDate()['paused']) { + start = false; + } + if (timerTween != null && !timerTween.runing && start) { + timerTween.start(); + } + }; + this.addListenerInside('mouseout', mouseOut, obj['element']); + } + + this.animateArray.push(timerTween); + this.animateElementArray.push(animateId); + if (obj['pauseStop']) { + this.animatePauseArray.push(animateId); + } + return animateId; + }, + /* + 接口函数函数 + 继续运行animate + */ + animateResume: function(id) { + if (this.playerType == 'flashplayer') { + this.V.animateResume(this.isUndefined(id) ? '': id); + return; + } + var arr = []; + if (id != '' && !this.isUndefined(id) && id != 'pause') { + arr.push(id); + } else { + if (id === 'pause') { + arr = this.animatePauseArray; + } else { + arr = this.animateElementArray; + } + } + for (var i = 0; i < arr.length; i++) { + var index = this.arrIndexOf(this.animateElementArray, arr[i]); + if (index > -1) { + this.animateArray[index].start(); + } + } + + }, + /* + 接口函数 + 暂停运行animate + */ + animatePause: function(id) { + if (this.playerType == 'flashplayer') { + this.V.animatePause(this.isUndefined(id) ? '': id); + return; + } + var arr = []; + if (id != '' && !this.isUndefined(id) && id != 'pause') { + arr.push(id); + } else { + if (id === 'pause') { + arr = this.animatePauseArray; + } else { + arr = this.animateElementArray; + } + } + for (var i = 0; i < arr.length; i++) { + var index = this.arrIndexOf(this.animateElementArray, arr[i]); + if (index > -1) { + this.animateArray[index].stop(); + } + } + }, + /* + 内置函数 + 根据ID删除数组里对应的内容 + */ + deleteAnimate: function(id) { + if (this.playerType == 'flashplayer' && this.V) { + try { + this.V.deleteAnimate(id); + } catch(event) { + this.log(event); + } + return; + } + var index = this.arrIndexOf(this.animateElementArray, id); + if (index > -1) { + this.animateArray[index].callBackFunction(); + this.animateArray.splice(index, 1); + this.animateElementArray.splice(index, 1); + } + }, + /* + 内置函数 + 删除外部新建的元件 + */ + deleteElement: function(ele) { + if (this.playerType == 'flashplayer' && this.V) { + try { + this.V.deleteElement(ele); + } catch(event) {} + return; + } + //先将该元件从元件数组里删除,让其不再跟随播放器的尺寸改变而改变位置 + var def = this.arrIndexOf(this.elementArr, ele.className); + if (def > -1) { + this.elementArr.splice(def, 1); + } + try { + def = this.arrIndexOf(this.elementTempArr, ele.className); + if (def > -1) { + this.elementTempArr.splice(def, 1); + } + } catch(event) {} + this.deleteAnimate(ele.className); + this.deleteChild(ele); + }, + /* + -------------------------------------------------------------- + 共用函数部分 + 以下函数并非只能在本程序中使用,也可以在页面其它项目中使用 + 根据ID或className获取元素对象 + */ + getByElement: function(obj, parent) { + if (this.isUndefined(parent)) { + parent = document; + } + var num = obj.substr(0, 1); + var res = []; + if (num != '#') { + if (num == '.') { + obj = obj.substr(1, obj.length); + } + if (parent.getElementsByClassName) { + res = parent.getElementsByClassName(obj); + if(!res.length){ + return null; + } + } else { + var reg = new RegExp(' ' + obj + ' ', 'i'); + var ele = parent.getElementsByTagName('*'); + for (var i = 0; i < ele.length; i++) { + if (reg.test(' ' + ele[i].className + ' ')) { + res.push(ele[i]); + } + } + } + if (res.length > 0) { + res=res[0]; + } + else{ + res=null; + } + } else { + if (num == '#') { + obj = obj.substr(1, obj.length); + } + try{ + res=document.getElementById(obj); + } + catch(event){ + res=null; + } + } + return res; + }, + /* + 共用函数 + 功能:修改样式或获取指定样式的值, + elem:ID对象或ID对应的字符,如果多个对象一起设置,则可以使用数组 + attribute:样式名称或对象,如果是对象,则省略掉value值 + value:attribute为样式名称时,定义的样式值 + 示例一: + this.css(ID,'width','100px'); + 示例二: + this.css('id','width','100px'); + 示例三: + this.css([ID1,ID2,ID3],'width','100px'); + 示例四: + this.css(ID,{ + width:'100px', + height:'100px' + }); + 示例五(获取宽度): + var width=this.css(ID,'width'); + */ + css: function(elem, attribute, value) { + var i = 0; + var k = ''; + if (this.varType(elem) == 'array') { //数组 + for (i = 0; i < elem.length; i++) { + var el; + if (typeof(elem[i]) == 'string') { + el = this.getByElement(elem[i]) + } else { + el = elem[i]; + } + if (typeof(attribute) != 'object') { + if (!this.isUndefined(value)) { + el.style[attribute] = value; + } + } else { + for (k in attribute) { + if (!this.isUndefined(attribute[k])) { + try { + el.style[k] = attribute[k]; + } catch(event) { + this.log(event); + } + } + } + } + } + return; + + } + if (this.varType(elem) == 'string') { + elem = this.getByElement(elem); + } + if (this.varType(attribute) != 'object') { + if (!this.isUndefined(value)) { + elem.style[attribute] = value; + } else { + if (!this.isUndefined(this.getStyle(elem, attribute))) { + return this.getStyle(elem, attribute); + } else { + return false; + } + } + } else { + for (k in attribute) { + if (!this.isUndefined(attribute[k])) { + elem.style[k] = attribute[k]; + } + } + } + + }, + /* + 内置函数 + 兼容型获取style + */ + getStyle: function(obj, attr) { + if (!this.isUndefined(obj.style[attr])) { + return obj.style[attr]; + } else { + if (obj.currentStyle) { + return obj.currentStyle[attr]; + } else { + return getComputedStyle(obj, false)[attr]; + } + } + }, + /* + 共用函数 + 判断变量是否存在或值是否为undefined + */ + isUndefined: function(value) { + try { + if (value === 'undefined' || value === undefined || value === null || value === 'NaN' || value === NaN) { + return true; + } + } catch(event) { + this.log(event); + return true; + } + return false; + }, + /* + 共用函数 + 外部监听函数 + */ + addListener: function(name, funName) { + if (name && funName) { + if (this.playerType == 'flashplayer') { + var ff = ''; //定义用来向flashplayer传递的函数字符 + if (this.varType(funName) == 'function') { + ff = this.getParameterNames(funName); + } + this.V.addListener(name, ff); + return; + } + var have = false; + for (var i = 0; i < this.listenerJsArr.length; i++) { + var arr = this.listenerJsArr[i]; + if (arr[0] == name && arr[1] == funName) { + have = true; + break; + } + } + if (!have) { + this.listenerJsArr.push([name, funName]); + } + } + }, + /* + 共用函数 + 外部删除监听函数 + */ + removeListener: function(name, funName) { + if (name && funName) { + if (this.playerType == 'flashplayer') { + var ff = ''; //定义用来向flashplayer传递的函数字符 + if (this.varType(funName) == 'function') { + ff = this.getParameterNames(funName); + } + this.V.removeListener(name, ff); + return; + } + for (var i = 0; i < this.listenerJsArr.length; i++) { + var arr = this.listenerJsArr[i]; + if (arr[0] == name && arr[1] == funName) { + this.listenerJsArr.splice(i, 1); + break; + } + } + } + }, + /* + 内部监听函数,调用方式: + this.addListenerInside('click',function(event){},[ID]); + d值为空时,则表示监听当前的视频播放器 + */ + addListenerInside: function(e, f, d, t) { + if (this.isUndefined(t)) { + t = false; + } + var o = this.V; + if (!this.isUndefined(d)) { + o = d; + } + if (o.addEventListener) { + try { + o.addEventListener(e, f, t); + } catch(event) {this.log(event)} + } else if (o.attachEvent) { + try { + o.attachEvent('on' + e, f); + } catch(event) {this.log(event)} + } else { + o['on' + e] = f; + } + }, + /* + 删除内部监听函数,调用方式: + this.removeListenerInside('click',function(event){}[,ID]); + d值为空时,则表示监听当前的视频播放器 + */ + removeListenerInside: function(e, f, d, t) { + /*if(this.playerType=='flashplayer' && this.getParameterNames(f) && this.isUndefined(d)) { + return; + }*/ + if (this.isUndefined(t)) { + t = false; + } + var o = this.V; + if (!this.isUndefined(d)) { + o = d; + } + if (o.removeEventListener) { + try { + this.addNum--; + o.removeEventListener(e, f, t); + } catch(e) {} + } else if (o.detachEvent) { + try { + o.detachEvent('on' + e, f); + } catch(e) {} + } else { + o['on' + e] = null; + } + }, + /* + 共用函数 + 统一分配监听,以达到跟as3同样效果 + */ + sendJS: function(name, val) { + if (this.adPlayerPlay && name.substr( - 2) != 'Ad') { + return; + } + if(this.isUndefined(name)){ + return; + } + var list = this.listenerJsArr; + var obj = this.vars['variable']; + if(this.vars['debug']){ + this.log(name+':'+val); + } + for (var i = 0; i < list.length; i++) { + var arr = list[i]; + if (arr[0] == name) { + if (!this.isUndefined(val)) { + switch (arr[1].length) { + case 1: + arr[1](val); + break; + case 2: + arr[1](val, obj); + break; + default: + arr[1](); + break; + } + + } else { + arr[1](obj); + } + } + } + }, + /* + 共用函数 + 获取函数名称,如 function ckplayer(){} var fun=ckplayer,则getParameterNames(fun)=ckplayer + */ + getParameterNames: function(fn) { + if (this.varType(fn) !== 'function') { + return false; + } + var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + var code = fn.toString().replace(COMMENTS, ''); + var result = code.slice(code.indexOf(' ') + 1, code.indexOf('(')); + return result === null ? false: result; + }, + /* + 共用函数 + 时间替换 + */ + replaceTime:function(str,obj){ + //var timeStrArr = ['[$timeh]', '[$timei]', '[$timeI]', '[$times]', '[$timeS]', '[$durationh]', '[$durationi]', '[$durationI]', '[$durations]', '[$durationS]','[$liveTimey]', '[$liveTimeY]', '[$liveTimem]', '[$liveTimed]', '[$liveTimeh]', '[$liveTimei]', '[$liveTimes]', '[$liveLanguage]']; + for(var k in obj){ + str=str.replace('[$'+k+']',obj[k]) + } + return str; + }, + /* + 共用函数 + 格式化时分秒 + t:Int:秒数,dt:总时间的秒数 + */ + formatTime: function(t,dt,str) { + if (this.isUndefined(t) || isNaN(t)) { + seconds = 0; + } + if (this.isUndefined(dt) || isNaN(dt)) { + dt = 0; + } + var minuteS=Math.floor(t/60);//将秒数直接转化成分钟取整,这个可以得到如80分钟 + var minute=minuteS;//获取准确的分钟 + var hourS=Math.floor(t/360);//将秒数直接转化成小时取整,这个可以得到100小时 + var second=t %60; + if(minuteS>=60){ + minute=Math.floor(minuteS%60); + } + //总时间 + var hminuteS=Math.floor(dt/60);//将秒数直接转化成分钟取整,这个可以得到如80分钟 + var hminute=hminuteS;//获取准确的分钟 + var hhourS=Math.floor(dt/360);//将秒数直接转化成小时取整,这个可以得到100小时 + var hsecond=dt %60; + if(hminuteS>=60){ + hminute=Math.floor(hminuteS%60); + } + //当前时间 + var nowDate = new Date(); + var obj={ + timeh:hourS,//时 + timei:minute,//分 + timeI:minuteS,//只有分 + times:second,//秒 + timeS:t,//只有秒 + durationh:hhourS,//时 + durationi:hminute,//分 + durationI:hminuteS,//只有分 + durations:hsecond,//秒 + durationS:dt,//只有秒 + liveTimey:nowDate.getYear(),//获取当前年份(2位) + liveTimeY:nowDate.getFullYear(),//获取完整的年份(4位,1970-????) + liveTimem:nowDate.getMonth()+1,//获取当前月份(0-11,0代表1月) + liveTimed:nowDate.getDate(),// 获取当前日(1-31) + liveTimeh:nowDate.getHours(), // 获取当前小时数(0-23) + liveTimei:nowDate.getMinutes(),// 获取当前分钟数(0-59) + liveTimes:nowDate.getSeconds()// 获取当前秒数(0-59) + }; + for(var k in obj){ + if(obj[k]<10){ + obj[k]='0'+Math.floor(obj[k]); + } + else{ + obj[k]=Math.floor(obj[k]).toString(); + } + } + return this.replaceTime(str,obj); + }, + /* + 共用函数 + 获取一个随机字符 + len:随机字符长度 + */ + randomString: function(len) { + len = len || 16; + var chars = 'abcdefghijklmnopqrstuvwxyz'; + var maxPos = chars.length; + var val = ''; + for (i = 0; i < len; i++) { + val += chars.charAt(Math.floor(Math.random() * maxPos)); + } + return 'ch' + val; + }, + /* + 共用函数 + 获取字符串长度,中文算两,英文数字算1 + */ + getStringLen: function(str) { + if(this.isUndefined(str)){ + return 0; + } + var len = 0; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) { + len += 2; + } else { + len++; + } + } + return len; + }, + /* + 内部函数 + 用来为ajax提供支持 + */ + createXHR: function() { + if (window.XMLHttpRequest) { + //IE7+、Firefox、Opera、Chrome 和Safari + return new XMLHttpRequest(); + } else if (window.ActiveXObject) { + //IE6 及以下 + try { + return new ActiveXObject('Microsoft.XMLHTTP'); + } catch(event) { + try { + return new ActiveXObject('Msxml2.XMLHTTP'); + } catch(event) { + this.eject(this.errorList[7]); + } + } + } else { + this.eject(this.errorList[8]); + } + }, + /* + 共用函数 + ajax调用 + */ + ajax: function(cObj) { + var thisTemp = this; + var callback = null; + var obj = { + method: 'get',//请求类型 + dataType: 'json',//请求的数据类型 + charset: 'utf-8', + async: false,//true表示异步,false表示同步 + url: '', + data: null, + success: null, + error:null + }; + if (this.varType(cObj) != 'object') { + this.eject(this.errorList[9]); + return; + } + obj = this.standardization(obj, cObj); + if (obj.dataType === 'json' || obj.dataType === 'text' || obj.dataType === 'html' || obj.dataType === 'xml') { + var xhr = this.createXHR(); + callback = function() { + //判断http的交互是否成功 + if (xhr.status == 200) { + if (thisTemp.isUndefined(obj.success)) { + return; + } + if (obj.dataType === 'json') { + try { + obj.success(eval('(' + xhr.responseText + ')')); //回调传递参数 + } catch(event) { + if(!thisTemp.isUndefined(obj['error'])){ + obj.error(event); + } + } + } else { + obj.success(xhr.responseText); //回调传递参数 + } + } + else { + obj.success(null); + thisTemp.eject(thisTemp.errorList[10], 'Ajax.status:' + xhr.status); + } + }; + obj.url = obj.url.indexOf('?') == -1 ? obj.url + '?rand=' + this.randomString(6) : obj.url; + obj.data = this.formatParams(obj.data); //通过params()将名值对转换成字符串 + if (obj.method === 'get' && !this.isUndefined(obj.data)) { + if (obj.data != '') { + if (obj.url.indexOf('?') == -1) { + obj.url += '?' + obj.data + } else { + obj.url += '&' + obj.data; + } + } + } + if (obj.async === true) { //true表示异步,false表示同步 + xhr.onreadystatechange = function() { + if (xhr.readyState == 4 && callback != null) { //判断对象的状态是否交互完成 + callback(); //回调 + } + }; + } + xhr.open(obj.method, obj.url, obj.async); + if (obj.method === 'post') { + try{ + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('charset', obj['charset']); + xhr.send(obj.data); + } + catch(event){ + callback(); + } + } + else { + try{ + xhr.send(null); //get方式则填null + } + catch(event){ + callback(); + } + } + if (obj.async === false) { //同步 + callback(); + } + + } + else if (obj.dataType === 'jsonp') { + var oHead = document.getElementsByTagName('head')[0]; + var oScript = document.createElement('script'); + var callbackName = 'callback' + new Date().getTime(); + var params = this.formatParams(obj.data) + '&callback=' + callbackName; //按时间戳拼接字符串 + callback = obj.success; + //拼接好src + oScript.src = obj.url.split('?') + '?' + params; + //插入script标签 + oHead.insertBefore(oScript, oHead.firstChild); + //jsonp的回调函数 + window[callbackName] = function(json) { + callback(json); + oHead.removeChild(oScript); + }; + } + }, + /* + 内置函数 + 动态加载js + */ + loadJs: function(path, success) { + var oHead = document.getElementsByTagName('HEAD').item(0); + var oScript = document.createElement('script'); + oScript.type = 'text/javascript'; + oScript.src = this.getNewUrl(path); + oHead.appendChild(oScript); + oScript.onload = function() { + success(); + } + }, + /* + 共用函数 + 排除IE6-9 + */ + isMsie: function() { + var browser = navigator.appName; + var b_version = navigator.appVersion; + var version = b_version.split(';'); + var trim_Version = ''; + if (version.length > 1) { + trim_Version = version[1].replace(/[ ]/g, ''); + } + if (browser == 'Microsoft Internet Explorer' && (trim_Version == 'MSIE6.0' || trim_Version == 'MSIE7.0' || trim_Version == 'MSIE8.0' || trim_Version == 'MSIE9.0' || trim_Version == 'MSIE10.0')) { + return false; + } + return true; + }, + /* + 共用函数 + 判断是否安装了flashplayer + */ + uploadFlash: function() { + var swf; + if (navigator.userAgent.indexOf('MSIE') > 0) { + try { + var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + return true; + } catch(e) { + return false; + } + } + if (navigator.userAgent.indexOf('Firefox') > 0) { + swf = navigator.plugins['Shockwave Flash']; + if (swf) { + return true + } else { + return false; + } + } + return true; + }, + /* + 共用函数 + 检测浏览器是否支持HTML5-Video + */ + supportVideo: function() { + if (!this.isMsie()) { + return false; + } + if ( !! document.createElement('video').canPlayType) { + var vidTest = document.createElement('video'); + var oggTest; + try { + oggTest = vidTest.canPlayType('video/ogg; codecs="theora, vorbis"'); + } catch(error) { + oggTest = false; + } + if (!oggTest) { + var h264Test; + try { + h264Test = vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); + } catch(error) { + h264Test = false; + } + if (!h264Test) { + return false; + } else { + if (h264Test == "probably") { + return true; + } else { + return false; + } + } + } else { + if (oggTest == "probably") { + return true; + } else { + return false; + } + } + } else { + return false; + } + }, + /* + 共用函数 + 获取属性值 + */ + getDataset: function(ele, z) { + try { + return ele.dataset[z]; + } catch(error) { + try { + return ele.getAttribute('data-' + z) + } catch(error) { + return false; + } + } + }, + /* + 共用函数 + 返回flashplayer的对象 + */ + getObjectById: function(id) { + var x = null; + var y = this.getByElement('#' + id); + var r = 'embed'; + if (y && y.nodeName == 'OBJECT') { + if (this.varType(y.SetVariable) != 'undefined') { + x = y; + } else { + var z = y.getElementsByTagName(r)[0]; + if (z) { + x = z; + } + } + } + return x; + }, + /* + 共用函数 + 对象转地址字符串 + */ + formatParams: function(data) { + var arr = []; + for (var i in data) { + arr.push(encodeURIComponent(i) + '=' + encodeURIComponent(data[i])); + } + return arr.join('&'); + }, + /* + 内置函数 + 对地址进行冒泡排序 + */ + arrSort: function(arr) { + var temp = []; + for (var i = 0; i < arr.length; i++) { + for (var j = 0; j < arr.length - i; j++) { + if (!this.isUndefined(arr[j + 1]) && arr[j][3] < arr[j + 1][3]) { + temp = arr[j + 1]; + arr[j + 1] = arr[j]; + arr[j] = temp; + } + } + } + return arr; + }, + /* + 共用函数 + 获取文件名称 + */ + getFileName: function(filepath) { + if(!filepath) return ''; + return filepath.replace(/(.*\/)*([^.]+).*/ig,'$2'); + }, + /* + 内置函数 + 判断文件后缀 + */ + getFileExt: function(filepath) { + if (filepath != '' && !this.isUndefined(filepath)) { + if (filepath.indexOf('?') > -1) { + filepath = filepath.split('?')[0]; + } + var pos = '.' + filepath.replace(/.+\./, ''); + return pos.toLowerCase(); + } + return ''; + }, + /* + 内置函数 + 判断是否是移动端 + */ + isMobile: function() { + if (navigator.userAgent.toLowerCase().match(/(iphone|ipad|ipod|android|ios|midp|windows mobile|windows ce|rv:1.2.3.4|ucweb)/i)) { + return true; + } + return false; + }, + /* + 内置函数 + 搜索字符串str是否包含key + */ + isContains: function(str, key) { + return str.indexOf(key) > -1; + }, + /* + 内置函数 + 给地址添加随机数 + */ + getNewUrl: function(url) { + if (this.isContains(url, '?')) { + return url += '&' + this.randomString(8) + '=' + this.randomString(8); + } else { + return url += '?' + this.randomString(8) + '=' + this.randomString(8); + } + }, + /* + 共用函数 + 获取clientX和clientY + */ + client: function(event) { + var eve = event || window.event; + if (this.isUndefined(eve)) { + eve = { + clientX: 0, + clientY: 0 + }; + } + return { + x: eve.clientX + (document.documentElement.scrollLeft || this.body.scrollLeft) - this.pdCoor['x'], + y: eve.clientY + (document.documentElement.scrollTop || this.body.scrollTop) - this.pdCoor['y'] + } + }, + /* + 内置函数 + 获取节点的绝对坐标 + */ + getCoor: function(obj) { + var coor = this.getXY(obj); + return { + x: coor['x'] - this.pdCoor['x'], + y: coor['y'] - this.pdCoor['y'] + }; + }, + getXY: function(obj) { + var parObj = obj; + var left = obj.offsetLeft; + var top = obj.offsetTop; + + while (parObj = parObj.offsetParent) { + left += parObj.offsetLeft; + top += parObj.offsetTop; + } + return { + x: left, + y: top + }; + }, + /* + 内置函数 + 删除本对象的所有属性 + */ + removeChild: function() { + if (this.playerType == 'html5video') { + //删除计时器 + var i = 0; + var timerArr = [this.timerError, this.timerFull, this.timerTime, this.timerBuffer, this.timerClick, this.timerCBar, this.timerVCanvas]; + for (i = 0; i < timerArr.length; i++) { + if (timerArr[i] != null) { + if (timerArr[i].runing) { + timerArr[i].stop(); + } + timerArr[i] = null; + } + } + //删除事件监听 + var ltArr = this.listenerJsArr; + for (i = 0; i < ltArr.length; i++) { + this.removeListener(ltArr[i][0], ltArr[i][1]); + } + } + this.playerType == ''; + this.V = null; + if (this.conBarShow) { + this.deleteChild(this.CB['menu']); + } + this.deleteChild(this.PD); + this.CD.innerHTML = ''; + }, + /* + 内置函数 + 画封闭的图形 + */ + canvasFill: function(name, path) { + name.beginPath(); + for (var i = 0; i < path.length; i++) { + var d = path[i]; + if (i > 0) { + name.lineTo(d[0], d[1]); + } else { + name.moveTo(d[0], d[1]); + } + } + name.closePath(); + name.fill(); + }, + /* + 内置函数 + 画矩形 + */ + canvasFillRect: function(name, path) { + for (var i = 0; i < path.length; i++) { + var d = path[i]; + name.fillRect(d[0], d[1], d[2], d[3]); + } + }, + /* + 共用函数 + 删除容器节点 + */ + deleteChild: function(f) { + var def = this.arrIndexOf(this.elementArr, f.className); + if (def > -1) { + this.elementArr.splice(def, 1); + } + var childs = f.childNodes; + for (var i = childs.length - 1; i >= 0; i--) { + f.removeChild(childs[i]); + } + + if (f && f != null && f.parentNode) { + try { + if (f.parentNode) { + f.parentNode.removeChild(f); + + } + + } catch(event) {} + } + }, + /* + 内置函数 + 根据容器的宽高,内部节点的宽高计算出内部节点的宽高及坐标 + */ + getProportionCoor: function(stageW, stageH, vw, vh) { + var w = 0, + h = 0, + x = 0, + y = 0; + if (stageW / stageH < vw / vh) { + w = stageW; + h = w * vh / vw; + } else { + h = stageH; + w = h * vw / vh; + } + x = (stageW - w) * 0.5; + y = (stageH - h) * 0.5; + return { + width: parseInt(w), + height: parseInt(h), + x: parseInt(x), + y: parseInt(y) + }; + }, + /* + 共用函数 + 将字幕文件内容转换成数组 + */ + parseSrtSubtitles: function(srt) { + var subtitlesArr = []; + var textSubtitles = []; + var i = 0; + var arrs = srt.split('\n'); + var arr = []; + var delHtmlTag = function(str) { + return str.replace(/<[^>]+>/g, ''); //去掉所有的html标记 + }; + for (i = 0; i < arrs.length; i++) { + if (arrs[i].replace(/\s/g, '').length > 0) { + arr.push(arrs[i]); + } else { + if (arr.length > 0) { + textSubtitles.push(arr); + } + arr = []; + } + } + for (i = 0; i < textSubtitles.length; ++i) { + var textSubtitle = textSubtitles[i]; + if (textSubtitle.length >= 2) { + var sn = textSubtitle[0]; // 字幕的序号 + var startTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[0])); // 字幕的开始时间 + var endTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[1])); // 字幕的结束时间 + var content = [delHtmlTag(textSubtitle[2])]; // 字幕的内容 + var cktrackdelay=this.vars['cktrackdelay']; + if(cktrackdelay!=0){ + startTime+=cktrackdelay; + endTime+=cktrackdelay; + } + // 字幕可能有多行 + if (textSubtitle.length > 2) { + for (var j = 3; j < textSubtitle.length; j++) { + content.push(delHtmlTag(textSubtitle[j])); + } + } + // 字幕对象 + var subtitle = { + sn: sn, + startTime: startTime, + endTime: endTime, + content: content + }; + subtitlesArr.push(subtitle); + } + } + return subtitlesArr; + }, + /* + 共用函数 + 计时器,该函数模拟as3中的timer原理 + time:计时时间,单位:毫秒 + fun:接受函数 + number:运行次数,不设置则无限运行 + */ + timer: function(time, fun, number) { + var thisTemp = this; + this.time = 10; //运行间隔 + this.fun = null; //监听函数 + this.timeObj = null; //setInterval对象 + this.number = 0; //已运行次数 + this.numberTotal = null; //总至需要次数 + this.runing = false; //当前状态 + this.startFun = function() { + thisTemp.number++; + thisTemp.fun(); + if (thisTemp.numberTotal != null && thisTemp.number >= thisTemp.numberTotal) { + thisTemp.stop(); + } + }; + this.start = function() { + if (!thisTemp.runing) { + thisTemp.runing = true; + thisTemp.timeObj = window.setInterval(thisTemp.startFun, time); + } + }; + this.stop = function() { + if (thisTemp.runing) { + thisTemp.runing = false; + window.clearInterval(thisTemp.timeObj); + thisTemp.timeObj = null; + } + }; + if (time) { + this.time = time; + } + if (fun) { + this.fun = fun; + } + if (number) { + this.numberTotal = number; + } + this.start(); + }, + /* + 共用函数 + 将时分秒转换成秒 + */ + toSeconds: function(t) { + var s = 0.0; + if (t) { + var p = t.split(':'); + for (i = 0; i < p.length; i++) { + s = s * 60 + parseFloat(p[i].replace(',', '.')); + } + } + return s; + }, + /*将字符变成数字形式的数组*/ + arrayInt: function(str) { + var a = str.split(','); + var b = []; + for (var i = 0; i < a.length; i++) { + if (this.isUndefined(a[i])) { + a[i] = 0; + } + if (a[i].substr( - 1) != '%') { + a[i] = parseInt(a[i]); + } + b.push(a[i]); + } + return b; + }, + /* + 共用函数 + 将对象Object标准化 + */ + standardization: function(o, n) { //n替换进o + var h = {}; + var k; + for (k in o) { + h[k] = o[k]; + } + for (k in n) { + var type =''; + if(h[k]){ + type = this.varType(h[k]); + } + switch (type) { + case 'number': + h[k] = parseFloat(n[k]); + break; + default: + h[k] = n[k]; + break; + } + } + return h; + }, + objectAssign:function(o,n) { + if(this.varType(o)!='object' || this.varType(n)!='object'){ + return null; + } + var obj1=this.newObj(o),obj2=this.newObj(n); + for(var k in obj2){ + if(this.varType(obj2[k])=='object'){ + if(this.varType(obj1[k])!='object'){ + obj1[k]={}; + } + obj1[k]=this.objectAssign(obj1[k],obj2[k]); + } + else{ + obj1[k]=obj2[k]; + } + } + return obj1; + }, + /* + 共用函数 + 搜索数组 + */ + arrIndexOf: function(arr, key) { + if(this.isUndefined(arr) || this.isUndefined(key)){ + return -1; + } + var re = new RegExp(key, ['']); + return (arr.toString().replace(re, '┢').replace(/[^,┢]/g, '')).indexOf('┢'); + }, + /* + 共用函数 + 去掉空格 + */ + trim: function(str) { + if (str != '') { + return str.replace(/(^\s*)|(\s*$)/g, ''); + } + return ''; + }, + /* + 共用函数 + 输出内容到控制台 + */ + log: function(val) { + try { + console.log(val); + } catch(e) {} + }, + /* + 共用函数 + 弹出提示 + */ + eject: function(er, val) { + if (!this.vars['debug']) { + return; + } + var errorVal = er[1]; + if (!this.isUndefined(val)) { + errorVal = errorVal.replace('[error]', val); + } + var value = 'error ' + er[0] + ':' + errorVal; + try { + this.log(value); + } catch(e) {} + }, + /* + 共用函数 + 系统错误 + */ + sysError: function(er, val) { + var ele= this.getByElement(this.vars['container']); + var errorVal = er[1]; + if (!this.isUndefined(val)) { + errorVal = errorVal.replace('[error]', val); + } + var value = 'error ' + er[0] + ':' + errorVal; + ele.innerHTML=value; + this.css(ele,{ + backgroundColor: '#000', + color:'#FFF', + textAlign:'center', + lineHeight:ele.offsetHeight+'px' + }); + }, + /* + 共用函数 + 判断变量类型 + */ + varType:function(val){ + if(val===null){ + return 'string'; + } + var type = typeof(val); + switch(type) { + case 'string': + return 'string'; + break; + case 'number': + return 'number'; + break; + case 'boolean': + return 'boolean'; + break; + case 'function': + return 'function'; + break; + case 'symbol': + return 'symbol'; + break; + case 'object': + if(!this.isUndefined(typeof(val.length))) { + return 'array'; + } + return 'object'; + break; + case 'undefined': + return 'undefined'; + break; + default: + return typeof(val); + break; + } + }, + getConfigObject:function(){ + return this.jsonConfig; + }, + getStyleObject:function(){ + return this.jsonStyle; + }, + getLanguageObject:function(){ + return this.jsongLanguage; + } + }; + window.ckplayer = ckplayer; +})(); \ No newline at end of file diff --git a/ckplayer/ckplayer.json b/ckplayer/ckplayer.json new file mode 100644 index 0000000..2c928c1 --- /dev/null +++ b/ckplayer/ckplayer.json @@ -0,0 +1,105 @@ +{ + "config": { + "fullInteractive": true, + "delay": 30, + "timeFrequency": 100, + "autoLoad": true, + "loadNext": 0, + "definition": true, + "subtitle": true, + "playbackRate": true, + "smartRemove": true, + "bufferTime": 200, + "rtmpBufferTime": 0, + "click": true, + "doubleClick": true, + "doubleClickInterval": 200, + "keyDown": { + "space": true, + "left": true, + "right": true, + "up": true, + "down": true + }, + "timeJump": 10, + "volumeJump": 0.1, + "timeScheduleAdjust": "1", + "previewDefaultLoad": true, + "promptSpotTime": true, + "buttonMode": { + "player": false, + "controlBar": false, + "timeSchedule": true, + "volumeSchedule": true + }, + "liveAndVod": { + "open": false, + "vodTime": 2, + "start": "start" + }, + "usehardwareeecoder": false, + "errorNum": 1, + "playCorrect": false, + "timeCorrect": true, + "m3u8Definition": {}, + "m3u8MaxBufferLength": 30, + "split": ",", + "timeStamp": "", + "videoDrawImage": false, + "errorTime": 10, + "addCallback": "adPlay,adPause,playOrPause,videoPlay,videoPause,videoMute,videoEscMute,videoClear,changeVolume,fastBack,fastNext,videoSeek,newVideo,getMetaDate,videoRotation,videoBrightness,videoContrast,videoSaturation,videoHue,videoZoom,videoProportion,videoError,addListener,removeListener,addElement,getElement,deleteElement,elementShow,animate,animateResume,animatePause,deleteAnimate,changeConfig,getConfig,openUrl,fullScreen,quitFullScreen,switchFull,screenshot,custom,changeControlBarShow,getCurrentSrc,changeDefinition,changeSubtitles,changeSubtitlesSize" + }, + "menu": { + "ckkey": "97b6a7181e0bdbe69e692383e1071ba1", + "name": "ckplayer", + "link": "http://www.ckplayer.com", + "domain": "", + "version": "version:X2", + "more":[] + }, + "languagePath": "", + "stylePath": "", + "style": { + "loading": { + "file": "data:image/gif;base64,R0lGODlhPAAeALMIAPRqMPRmK/RqMfNkKPRyPPV+TPRpL/NfIf///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3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Kg4CJjoyLk5R9UI1UVlWYgU6WjyCec36VIqKFpBZERU10CHY5FwWztIsvKrEktwG5vb6/wMHCw8QTEQAh+QQFCgAIACwAAAAAPAAeAAAErBDJSau9OOvNu/9gKI5kOQ1oaq7Z4b5sXL2w7NHuhR824f+YnQ4nKBpLwiFNuauNkhYopYnDAK5YZk7Li1Kds6p3yeVKp+IweQyefNvuNHqthiPeW3Z+br/L429BfxJngHZ4XXqJfHuMi4ZUgnSQj5Rmg4SYhZmTnF9WWFdlo3WRJJt+namfp5irjZ4uRketqq+Vtz0/PpKHrjaKpMAam6jDIcbHHykqys7PKxEAOw==", + "align": "center", + "vAlign": "middle", + "width": 60, + "height": 30, + "offsetX": -30, + "offsetY": -15 + }, + "logo": { + "file": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAUCAYAAAD4BKGuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAVTSURBVHja1Fl/aJVVGP4cw/mH5tUWi3I53cA0WbeIzMgaq6lQoVawm0S6glHhIKM/TELICotqCxMSGWQRdFfRLEhc9mMxqA0rbdS2wsV0GkZXuaKUWlHvgeeNh7f3u1du3Ft74eGcnXu+c873vD/Pt0nZbDZyZL2gWZAQTBH8IjggeEjgPZASPIB+g/P7EsGT6J/BfHfjHFIv2Jpjj/+dlDskvCm42Jk7X3C7YJOgw/z2oOBGwdEYRW0RVAjOCZ4ugNggqwU3CTLRBJFyQ+xuwVRY14igB78tE9QKpgmeEHwkGKRnq9AeMesHRWwEsYGUxwSdBZ51ecweE4Lct0DsOVjaZvptA8jfC4JfghWpXIJ2jMY+EDShf1pwh6DvX5x1GtpDE43cNFlfhyFWpQ9xd5FgFo3fRi++C+2nCBNBRgU3O6RsEyyEQv4QLMb4CcE9RlFBLqS1WZ6BZ83A35ofVhuvfE5QJrjWebdgCJOx51qM1QgewbMzsO57MDQrB9DeC8ObHd5Xyb2eiNiQQxmtg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3tr9lkvPJMUV152kc2PsmUEMxtzdPRk2SNX2DQ3Vhr02Is18LXjHVAz/bG0NEK8johus3UBiwyfkYlDkQUyLaWrwZBrbHMaB8Z3PJLaYk8IIVKKPSJdxbv3ecynNzLNr33GKLV1YVW4IyfycXfq0UxP4X5HJdXCqX4Wv0AKqYkkipw4LG6WxMNi+GhAtH+M/K8wVe7wuWvwQYAFT+UsGCXmX3AAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 87, + "height": 30, + "offsetX": -100, + "offsetY": 10 + }, + "advertisement": { + "time": 5, + "method": "get", + "videoForce": false, + "videoVolume": 0.8, + "skipButtonShow": true, + "linkButtonShow": true, + "muteButtonShow": true, + "closeButtonShow": true, + "closeOtherButtonShow": true, + "frontSkipButtonDelay": 2, + "insertSkipButtonDelay": 0, + "endSkipButtonDelay": 0, + "frontStretched": 1, + "insertStretched": 2, + "pauseStretched": 2, + "endStretched": 2 + }, + "videoDefault": { + "defaultWidth": 4, + "defaultHeight": 3 + } + } +} \ No newline at end of file diff --git a/ckplayer/ckplayer.min.js b/ckplayer/ckplayer.min.js new file mode 100644 index 0000000..94d6e06 --- /dev/null +++ b/ckplayer/ckplayer.min.js @@ -0,0 +1,16 @@ +/* + 软件名称:ckplayer + 软件版本:X2 + 软件作者:niandeng + 软件网站:http://www.ckplayer.com + -------------------------------------------------------------------------------------------------------------------- + 开发说明: + 使用的主要程序语言:javascript(js)及actionscript3.0(as3.0)(as3.0主要用于flashplayer部分的开发,不在该页面呈现) + 功能:播放视频 + 特点:兼容HTML5-VIDEO(优先)以及FlashPlayer + -------------------------------------------------------------------------------------------------------------------- + 使用开源代码部分: + 1:flashls-http://flashls.org/ + ===================================================================================================================== +*/ +!(function(){var ckplayerPath='';!function(){var scriptList=document.scripts,thisPath=scriptList[scriptList.length-1].src;for(var i=0;i1){if(videoStringTemp[0][0].substr(0,3)=='CK:'||videoStringTemp[0][0].substr(0,3)=='CE:'||videoStringTemp[0][0].substr(8,3)=='CK:'||videoStringTemp[0][0].substr(8,3)=='CE:'){this.vars['flashplayer']=true}}}this.videoString=videoStringTemp;this.checkUpConfig()},checkUpConfig:function(){var thisTemp=this;var configPath='';var jsTemp=null;if(this.vars['config']){if(this.vars['config'].substr(0,8)!='website:'){jsTemp=eval(this.vars['config']+'()');if(!this.isUndefined(jsTemp)){this.ckConfig=this.newObj(jsTemp);this.jsonConfig=this.newObj(jsTemp);this.loadConfig(null)}else{this.loadConfig(ckplayerPath+this.vars['config'])}}else{this.loadConfig(ckplayerPath+this.vars['config'].substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerConfig)==='function'){isFun=true}}catch(e){}if(isFun){jsTemp=ckplayerConfig();if(jsTemp){this.ckConfig=this.newObj(jsTemp);this.jsonConfig=this.newObj(jsTemp);this.loadConfig(null)}else{this.loadConfig(ckplayerPath+'ckplayer.json')}}else{this.loadConfig(ckplayerPath+'ckplayer.json')}}catch(e){thisTemp.sysError(thisTemp.errorList[12],e)}}},loadConfig:function(file){var thisTemp=this;if(file){this.ajax({url:file,success:function(data){if(data){thisTemp.ckConfig=data;thisTemp.jsonConfig=thisTemp.newObj(data);if(!thisTemp.isUndefined(data['flashvars'])){thisTemp.vars=thisTemp.objectAssign(data['flashvars'],thisTemp.vars)}thisTemp.checkUpLanguage()}else{thisTemp.sysError(thisTemp.errorList[11],'Config')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.checkUpLanguage()}},checkUpLanguage:function(){var thisTemp=this;var languagePath='';var jsTemp=null;if(this.vars['language']){languagePath=this.vars['language']}else{if(this.ckConfig['languagePath']){languagePath=this.ckConfig['languagePath']}}if(languagePath){if(languagePath.substr(0,8)!='website:'){jsTemp=eval(languagePath+'()');if(jsTemp){this.ckLanguage=this.newObj(jsTemp);this.jsonLanguage=this.newObj(jsTemp);this.loadLanguage(null)}else{this.loadLanguage(ckplayerPath+languagePath)}}else{this.loadLanguage(ckplayerPath+languagePath.substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerLanguage)==='function'){isFun=true}}catch(e){}if(isFun){jsTemp=ckplayerLanguage();if(jsTemp){this.ckLanguage=this.newObj(jsTemp);this.jsonLanguage=this.newObj(jsTemp);this.loadLanguage(null)}else{this.loadLanguage(ckplayerPath+'language.json')}}else{this.loadLanguage(ckplayerPath+'language.json')}}catch(e){thisTemp.sysError(thisTemp.errorList[12],e)}}},loadLanguage:function(file){var thisTemp=this;if(file){this.ajax({url:file,success:function(data){if(data){thisTemp.ckLanguage=data;thisTemp.jsonLanguage=thisTemp.newObj(data);thisTemp.checkUpStyle()}else{thisTemp.sysError(thisTemp.errorList[11],'language.json')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.checkUpStyle()}},checkUpStyle:function(){var thisTemp=this;var stylePath='';var jsTemp=null;var configJs=this.newObj(this.ckConfig);if(this.vars['style']){stylePath=this.vars['style']}else{if(this.ckConfig['stylePath']){stylePath=''+this.ckConfig['stylePath']}}if(stylePath){if(stylePath.substr(0,8)!='website:'){jsTemp=eval(stylePath+'()');if(!this.isUndefined(jsTemp)){this.jsonStyle=this.newObj(jsTemp);this.ckStyle=this.newObj(jsTemp);this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']);this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle);this.loadStyle(null)}else{this.loadStyle(ckplayerPath+stylePath)}}else{this.loadStyle(ckplayerPath+stylePath.substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerStyle)==='function'){isFun=true}}catch(e){isFun=false}if(isFun){jsTemp=ckplayerStyle();if(!this.isUndefined(jsTemp)){this.jsonStyle=this.newObj(jsTemp);this.ckStyle=this.newObj(jsTemp);this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']);this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle);this.loadStyle(null)}else{this.loadStyle(ckplayerPath+'style.json')}}else{this.loadStyle(ckplayerPath+'style.json')}}catch(e){}}},loadStyle:function(file){var thisTemp=this;if(file){var configJs=this.newObj(this.ckConfig);this.ajax({url:file,success:function(data){if(data){thisTemp.jsonStyle=thisTemp.newObj(data);thisTemp.ckStyle=thisTemp.newObj(data);thisTemp.ckStyle['advertisement']=thisTemp.objectAssign(configJs['style']['advertisement'],thisTemp.ckStyle['advertisement']);thisTemp.ckStyle=thisTemp.objectAssign(configJs['style'],thisTemp.ckStyle);thisTemp.loadConfigHandler()}else{thisTemp.sysError(thisTemp.errorList[11],'Style')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.loadConfigHandler()}},loadConfigHandler:function(){if((!this.supportVideo()&&this.vars['flashplayer']!='')||(this.vars['flashplayer']&&this.uploadFlash())||!this.isMsie()){this.html5Video=false;this.getVideo()}else if(this.videoString){this.analysedVideoUrl(this.videoString)}else{this.eject(this.errorList[2])}},analysedVideoUrl:function(video){var i=0,y=0;var thisTemp=this;this.VA=[];if(this.varType(video)=='string'){if(video.substr(0,8)!='website:'){this.VA=[[video,'','',0]];var fileExt=this.getFileExt(video);switch(fileExt){case'.mp4':this.VA[0][1]='video/mp4';break;case'.ogg':this.VA[0][1]='video/ogg';break;case'.webm':this.VA[0][1]='video/webm';break;default:break}this.getVideo()}else{if(this.html5Video){var ajaxObj={url:video.substr(8),success:function(data){if(data){thisTemp.analysedUrl(data)}else{thisTemp.eject(thisTemp.errorList[5]);this.VA=video;thisTemp.getVideo()}},error:function(data){thisTemp.eject(thisTemp.errorList[12],data)}};this.ajax(ajaxObj)}else{this.VA=video;this.getVideo()}}}else if(this.varType(video)=='array'){if(this.varType(video[0])=='array'){this.VA=video}this.getVideo()}else if(this.varType(video)=='object'){if(!this.isUndefined(video['type'])){this.VA.push([video['file'],video['type'],'',0]);this.getVideo()}else{this.eject(this.errorList[5])}}else{this.eject(this.errorList[4])}},analysedUrl:function(data){this.vars=this.standardization(this.vars,data);if(!this.isUndefined(data['video'])){this.vars['video']=data['video']}this.analysedVideoUrl(this.vars['video'])},getHtml5Video:function(){var va=this.VA;var nva=[];var mobile=this.isMobile();var video=document.createElement('video');var codecs=function(type){var cod='';switch(type){case'video/mp4':cod='avc1.4D401E, mp4a.40.2';break;case'video/ogg':cod='theora, vorbis';break;case'video/webm':cod='vp8.0, vorbis';break;default:break}return cod};var supportType=function(vidType,codType){if(!video.canPlayType){this.html5Video=false;return}var isSupp=video.canPlayType(vidType+';codecs="'+codType+'"');if(isSupp==''){return false}return true};if(this.vars['flashplayer']||!this.isMsie()){this.html5Video=false;return}for(var i=0;i0){this.VA=nva}else{if(!mobile){this.html5Video=false}}},getVideo:function(){var thisTemp=this;var v=this.vars;if(!this.adAnalysisEnd&&(v['adfront']!=''||v['adpause']!=''||v['adinsert']!=''||v['adend']!=''||v['advertisements']!='')){this.adAnalysisEnd=true;this.adAnalysis();return}if(this.V){this.changeVideo();return}if(this.vars['cktrack']){this.loadTrack()}if(this.supportVideo()&&!this.vars['flashplayer']){this.getHtml5Video()}var src='',source='',poster='',loop='',autoplay='',track='',crossorigin='';var video=v['video'];var i=0;var vBg=this.ckStyle['background']['backgroundColor'].replace('0x','#');this.CD=this.getByElement(v['container']);volume=v['volume'];if(this.isUndefined(this.CD)){this.eject(this.errorList[6],v['container']);return false}this.V=undefined;var thisPd=null;if(v['h5container']!=''){thisPd=this.getByElement(v['h5container']);if(this.isUndefined(thisPd)){thisPd=null}}var isVideoH5=null;if(v['playerID']!=''){isVideoH5=this.getByElement('#'+v['playerID']);if(this.isUndefined(isVideoH5)){isVideoH5=null}}if(thisPd!=null&&isVideoH5!=null){this.PD=thisPd}else{var playerID='ckplayer-'+this.randomString();var playerDiv=document.createElement('div');playerDiv.className=playerID;this.CD.innerHTML='';this.CD.appendChild(playerDiv);this.PD=playerDiv}this.css(this.CD,{backgroundColor:vBg,overflow:'hidden',position:'relative'});this.css(this.PD,{backgroundColor:vBg,width:'100%',height:'100%',fontFamily:this.fontFamily});if(this.html5Video){this.PD.onselectstart=this.PD.ondrag=function(){return false};if(this.VA.length==1){this.videoTemp['src']=decodeURIComponent(this.VA[0][0]);src=' src="'+this.videoTemp['src']+'"'}else{var videoArr=this.VA.slice(0);videoArr=this.arrSort(videoArr);for(i=0;i'}this.videoTemp['source']=source}if(v['autoplay']){autoplay=' autoplay="autoplay"'}if(v['poster']){poster=' poster="'+v['poster']+'"'}if(v['loop']){loop=' loop="loop"'}if(v['seek']>0){this.needSeek=v['seek']}if(v['track']!=null&&v['cktrack']==null){var trackArr=v['track'];var trackDefault='';var defaultHave=false;for(i=0;i'}}if(v['crossorigin']){crossorigin=' crossorigin="'+v['crossorigin']+'"'}var autoLoad=this.ckConfig['config']['autoLoad'];var preload='';if(!autoLoad){preload=' preload="meta"'}var vid=this.randomString();var controls='';var mobileAutoFull=v['mobileAutoFull'];var mobileautofull='';if(!mobileAutoFull){mobileautofull=' x-webkit-airplay="true" playsinline webkit-playsinline="true" x5-video-player-type="h5"'}if(this.isMobile()){controls=' controls="controls"'}if(isVideoH5!=null&&thisPd!=null){this.V=isVideoH5;if(v['poster']){this.V.poster=v['poster']}}else{var html='';if(!this.isM3u8){html=''}else{html=''}this.PD.innerHTML=html;this.V=this.getByElement('#'+vid)}try{this.V.volume=volume;if(this.playbackRateArr&&this.vars['playbackrate']>-1){if(this.vars['playbackrate']-1){this.playbackRate()}if(v['autoplay']){this.loadingStart(true)}this.subtitleSwitch()}this.playerLoad()}else{this.embedSWF()}},adAnalysis:function(){var thisTemp=this;var v=this.vars;var isAdvShow=[];var i=0;if(v['advertisements']!=''&&v['advertisements'].substr(0,8)=='website:'){var ajaxObj={url:v['advertisements'].substr(8),success:function(data){if(data){var newData={};var val=null;try{if(!thisTemp.isUndefined(data['front'])||!thisTemp.isUndefined(data['pause'])||!thisTemp.isUndefined(data['end'])||!thisTemp.isUndefined(data['insert'])||!thisTemp.isUndefined(data['other'])){val=thisTemp.arrayDel(data['front']);if(!thisTemp.isUndefined(val)){newData['front']=val}val=thisTemp.arrayDel(data['pause']);if(!thisTemp.isUndefined(val)){newData['pause']=val}val=thisTemp.arrayDel(data['insert']);if(!thisTemp.isUndefined(val)){newData['insert']=val;if(!thisTemp.isUndefined(data['inserttime'])){newData['inserttime']=thisTemp.arrayInt(data['inserttime']);isAdvShow=[];for(i=0;i0){return newArr}return null},adAnalysisOne:function(adType,adName,adTime,adLink,adStype){var v=this.vars;if(this.isUndefined(v[adName])){v[adName]=''}if(this.isUndefined(v[adTime])){v[adTime]=''}if(this.isUndefined(v[adLink])){v[adLink]=''}if(this.isUndefined(v[adStype])){v[adStype]=''}if(v[adName]!=''){var adList=[];var ad=v[adName].split(',');var adtime=v[adTime].split(',');var adlink=v[adLink].split(',');var adstype=v[adStype].split(',');var i=0;if(ad.length>0){var adLinkLen=adlink.length,adTimeLen=adtime.length;if(v[adLink]==''){adLinkLen=0;adlink=[]}if(v[adTime]==''){adTimeLen=0;adtime=[]}if(adLinkLen0?parseInt(adtime[i]):this.ckStyle['advertisement']['time'],link:adlink[i]};adList.push(obj)}}if(this.isUndefined(this.advertisements)){this.advertisements={}}if(adList.length>0){this.advertisements[adType]=adList}}}},playerLoad:function(){var thisTemp=this;if(this.isFirst){this.isFirst=false;setTimeout(function(){thisTemp.loadedHandler()},1)}},addVEvent:function(){var thisTemp=this;var duration=0;var eventVideoClick=function(event){thisTemp.videoClickXy={x:event.clientX,y:event.clientY};thisTemp.videoClick()};this.addListenerInside('click',eventVideoClick);this.addListenerInside('click',eventVideoClick,this.MDC);this.timerErrorFun();var eventJudgeIsLive=function(event){thisTemp.sendJS('loadedmetadata');if(thisTemp.varType(thisTemp.V.duration)=='number'&&thisTemp.V.duration>1){duration=thisTemp.V.duration;if(!duration){if(thisTemp.vars['duration']>0){duration=thisTemp.vars['duration']}}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}thisTemp.sendJS('duration',duration);thisTemp.formatInserttime(duration);if(thisTemp.adPlayerPlay){thisTemp.advertisementsTime(duration+1)}thisTemp.durationSendJS=true}if(thisTemp.conBarShow){thisTemp.V.controls=null;thisTemp.videoCss()}thisTemp.judgeIsLive()};var eventPlaying=function(event){thisTemp.playingHandler();thisTemp.sendJS('play');thisTemp.sendJS('paused',false);if(!thisTemp.durationSendJS&&thisTemp.varType(thisTemp.V.duration)=='number'&&thisTemp.V.duration>0){duration=thisTemp.V.duration;if(!duration){if(thisTemp.vars['duration']>0){duration=thisTemp.vars['duration']}}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}thisTemp.durationSendJS=true;thisTemp.sendJS('duration',duration);thisTemp.formatInserttime(duration)}};this.addListenerInside('playing',eventPlaying);var eventPause=function(event){thisTemp.pauseHandler();thisTemp.sendJS('pause');thisTemp.sendJS('paused',true)};this.addListenerInside('pause',eventPause);var eventEnded=function(event){thisTemp.endedHandler()};this.addListenerInside('ended',eventEnded);var eventTimeupdate=function(event){if(thisTemp.loadingShow){thisTemp.loadingStart(false)}if(thisTemp.time){if(!thisTemp.adPlayerPlay){thisTemp.sendJS('time',thisTemp.time);if(!thisTemp.isUndefined(thisTemp.advertisements['insert'])){thisTemp.checkAdInsert(thisTemp.time)}if(!thisTemp.isUndefined(thisTemp.advertisements['other'])){thisTemp.checkAdOther(thisTemp.time)}if(thisTemp.time<3&&thisTemp.adReset){thisTemp.adReset=false;thisTemp.endedAdReset()}}else{thisTemp.adPlayerTimeHandler(thisTemp.time)}}};this.addListenerInside('timeupdate',eventTimeupdate);var eventWaiting=function(event){thisTemp.loadingStart(true)};this.addListenerInside('waiting',eventWaiting);var eventSeeking=function(event){thisTemp.sendJS('seek','start')};this.addListenerInside('seeking',eventSeeking);var eventSeeked=function(event){thisTemp.seekedHandler();thisTemp.sendJS('seek','ended')};this.addListenerInside('seeked',eventSeeked);var eventVolumeChange=function(event){try{thisTemp.volumechangeHandler();thisTemp.sendJS('volume',thisTemp.volume||thisTemp.V.volume)}catch(event){}};this.addListenerInside('volumechange',eventVolumeChange);var eventFullChange=function(event){var fullState=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen;thisTemp.sendJS('full',fullState)};this.addListenerInside('fullscreenchange',eventFullChange);this.addListenerInside('webkitfullscreenchange',eventFullChange);this.addListenerInside('mozfullscreenchange',eventFullChange);if(this.conBarShow){this.interFace()}this.addListenerInside('loadedmetadata',eventJudgeIsLive)},resetPlayer:function(){this.timeTextHandler();if(this.conBarShow){this.timeProgress(0,1);this.changeLoad(0);this.initPlayPause();this.definition();this.deletePrompt();this.deletePreview();this.trackHide();this.resetTrack();this.trackElement=[];this.track=[]}},interFace:function(){this.conBarShow=true;var thisTemp=this;var html='';var i=0;var thisStyle=this.ckStyle;var styleC=thisStyle['controlBar'];var styleCB=styleC['button'];var styleAS=thisStyle['advertisement'];var styleDF=styleC['definition'];var bWidth=38;var timeInto=this.formatTime(0,this.vars['duration'],this.ckLanguage['vod']);this.CB={menu:null};var divEle={controlBarBg:null,controlBar:null,pauseCenter:null,errorText:null,promptBg:null,prompt:null,promptTriangle:null,definitionP:null,playbackrateP:null,subtitlesP:null,loading:null,logo:null,adBackground:null,adElement:null,adLink:null,adPauseClose:null,adTime:null,adTimeText:null,adMute:null,adEscMute:null,adSkip:null,adSkipText:null,adSkipButton:null};var k='';for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.PD.appendChild(this.CB[k])}this.CB['menu']=document.createElement('div');this.body.appendChild(this.CB['menu']);if(this.vars['live']){timeInto=this.formatTime(0,0,this.ckLanguage['live'])}divEle={play:null,pause:null,mute:null,escMute:null,full:null,escFull:null,definition:null,playbackrate:null,subtitles:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){this.CB[k].dataset.title=this.ckLanguage['buttonOver'][k]}this.CB['controlBar'].appendChild(this.CB[k])}divEle={timeProgressBg:null,timeBoBg:null,volume:null,timeText:null};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['controlBar'].appendChild(this.CB[k])}this.CB['timeText'].innerHTML=timeInto;divEle={loadProgress:null,timeProgress:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['timeProgressBg'].appendChild(this.CB[k])}this.CB['timeButton']=document.createElement('div');this.CB['timeBoBg'].appendChild(this.CB['timeButton']);divEle={volumeBg:null,volumeBO:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['volume'].appendChild(this.CB[k])}this.CB['volumeUp']=document.createElement('div');this.CB['volumeBg'].appendChild(this.CB['volumeUp']);var imgTemp=null;var imgFile='';var imgFile=thisStyle['loading']['file'];if(!this.isUndefined(thisStyle['loading']['fileH5'])){imgFile=thisStyle['loading']['fileH5']}if(imgFile){imgTemp=document.createElement('img');imgTemp.src=imgFile;imgTemp.border=0;this.CB['loading'].appendChild(imgTemp)}imgFile=thisStyle['logo']['file'];if(!this.isUndefined(thisStyle['logo']['fileH5'])){imgFile=thisStyle['logo']['fileH5']}if(imgFile){imgTemp=document.createElement('img');imgTemp.src=imgFile;imgTemp.border=0;this.CB['logo'].appendChild(imgTemp)}if(this.ckConfig['config']['buttonMode']['player']){this.css(this.PD,{cursor:'pointer'})}this.controlBar();var cssTemp=null;var promptCss=thisStyle['prompt'];cssTemp=this.getEleCss(promptCss,{overflow:'hidden',zIndex:900,display:'none'});this.css(this.CB['promptBg'],cssTemp);this.css(this.CB['promptBg'],'padding','0px');cssTemp['backgroundColor']='';cssTemp['border']='';cssTemp['borderRadius']='';cssTemp['whiteSpace']='nowrap';this.css(this.CB['prompt'],cssTemp);cssTemp={width:0,height:0,borderLeft:promptCss['triangleWidth']*0.5+'px solid transparent',borderRight:promptCss['triangleWidth']*0.5+'px solid transparent',borderTop:promptCss['triangleHeight']+'px solid '+promptCss['triangleBackgroundColor'].replace('0x','#'),overflow:'hidden',opacity:promptCss['triangleAlpha'],filter:'alpha(opacity:'+promptCss['triangleAlpha']+')',position:'absolute',left:'0px',top:'0px',zIndex:900,display:'none'};this.css(this.CB['promptTriangle'],cssTemp);this.elementCoordinate();this.css([this.CB['pauseCenter'],this.CB['loading'],this.CB['errorText']],'display','none');this.carbarButton();this.playerCustom();this.carbarCustom();this.timeProgressDefault();this.videoCss();this.initPlayPause();if(this.vars['volume']>0){this.css(this.CB['escMute'],'display','none')}else{this.css(this.CB['mute'],'display','none')}if(!this.ckConfig['config']['mobileVolumeBarShow']&&this.isMobile()){this.css([this.CB['mute'],this.CB['escMute'],this.CB['volume']],{display:'none'})}this.css(this.CB['escFull'],'display','none');var cssObj={align:'top',vAlign:'left',width:'100%',height:'100%',offsetX:0,offsetY:0,zIndex:910,display:'none'};cssTemp=this.getEleCss(styleAS['background'],cssObj);this.css(this.CB['adBackground'],cssTemp);this.css(this.CB['adElement'],{position:'absolute',overflow:'hidden',top:'0px',zIndex:911,float:'center',display:'none'});this.advertisementStyle();this.css([this.CB['adTime'],this.CB['adTimeText'],this.CB['adMute'],this.CB['adEscMute'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink'],this.CB['adPauseClose']],'display','none');var timeProgressOut=function(event){thisTemp.timeProgressMouseOut()};this.addListenerInside('mouseout',timeProgressOut,this.CB['timeBoBg']);var timeProgressOver=function(event){thisTemp.timeProgressDefault()};this.addListenerInside('mouseover',timeProgressOver,this.CB['controlBar']);this.buttonEventFun(this.CB['play'],styleCB['play']);this.buttonEventFun(this.CB['pause'],styleCB['pause']);this.buttonEventFun(this.CB['mute'],styleCB['mute']);this.buttonEventFun(this.CB['escMute'],styleCB['escMute']);this.buttonEventFun(this.CB['full'],styleCB['full']);this.buttonEventFun(this.CB['escFull'],styleCB['escFull']);this.buttonEventFun(this.CB['adMute'],styleAS['muteButton']);this.buttonEventFun(this.CB['adEscMute'],styleAS['escMuteButton']);this.buttonEventFun(this.CB['adSkipButton'],styleAS['skipAdButton']);this.buttonEventFun(this.CB['adLink'],styleAS['adLinkButton']);this.buttonEventFun(this.CB['adPauseClose'],styleAS['closeButton']);this.buttonEventFun(this.CB['pauseCenter'],thisStyle['centerPlay']);this.buttonEventFun(this.CB['volumeBO'],styleC['volumeSchedule']['button']);this.buttonEventFun(this.CB['timeButton'],styleC['timeSchedule']['button']);this.addButtonEvent();this.controlBarHide();this.newMenu();this.keypress();this.changeVolume(this.vars['volume']);setTimeout(function(){thisTemp.elementCoordinate()},100);this.checkBarWidth();var resize=function(){thisTemp.log('window.resize');thisTemp.playerResize()};var MutationObserver=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;var observer=new MutationObserver(function(){thisTemp.log('video.resize');var cdW=parseInt(thisTemp.css(thisTemp.CD,'width')),cdH=parseInt(thisTemp.css(thisTemp.CD,'height'));if(cdW!=thisTemp.cdWH['w']||cdH!=thisTemp.cdWH['h']){thisTemp.cdWH={w:cdW,h:cdH};thisTemp.changeSize(cdW,cdH)}});observer.observe(this.CD,{attributes:true,attributeFilter:['style'],attributeOldValue:true});this.addListenerInside('resize',resize,window)},timeProgressDefault:function(){var styleCT=this.ckStyle['controlBar']['timeSchedule'];var cssObj=this.newObj(styleCT['default']);var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg'];var cssTemp=null;this.css(this.CB['timeBoBg'],'display','block');cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:2},this.CB['controlBarBg']);this.css(this.CB['timeProgressBg'],cssTemp);cssObj={align:'left',vAlign:'top',width:1,height:cssObj['height'],backgroundImg:loadBackImg};if(this.CB['loadProgress'].offsetWidth>1){cssObj['width']=this.CB['loadProgress'].offsetWidth}cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']);this.css(this.CB['loadProgress'],cssTemp);cssObj['width']=0;if(this.CB['timeProgress'].offsetWidth>1&&parseInt(this.css(this.CB['timeButton'],'left'))>0){cssObj['width']=this.CB['timeProgress'].offsetWidth}cssObj['backgroundImg']=playBackImg;cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2});this.css(this.CB['timeProgress'],cssTemp);cssTemp=this.getEleCss(styleCT['buttonContainer'],{position:'absolute',overflow:'hidden',zIndex:3},this.CB['controlBar']);if(this.ckConfig['config']['buttonMode']['timeSchedule']){cssTemp['cursor']='pointer'}this.css(this.CB['timeBoBg'],cssTemp);cssTemp=this.getEleCss(styleCT['button'],{cursor:'pointer',overflow:'hidden',zIndex:4},this.CB['timeBoBg']);this.css(this.CB['timeButton'],cssTemp)},timeProgressMouseOut:function(){var styleCT=this.ckStyle['controlBar']['timeSchedule'];var cssObj=this.newObj(styleCT['mouseOut']);var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg'];var cssTemp=null;this.css(this.CB['timeBoBg'],'display','block');cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:2},this.CB['controlBarBg']);this.css(this.CB['timeProgressBg'],cssTemp);cssObj={align:'left',vAlign:'top',width:1,height:cssObj['height'],backgroundImg:loadBackImg};if(this.CB['loadProgress'].offsetWidth>1){cssObj['width']=this.CB['loadProgress'].offsetWidth}cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']);this.css(this.CB['loadProgress'],cssTemp);cssObj['width']=1;if(this.CB['timeProgress'].offsetWidth>1&&parseInt(this.css(this.CB['timeButton'],'left'))>0){cssObj['width']=this.CB['timeProgress'].offsetWidth;cssObj['backgroundImg']=playBackImg}cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2});this.css(this.CB['timeProgress'],cssTemp);this.css(this.CB['timeBoBg'],'display','none')},buttonEventFun:function(ele,cssEle){var thisTemp=this;var overFun=function(event){thisTemp.css(ele,{backgroundImage:'url('+cssEle['mouseOver']+')'});thisTemp.promptShow(ele)};var outFun=function(event){thisTemp.css(ele,{backgroundImage:'url('+cssEle['mouseOut']+')'});thisTemp.promptShow(false)};outFun();this.addListenerInside('mouseover',overFun,ele);this.addListenerInside('mouseout',outFun,ele);if(!this.isUndefined(cssEle['clickEvent'])){var clickFun=function(event){thisTemp.runFunction(cssEle['clickEvent'])};this.addListenerInside('click',clickFun,ele)}},formatNumPx:function(str,z){if(!str){return 0}if(str.toString().indexOf('%')>-1){if(!this.isUndefined(z)){return parseInt(str)*z*0.01+'px'}return str}else{return str+'px'}},formatZToNum:function(str,z){if(!str){return 0}if(str.toString().indexOf('%')>-1){if(!this.isUndefined(z)){return parseInt(str)*z*0.01}return str}else{return str}},newObj:function(obj){if(this.isUndefined(obj)){return obj}var str,newobj={};if(this.varType(obj)!='object'){return obj}else{for(var k in obj){if(this.isUndefined(obj[k])){newobj[k]=obj[k]}else{if(this.varType(obj[k])=='object'){newobj[k]=this.newObj(obj[k])}else{newobj[k]=obj[k]}}}}return newobj},loadImgBg:function(eleid,obj){this.css(this.getByElement(eleid),{backgroundImage:'url('+obj+')'})},getEleCss:function(eleObj,supplement,rrEle){var eleName=null;var pdW=this.PD.offsetWidth,pdH=this.PD.offsetHeight;if(rrEle){pdW=rrEle.offsetWidth;pdH=rrEle.offsetHeight}if(this.isUndefined(eleObj)){return null}eleName=this.newObj(eleObj);var cssObject={};if(!this.isUndefined(eleName['width'])){cssObject['width']=this.formatZToNum(eleName['width'],pdW)+'px'}if(!this.isUndefined(eleName['height'])){cssObject['height']=this.formatZToNum(eleName['height'],pdH)+'px'}if(!this.isUndefined(eleName['background'])){var bg=eleName['background'];if(!this.isUndefined(bg['backgroundColor'])){cssObject['backgroundColor']=bg['backgroundColor'].replace('0x','#')}if(!this.isUndefined(bg['backgroundImg'])){cssObject['backgroundImage']='url('+bg['backgroundImg']+')'}if(!this.isUndefined(bg['alpha'])){cssObject['filter']='alpha(opacity:'+bg['alpha']+')';cssObject['opacity']=bg['alpha']}}if(!this.isUndefined(eleName['backgroundColor'])){cssObject['backgroundColor']=eleName['backgroundColor'].replace('0x','#')}if(!this.isUndefined(eleName['backgroundImg'])){cssObject['backgroundImage']='url('+eleName['backgroundImg']+')'}if(!this.isUndefined(eleName['color'])){cssObject['color']=eleName['color'].replace('0x','#')}if(!this.isUndefined(eleName['font'])){cssObject['fontFamily']=eleName['font']}if(!this.isUndefined(eleName['size'])){cssObject['fontSize']=eleName['size']+'px'}if(!this.isUndefined(eleName['alpha'])){cssObject['filter']='alpha(opacity:'+eleName['alpha']+')';cssObject['opacity']=eleName['alpha']}if(!this.isUndefined(eleName['lineHeight'])){cssObject['lineHeight']=eleName['lineHeight']+'px'}if(!this.isUndefined(eleName['textAlign'])){cssObject['textAlign']=eleName['textAlign']}if(!this.isUndefined(eleName['borderRadius'])){cssObject['borderRadius']=eleName['borderRadius']+'px'}if(!this.isUndefined(eleName['radius'])){cssObject['borderRadius']=eleName['radius']+'px'}if(!this.isUndefined(eleName['padding'])){cssObject['padding']=eleName['padding']+'px'}if(!this.isUndefined(eleName['paddingLeft'])){cssObject['paddingLeft']=eleName['paddingLeft']+'px'}if(!this.isUndefined(eleName['paddingRight'])){cssObject['paddingRight']=eleName['paddingRight']+'px'}if(!this.isUndefined(eleName['paddingTop'])){cssObject['paddingTop']=eleName['paddingTop']+'px'}if(!this.isUndefined(eleName['paddingBottom'])){cssObject['paddingBottom']=eleName['paddingBottom']+'px'}if(!this.isUndefined(eleName['margin'])){cssObject['margin']=eleName['margin']+'px'}if(!this.isUndefined(eleName['marginLeft'])){cssObject['marginLeft']=eleName['marginLeft']+'px'}if(!this.isUndefined(eleName['marginRight'])){cssObject['marginRight']=eleName['marginRight']+'px'}if(!this.isUndefined(eleName['marginTop'])){cssObject['marginTop']=eleName['marginTop']+'px'}if(!this.isUndefined(eleName['marginBottom'])){cssObject['marginBottom']=eleName['marginBottom']+'px'}if(!this.isUndefined(eleName['border'])&&!this.isUndefined(eleName['borderColor'])){cssObject['border']=eleName['border']+'px solid '+eleName['borderColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderLeft'])&&!this.isUndefined(eleName['borderLeftColor'])){cssObject['borderLeft']=eleName['borderLeft']+'px solid '+eleName['borderLeftColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderRight'])&&!this.isUndefined(eleName['borderRightColor'])){cssObject['borderRight']=eleName['borderRight']+'px solid '+eleName['borderRightColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderTop'])&&!this.isUndefined(eleName['borderTopColor'])){cssObject['borderTop']=eleName['borderTop']+'px solid '+eleName['borderTopColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderBottom'])&&!this.isUndefined(eleName['borderBottomColor'])){cssObject['borderBottom']=eleName['borderBottom']+'px solid '+eleName['borderBottomColor'].replace('0x','#')}if(!this.isUndefined(supplement)){for(var k in supplement){cssObject[k]=supplement[k]}}cssObject['position']='absolute';var left=-10000,top=-10000,right=-10000,bottom=-10000;var offsetX=0,offsetY=0;if(!this.isUndefined(eleName['offsetX'])){offsetX=eleName['offsetX']}if(!this.isUndefined(eleName['marginX'])){offsetX=eleName['marginX']}if(!this.isUndefined(eleName['offsetY'])){offsetY=eleName['offsetY']}if(!this.isUndefined(eleName['marginY'])){offsetY=eleName['marginY']}offsetX=this.formatZToNum(offsetX,pdW);offsetY=this.formatZToNum(offsetY,pdH);if(!this.isUndefined(eleName['align'])){left=0;switch(eleName['align']){case'left':left=offsetX;break;case'center':left=pdW*0.5+offsetX;break;case'right':left=pdW+offsetX;break;case'right2':left=-10000;right=offsetX;break}}if(!this.isUndefined(eleName['vAlign'])){top=0;switch(eleName['vAlign']){case'top':top=offsetY;break;case'middle':top=pdH*0.5+offsetY;break;case'bottom':top=pdH+offsetY;break;case'bottom2':top=-10000;bottom=offsetY;break}}if(left>-10000){cssObject['left']=left+'px'}if(right>-10000){cssObject['right']=right+'px'}if(top>-10000){cssObject['top']=top+'px'}if(bottom>-10000){cssObject['bottom']=bottom+'px'}return cssObject},newCanvas:function(id,width,height){return''},addButtonEvent:function(){var thisTemp=this;var promptHide=function(event){thisTemp.promptShow(false)};var definitionOver=function(event){thisTemp.promptShow(thisTemp.CB['definition'])};this.addListenerInside('mouseover',definitionOver,this.CB['definition']);this.addListenerInside('mouseout',promptHide,this.CB['definition']);var playbackrateOver=function(event){thisTemp.promptShow(thisTemp.CB['playbackrate'])};this.addListenerInside('mouseover',playbackrateOver,this.CB['playbackrate']);this.addListenerInside('mouseout',promptHide,this.CB['playbackrate']);var subtitlesOver=function(event){thisTemp.promptShow(thisTemp.CB['subtitles'])};this.addListenerInside('mouseover',subtitlesOver,this.CB['subtitles']);this.addListenerInside('mouseout',promptHide,this.CB['subtitles']);var volumePrompt=function(vol){var volumeBOXY=thisTemp.getCoor(thisTemp.CB['volumeBO']);var promptObj={title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',vol),x:volumeBOXY['x']+thisTemp.CB['volumeBO'].offsetWidth*0.5,y:volumeBOXY['y']};thisTemp.promptShow(false,promptObj)};var volumeObj={slider:this.CB['volumeBO'],follow:this.CB['volumeUp'],refer:this.CB['volumeBg'],grossValue:'volume',pd:true,startFun:function(vol){},monitorFun:function(vol){thisTemp.changeVolume(vol*0.01,false,false);volumePrompt(vol)},endFun:function(vol){},overFun:function(vol){volumePrompt(vol)}};this.slider(volumeObj);var volumeClickObj={refer:this.CB['volumeBg'],grossValue:'volume',fun:function(vol){thisTemp.changeVolume(vol*0.01,true,true)}};this.progressClick(volumeClickObj);this.timeButtonMouseDown();var volumeBgMove=function(event){var volumeBgXY=thisTemp.getCoor(thisTemp.CB['volumeBg']);var eventX=thisTemp.client(event)['x'];var eventVolume=parseInt((eventX-volumeBgXY['x'])*100/thisTemp.CB['volumeBg'].offsetWidth);var buttonPromptObj={title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',eventVolume),x:eventX,y:volumeBgXY['y']};thisTemp.promptShow(false,buttonPromptObj)};this.addListenerInside('mousemove',volumeBgMove,this.CB['volumeBg']);this.addListenerInside('mouseout',promptHide,this.CB['volumeBg']);this.addListenerInside('mouseout',promptHide,this.CB['volumeBO']);this.addDefListener();this.addPlaybackrate();this.addSubtitles()},videoClick:function(){var thisTemp=this;var clearTimerClick=function(){if(thisTemp.timerClick!=null){if(thisTemp.timerClick.runing){thisTemp.timerClick.stop()}thisTemp.timerClick=null}};var timerClickFun=function(){clearTimerClick();thisTemp.isClick=false;thisTemp.sendJS('videoClick',thisTemp.videoClickXy);if(thisTemp.adPlayerPlay){var ad=thisTemp.getNowAdvertisements();try{if(ad['link']!=''){window.open(ad['link'])}thisTemp.ajaxSuccessNull(ad['clickMonitor'])}catch(event){}}else{if(thisTemp.ckConfig['config']['click']){thisTemp.playOrPause()}}};clearTimerClick();if(this.isClick){this.isClick=false;thisTemp.sendJS('videoDoubleClick',thisTemp.videoClickXy);if(thisTemp.ckConfig['config']['doubleClick']){if(!this.full){thisTemp.fullScreen()}else{thisTemp.quitFullScreen()}}}else{this.isClick=true;this.timerClick=new this.timer(300,timerClickFun,1)}},timeButtonMouseDown:function(){var thisTemp=this;var timePrompt=function(time){if(isNaN(time)){time=0}var timeButtonXY=thisTemp.getCoor(thisTemp.CB['timeButton']);var promptObj={title:thisTemp.formatTime(time,0,thisTemp.ckLanguage['timeSliderOver']),x:timeButtonXY['x']-thisTemp.pdCoor['x']+thisTemp.CB['timeButton'].offsetWidth*0.5,y:timeButtonXY['y']-thisTemp.pdCoor['y']};thisTemp.promptShow(false,promptObj)};var timeObj={slider:this.CB['timeButton'],follow:this.CB['timeProgress'],refer:this.CB['timeBoBg'],grossValue:'time',pd:false,startFun:function(time){thisTemp.isTimeButtonMove=false},monitorFun:function(time){},endFun:function(time){if(thisTemp.V){if(thisTemp.V.duration>0){thisTemp.needSeek=0;thisTemp.videoSeek(parseInt(time))}}},overFun:function(time){timePrompt(time)}};var timeClickObj={refer:this.CB['timeBoBg'],grossValue:'time',fun:function(time){if(thisTemp.V){if(thisTemp.V.duration>0){thisTemp.needSeek=0;thisTemp.videoSeek(parseInt(time))}}}};var timeBoBgmousemove=function(event){var timeBoBgXY=thisTemp.getCoor(thisTemp.CB['timeBoBg']);var eventX=thisTemp.client(event)['x'];var duration=thisTemp.V.duration;if(isNaN(duration)||parseInt(duration)<0.2){duration=thisTemp.vars['duration']}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}var eventTime=parseInt((eventX-timeBoBgXY['x'])*duration/thisTemp.CB['timeBoBg'].offsetWidth);var buttonPromptObj={title:thisTemp.formatTime(eventTime,0,thisTemp.ckLanguage['timeSliderOver']),x:eventX,y:timeBoBgXY['y']};thisTemp.promptShow(false,buttonPromptObj);var def=false;if(!thisTemp.isUndefined(thisTemp.CB['definitionP'])){if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block'){def=true}}if(thisTemp.vars['preview']!=null&&def){buttonPromptObj['time']=eventTime;thisTemp.preview(buttonPromptObj)}};var promptHide=function(event){thisTemp.promptShow(false);if(thisTemp.previewDiv!=null){thisTemp.css([thisTemp.previewDiv,thisTemp.previewTop],'display','none')}};if(!this.vars['live']){this.isTimeButtonDown=true;this.addListenerInside('mousemove',timeBoBgmousemove,this.CB['timeBoBg']);this.addListenerInside('mouseout',promptHide,this.CB['timeBoBg'])}else{this.isTimeButtonDown=false;timeObj['removeListenerInside']=true;timeClickObj['removeListenerInside']=true}this.slider(timeObj);this.progressClick(timeClickObj)},progressClick:function(obj){var thisTemp=this;var referMouseClick=function(event){var referX=thisTemp.client(event)['x']-thisTemp.getCoor(obj['refer'])['x'];var rWidth=obj['refer'].offsetWidth;var grossValue=0;if(obj['grossValue']=='volume'){grossValue=100}else{if(thisTemp.V){grossValue=thisTemp.V.duration;if(isNaN(grossValue)||parseInt(grossValue)<0.2){grossValue=thisTemp.vars['duration']}if(thisTemp.vars['forceduration']>0){grossValue=thisTemp.vars['forceduration']}}}var nowZ=parseInt(referX*grossValue/rWidth);if(obj['fun']){if(obj['grossValue']==='time'){var sliderXY=thisTemp.getCoor(thisTemp.CB['timeButton']);sliderLeft=sliderXY['x'];if(!thisTemp.checkSlideLeft(referX,sliderLeft,rWidth)){return}var bimeButtonWB=thisTemp.CB['timeButton'].offsetWidth*0.5;thisTemp.css(thisTemp.CB['timeButton'],'left',(referX-bimeButtonWB)+'px');thisTemp.css(thisTemp.CB['timeProgress'],'width',(referX)+'px')}obj['fun'](nowZ)}};if(this.isUndefined(obj['removeListenerInside'])){this.addListenerInside('click',referMouseClick,obj['refer'])}else{this.removeListenerInside('click',referMouseClick,obj['refer'])}},slider:function(obj){var thisTemp=this;var clientX=0,criterionWidth=0,sliderLeft=0,referLeft=0;var value=0;var calculation=function(){var sLeft=parseInt(thisTemp.css(obj['slider'],'left'));var rWidth=obj['refer'].offsetWidth-obj['slider'].offsetWidth;var grossValue=0;if(thisTemp.isUndefined(sLeft)||isNaN(sLeft)){sLeft=0}if(obj['grossValue']=='volume'){grossValue=100}else{if(thisTemp.V){grossValue=thisTemp.V.duration}}return parseInt(sLeft*grossValue/rWidth)};var mDown=function(event){thisTemp.addListenerInside('mousemove',mMove,document);thisTemp.addListenerInside('mouseup',mUp,document);var referXY=thisTemp.getCoor(obj['refer']);var sliderXY=thisTemp.getCoor(obj['slider']);clientX=thisTemp.client(event)['x'];referLeft=referXY['x'];sliderLeft=sliderXY['x'];criterionWidth=clientX-sliderLeft;if(obj['startFun']){obj['startFun'](calculation())}};var mMove=function(event){clientX=thisTemp.client(event)['x'];var newX=clientX-criterionWidth-referLeft;if(newX<0){newX=0}if(newX>obj['refer'].offsetWidth-obj['slider'].offsetWidth){newX=obj['refer'].offsetWidth-obj['slider'].offsetWidth}if(obj['slider']===thisTemp.CB['timeButton']){if(!thisTemp.checkSlideLeft(newX,sliderLeft,obj['refer'].offsetWidth)){return}}thisTemp.css(obj['slider'],'left',newX+'px');thisTemp.css(obj['follow'],'width',(newX+obj['slider'].offsetWidth*0.5)+'px');var nowZ=calculation();if(obj['monitorFun']){obj['monitorFun'](nowZ)}};var mUp=function(event){thisTemp.removeListenerInside('mousemove',mMove,document);thisTemp.removeListenerInside('mouseup',mUp,document);if(obj['endFun']){obj['endFun'](calculation())}};var mOver=function(event){if(obj['overFun']){obj['overFun'](calculation())}};if(this.isUndefined(obj['removeListenerInside'])){this.addListenerInside('mousedown',mDown,obj['slider']);this.addListenerInside('mouseover',mOver,obj['slider'])}else{this.removeListenerInside('mousedown',mDown,obj['slider']);this.removeListenerInside('mouseover',mOver,obj['slider'])}},checkSlideLeft:function(newX,sliderLeft,refer){var timeSA=this.ckConfig['config']['timeScheduleAdjust'];switch(timeSA){case 0:return false;break;case 2:if(newXsliderLeft){return false}break;case 4:if(!this.timeSliderLeftTemp){this.timeSliderLeftTemp=sliderLeft/refer}if(newXthis.timeSliderLeftTemp){this.timeSliderLeftTemp=timeSliderMax}}if(newX>this.timeSliderLeftTemp*refer){return false}break;default:return true;break}return true},loadingStart:function(rot){var thisTemp=this;if(this.isUndefined(rot)){rot=true}if(this.conBarShow){this.css(thisTemp.CB['loading'],'display','none');this.loadingShow=false}var buffer=0;if(rot){if(this.conBarShow){this.css(thisTemp.CB['loading'],'display','block');this.loadingShow=true}}else{thisTemp.sendJS('buffer',100)}},promptShow:function(ele,data){if(!this.conBarShow){return}var obj={};var eleTitle='';if(!this.isUndefined(ele)){eleTitle=this.getDataset(ele,'title');if(this.isUndefined(eleTitle)){ele=null}}if(ele||data){if(!this.isUndefined(data)){obj=data}else{var offsetCoor=this.getCoor(ele);obj={title:eleTitle,x:offsetCoor['x']+ele.offsetWidth*0.5,y:offsetCoor['y']}}this.CB['prompt'].innerHTML=obj['title'];this.css(this.CB['prompt'],'display','block');var promptStye=this.ckStyle['prompt'];var promoptWidth=this.CB['prompt'].offsetWidth,promoptHeight=this.CB['prompt'].offsetHeight;this.css(this.CB['promptBg'],{width:promoptWidth+'px',height:promoptHeight+'px'});var x=obj['x']-(promoptWidth*0.5);var y=obj['y']-this.CB['prompt'].offsetHeight-promptStye['marginBottom']-promptStye['triangleHeight'];if(x<0){x=0}if(x>this.PD.offsetWidth-promoptWidth){x=this.PD.offsetWidth-promoptWidth}this.css([this.CB['promptBg'],this.CB['prompt']],{display:'block',left:x+'px',top:y+'px'});this.css(this.CB['promptTriangle'],{display:'block',left:x+(promoptWidth-promptStye['triangleWidth'])*0.5+parseInt(promptStye['triangleDeviationX'])+'px',top:y+promoptHeight+'px'})}else{this.css([this.CB['promptBg'],this.CB['prompt'],this.CB['promptTriangle']],{display:'none'})}},timerErrorFun:function(){var thisTemp=this;this.errorSend=false;var clearIntervalError=function(event){if(thisTemp.timerError!=null){if(thisTemp.timerError.runing){thisTemp.timerError.stop()}thisTemp.timerError=null}};var errorFun=function(event){clearIntervalError();thisTemp.error=true;thisTemp.errorUrl=thisTemp.getVideoUrl();if(!thisTemp.errorSend){thisTemp.errorSend=true;thisTemp.sendJS('error')}if(thisTemp.conBarShow){thisTemp.CB['errorText'].innerHTML=thisTemp.ckLanguage['error']['streamNotFound'];thisTemp.css(thisTemp.CB['errorText'],'display','block');thisTemp.css([thisTemp.CB['pauseCenter'],thisTemp.CB['loading']],'display','none')}thisTemp.V.removeAttribute('poster');thisTemp.resetPlayer()};var errorListenerFun=function(event){setTimeout(function(){if(isNaN(thisTemp.V.duration)){errorFun(event)}},500)};if(!this.errorAdd){this.errorAdd=true;this.addListenerInside('error',errorListenerFun)}clearIntervalError();var timerErrorFun=function(){if(thisTemp.V&&parseInt(thisTemp.V.networkState)==3){errorFun()}};this.timerError=new this.timer(this.ckConfig['config']['errorTime'],timerErrorFun)},judgeFullScreen:function(){var thisTemp=this;if(this.timerFull!=null){if(this.timerFull.runing){this.timerFull.stop()}this.timerFull=null}var fullFun=function(){thisTemp.isFullScreen()};this.timerFull=new this.timer(20,fullFun)},isFullScreen:function(){if(!this.conBarShow){return}var fullState=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;if(fullState&&!this.full){this.full=true;this.sendJS('full',true);this.elementCoordinate();this.carbarButton();this.customCoor();this.css(this.CB['full'],'display','none');this.css(this.CB['escFull'],'display','block');if(this.vars['live']==0){this.timeUpdateHandler()}this.PD.appendChild(this.CB['menu'])}if(!fullState&&this.full){this.full=false;this.sendJS('full',false);this.elementCoordinate();this.carbarButton();this.customCoor();this.css(this.CB['full'],'display','block');this.css(this.CB['escFull'],'display','none');if(this.timerFull!=null){if(this.timerFull.runing){this.timerFull.stop()}this.timerFull=null}if(this.vars['live']==0){this.timeUpdateHandler()}this.body.appendChild(this.CB['menu'])}},newMenu:function(){var thisTemp=this;var i=0;this.css(this.CB['menu'],{backgroundColor:'#FFFFFF',padding:'5px',position:'absolute',left:'10px',top:'20px',display:'none',zIndex:'999',color:'#A1A9BE',boxShadow:'2px 2px 3px #AAAAAA'});var mArr=this.contextMenu;var cMenu=this.ckConfig['menu'];if(cMenu['name']){if(cMenu['link']){mArr[0]=[cMenu['name'],'link',cMenu['link']]}else{mArr[0]=[cMenu['name'],'default']}}if(cMenu['version']){mArr[1]=[cMenu['version'],'default','line']}if(cMenu['more']){if(this.varType(cMenu['more'])=='array'){if(cMenu['more'].length>0){var moreArr=cMenu['more'];for(i=0;i'+me[0]+'

';break;case'link':if(me[3]){me[3]='target="'+me[3]+'"'}html+='

'+me[0]+'

';break;case'javaScript':html+='

'+me[0]+'

';break;case'actionScript':html+='

'+me[0]+'

';break;default:break}}this.CB['menu'].innerHTML=html;var pArr=this.CB['menu'].childNodes;for(i=0;icdH-2)&&cShow&&!thisTemp.getMetaDate()['paused']){controlBarShow(false)}}else{if(!cShow){controlBarShow(true)}}oldClient={x:client['x'],y:client['y']}};this.timerCBar=new this.timer(2000,cbarFun);var cdMove=function(event){var getClient=thisTemp.client(event);client['x']=getClient['x'];client['y']=getClient['y'];if(!cShow){controlBarShow(true)}thisTemp.sendJS('mouse',client)};this.addListenerInside('mousemove',cdMove,thisTemp.CD);this.addListenerInside('ended',cdMove);this.addListenerInside('resize',cdMove,window);if(hide===true){cShow=true;force=true;controlBarShow(false)}if(hide===false){cShow=false;force=true;controlBarShow(true)}},keypress:function(){var thisTemp=this;var keyDown=function(eve){var keycode=eve.keyCode||eve.which;if(thisTemp.adPlayerPlay){return}switch(keycode){case 32:thisTemp.playOrPause();break;case 37:thisTemp.fastBack();break;case 39:thisTemp.fastNext();break;case 38:now=thisTemp.volume+thisTemp.ckConfig['config']['volumeJump'];thisTemp.changeVolume(now>1?1:now);break;case 40:now=thisTemp.volume-thisTemp.ckConfig['config']['volumeJump'];thisTemp.changeVolume(now<0?0:now);break;default:break}};this.addListenerInside('keydown',keyDown,window||document)},playbackRate:function(){if(!this.conBarShow||!this.ckConfig['config']['playbackRate']){return}var styleCD=this.ckStyle['controlBar']['playbackrate'];var cssSup={overflow:'hidden',display:'none',zIndex:995};var cssSup2={overflow:'hidden',align:'top',vAlign:'left',offsetX:0,offsetY:0,zIndex:1};var thisTemp=this;var dArr=this.playbackRateArr;var html='';var nowD='';var i=0,nowI=0;nowD=dArr[this.playbackRateDefault][1];nowI=this.playbackRateDefault;this.removeChildAll(this.CB['playbackrateP']);if(dArr.length>1){this.CB['playbackratePB']=document.createElement('div'),this.CB['playbackratePC']=document.createElement('div');this.CB['playbackrateP'].appendChild(this.CB['playbackratePB']);this.CB['playbackrateP'].appendChild(this.CB['playbackratePC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['playbackratePC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['playbackrateP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['playbackratePB'],cssTemp);for(i=0;i0){this.subtitlesTemp=dArr.length-1}for(i=0;i1){this.CB['subtitlesPB']=document.createElement('div'),this.CB['subtitlesPC']=document.createElement('div');this.CB['subtitlesP'].appendChild(this.CB['subtitlesPB']);this.CB['subtitlesP'].appendChild(this.CB['subtitlesPC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['subtitlesPC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['subtitlesP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['subtitlesPB'],cssTemp);for(i=0;in){var arr=vArr[n];if(arr.length>2){var title=arr[1];if(title){this.newSubtitles(title)}}}},changeSubtitlesSize:function(n,m){if(!this.loaded||n<0){return}if(this.playerType=='flashplayer'){this.V.changeSubtitlesSize(n,m);return}this.ckStyle['cktrack']['size']=n;if(!this.isUndefined(m)){this.ckStyle['cktrack']['leading']=m}this.trackShowAgain()},newSubtitles:function(title){var vArr=this.vars['cktrack'];var i=0;for(i=0;i1){this.CB['definitionPB']=document.createElement('div'),this.CB['definitionPC']=document.createElement('div');this.CB['definitionP'].appendChild(this.CB['definitionPB']);this.CB['definitionP'].appendChild(this.CB['definitionPC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['definitionPC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['definitionP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['definitionPB'],cssTemp);for(i=0;i=0;i--){var childNode=ele.childNodes[i];ele.removeChild(childNode)}},addDefListener:function(){var thisTemp=this;var setTimeOutP=null;var defClick=function(event){if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block'&&!thisTemp.isUndefined(thisTemp.CB['definitionPC'])){thisTemp.css(thisTemp.CB['definitionP'],'display','block');var tbCss=thisTemp.ckStyle['controlBar']['definition']['background'];thisTemp.css(thisTemp.CB['definitionPB'],{width:thisTemp.CB['definitionPC'].offsetWidth+'px',height:thisTemp.CB['definitionPC'].offsetHeight+'px'});thisTemp.css(thisTemp.CB['definitionP'],{width:(thisTemp.CB['definitionPC'].offsetWidth+tbCss['triangleDeviationX']+tbCss['triangleWidth'])+'px',height:(thisTemp.CB['definitionPC'].offsetHeight+tbCss['triangleDeviationY']+tbCss['triangleHeight'])+'px'});thisTemp.promptShow(false);var tempELe=thisTemp.CB['definitionPB'];var tempWidth=tempELe.offsetWidth,tempHeight=tempELe.offsetHeight;var x=((tempWidth-tbCss['triangleWidth'])*0.5)+tbCss['triangleDeviationX'];var y=tempELe.offsetHeight+tbCss['triangleDeviationY'];var cssTemp={left:x+'px',top:y+'px'};thisTemp.css(thisTemp.CB['definitionTriangle'],cssTemp)}else{thisTemp.css(thisTemp.CB['definitionP'],'display','none')}};this.addListenerInside('click',defClick,this.CB['definition']);var defMouseOut=function(event){if(setTimeOutP){window.clearTimeout(setTimeOutP);setTimeOutP=null}setTimeOutP=setTimeout(function(event){thisTemp.css(thisTemp.CB['definitionP'],'display','none')},500)};this.addListenerInside('mouseout',defMouseOut,thisTemp.CB['definitionP']);var defMouseOver=function(event){thisTemp.buttonHide=false;if(setTimeOutP){window.clearTimeout(setTimeOutP);setTimeOutP=null}};this.addListenerInside('mouseover',defMouseOver,thisTemp.CB['definitionP'])},changeDefinition:function(n){if(!this.loaded||n<0){return}if(this.playerType=='flashplayer'){this.V.changeDefinition(n);return}if(this.VA.length>n){var arr=this.VA[n];if(arr.length>3){var title=arr[2];if(title){this.newDefinition(title)}}}},newDefinition:function(title){var vArr=this.VA;var nVArr=[];var i=0;for(i=0;i'}this.V.removeAttribute('src');this.V.innerHTML=source;this.V.currentSrc=nVArr[0][0]}}else{this.embedHls(vArr[0][0],this.vars['autoplay'])}this.V.autoplay='autoplay';this.V.load();if(this.playbackRateTemp!=1){this.V.playbackRate=this.playbackRateTemp}this.timerErrorFun()},embedHls:function(url,autoplay){var thisTemp=this;thisTemp.hlsAutoPlay=autoplay;if(Hls.isSupported()){var hls=new Hls();hls.loadSource(url);hls.attachMedia(this.V);hls.on(Hls.Events.MANIFEST_PARSED,function(){thisTemp.playerLoad();if(autoplay){thisTemp.videoPlay()}})}},prompt:function(){if(!this.conBarShow){return}var thisTemp=this;var prompt=this.vars['promptSpot'];if(prompt==null||this.promptArr.length>0){return}var showPrompt=function(event){if(thisTemp.promptElement==null){var random2='prompte-'+thisTemp.randomString(5);var ele2=document.createElement('div');ele2.className=random2;thisTemp.PD.appendChild(ele2);thisTemp.promptElement=thisTemp.getByElement(random2);thisTemp.css(thisTemp.promptElement,{overflowX:'hidden',lineHeight:thisTemp.ckStyle['previewPrompt']['lineHeight']+'px',fontFamily:thisTemp.ckStyle['previewPrompt']['font'],fontSize:thisTemp.ckStyle['previewPrompt']['size']+'px',color:thisTemp.ckStyle['previewPrompt']['color'].replace('0x','#'),position:'absolute',display:'block',zIndex:'90'})}var pcon=thisTemp.getPromptTest();var pW=pcon['pW'],pT=pcon['pT'],pL=parseInt(thisTemp.css(this,'left'))-parseInt(pW*0.5);if(pcon['pL']>10){pL=pcon['pL']}if(pL<0){pL=0}thisTemp.css(thisTemp.promptElement,{width:pW+'px',left:(-pW-10)+'px',display:'block'});thisTemp.promptElement.innerHTML=thisTemp.getDataset(this,'words');thisTemp.css(thisTemp.promptElement,{left:pL+'px',top:(pT-thisTemp.promptElement.offsetHeight-thisTemp.ckStyle['previewPrompt']['marginBottom'])+'px'})};var hidePrompt=function(event){if(thisTemp.promptElement!=null){thisTemp.css(thisTemp.promptElement,{display:'none'})}};var i=0;for(i=0;ithis.PD.offsetWidth-pW){pL=this.PD.offsetWidth-pW}return{pW:pW,pT:pT,pL:pL}},deletePrompt:function(){var arr=this.promptArr;if(arr.length>0){for(var i=0;ibw-parseInt(arr[i].offsetWidth*0.5)){left=bw-parseInt(arr[i].offsetWidth*0.5)}this.css(arr[i],{left:left+'px',display:'block'})}},preview:function(obj){var thisTemp=this;var preview={file:null,scale:0};preview=this.standardization(preview,this.vars['preview']);if(preview['file']==null||preview['scale']<=0){return}var srcArr=preview['file'];if(this.previewStart==0){this.previewStart=1;if(srcArr.length>0){var i=0;var imgW=0,imgH=0;var random='preview-'+thisTemp.randomString(10);var loadNum=0;var loadImg=function(i){srcArr[i]=thisTemp.getNewUrl(srcArr[i]);var n=0;var img=new Image();img.src=srcArr[i];img.className=random+i;img.onload=function(event){loadNum++;if(thisTemp.previewDiv==null){imgW=img.width;imgH=img.height;thisTemp.previewWidth=parseInt(imgW*0.1);var ele=document.createElement('div');ele.className=random;thisTemp.PD.appendChild(ele);thisTemp.previewDiv=thisTemp.getByElement(random);var eleTop=0;eleTop=thisTemp.PD.offsetHeight-thisTemp.ckStyle['preview']['bottom'];thisTemp.css(thisTemp.previewDiv,{width:srcArr.length*imgW*10+'px',height:parseInt(imgH*0.1)+'px',backgroundColor:'#000000',position:'absolute',left:'0px',top:eleTop+'px',display:'none',zIndex:'80'});ele.setAttribute('data-x','0');ele.setAttribute('data-y',eleTop);var ele2=document.createElement('div');ele2.className=random+'d2';thisTemp.PD.appendChild(ele2);thisTemp.previewTop=thisTemp.getByElement(ele2.className);thisTemp.css(thisTemp.previewTop,{width:parseInt(imgW*0.1)+'px',height:parseInt(imgH*0.1)+'px',position:'absolute',border:thisTemp.ckStyle['preview']['border']+'px solid '+thisTemp.ckStyle['preview']['borderColor'].replace('0x','#'),left:'0px',top:eleTop+'px',display:'none',zIndex:'81'});var html='';for(n=0;n=imgW){sx=0;sy+=h}thisTemp.css(cimg,'display','none')}if(loadNum==srcArr.length){thisTemp.previewStart=2}else{i++;loadImg(i)}}}}loadImg(i);return}if(this.previewStart==2){var isTween=true;var nowNum=parseInt(obj['time']/this.vars['preview']['scale']);var numTotal=parseInt(thisTemp.getMetaDate()['duration']/this.vars['preview']['scale']);if(thisTemp.css(thisTemp.previewDiv,'display')=='none'){isTween=false}thisTemp.css(thisTemp.previewDiv,'display','block');var imgWidth=thisTemp.previewDiv.offsetWidth*0.01/srcArr.length;var left=(imgWidth*nowNum)-obj['x']+parseInt(imgWidth*0.5),top=thisTemp.PD.offsetHeight-thisTemp.previewDiv.offsetHeight-thisTemp.ckStyle['preview']['bottom'];thisTemp.css(thisTemp.previewDiv,'top',top+2+'px');var topLeft=obj['x']-parseInt(imgWidth*0.5);var timepieces=0;if(topLeft<0){topLeft=0;timepieces=obj['x']-topLeft-imgWidth*0.5}if(topLeft>thisTemp.PD.offsetWidth-imgWidth){topLeft=thisTemp.PD.offsetWidth-imgWidth;timepieces=obj['x']-topLeft-imgWidth*0.5}if(left<0){left=0}if(left>numTotal*imgWidth-thisTemp.PD.offsetWidth){left=numTotal*imgWidth-thisTemp.PD.offsetWidth}thisTemp.css(thisTemp.previewTop,{left:topLeft+'px',top:top+2+'px',display:'block'});if(thisTemp.previewTop.offsetHeight>thisTemp.previewDiv.offsetHeight){thisTemp.css(thisTemp.previewTop,{height:thisTemp.previewDiv.offsetHeight-(thisTemp.previewTop.offsetHeight-thisTemp.previewDiv.offsetHeight)+'px'})}if(this.previewTween!=null){this.animatePause(this.previewTween);this.previewTween=null}var nowLeft=parseInt(thisTemp.css(thisTemp.previewDiv,'left'));var leftC=nowLeft+left;if(nowLeft==-(left+timepieces)){return}if(isTween){var obj={element:thisTemp.previewDiv,start:null,end:-(left+timepieces),speed:0.3};this.previewTween=this.animate(obj)}else{thisTemp.css(thisTemp.previewDiv,'left',-(left+timepieces)+'px')}}},deletePreview:function(){if(this.previewDiv!=null){this.deleteChild(this.previewDiv);this.previewDiv=null;this.previewStart=0}},changeVideo:function(){if(!this.html5Video){this.getVarsObject();this.V.newVideo(this.vars);return}var vArr=this.VA;var v=this.vars;var i=0;if(vArr.length<1){return}if(this.V!=null&&this.needSeek==0){this.needSeek=this.V.currentTime}if(v['poster']){this.V.poster=v['poster']}else{this.V.removeAttribute('poster')}if(v['loop']){this.V.loop='loop'}else{this.V.removeAttribute('loop')}if(v['seek']>0){this.needSeek=v['seek']}else{this.needSeek=0}if(this.getFileExt(vArr[0][0])!='.m3u8'){this.isM3u8=false}if(!this.isM3u8){if(vArr.length==1){this.V.innerHTML='';this.V.src=vArr[0][0]}else{var source='';vArr=this.arrSort(vArr);for(i=0;i'}this.V.removeAttribute('src');this.V.innerHTML=source}if(v['autoplay']){this.V.autoplay='autoplay'}else{this.V.removeAttribute('autoplay')}this.V.load()}else{this.embedHls(vArr[0][0],v['autoplay'])}if(!this.isUndefined(v['volume'])){this.changeVolume(v['volume'])}this.resetPlayer();this.timerErrorFun();if(this.vars['cktrack']){this.loadTrack()}},elementCoordinate:function(){this.pdCoor=this.getXY(this.PD);var cssTemp=null;try{cssTemp=this.getEleCss(this.ckStyle['centerPlay'],{cursor:'pointer'});this.css(this.CB['pauseCenter'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['loading']);this.css(this.CB['loading'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['error']);this.css(this.CB['errorText'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['logo']);this.css(this.CB['logo'],cssTemp)}catch(event){this.log(event)}this.checkBarWidth()},carbarButton:function(){var styleC=this.ckStyle['controlBar'];var styleCB=styleC['button'];var cssTemp=null;var cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};var cssSup2={overflow:'hidden',cursor:'default',zIndex:1};var cssSup4={overflow:'hidden',cursor:'pointer',display:'none',zIndex:995};cssTemp=this.getEleCss(styleCB['play'],cssSup,this.CB['controlBarBg']);this.css(this.CB['play'],cssTemp);cssTemp=this.getEleCss(styleCB['pause'],cssSup,this.CB['controlBarBg']);this.css(this.CB['pause'],cssTemp);cssTemp=this.getEleCss(styleCB['mute'],cssSup,this.CB['controlBarBg']);this.css(this.CB['mute'],cssTemp);cssTemp=this.getEleCss(styleCB['escMute'],cssSup,this.CB['controlBarBg']);this.css(this.CB['escMute'],cssTemp);cssTemp=this.getEleCss(styleCB['full'],cssSup,this.CB['controlBarBg']);this.css(this.CB['full'],cssTemp);cssTemp=this.getEleCss(styleCB['escFull'],cssSup,this.CB['controlBarBg']);this.css(this.CB['escFull'],cssTemp);cssTemp=this.getEleCss(styleC['timeText']['vod'],cssSup2,this.CB['controlBarBg']);this.css(this.CB['timeText'],cssTemp);var volumeSchedule=this.newObj(styleC['volumeSchedule']);volumeSchedule['backgroundImg']='';cssTemp=this.getEleCss(volumeSchedule,cssSup2,this.CB['controlBarBg']);this.css(this.CB['volume'],cssTemp);cssTemp={width:cssTemp['width'],height:styleC['volumeSchedule']['backgroundHeight']+'px',overflow:'hidden',backgroundRepeat:'no-repeat',backgroundPosition:'left center'};if(this.ckConfig['config']['buttonMode']['volumeSchedule']){cssTemp['cursor']='pointer'}this.css(this.CB['volumeBg'],cssTemp);this.css(this.CB['volumeBg'],{position:'absolute',});cssTemp['width']=(this.CB['volumeBO'].offsetWidth*0.5+parseInt(this.css(this.CB['volumeBO'],'left')))+'px';this.css(this.CB['volumeUp'],cssTemp);this.css(this.CB['volumeBg'],'backgroundImage','url('+styleC['volumeSchedule']['backgroundImg']+')');this.css(this.CB['volumeUp'],'backgroundImage','url('+styleC['volumeSchedule']['maskImg']+')');cssTemp=this.getEleCss(styleC['volumeSchedule']['button'],{overflow:'hidden',cursor:'pointer',backgroundRepeat:'no-repeat',backgroundPosition:'left center'});this.css(this.CB['volumeBO'],cssTemp);if(this.ckConfig['config']['playbackRate']){if(!this.CB['playbackrateButtonText']){this.textButton(this.CB['playbackrate'],styleC['playbackrate']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['playbackrate']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['playbackrate'],'playbackrateButtonText')}cssTemp=this.getEleCss(styleC['playbackrate']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['playbackrate'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['playbackrateP'],'display','none');cssTemp=this.getEleCss(styleC['playbackrate']['backgroundCoorH5'],cssSup4);this.css(this.CB['playbackrateP'],cssTemp)}if(this.ckConfig['config']['definition']){if(!this.CB['defaultButtonText']){this.textButton(this.CB['definition'],styleC['definition']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['definition']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['definition'],'defaultButtonText')}cssTemp=this.getEleCss(styleC['definition']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['definition'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['definitionP'],'display','none');cssTemp=this.getEleCss(styleC['definition']['backgroundCoorH5'],cssSup4);this.css(this.CB['definitionP'],cssTemp)}if(this.ckConfig['config']['subtitle']){if(!this.CB['subtitleButtonText']){this.textButton(this.CB['subtitles'],styleC['subtitle']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['subtitle']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['subtitle'],'subtitleButtonText')}cssTemp=this.getEleCss(styleC['subtitle']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['subtitles'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['subtitlesP'],'display','none');cssTemp=this.getEleCss(styleC['subtitle']['backgroundCoorH5'],cssSup4);this.css(this.CB['subtitlesP'],cssTemp)}},textButton:function(ele,css,cssSup,upEle,text,newName){var thisTemp=this;var bgCss={width:css['width'],height:css['height']};if(cssSup){bgCss={width:css['width'],height:css['height'],align:cssSup['align'],vAlign:cssSup['vAlign'],marginX:cssSup['marginX'],marginY:cssSup['marginY'],offsetX:cssSup['offsetX'],offsetY:cssSup['offsetY'],zIndex:2}}cssTemp=this.getEleCss(bgCss,null,upEle);thisTemp.css(ele,cssTemp);var outCss=this.newObj(css);var overCss=this.newObj(css);var textOutCss=this.newObj(css);var textOverCss=this.newObj(css);var cssTemp=null;outCss['alpha']=css['backgroundAlpha'];overCss['backgroundColor']=css['overBackgroundColor'];overCss['alpha']=css['backgroundAlpha'];textOutCss['color']=css['textColor'];textOverCss['color']=css['overTextColor'];textOutCss['textAlign']=css['align'];textOverCss['textAlign']=css['align'];textOutCss['backgroundColor']=textOverCss['backgroundColor']='';var bgEle=document.createElement('div');this.removeChildAll(ele);ele.appendChild(bgEle);if(newName){this.CB[newName]=document.createElement('div');ele.appendChild(this.CB[newName]);this.CB[newName].innerHTML=text}else{var newEle=document.createElement('div');ele.appendChild(newEle);newEle.innerHTML=text}var outFun=function(){cssTemp=thisTemp.getEleCss(outCss,{cursor:'pointer',zIndex:1},bgEle);cssTemp['left']='';cssTemp['top']='';thisTemp.css(bgEle,cssTemp);cssTemp=thisTemp.getEleCss(textOutCss,{cursor:'pointer',zIndex:2},bgEle);cssTemp['left']='';cssTemp['top']='';if(newName){thisTemp.css(thisTemp.CB[newName],cssTemp,bgEle)}else{thisTemp.css(newEle,cssTemp,bgEle)}thisTemp.buttonHide=true;if(thisTemp.timeButtonOver){window.clearTimeout(thisTemp.timeButtonOver);thisTemp.timeButtonOver=null}thisTemp.timeButtonOver=window.setTimeout(function(){thisTemp.buttonListHide()},1000)};var overFun=function(){cssTemp=thisTemp.getEleCss(overCss,{zIndex:1},bgEle);cssTemp['left']='';cssTemp['top']='';thisTemp.css(bgEle,cssTemp);cssTemp=thisTemp.getEleCss(textOverCss,{zIndex:2},bgEle);cssTemp['left']='';cssTemp['top']='';if(newName){thisTemp.css(thisTemp.CB[newName],cssTemp)}else{thisTemp.css(newEle,cssTemp)}};outFun();this.addListenerInside('mouseout',outFun,ele);this.addListenerInside('mouseover',overFun,ele)},buttonListHide:function(){if(this.buttonHide){this.css([this.CB['definitionP'],this.CB['subtitlesP'],this.CB['playbackrateP']],'display','none')}if(this.timeButtonOver){window.clearTimeout(this.timeButtonOver);this.timeButtonOver=null}this.buttonHide=false},videoCss:function(){var cssTemp={};if(this.css(this.CB['controlBar'],'display')=='none'){cssTemp=this.ckStyle['video']['controlBarHideReserve']}else{cssTemp=this.ckStyle['video']['reserve']}var spacingBottom=cssTemp['spacingBottom'];if(this.V.controls&&this.isMobile()){spacingBottom-=40}var pW=this.PD.offsetWidth,pH=this.PD.offsetHeight;var vW=pW-cssTemp['spacingLeft']-cssTemp['spacingRight'];var vH=pH-cssTemp['spacingTop']-spacingBottom;if(!this.MD){this.css(this.V,{width:vW+'px',height:vH+'px',marginLeft:cssTemp['spacingLeft']+'px',marginTop:cssTemp['spacingTop']+'px'})}else{this.css([this.MD,this.MDC],{width:vW+'px',height:vH+'px',marginLeft:cssTemp['spacingLeft']+'px',marginTop:cssTemp['spacingTop']+'px'})}},playerCustom:function(){var custom=this.ckStyle['custom'];var button=custom['button'];var images=custom['images'];var cssTemp=null;var cssSup=null;var k='',tempID='';var b={};var tempDiv;var i=0;for(k in button){b=button[k];cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};cssTemp=this.getEleCss(b,cssSup);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-button',name:k});this.PD.appendChild(tempDiv);if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]}i++;this.buttonEventFun(tempDiv,b)}for(k in images){b=images[k];cssSup={overflow:'hidden',zIndex:1};cssTemp=this.getEleCss(b,cssSup);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-images',name:k});this.PD.appendChild(tempDiv);var img=new Image();img.src=images[k]['img'];tempDiv.appendChild(img);i++}},carbarCustom:function(){var custom=this.ckStyle['controlBar']['custom'];var button=custom['button'];var images=custom['images'];var cssTemp=null;var cssSup=null;var k='',tempID='';var b={};var tempDiv;var i=0;for(k in button){b=button[k];cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-button',name:k});this.CB['controlBar'].appendChild(tempDiv);if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]}i++;this.buttonEventFun(tempDiv,b)}for(k in images){b=images[k];cssSup={overflow:'hidden',zIndex:1};cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-images',name:k});this.CB['controlBar'].appendChild(tempDiv);var img=new Image();img.src=images[k]['img'];tempDiv.appendChild(img);i++}},customCoor:function(){var cssTemp=null;if(this.customeElement.length>0){for(var i=0;i0){for(var i=0;i0){this.videoSeek(this.needSeek);this.needSeek=0}if(this.animatePauseArray.length>0){this.animateResume('pause')}if(this.playerType=='html5video'&&this.V!=null&&this.ckConfig['config']['videoDrawImage']){this.sendVCanvas()}if(!this.isUndefined(this.advertisements['pause'])&&!this.adPlayStart){this.closePauseAd()}},adPausePlayer:function(){this.adI=0;this.adType='pause';this.adPauseShow=true;this.loadAdPause();this.sendJS('pauseAd','play')},loadAdPause:function(){var ad=this.getNowAdvertisements();var type=ad['type'];var thisTemp=this;var width=this.PD.offsetWidth,height=this.PD.offsetHeight;if(this.isStrImage(type)&&this.adPauseShow){this.css(this.CB['adElement'],'display','block');var imgClass='adimg'+this.randomString(10);var imgHtml='';if(ad['link']){imgHtml=''+imgHtml+''}this.CB['adElement'].innerHTML=imgHtml;this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css([thisTemp.getByElement(imgClass),thisTemp.CB['adElement']],{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});if(thisTemp.ckStyle['advertisement']['closeButtonShow']&&thisTemp.adPauseShow){thisTemp.css(thisTemp.CB['adPauseClose'],{display:'block'})}thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']);thisTemp.adPauseCoor()},this.getByElement(imgClass));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adElement']);var newI=this.adI;if(this.adI0){setTimeout(function(){if(thisTemp.adPauseShow){thisTemp.adI=newI;thisTemp.loadAdPause()}},ad['time']*1000)}}},adPauseCoor:function(){if(this.css(this.CB['adElement'],'display')=='block'){var w=this.CB['adElement'].offsetWidth,h=this.CB['adElement'].offsetHeight;var pw=this.PD.offsetWidth,ph=this.PD.offsetHeight;this.css(this.CB['adElement'],{top:(ph-h)*0.5+'px',left:(pw-w)*0.5+'px'});if(this.css(this.CB['adPauseClose'],'display')=='block'){var rr=this.ckStyle['advertisement']['closeButton'];var cxy=this.getPosition(rr,this.CB['adElement']);this.css(this.CB['adPauseClose'],{top:cxy['y']+'px',left:cxy['x']+'px'})}}},closePauseAd:function(){this.CB['adElement'].innerHTML='';this.css([this.CB['adElement'],this.CB['adPauseClose']],'display','none');this.adPauseShow=false;this.sendJS('pauseAd','ended')},advertisementsTime:function(nt){if(this.isUndefined(nt)){nt=0}var ad=this.advertisements[this.adType];if(nt>0){ad[this.adI]['time']=Math.ceil(nt)}this.adTimeAllTotal=0;for(var i=this.adI;i0){this.CB['adTimeText'].innerHTML=this.ckLanguage['adCountdown'].replace('[$second]',this.adTimeAllTotal).replace('[$Second]',this.adTimeAllTotal>9?this.adTimeAllTotal:'0'+this.adTimeAllTotal)}if(this.adPauseShow){this.closePauseAd()}this.adOtherCloseAll();this.adTimeTotal=-1},adSkipButtonShow:function(){var thisTemp=this;var skipConfig=this.ckStyle['advertisement'];var delayTimeTemp=skipConfig[this.adType+'SkipButtonDelay'];var timeFun=function(){if(delayTimeTemp>=0){thisTemp.CB['adSkipText'].innerHTML=thisTemp.ckLanguage['skipDelay'].replace('[$second]',delayTimeTemp).replace('[$Second]',delayTimeTemp>9?delayTimeTemp:'0'+delayTimeTemp);thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block');thisTemp.css(thisTemp.CB['adSkipButton'],'display','none');setTimeout(timeFun,1000)}else{thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none');if(thisTemp.css(thisTemp.CB['adTime'],'display')=='block'){thisTemp.css(thisTemp.CB['adSkipButton'],'display','block')}}delayTimeTemp--};if(skipConfig['skipButtonShow']){if(skipConfig[this.adType+'SkipButtonDelay']>0&&this.isUndefined(this.adSkipButtonTime)){thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block');timeFun()}else{thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none');thisTemp.css(thisTemp.CB['adSkipButton'],'display','block')}}},advertisementsPlay:function(){this.css([this.CB['adBackground'],this.CB['adElement'],this.CB['adTime'],this.CB['adTimeText'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink']],'display','none');this.adPlayerPlay=false;var ad=this.advertisements[this.adType];if(this.adI==0&&(this.adType=='front'||this.adType=='insert'||this.adType=='end')){this.sendJS('process',this.adType+' ad play');this.sendJS(this.adType+'Ad','play')}this.trackHide();if(this.adI';if(ad['link']){imgHtml=''+imgHtml+''}this.CB['adElement'].innerHTML=imgHtml;this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css(thisTemp.getByElement(imgClass),{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});thisTemp.css(thisTemp.CB['adElement'],{width:imgWH['width']+'px',height:imgWH['height']+'px',top:(height-imgWH['height'])*0.5+'px',left:(width-imgWH['width'])*0.5+'px'});thisTemp.ajaxSuccessNull(ad['exhibitionMonitor'])},this.getByElement(imgClass));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adElement']);if(!this.isUndefined(ad['time'])){this.adCountDown()}}else{this.css([this.CB['adTime'],this.CB['adTimeText']],'display','block');if(this.adVideoMute){this.css(this.CB['adEscMute'],'display','block');this.css(this.CB['adMute'],'display','none')}else{this.css(this.CB['adEscMute'],'display','none');this.css(this.CB['adMute'],'display','block')}this.CB['adElement'].innerHTML='';if(this.videoTemp['currentSrc']==''){this.videoTemp['currentSrc']=this.getCurrentSrc()}if(this.V.loop){this.videoTemp['loop']=true;this.V.loop=false}if(this.V!=null&&this.V.currentTime>0&&this.adIsVideoTime&&this.adType!='front'){this.adIsVideoTime=false;this.needSeek=this.V.currentTime}this.V.src=ad['file'];this.V.currentSrc=ad['file'];this.V.innerHTML='';this.V.play();this.adVideoPlay=true;this.ajaxSuccessNull(ad['exhibitionMonitor']);if(!this.adVideoMute){this.escAdMute()}}if(ad['link']){this.css(this.CB['adLink'],'display','block');var adLinkClick=function(event){thisTemp.sendJS('clickEvent','javaScript->adLinkClick')};this.addListenerInside('click',adLinkClick,this.CB['adLink']);this.adLinkTemp=ad['link'];var linkTemp='';this.CB['adLink'].innerHTML=linkTemp;this.css(this.getByElement('ckadmorelink'),{color:'#FFFFFF',textDecoration:'none'});this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adLink'])}else{this.css(this.CB['adLink'],'display','none')}},adCountDown:function(){var thisTemp=this;if(this.adTimeTotal>0){if(!this.adIsPause){this.adTimeTotal--;this.showAdTime();this.adCountDownObj=null;this.adCountDownObj=setTimeout(function(){thisTemp.adCountDown()},1000)}}else{this.adI++;this.advertisementsPlay()}},adPlayerTimeHandler:function(time){var ad=this.getNowAdvertisements();var type=ad['type'];if(this.isStrImage(type)){return}if(this.adTimeTotal!=parseInt(time)){this.adTimeTotal=parseInt(time);this.showAdTime()}},showAdTime:function(){this.adTimeAllTotal--;var n=this.adTimeAllTotal;if(n<0){n=0}this.CB['adTimeText'].innerHTML=this.ckLanguage['adCountdown'].replace('[$second]',n).replace('[$Second]',n<10?'0'+n:n)},checkAdOther:function(t){if(this.adPlayerPlay){return}var adTime=this.advertisements['othertime'];var adPlay=this.advertisements['otherPlay'];for(var i=0;i=adTime[i]&&!adPlay[i]){adPlay[i]=true;this.newAdOther(i)}}},newAdOther:function(i){var thisTemp=this;var ad=this.advertisements['other'][i];var randomS=this.randomString(10);var adDivID='adother'+randomS;imgClassName='adimgother'+randomS;var adDiv=document.createElement('div');adDiv.className=adDivID;this.PD.appendChild(adDiv);ad['div']=adDivID;ad['element']=imgClassName;var adHtml='';if(ad['link']){adHtml=''+adHtml+''}this.getByElement(adDivID).innerHTML=adHtml;this.css(adDivID,{position:'absolute',overflow:'hidden',zIndex:'996',top:'-600px',left:'-600px',cursor:'pointer'});if(this.ckStyle['advertisement']['closeOtherButtonShow']){var closeAdDivID='adotherclose-'+randomS;var closeAdDiv=document.createElement('div');closeAdDiv.className=closeAdDivID;this.PD.appendChild(closeAdDiv);ad['closeDiv']=closeAdDivID;ad['close']=false;var closeAdDivCss=this.getEleCss(this.ckStyle['advertisement']['closeOtherButton'],{offsetX:-10000,offsetY:-10000,cursor:'pointer',zIndex:997});this.css(closeAdDivID,closeAdDivCss);var adOtherCloseOver=function(){thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOver'])};var adOtherCloseOut=function(){thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOut'])};adOtherCloseOut();this.addListenerInside('mouseover',adOtherCloseOver,this.getByElement(closeAdDivID));this.addListenerInside('mouseout',adOtherCloseOut,this.getByElement(closeAdDivID))}this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css([thisTemp.getByElement(imgClassName),thisTemp.getByElement(adDivID)],{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});thisTemp.advertisements['other'][i]=ad;thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']);thisTemp.adOtherCoor()},this.getByElement(imgClassName));this.addListenerInside('click',function(){thisTemp.adOtherClose(i)},this.getByElement(closeAdDivID));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.getByElement(imgClassName));if(ad['time']>0){setTimeout(function(){thisTemp.adOtherClose(i)},ad['time']*1000)}},adOtherClose:function(i){var ad=this.advertisements['other'][i];if(!this.isUndefined(ad['close'])){if(!ad['close']){ad['close']=true;this.PD.removeChild(this.getByElement(ad['div']));this.PD.removeChild(this.getByElement(ad['closeDiv']))}}},adOtherCloseAll:function(){if(!this.isUndefined(this.advertisements['other'])){var ad=this.advertisements['other'];for(var i=0;i-1;i--){if(t>=adTime[i]&&t1&&!adPlay[i]){this.adI=0;this.adType='insert';this.adMuteInto();this.adIsVideoTime=true;this.adPlayStart=true;this.adVideoPlay=false;this.videoPause();this.advertisementsTime();this.advertisementsPlay();this.adSkipButtonShow();adPlay[i]=true;for(var n=0;n=width||h>=height){if(width/w>height/h){nh=height-20;nw=w*nh/h}else{nw=width-20;nh=h*nw/w}}else{nw=w;nh=h}return{width:nw,height:nh}},ajaxSuccessNull:function(url){if(!this.isUndefined(url)){var ajaxObj={url:url,success:function(data){}};this.ajax(ajaxObj)}},runFunction:function(s){try{var arr=s.split('->');if(arr.length==2){switch(arr[0]){case'javaScript':if(arr[1].substr(0,11)!='[flashvars]'){eval(arr[1]+'()')}else{eval(this.vars[arr[1].substr(11)]+'()')}break;case'actionScript':eval('this.'+arr[1]+'()');break}}this.sendJS('clickEvent',s)}catch(event){}},sendVCanvas:function(){if(this.timerVCanvas==null){this.css(this.V,'display','none');this.css(this.MD,'display','block');var thisTemp=this;var videoCanvas=function(){if(thisTemp.MDCX.width!=thisTemp.MD.offsetWidth){thisTemp.MDC.width=thisTemp.MD.offsetWidth}if(thisTemp.MDCX.height!=thisTemp.MD.offsetHeight){thisTemp.MDC.height=thisTemp.MD.offsetHeight}thisTemp.MDCX.clearRect(0,0,thisTemp.MDCX.width,thisTemp.MDCX.height);var coor=thisTemp.getProportionCoor(thisTemp.PD.offsetWidth,thisTemp.PD.offsetHeight,thisTemp.V.videoWidth,thisTemp.V.videoHeight);thisTemp.MDCX.drawImage(thisTemp.V,0,0,thisTemp.V.videoWidth,thisTemp.V.videoHeight,coor['x'],coor['y'],coor['width'],coor['height'])};this.timerVCanvas=new this.timer(0,videoCanvas)}},pauseHandler:function(){var thisTemp=this;this.playShow(false);if(this.animatePauseArray.length>0){this.animatePause('pause')}if(this.playerType=='html5video'&&this.V!=null&&this.ckConfig['config']['videoDrawImage']){this.stopVCanvas()}if(!this.isUndefined(this.advertisements['pause'])&&!this.adPlayStart&&!this.adPauseShow){setTimeout(function(){if(!thisTemp.isUndefined(thisTemp.advertisements['pause'])&&!thisTemp.adPlayStart&&!thisTemp.adPauseShow&&thisTemp.time>1){thisTemp.adPausePlayer()}},300)}},stopVCanvas:function(){if(this.timerVCanvas!=null){this.css(this.V,'display','block');this.css(this.MD,'display','none');if(this.timerVCanvas.runing){this.timerVCanvas.stop()}this.timerVCanvas=null}},playShow:function(b){if(!this.conBarShow){return}if(b){this.css(this.CB['play'],'display','none');this.css(this.CB['pauseCenter'],'display','none');this.css(this.CB['pause'],'display','block')}else{this.css(this.CB['play'],'display','block');if(this.css(this.CB['errorText'],'display')=='none'){if(!this.adPlayerPlay){this.css(this.CB['pauseCenter'],'display','block')}}else{this.css(this.CB['pauseCenter'],'display','none')}this.css(this.CB['pause'],'display','none')}},seekedHandler:function(){this.resetTrack();this.isTimeButtonMove=true;if(this.V.paused){if(this.hlsAutoPlay){this.videoPlay()}else{this.hlsAutoPlay=true}}},endedHandler:function(){this.sendJS('ended');if(this.adPlayerPlay){this.adI++;this.advertisementsPlay();return}if(!this.endAdPlay&&!this.isUndefined(this.advertisements['end'])){this.endAdPlay=true;this.adI=0;this.adType='end';this.adMuteInto();this.adIsVideoTime=true;this.adPlayStart=true;this.adVideoPlay=false;this.videoPause();this.advertisementsTime();this.advertisementsPlay();this.adSkipButtonShow();this.adReset=true;return}this.endedAdReset();if(this.vars['loop']){this.videoSeek(0)}},endedAdReset:function(){var arr=[];var i=0;if(!this.isUndefined(this.advertisements['insertPlay'])){arr=this.advertisements['insertPlay'];for(i=0;i0){this.css(this.CB['mute'],'display','block');this.css(this.CB['escMute'],'display','none')}else{this.css(this.CB['mute'],'display','none');this.css(this.CB['escMute'],'display','block')}}catch(event){}}},timeUpdateHandler:function(){var duration=0;if(this.playerType=='html5video'){try{duration=this.V.duration}catch(event){}}if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}if(duration>0){this.time=this.V.currentTime;this.timeTextHandler();this.trackShowHandler();if(this.isTimeButtonMove){this.timeProgress(this.time,duration)}}},controlBar:function(){var cb=this.ckStyle['controlBar'];var cssObjTemp={align:cb['align'],vAlign:cb['vAlign'],width:cb['width'],height:cb['height'],offsetX:cb['offsetX'],offsetY:cb['offsetY']};var bgCss={backgroundColor:cb['background']['backgroundColor'],backgroundImg:cb['background']['backgroundImg'],alpha:cb['background']['alpha']};var cssTemp=this.getEleCss(this.objectAssign(cssObjTemp,bgCss),{zIndex:888});this.css(this.CB['controlBarBg'],cssTemp);cssTemp=this.getEleCss(cssObjTemp,{zIndex:889});this.css(this.CB['controlBar'],cssTemp)},timeProgress:function(time,duration){if(!this.conBarShow){return}var timeProgressBgW=this.CB['timeProgressBg'].offsetWidth;var timeBOW=parseInt((time*timeProgressBgW/duration)-(this.CB['timeButton'].offsetWidth*0.5));if(timeBOW>timeProgressBgW-this.CB['timeButton'].offsetWidth){timeBOW=timeProgressBgW-this.CB['timeButton'].offsetWidth}if(timeBOW<0){timeBOW=0}this.css(this.CB['timeProgress'],'width',timeBOW+'px');this.css(this.CB['timeButton'],'left',parseInt(timeBOW)+'px')},timeTextHandler:function(){if(!this.conBarShow){return}var duration=this.V.duration;var time=this.V.currentTime;if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}this.CB['timeText'].innerHTML=this.formatTime(time,duration,this.ckLanguage['vod'])},bufferEdHandler:function(){if(!this.conBarShow||this.playerType=='flashplayer'){return}var thisTemp=this;var clearTimerBuffer=function(){if(thisTemp.timerBuffer!=null){if(thisTemp.timerBuffer.runing){thisTemp.sendJS('buffer',100);thisTemp.timerBuffer.stop()}thisTemp.timerBuffer=null}};clearTimerBuffer();var bufferFun=function(){if(!thisTemp.isUndefined(thisTemp.V)&&thisTemp.V.buffered.length>0){var duration=thisTemp.V.duration;var len=thisTemp.V.buffered.length;var bufferStart=thisTemp.V.buffered.start(len-1);var bufferEnd=thisTemp.V.buffered.end(len-1);var loadTime=bufferStart+bufferEnd;var loadProgressBgW=thisTemp.CB['timeProgressBg'].offsetWidth;var timeButtonW=thisTemp.CB['timeButton'].offsetWidth;var loadW=parseInt((loadTime*loadProgressBgW/duration)+timeButtonW);if(loadW>=loadProgressBgW){loadW=loadProgressBgW;clearTimerBuffer()}thisTemp.changeLoad(loadTime)}};this.timerBuffer=new this.timer(200,bufferFun)},changeLoad:function(loadTime){if(this.V==null){return}if(!this.conBarShow){return}var loadProgressBgW=this.CB['timeProgressBg'].offsetWidth;var timeButtonW=this.CB['timeButton'].offsetWidth;var duration=this.V.duration;if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}if(this.isUndefined(loadTime)){loadTime=this.loadTime}else{this.loadTime=loadTime}var loadW=parseInt((loadTime*loadProgressBgW/duration)+timeButtonW);this.css(this.CB['loadProgress'],'width',loadW+'px');this.sendJS('loadTime',loadTime);this.loadTimeTemp=loadTime},judgeIsLive:function(){var thisTemp=this;if(this.timerError!=null){if(this.timerError.runing){this.timerError.stop()}this.timerError=null}this.error=false;if(this.conBarShow){this.css(this.CB['errorText'],'display','none')}var timeupdate=function(event){thisTemp.timeUpdateHandler()};if(!this.vars['live']){if(this.V!=null&&this.playerType=='html5video'){this.addListenerInside('timeupdate',timeupdate);thisTemp.timeTextHandler();thisTemp.prompt();setTimeout(function(){thisTemp.bufferEdHandler()},200)}}else{this.removeListenerInside('timeupdate',timeupdate);if(this.timerTime!=null){window.clearInterval(this.timerTime);timerTime=null}if(this.timerTime!=null){if(this.timerTime.runing){this.timerTime.stop()}this.timerTime=null}var timeFun=function(){if(thisTemp.V!=null&&!thisTemp.V.paused&&thisTemp.conBarShow){thisTemp.CB['timeText'].innerHTML=thisTemp.formatTime(0,0,thisTemp.ckLanguage['live'])}};this.timerTime=new this.timer(1000,timeFun)}this.definition()},loadTrack:function(def){if(this.playerType=='flashplayer'||this.vars['flashplayer']==true){return}if(this.isUndefined(def)){def=-1}var track=this.vars['cktrack'];var loadTrackUrl='';var type=this.varType(track);var thisTemp=this;if(type=='array'){if(def==-1){var index=0;var indexN=0;for(var i=0;iindexN){indexN=li[2];index=i}}}else{index=def}loadTrackUrl=track[index][0]}else{loadTrackUrl=track}var obj={method:'get',dataType:'text',url:loadTrackUrl,charset:'utf-8',success:function(data){if(data){thisTemp.track=thisTemp.parseSrtSubtitles(data);thisTemp.trackIndex=0;thisTemp.nowTrackShow={sn:''}}}};this.ajax(obj)},resetTrack:function(){this.trackIndex=0;this.nowTrackShow={sn:''}},trackShowHandler:function(){if(!this.conBarShow||this.adPlayerPlay){return}if(this.track.length<1){return}if(this.trackIndex>=this.track.length){this.trackIndex=0}var nowTrack=this.track[this.trackIndex];if(this.time>=nowTrack['startTime']&&this.time<=nowTrack['endTime']){var nowShow=this.nowTrackShow;if(nowShow['sn']!=nowTrack['sn']){this.trackHide();this.trackShow(nowTrack);this.nowTrackTemp=nowTrack}}else{this.trackHide();this.checkTrack()}},trackShowAgain:function(){this.trackHide();this.trackShow(this.nowTrackTemp)},trackShow:function(track){this.nowTrackShow=track;var arr=track['content'];for(var i=0;i=arr[i]['startTime']&&this.time<=arr[i]['endTime']){this.trackIndex=i;break}}},playOrPause:function(){if(!this.loaded){return}if(this.V==null){return}if(this.playerType=='flashplayer'){this.V.playOrPause();return}if(this.V.paused){this.videoPlay()}else{this.videoPause()}},videoPlay:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoPlay();return}if(this.adPlayerPlay){this.eliminateAd();return}try{if(this.V.currentSrc){this.V.play()}}catch(event){}},videoPause:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoPause();return}try{this.V.pause()}catch(event){}},videoSeek:function(time){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoSeek(time);return}var duration=this.V.duration>0.2?this.V.duration:this.getMetaDate()['duration'];if(duration>0&&time>duration){if(this.vars['forceduration']>0){time=0;this.sendJS('ended')}else{time=duration-0.1}}if(time>=0){this.V.currentTime=time;this.sendJS('seekTime',time)}},changeVolume:function(vol,bg,button){if(this.loaded){if(this.playerType=='flashplayer'){this.V.changeVolume(vol);return}}if(isNaN(vol)||this.isUndefined(vol)){vol=0}if(!this.loaded){this.vars['volume']=vol}if(!this.html5Video){this.V.changeVolume(vol);return}try{if(this.isUndefined(bg)){bg=true}}catch(e){}try{if(this.isUndefined(button)){button=true}}catch(e){}if(!vol){vol=0}if(vol<0){vol=0}if(vol>1){vol=1}try{this.V.volume=vol}catch(error){}this.volume=vol;if(bg&&this.conBarShow){var bgW=vol*this.CB['volumeBg'].offsetWidth;if(bgW<0){bgW=0}if(bgW>this.CB['volumeBg'].offsetWidth){bgW=this.CB['volumeBg'].offsetWidth}this.css(this.CB['volumeUp'],'width',bgW+'px')}if(button&&this.conBarShow){var buLeft=parseInt(this.CB['volumeUp'].offsetWidth-(this.CB['volumeBO'].offsetWidth*0.5));if(buLeft>this.CB['volumeBg'].offsetWidth-this.CB['volumeBO'].offsetWidth){buLeft=this.CB['volumeBg'].offsetWidth-this.CB['volumeBO'].offsetWidth}if(buLeft<0){buLeft=0}this.css(this.CB['volumeBO'],'left',buLeft+'px')}},videoMute:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoMute();return}this.volumeTemp=this.V?(this.V.volume>0?this.V.volume:this.vars['volume']):this.vars['volume'];this.changeVolume(0)},videoEscMute:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoEscMute();return}this.changeVolume(this.volumeTemp>0?this.volumeTemp:this.vars['volume'])},adMute:function(){if(!this.loaded){return}this.changeVolume(0);this.adVideoMute=true;this.css(this.CB['adEscMute'],'display','block');this.css(this.CB['adMute'],'display','none')},escAdMute:function(){if(!this.loaded){return}var v=this.ckStyle['advertisement']['videoVolume'];this.changeVolume(v);this.adMuteInto()},adMuteInto:function(){this.adVideoMute=false;this.css(this.CB['adEscMute'],'display','none');this.css(this.CB['adMute'],'display','block')},fastBack:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.fastBack();return}var time=this.time-this.ckConfig['config']['timeJump'];if(time<0){time=0}this.videoSeek(time)},fastNext:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.fastNext();return}var time=this.time+this.ckConfig['config']['timeJump'];if(time>this.V.duration){time=this.V.duration}this.videoSeek(time)},getCurrentSrc:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){return this.V.getCurrentSrc()}return this.V.currentSrc},switchFull:function(){if(this.full){this.quitFullScreen()}else{this.fullScreen()}},fullScreen:function(){if(this.html5Video&&this.playerType=='html5video'){var element=this.PD;if(element.requestFullscreen){element.requestFullscreen()}else if(element.mozRequestFullScreen){element.mozRequestFullScreen()}else if(element.webkitRequestFullscreen){element.webkitRequestFullscreen()}else if(element.msRequestFullscreen){element.msRequestFullscreen()}else if(element.oRequestFullscreen){element.oRequestFullscreen()}this.judgeFullScreen()}else{}},quitFullScreen:function(){if(this.html5Video&&this.playerType=='html5video'){if(document.exitFullscreen){document.exitFullscreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.oRequestFullscreen){document.oCancelFullScreen()}else if(document.requestFullscreen){document.requestFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}else{this.css(document.documentElement,'cssText','');this.css(document.document.body,'cssText','');this.css(this.PD,'cssText','')}this.judgeFullScreen()}},videoRotation:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoRotation(n);return}if(this.isUndefined(n)){n=0}var tf=this.css(this.V,'transform');if(this.isUndefined(tf)&&!tf){tf='rotate(0deg)'}var reg=tf.match(/rotate\([^)]+\)/);reg=reg?reg[0].replace('rotate(','').replace('deg)',''):'';if(reg==''){reg=0}else{reg=parseInt(reg)}if(n==-1){reg-=90}else if(n==1){reg+=90}else{if(n!=90&&n!=180&&n!=270&&n!=-90&&n!=-180&&n!=-270){reg=0}else{reg=n}}n=reg;var y90=n%90,y180=n%180,y270=n%270;var ys=false;if(y90==0&&y180==90&&y270==90){ys=true}if(y90==0&&y180==90&&y270==0){ys=true}if(y90==-0&&y180==-90&&y270==-90){ys=true}if(y90==-0&&y180==-90&&y270==-0){ys=true}tf=tf.replace(/rotate\([^)]+\)/,'').replace(/scale\([^)]+\)/,'')+' rotate('+n+'deg)';var cdW=this.CD.offsetWidth,cdH=this.CD.offsetHeight,vW=this.V.videoWidth,vH=this.V.videoHeight;if(vW>0&&vH>0){if(ys){if(cdW/cdH>vH/vW){nH=cdH;nW=vH*nH/vW}else{nW=cdW;nH=vW*nW/vH}this.css(this.V,'transform','rotate(0deg)');this.css(this.V,'transform','scale('+nH/cdW+','+nW/cdH+')'+tf)}else{this.css(this.V,'transform',tf)}}else{this.css(this.V,'transform',tf)}return},videoBrightness:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoBrightness(n);return}},videoContrast:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoContrast(n);return}},videoSaturation:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoSaturation(n);return}},videoHue:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoHue(n);return}},videoZoom:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoZoom(n);return}if(this.isUndefined(n)){n=1}if(n<0){n=0}if(n>2){n=2}var tf=this.css(this.V,'transform');tf=tf.replace(/scale\([^)]+\)/,'')+' scale('+n+')';this.videoScale=n;this.css(this.V,'transform',tf);return},videoProportion:function(w,h){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoProportion(w,h);return}},adPlay:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.adPlay();return}if(this.adPlayerPlay){this.adIsPause=false;var ad=this.getNowAdvertisements();var type=ad['type'];if(this.isStrImage(type)){this.adCountDown()}else{this.V.play()}}},adPause:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.adPause();return}if(this.adPlayerPlay){this.adIsPause=true;var ad=this.getNowAdvertisements();var type=ad['type'];if(type!='jpg'&&type!='jpeg'&&type!='png'&&type!='svg'&&type!='gif'){this.videoPause()}}},videoError:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoError(n);return}},changeConfig:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){var args=Array.prototype.slice.call(arguments);switch(args.length){case 1:this.V.changeConfig(args[0]);break;case 2:this.V.changeConfig(args[0],args[1]);break;case 3:this.V.changeConfig(args[0],args[1],args[2]);break;case 4:this.V.changeConfig(args[0],args[1],args[2],args[3]);break;case 5:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4]);break;case 6:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5]);break;case 7:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);break;case 8:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);break;case 8:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);break}return}var obj=this.ckConfig;var arg=arguments;for(var i=0;i0){this.css(this.CD,'width',w+'px')}if(h>0){this.css(this.CD,'height',h+'px')}if(this.html5Video){this.playerResize()}},playerResize:function(){this.controlBar();this.elementCoordinate();this.carbarButton();this.customCoor();this.timeProgressDefault();this.videoCss();this.timeUpdateHandler();this.changeElementCoor();this.changePrompt();this.advertisementStyle();this.adPauseCoor();this.adOtherCoor();this.changeLoad();this.sendJS('resize')},changePlaybackRate:function(n){if(this.html5Video){var arr=this.playbackRateArr;n=parseInt(n);if(n';html+=param['v'];html+='';html+='';html+='';html+='';html+='';this.PD.innerHTML=html;this.V=this.getObjectById(vid);this.playerType='flashplayer'},checkShockwaveFlash:function(){if(window.ActiveXObject){try{var s=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');if(s){return true}}catch(e){}}else{try{var s=navigator.plugins['Shockwave Flash'];if(s){return true}}catch(e){}}return false},getFlashVars:function(){this.getVarsObject();var v=this.vars;var z='';for(k in v){if(k!='flashplayer'&&k!='container'&&v[k]!=''){if(z!=''){z+='&'}var vk=v[k];if(vk==true){vk=1}if(vk==false){vk=0}z+=k+'='+vk}}if(!v.hasOwnProperty('volume')||!v['volume']){if(z!=''){z+='&'}z+='volume=0'}return z},isStrImage:function(s){if(s=='jpg'||s=='jpeg'||s=='png'||s=='svg'||s=='gif'){return true}return false},getVarsObject:function(){var v=this.vars;var f='',d='',w='';var arr=this.VA;var prompt=v['promptSpot'];var i=0;var video=this.vars['video'];if(this.varType(video)=='array'){var arr=video;for(i=0;i'}w=w.replace('movie=','src=');return{w:w,v:v}},getMetaDate:function(){if(!this.loaded||this.V==null){return false}if(this.playerType=='html5video'){var duration=0;try{duration=!isNaN(this.V.duration)?this.V.duration:0;if(isNaN(duration)||parseInt(duration)<0.2){if(this.vars['duration']>0){duration=this.vars['duration']}}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}}catch(event){this.log(event)}var data={duration:duration,volume:this.V.volume,playbackRate:this.V.playbackRate,width:this.PD.offsetWidth||this.V.offsetWidth||this.V.width,height:this.PD.offsetHeight||this.V.offsetHeight||this.V.height,streamWidth:this.V.videoWidth,streamHeight:this.V.videoHeight,videoWidth:this.V.offsetWidth,videoHeight:this.V.offsetHeight,paused:this.V.paused,loadTime:this.loadTimeTemp};return data}else{try{return this.V.getMetaDate()}catch(event){this.log(event)}}return false},getVideoUrl:function(){if(this.playerType=='flashplayer'){return this.V.getVideoUrl()}var arr=[];if(this.V.src){arr.push(this.V.src)}else{var uArr=this.V.childNodes;for(var i=0;i');var type='',fun='',link='',target='';if(callArr.length==2){var callM=callArr[0];var callE=callArr[1];if(!callE){return{type:'none'}}var val='';var eArr=[];type=callM;switch(callM){case'actionScript':if(callE.indexOf('(')>-1){eArr=callE.split('(');callE=eArr[0];val=eArr[1].replace(')','')}if(val==''){fun='thisTemp.'+callE+'()'}else{fun='thisTemp.'+callE+'('+val+')'}break;case'javaScript':if(callE.substr(0,11)=='[flashvars]'){callE=callE.substr(11);if(this.vars.hasOwnProperty(callE)){callE=this.vars[callE]}else{break}}if(callE.indexOf('(')>-1){eArr=callE.split('(');callE=eArr[0];val=eArr[1].replace(')','')}if(val==''){fun=callE+'()'}else{fun=callE+'('+val+')'}break;case"link":var callLink=(callE+',').split(',');if(callLink[0].substr(0,11)=='[flashvars]'){var fl=callLink[0].replace('[flashvars]','');if(this.vars.hasOwnProperty(fl)){callLink[0]=this.vars[fl]}else{break}}if(!callLink[1]){callLink[1]='_blank'}link=callLink[0];target=callLink[1];break}}return{type:type,fun:fun,link:link,target:target}},getPosition:function(obj,rEle){var pw=this.PD.offsetWidth,ph=this.PD.offsetHeight;var x=0,y=0;var left=0,top=0,rw=0,rh=0;if(!this.isUndefined(rEle)){left=parseInt(this.css(rEle,'left')),top=parseInt(this.css(rEle,'top')),rw=rEle.offsetWidth,rh=rEle.offsetHeight}switch(obj['align']){case'left':x=obj['offsetX']+left;break;case'center':x=pw*0.5+obj['offsetX'];if(left){x-=(pw*0.5-rw*0.5-left)}break;case'right':x=pw+obj['offsetX'];if(left){x-=(pw-left-rw)}break}switch(obj['vAlign']){case'top':y=obj['offsetY']+top;break;case'middle':y=ph*0.5+obj['offsetY']-top-(rh*0.5);if(top){x-=(ph*0.5-rh*0.5-top)}break;case'bottom':y=ph+obj['offsetY'];if(top){y-=(ph-top-rh)}break}return{x:x,y:y}},addElement:function(attribute){var thisTemp=this;if(this.playerType=='flashplayer'){return this.V.addElement(attribute)}var i=0;var obj={list:null,x:'100%',y:"50%",position:null,alpha:1,backgroundColor:'',backAlpha:1,backRadius:0,clickEvent:''};obj=this.standardization(obj,attribute);var list=obj['list'];if(list==null){return''}var id='element-'+this.randomString(10);var ele=document.createElement('div');ele.className=id;if(obj['x']){ele.setAttribute('data-x',obj['x'])}if(obj['y']){ele.setAttribute('data-y',obj['y'])}if(obj['position']!=null){ele.setAttribute('data-position',obj['position'].join(','))}this.PD.appendChild(ele);this.css(ele,{position:'absolute',filter:'alpha(opacity:'+obj['alpha']+')',opacity:obj['alpha'].toString(),width:'800px',zIndex:'20'});var bgid='elementbg'+this.randomString(10);var bgAlpha=obj['alpha'].toString();var bgColor=obj['backgroundColor'].replace('0x','#');var html='';var idArr=[];var clickArr=[];if(!this.isUndefined(list)&&list.length>0){var textObj,returnObj,clickEvent;for(i=0;i'}else{html+='
'}break;case'text':textObj={type:'text',text:'',color:'0xFFFFFF',size:14,fontFamily:this.fontFamily,leading:0,alpha:1,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,marginLeft:0,marginRight:0,marginTop:0,marginBottom:0,backgroundColor:'',backAlpha:1,backRadius:0,clickEvent:''};list[i]=this.standardization(textObj,list[i]);clickEvent=this.clickEvent(list[i]['clickEvent']);clickArr.push(clickEvent);if(clickEvent['type']=='link'){html+=''}else{html+='
'+list[i]['text']+'
'}break;default:break}idArr.push(newEleid)}}var objClickEvent=this.clickEvent(obj['clickEvent']);ele.innerHTML='
'+html+'
';if(objClickEvent['type']=='javaScript'||objClickEvent['type']=='actionScript'){var objClickHandler=function(){eval(objClickEvent['fun']);thisTemp.sendJS('clickEvent',clk['type']+'->'+clk['fun'].replace('thisTemp.','').replace('()',''))};this.addListenerInside('click',objClickHandler,this.getByElement(bgid+'_c'))}this.css(bgid+'_c',{position:'absolute',zIndex:'2'});for(i=0;i'+clk['fun'].replace('thisTemp.','').replace('()',''))};this.addListenerInside('click',clickHandler,this.getByElement(idArr[i]))}switch(list[i]['type']){case'image':case'png':case'jpg':case'jpeg':case'gif':this.css(idArr[i],{float:'left',width:list[i]['width']+'px',height:list[i]['height']+'px',filter:'alpha(opacity:'+list[i]['alpha']+')',opacity:list[i]['alpha'].toString(),marginLeft:list[i]['marginLeft']+'px',marginRight:list[i]['marginRight']+'px',marginTop:list[i]['marginTop']+'px',marginBottom:list[i]['marginBottom']+'px',borderRadius:list[i]['radius']+'px',cursor:'pointer'});this.css(idArr[i]+'_image',{width:list[i]['width']+'px',height:list[i]['height']+'px',borderRadius:list[i]['radius']+'px'});break;case'text':this.css(idArr[i]+'_text',{filter:'alpha(opacity:'+list[i]['alpha']+')',opacity:list[i]['alpha'].toString(),borderRadius:list[i]['radius']+'px',fontFamily:list[i]['font'],fontSize:list[i]['size']+'px',color:list[i]['color'].replace('0x','#'),lineHeight:list[i]['leading']>0?list[i]['leading']+'px':'',paddingLeft:list[i]['paddingLeft']+'px',paddingRight:list[i]['paddingRight']+'px',paddingTop:list[i]['paddingTop']+'px',paddingBottom:list[i]['paddingBottom']+'px',whiteSpace:'nowrap',position:'absolute',zIndex:'3',cursor:'pointer'});this.css(idArr[i],{float:'left',width:this.getByElement(idArr[i]+'_text').offsetWidth+'px',height:this.getByElement(idArr[i]+'_text').offsetHeight+'px',marginLeft:list[i]['marginLeft']+'px',marginRight:list[i]['marginRight']+'px',marginTop:list[i]['marginTop']+'px',marginBottom:list[i]['marginBottom']+'px'});this.css(idArr[i]+'_bg',{width:this.getByElement(idArr[i]+'_text').offsetWidth+'px',height:this.getByElement(idArr[i]+'_text').offsetHeight+'px',filter:'alpha(opacity:'+list[i]['backAlpha']+')',opacity:list[i]['backAlpha'].toString(),borderRadius:list[i]['backRadius']+'px',backgroundColor:list[i]['backgroundColor'].replace('0x','#'),position:'absolute',zIndex:'2'});break;default:break}}this.css(bgid,{width:this.getByElement(bgid+'_c').offsetWidth+'px',height:this.getByElement(bgid+'_c').offsetHeight+'px',position:'absolute',filter:'alpha(opacity:'+bgAlpha+')',opacity:bgAlpha,backgroundColor:bgColor.replace('0x','#'),borderRadius:obj['backRadius']+'px',zIndex:'1'});this.css(ele,{width:this.getByElement(bgid).offsetWidth+'px',height:this.getByElement(bgid).offsetHeight+'px'});var eidCoor=this.calculationCoor(ele);this.css(ele,{left:eidCoor['x']+'px',top:eidCoor['y']+'px'});this.elementArr.push(ele.className);return ele},getElement:function(element){if(this.playerType=='flashplayer'){return this.V.getElement(element)}var ele=element;if(this.varType(element)=='string'){ele=this.getByElement(element)}var coor=this.getCoor(ele);return{x:coor['x'],y:coor['y'],width:ele.offsetWidth,height:ele.offsetHeight,alpha:!this.isUndefined(this.css(ele,'opacity'))?parseFloat(this.css(ele,'opacity')):1,show:this.css(ele,'display')=='none'?false:true}},elementShow:function(element,show){if(this.playerType=='flashplayer'){this.V.elementShow(element,show);return}if(this.varType(element)=='string'){if(element){this.css(ele,'display',show==true?'block':'none')}else{var arr=this.elementTempArr;for(var i=0;i0){position.push(null,null,null,null);var i=0;for(i=0;i-1){this.elementTempArr.push(obj['element'].className);this.elementArr.splice(def,1)}var css={};var pm=this.getElement(obj['element']);var t=0;var b=0;var c=0;var d=obj['speed']*1000;var timerTween=null;var tweenObj=null;var start=obj['start']==null?'':obj['start'].toString();var end=obj['end']==null?'':obj['end'].toString();switch(obj['parameter']){case'x':if(obj['start']==null){b=pm['x']}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(start)*w*0.01}else{b=parseInt(start)}}if(obj['end']==null){c=pm['x']-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)*w*0.01-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])-b}else{c=parseInt(end)}}else{c=parseInt(end)-b}}break;case'y':if(obj['start']==null){b=pm['y']}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(start)*h*0.01}else{b=parseInt(start)}}if(obj['end']==null){c=pm['y']-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)*h*0.01-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])-b}else{c=parseInt(end)}}else{c=parseInt(end)-b}}break;case'alpha':if(obj['start']==null){b=pm['alpha']*100}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(obj['start'])}else{b=parseInt(obj['start']*100)}}if(obj['end']==null){c=pm['alpha']*100-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])*100-b}else{c=parseInt(obj['end'])*100}}else{c=parseInt(obj['end'])*100-b}}break}var callBack=function(){var index=thisTemp.arrIndexOf(thisTemp.animateElementArray,animateId);if(index>-1){thisTemp.animateArray.splice(index,1);thisTemp.animateElementArray.splice(index,1)}index=thisTemp.arrIndexOf(thisTemp.animatePauseArray,animateId);if(index>-1){thisTemp.animatePauseArray.splice(index,1)}if(obj['callBack']!=null&&obj['element']&&obj['callBack']!='callBack'&&obj['callBack']!='tweenX'&&obj['tweenY']!='callBack'&&obj['callBack']!='tweenAlpha'){var cb=eval(obj['callBack']);cb(obj['element']);obj['callBack']=null}};var stopTween=function(){if(timerTween!=null){if(timerTween.runing){timerTween.stop()}timerTween=null}};var tweenX=function(){if(t-1){this.elementTempArr.splice(defX,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};var tweenY=function(){if(t-1){this.elementTempArr.splice(defY,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};var tweenAlpha=function(){if(t-1){this.elementTempArr.splice(defA,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};switch(obj['parameter']){case'x':tweenObj=tweenX;break;case'y':tweenObj=tweenY;break;case'alpha':tweenObj=tweenAlpha;break;default:break}timerTween=new thisTemp.timer(10,tweenObj);timerTween.callBackFunction=callBack;if(obj['overStop']){var mouseOver=function(){if(timerTween!=null&&timerTween.runing){timerTween.stop()}};this.addListenerInside('mouseover',mouseOver,obj['element']);var mouseOut=function(){var start=true;if(obj['pauseStop']&&thisTemp.getMetaDate()['paused']){start=false}if(timerTween!=null&&!timerTween.runing&&start){timerTween.start()}};this.addListenerInside('mouseout',mouseOut,obj['element'])}this.animateArray.push(timerTween);this.animateElementArray.push(animateId);if(obj['pauseStop']){this.animatePauseArray.push(animateId)}return animateId},animateResume:function(id){if(this.playerType=='flashplayer'){this.V.animateResume(this.isUndefined(id)?'':id);return}var arr=[];if(id!=''&&!this.isUndefined(id)&&id!='pause'){arr.push(id)}else{if(id==='pause'){arr=this.animatePauseArray}else{arr=this.animateElementArray}}for(var i=0;i-1){this.animateArray[index].start()}}},animatePause:function(id){if(this.playerType=='flashplayer'){this.V.animatePause(this.isUndefined(id)?'':id);return}var arr=[];if(id!=''&&!this.isUndefined(id)&&id!='pause'){arr.push(id)}else{if(id==='pause'){arr=this.animatePauseArray}else{arr=this.animateElementArray}}for(var i=0;i-1){this.animateArray[index].stop()}}},deleteAnimate:function(id){if(this.playerType=='flashplayer'&&this.V){try{this.V.deleteAnimate(id)}catch(event){this.log(event)}return}var index=this.arrIndexOf(this.animateElementArray,id);if(index>-1){this.animateArray[index].callBackFunction();this.animateArray.splice(index,1);this.animateElementArray.splice(index,1)}},deleteElement:function(ele){if(this.playerType=='flashplayer'&&this.V){try{this.V.deleteElement(ele)}catch(event){}return}var def=this.arrIndexOf(this.elementArr,ele.className);if(def>-1){this.elementArr.splice(def,1)}try{def=this.arrIndexOf(this.elementTempArr,ele.className);if(def>-1){this.elementTempArr.splice(def,1)}}catch(event){}this.deleteAnimate(ele.className);this.deleteChild(ele)},getByElement:function(obj,parent){if(this.isUndefined(parent)){parent=document}var num=obj.substr(0,1);var res=[];if(num!='#'){if(num=='.'){obj=obj.substr(1,obj.length)}if(parent.getElementsByClassName){res=parent.getElementsByClassName(obj);if(!res.length){return null}}else{var reg=new RegExp(' '+obj+' ','i');var ele=parent.getElementsByTagName('*');for(var i=0;i0){res=res[0]}else{res=null}}else{if(num=='#'){obj=obj.substr(1,obj.length)}try{res=document.getElementById(obj)}catch(event){res=null}}return res},css:function(elem,attribute,value){var i=0;var k='';if(this.varType(elem)=='array'){for(i=0;i=60){minute=Math.floor(minuteS%60)}var hminuteS=Math.floor(dt/60);var hminute=hminuteS;var hhourS=Math.floor(dt/360);var hsecond=dt%60;if(hminuteS>=60){hminute=Math.floor(hminuteS%60)}var nowDate=new Date();var obj={timeh:hourS,timei:minute,timeI:minuteS,times:second,timeS:t,durationh:hhourS,durationi:hminute,durationI:hminuteS,durations:hsecond,durationS:dt,liveTimey:nowDate.getYear(),liveTimeY:nowDate.getFullYear(),liveTimem:nowDate.getMonth()+1,liveTimed:nowDate.getDate(),liveTimeh:nowDate.getHours(),liveTimei:nowDate.getMinutes(),liveTimes:nowDate.getSeconds()};for(var k in obj){if(obj[k]<10){obj[k]='0'+Math.floor(obj[k])}else{obj[k]=Math.floor(obj[k]).toString()}}return this.replaceTime(str,obj)},randomString:function(len){len=len||16;var chars='abcdefghijklmnopqrstuvwxyz';var maxPos=chars.length;var val='';for(i=0;i127||str.charCodeAt(i)==94){len+=2}else{len++}}return len},createXHR:function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else if(window.ActiveXObject){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(event){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(event){this.eject(this.errorList[7])}}}else{this.eject(this.errorList[8])}},ajax:function(cObj){var thisTemp=this;var callback=null;var obj={method:'get',dataType:'json',charset:'utf-8',async:false,url:'',data:null,success:null,error:null};if(this.varType(cObj)!='object'){this.eject(this.errorList[9]);return}obj=this.standardization(obj,cObj);if(obj.dataType==='json'||obj.dataType==='text'||obj.dataType==='html'||obj.dataType==='xml'){var xhr=this.createXHR();callback=function(){if(xhr.status==200){if(thisTemp.isUndefined(obj.success)){return}if(obj.dataType==='json'){try{obj.success(eval('('+xhr.responseText+')'))}catch(event){if(!thisTemp.isUndefined(obj['error'])){obj.error(event)}}}else{obj.success(xhr.responseText)}}else{obj.success(null);thisTemp.eject(thisTemp.errorList[10],'Ajax.status:'+xhr.status)}};obj.url=obj.url.indexOf('?')==-1?obj.url+'?rand='+this.randomString(6):obj.url;obj.data=this.formatParams(obj.data);if(obj.method==='get'&&!this.isUndefined(obj.data)){if(obj.data!=''){if(obj.url.indexOf('?')==-1){obj.url+='?'+obj.data}else{obj.url+='&'+obj.data}}}if(obj.async===true){xhr.onreadystatechange=function(){if(xhr.readyState==4&&callback!=null){callback()}}}xhr.open(obj.method,obj.url,obj.async);if(obj.method==='post'){try{xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.setRequestHeader('charset',obj['charset']);xhr.send(obj.data)}catch(event){callback()}}else{try{xhr.send(null)}catch(event){callback()}}if(obj.async===false){callback()}}else if(obj.dataType==='jsonp'){var oHead=document.getElementsByTagName('head')[0];var oScript=document.createElement('script');var callbackName='callback'+new Date().getTime();var params=this.formatParams(obj.data)+'&callback='+callbackName;callback=obj.success;oScript.src=obj.url.split('?')+'?'+params;oHead.insertBefore(oScript,oHead.firstChild);window[callbackName]=function(json){callback(json);oHead.removeChild(oScript)}}},loadJs:function(path,success){var oHead=document.getElementsByTagName('HEAD').item(0);var oScript=document.createElement('script');oScript.type='text/javascript';oScript.src=this.getNewUrl(path);oHead.appendChild(oScript);oScript.onload=function(){success()}},isMsie:function(){var browser=navigator.appName;var b_version=navigator.appVersion;var version=b_version.split(';');var trim_Version='';if(version.length>1){trim_Version=version[1].replace(/[ ]/g,'')}if(browser=='Microsoft Internet Explorer'&&(trim_Version=='MSIE6.0'||trim_Version=='MSIE7.0'||trim_Version=='MSIE8.0'||trim_Version=='MSIE9.0'||trim_Version=='MSIE10.0')){return false}return true},uploadFlash:function(){var swf;if(navigator.userAgent.indexOf('MSIE')>0){try{var swf=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');return true}catch(e){return false}}if(navigator.userAgent.indexOf('Firefox')>0){swf=navigator.plugins['Shockwave Flash'];if(swf){return true}else{return false}}return true},supportVideo:function(){if(!this.isMsie()){return false}if(!!document.createElement('video').canPlayType){var vidTest=document.createElement('video');var oggTest;try{oggTest=vidTest.canPlayType('video/ogg; codecs="theora, vorbis"')}catch(error){oggTest=false}if(!oggTest){var h264Test;try{h264Test=vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}catch(error){h264Test=false}if(!h264Test){return false}else{if(h264Test=="probably"){return true}else{return false}}}else{if(oggTest=="probably"){return true}else{return false}}}else{return false}},getDataset:function(ele,z){try{return ele.dataset[z]}catch(error){try{return ele.getAttribute('data-'+z)}catch(error){return false}}},getObjectById:function(id){var x=null;var y=this.getByElement('#'+id);var r='embed';if(y&&y.nodeName=='OBJECT'){if(this.varType(y.SetVariable)!='undefined'){x=y}else{var z=y.getElementsByTagName(r)[0];if(z){x=z}}}return x},formatParams:function(data){var arr=[];for(var i in data){arr.push(encodeURIComponent(i)+'='+encodeURIComponent(data[i]))}return arr.join('&')},arrSort:function(arr){var temp=[];for(var i=0;i-1){filepath=filepath.split('?')[0]}var pos='.'+filepath.replace(/.+\./,'');return pos.toLowerCase()}return''},isMobile:function(){if(navigator.userAgent.toLowerCase().match(/(iphone|ipad|ipod|android|ios|midp|windows mobile|windows ce|rv:1.2.3.4|ucweb)/i)){return true}return false},isContains:function(str,key){return str.indexOf(key)>-1},getNewUrl:function(url){if(this.isContains(url,'?')){return url+='&'+this.randomString(8)+'='+this.randomString(8)}else{return url+='?'+this.randomString(8)+'='+this.randomString(8)}},client:function(event){var eve=event||window.event;if(this.isUndefined(eve)){eve={clientX:0,clientY:0}}return{x:eve.clientX+(document.documentElement.scrollLeft||this.body.scrollLeft)-this.pdCoor['x'],y:eve.clientY+(document.documentElement.scrollTop||this.body.scrollTop)-this.pdCoor['y']}},getCoor:function(obj){var coor=this.getXY(obj);return{x:coor['x']-this.pdCoor['x'],y:coor['y']-this.pdCoor['y']}},getXY:function(obj){var parObj=obj;var left=obj.offsetLeft;var top=obj.offsetTop;while(parObj=parObj.offsetParent){left+=parObj.offsetLeft;top+=parObj.offsetTop}return{x:left,y:top}},removeChild:function(){if(this.playerType=='html5video'){var i=0;var timerArr=[this.timerError,this.timerFull,this.timerTime,this.timerBuffer,this.timerClick,this.timerCBar,this.timerVCanvas];for(i=0;i0){name.lineTo(d[0],d[1])}else{name.moveTo(d[0],d[1])}}name.closePath();name.fill()},canvasFillRect:function(name,path){for(var i=0;i-1){this.elementArr.splice(def,1)}var childs=f.childNodes;for(var i=childs.length-1;i>=0;i--){f.removeChild(childs[i])}if(f&&f!=null&&f.parentNode){try{if(f.parentNode){f.parentNode.removeChild(f)}}catch(event){}}},getProportionCoor:function(stageW,stageH,vw,vh){var w=0,h=0,x=0,y=0;if(stageW/stageH]+>/g,'')};for(i=0;i0){arr.push(arrs[i])}else{if(arr.length>0){textSubtitles.push(arr)}arr=[]}}for(i=0;i=2){var sn=textSubtitle[0];var startTime=this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[0]));var endTime=this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[1]));var content=[delHtmlTag(textSubtitle[2])];var cktrackdelay=this.vars['cktrackdelay'];if(cktrackdelay!=0){startTime+=cktrackdelay;endTime+=cktrackdelay}if(textSubtitle.length>2){for(var j=3;j=thisTemp.numberTotal){thisTemp.stop()}};this.start=function(){if(!thisTemp.runing){thisTemp.runing=true;thisTemp.timeObj=window.setInterval(thisTemp.startFun,time)}};this.stop=function(){if(thisTemp.runing){thisTemp.runing=false;window.clearInterval(thisTemp.timeObj);thisTemp.timeObj=null}};if(time){this.time=time}if(fun){this.fun=fun}if(number){this.numberTotal=number}this.start()},toSeconds:function(t){var s=0.0;if(t){var p=t.split(':');for(i=0;ivideoPlay" + }, + "pause": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhDNjc4QjgzRUE2ODExRUFBNzZBQzgwNEI3ODhCRUM4IiB4b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YMf6kUAAAAASUVORK5CYII=", + "width": 40, + "height": 40, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": 0, + "offsetX": 0, + "offsetY": 0, + "clickEvent": "actionScript->videoPause" + }, + "mute": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjc2QUQwQ0UzRUE2OTExRUFBNzU4RjdBRDMyMkQxNUQxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjc2QUQwQ0U0RUE2OTExRUFBNzU4RjdBRDMyMkQxNUQxIj4gPHhtcE1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Xy74KS5KBxIDBafwGpl0AsCeV/AlJsg60mARUxf6DpmQ9I/Ro0DgQ6SBSUc4H4JlRIDog5B1MI5gDxO2DUPoHyQbXJ88HkQBsgbkPiBwHxaqqWg0DfM1JQNiYC9T+C6skHpT8gfy/NQxCbo3GogznODkglA3E13epiYh0JdBw7kCoG4nqgnst0bc0Q6UhQsZIMVLt+QNqDhBwJlP8PxG/IMZuFWlmV2Oge7ZOMOnDUgaMOHHXgqAPpCwACDAAr5cn9pIP80AAAAABJRU5ErkJggg==", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -330, + "marginY": 0, + "offsetX": -280, + "offsetY": 0, + "clickEvent": "actionScript->videoMute" + }, + "escMute": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNv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f3cQRZATdQDfACc6fpDVNQ6JSKJd4Tb4ATSBf7q7XouqqIgzFlYViPkRQBEVQBEWQ+VjGfkAf3rfkpn55n45pIkicU0xsaxDpJbaLJIXc14skQmYPtmAHWm/egDMowX3ONtOADbiAzJPrnp+f5FIIXkEB1laqsNeHvWfRqENJJ9dy20loSFtKIWi8yJVeJDMOgiZIaxOke3bBTuYW1JyryRXIR+mD2ND1wN54svQtnHzSCPZJs9uLU0iOUYOau+CkktEnau9ErDlHUP7qRFAERVAE/1XwJcAA0FenACPg6tsAAAAASUVORK5CYII=", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -330, + "marginY": 0, + "offsetX": -280, + "offsetY": 0, + "clickEvent": "actionScript->videoEscMute" + }, + "full": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20ve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9InhtcC5kaWQ6QkFBMzJCNzFFQTY4MTFFQThDMDNDRkMwNkZDN0NBQUYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7YTDS9AAABhElEQVR42uyXu0oDQRSGx1uiENAXEN/BwspOO8FGRIOks/cGJlFLNUbwBnkDtRS1scwLSIg2og+QzkIbNV6yfgfOwrLEQnCZEWbg4wxZ2Hz8w5mZNXPZbMAwrtJpHB9e0At6QS/oBR0f3X/9wo6iGaNcyRQC5QtedX4blMy4NUFGA44hBe/QhC6YgQEYtZog6dxT5mOprlM+4RFaVgVjYmnKNixDAYYg50STICfvLqvcAcmWdblTrnTxHizAIRT1t34XujhD2YzIFUivGT5WrCY4qXJHsBaRk9ELPbabpAazcBGTk7ELJ4kJsnySToM/rrXp1im44dkd9eGHLahOqSe5xJewGpPr0249hWHbZ/EHvLTZ58KGOLd9Fodnayi3A4six/ItuXKbedZaUjnp1hVXrlty+KdJL0+VxPYhT3qtpAR/u8RvMK3zDcS2XLsPZnSzfYJBkqxIorr5yglRQfrapmAVRlQmp/e86NF1ZjVB0pnw3yRe0At6QS/oBf+X4LcAAwBYY9J77BQ29AAAAABJRU5ErkJggg==", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -40, + "marginY": 0, + "offsetX": -40, + "offsetY": 0, + "clickEvent": "actionScript->fullScreen" + }, + "escFull": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdG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DmANuZpupTVdsjpyWZuDI1rj4szF4xFu4FZHruYN/+eR/1XnBb2gF/SC/1vwR4ABAOZRShmnU6I7AAAAAElFTkSuQmCC", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -40, + "marginY": 0, + "offsetX": -40, + "offsetY": 0, + "clickEvent": "actionScript->quitFullScreen" + }, + "backLive": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAbCAYAAADBPvmtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjgzODFCMUM2QTAzNzExRTdCQzNEOTRFNDMwMzU0MzVEIiB4bXBNTTpEb2N1bWVudEl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3uAYbNHEEntOgEinH7uPPpR88VUbOO4nGAWC6cOoVO+1YtA1KiVcLaLMLpYKaGtapI2clrjwIq6ahRpDBYWkBWpekywBKSFmuGdMMp4vFMMHNR5wof5QsXwYSaM8aWyP4eSw9mjTjP7e4YmYz3tneVPM69quFQ2qGyrFqO6UdPFVxUztARiBK2eG5AM++qMiWINIBAlha9SSwloQa7vOc1ofLbiDTVQx8VQXSTFJEcMBe1o9MuI/7emUba98i1W2Qe4F4NTfw/xWUnb+2h+1e2jrhTbC7G6JKEYtkMqpeaMYniH//6cYvodU1i6SKnj/9DrcvuqTFT8W5lsNQalzwvHaImuVyewKRvhBXg0YQC6aryDaVItep+K/x/EL3lT6K4Me/OzgT9Ogg5fEXErzoEMbiWlI86BDA4n5AYEv42kEcIWczNm/7CL359sQ+E1ltoMCeZacUDHgD0ziwB3V28L+5PZiFpHhm14z1141zQX+EWAA7zET48FL/+QAAAAASUVORK5CYII=", + "align": "left", + "vAlign": "top", + "marginX": 110, + "marginY": 0, + "offsetX": 110, + "offsetY": 7, + "clickEvent": "actionScript->backLive" + } + }, + "definition": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 70, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 70, + "height": 28, + "lineHeight":28, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 70, + "height": 28, + "lineHeight":28, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -110, + "marginY": 5, + "offsetX": -110, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -125, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -125, + "offsetY": 45 + }, + "event": "click" + }, + "subtitle": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 60, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 60, + "height": 28, + "lineHeight":28, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 60, + "height": 28, + "lineHeight":28, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -170, + "marginY": 5, + "offsetX": -170, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -185, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -185, + "offsetY": 45 + }, + "event": "click" + }, + "playbackrate": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -220, + "marginY": 5, + "offsetX": 1000, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -235, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -235, + "offsetY": 45 + }, + "event": "click" + }, + "volumeSchedule": { + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAGCAYAAACfHf25AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWF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ZGlkOjAyNTI1OTlCRUE2QTExRUFCMDcwOTdFRUNEQkNCOUMyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDI1MjU5OThFQTZBMTFFQUIwNzA5N0VFQ0RCQ0I5QzIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDI1MjU5OTlFQTZBMTFFQUIwNzA5N0VFQ0RCQ0I5QzIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz49jTFHAAAAVElEQVR42mJkqPjPxsDA0A3EMUAsxDA8wXsgXgzEpSxAoguI8xiGNxCE+vE7IzCG3w7jmEUH75gYRhhggqbtkQLmgPJwGRAzAnEsNK0P50KrFiDAACzSDpFFQRvpAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 60, + "height": 12, + "backgroundHeight": 12, + "marginX": -290, + "marginY": 14, + "offsetX": -240, + "offsetY": 14, + "button": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9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GE+IDw/eHBhY2tldCBlbmQ9InIiPz4z4CyEAAAAvElEQVR42mJkqPjPAAWyQBwMxO5AbAwVOwvEO4F4LRA/BgkwQjVYAnE5EPszYAcbgbgTiI+zQE3Gp5gBSS6XBeoMsIAUHwNDmhkDQ6guRHb1ZQaGWacYGJ59gms6wAJ1MxiAFNc7I4yFsRv2wIXcmZA8CDcZGaCJGTMxkAiYoEEHdzM6QBM7ywINZw8QD+RBZGfAPI0EdoLiARSskwkEKywucpmgMdgJFWAgEHGPWaACx0G6QeFMKGkABBgAjZAxHJ8BxLUAAAAASUVORK5CYII=", + "vAlign": "top", + "width": 12, + "height": 12, + "marginX": 0, + "marginY": 0 + } + }, + "timeSchedule": { + "default": { + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAGCAIAAACNcmNmAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9S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y5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjIzQkQxNTY3RUE2QjExRUE4NDZERTIyNjVGODc0MkZBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjIzQkQxNTY4RUE2QjExRUE4NDZERTIyNjVGODc0MkZBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MjNCRDE1NjVFQTZCMTFFQTg0NkRFMjI2NUY4NzQyRkEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MjNCRDE1NjZFQTZCMTFFQTg0NkRFMjI2NUY4NzQyRkEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7hdq0DAAAADklEQVR42mJiqPgPEGAAAfsBeoA9/zQAAAAASUVORK5CYII=", + "width": "100%", + "height": 1, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": -1, + "offsetX": 0, + "offsetY": -1 + }, + "buttonContainer": { + "width": "100%", + "height": 14, + "align": "left", + "vAlign": "bottom", + "offsetX": 0, + "offsetY": -50 + }, + "button": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNU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NTI4OEFBMzc2MTFFNzlEM0Y4MEEwMzFCNEM1REUiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RUM3QkM1NjgwMzEyMTFFNjkxQTVFQjEwMjc1NTk0OUUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RUM3QkM1NjkwMzEyMTFFNjkxQTVFQjEwMjc1NTk0OUUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6w77XtAAAA0ElEQVR42mL8//8/AxIwAWIfIHYAYl2o2GUgPgDEW4D4DFwlSCMUpwPx1f+4wVWoGrB6ZE0f/xMGH2GaGYEEyHkLgVgL5IJDD/8yrLzyl2H33b9gF7kqMzOE6zAz2Mkzwxx5DYjjWaB+gmuq2P2b4dzzf3CvzD33h+E8kN/hygDTDFLrwwQNCDAA2YSsCQZAYiA5JODAhBR6cOdhA2hyukwMZAImaDzBAwIXQJO7zASNXDAAhZ6RJKYjQGIgOSRwgOzoIDsBkJ3kGMlN5AABBgAOqhy/RdZztQAAAABJRU5ErkJggg==", + "width": 14, + "height": 14 + }, + "defaultHideTime": "0.3", + "defaultShowTime": "0.3", + "mouseOutHideTime": "0.3", + "mouseOutShowTime": "0.3" + }, + "timeText": { + "vod": { + "text": "[$vodLanguage]", + "align": "left", + "vAlign": "top", + "marginX": 48, + "marginY": 7, + "offsetX": 48, + "offsetY": 7, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 0.8, + "bold": false, + "lineHeight": 25 + }, + "live": { + "text": "[$liveLanguage]", + "align": "left", + "vAlign": "top", + "marginX": 48, + "marginY": 7, + "offsetX": 48, + "offsetY": 7, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 0.8, + "bold": false, + "lineHeight": 25 + } + }, + "custom": { + "button": {}, + "images": { + "definitionSeparator": { + "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAmCAYAAAAFvPEHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUY5QzVEQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjA4QUY5QzVFQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDhBRjlDNUJBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDhBRjlDNUNBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5OVecRAAAAFUlEQVR42mJISEg4w8QABEORAAgwAIP7AjcGIX7gAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "marginX": -110, + "marginY": 0, + "offsetX": -110, + "offsetY": 0, + "width":1, + "height":40 + }, + "subtitleSeparator": { + "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAmCAYAAAAFvPEHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUY5QzVEQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjA4QUY5QzVFQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDhBRjlDNUJBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDhBRjlDNUNBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5OVecRAAAAFUlEQVR42mJISEg4w8QABEORAAgwAIP7AjcGIX7gAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "marginX": -170, + "marginY": 0, + "offsetX": -170, + "offsetY": 0, + "width":1, + "height":40 + }, + "playbackrateSeparator": { + "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAmCAYAAAAFvPEHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUY5QzVEQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjA4QUY5QzVFQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDhBRjlDNUJBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDhBRjlDNUNBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5OVecRAAAAFUlEQVR42mJISEg4w8QABEORAAgwAIP7AjcGIX7gAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "marginX": -220, + "marginY": 0, + "offsetX": 1000, + "offsetY": 0, + "width":1, + "height":40 + } + }, + "swf": {} + } + }, + "centerPlay": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAAC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V9VjJxRkSOCYcLPWYPBqG3GzBzzURF2P0DqQFJzc1DtIKoAUeeepotkCTTfIWsIvYIGejGSyQ1ts+EnMCLZ+qUNzbqXpDmZiGsgni7Oz4qFC0l5KRs9Fo7fywkHipS+XRTKq1ENdgszw9B4fVzZtDwkm09qzIReL+AJ+AMoj7IgX3K2IHWnHbWXR6Gy2TP6tMHRsOcSN8hwvkUYbfhbiuFN6zRpHHywfVTyBVOvuFizxhV0M8gaduG+UjxfKCXHat6Gdnk8T06QhcbVGmMhI8n8Y36D33qsX1unhitY7APrXlaNAEygEhQZ1FmYr3hU8dHK/wh2KfQ0++VOYBdjVFIGW6W0hE+x/UW5ApqrQb7VmwHzwGcfS++80hefVcZq3oVlQ9WLHvNpp6e1QjEU3NbbCgh4bmQG+RejaUiSnE9JM94uA7N5/LGtA4dpQdKZLAU4o8M5MmFTaZyRnE0LRZmv35DH/J/uE63RtgMY7vdsFE8yZFe350tLk4efsUjbUPc8Ggzlrg2jRcI6JeDiutKR5kN4brROgd1Sb8BWaDjaBYSb8o5rLNFo63ab6//aVe9iz18hcbmlxs6C93tWC5q7/g2oIF1/6Sf3/TCec3nfC3PfE33nHHxjv+1k/+5mPu2HzM3/5Ohb8Bo8kNGP0tQE2GvwmtiwRGw98G2aLwN+K2KPyt4C0M/58RWBye/3cY/wkwABTFsKMxq7wRAAAAAElFTkSuQmCC", + "width": 80, + "height": 80, + "align": "center", + "vAlign": "middle", + "offsetX": -40, + "offsetY": -40, + "clickEvent": "actionScript->videoPlay" + }, + "buffer": { + "file": "data:image/swf;base64,Q1dTJA8eAAB4nJVZeTxUbfs/9pAllZm0WbIvKVubJ0siSiHblGZRlBJPpXoYGV5hBlHZJin1UMhajTKZyZync+JJ2Vqk5YfSvgpp8cxvztS55/T+fn+8r4/PxXyd+9z3fd3X9b2+140GGbOwb7IctGLKJAiC3OUl5ur0yRIrBw0d5z/j1ukvgKDlk6qlCO3H81MgNzc3CBJLvrDfxFCE5ANkJ8ZMu+SHHRcz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ng23uMG4eMiOmHZKsupwpKau/JChCcfXvl1RQcM+DpTJiK4osZXToAibAkh5RGDigzUC5IUR6EJUvobRxBmPB7BiRiFxeXZ3BORYPhmOUIzh3vOKuubwOi8hNTbWqXuSSrX0uUBaGEfhLSu1KEnKTUDtV8kkNp3Z5ArXrYxT7dvvnkmEouNo0xLJFi9uixUmB4zmwJnRCG6pYb1qxHtJmu/hMWeZjNzXtRcbrvBdXqp5fP5ZbcndWj7vDq6nB5iMOO9f+JFh1nGDVcIK1kLTYkyGzH6g6BCL7C+V7jcAtOsHeThbtQ0eG20SuBcJo6xtkHEOsBgtE94+ZbPN+DBQoF2pnIQsrI6oD/mKDyGY4NsxEYjM9r1C2yv7PYbjo8Cyk7IH1UcrHQfzQRbxQ3gbSopFwdvQ9mSzVe6v3nlS7w+xmzI0moCufph9Z8ENXnsQ7gcbmuCeImA0tY4Sz8PorjNx4q5ka+CFQ16zXDURhvmG+EWl/s3s55/JcIAP/3wt3QfimBiTr4GIho0tbGweTeS59SEBgUBCjO28dDq4dNf2KTPHbF8JoIwNxZx4z7ZIod2dMPuf2LqA9tAxUcgXPy2xR8ygVEDFyAuhxk3vUcFFxxXcixm8u1yjKaeMTBwvJ4R0r9eMLWMRp4Jj83Oh0M5lwwRaEvqvPqKCzrXKJS0erqyur6B6yEoVtEt3NRN3octbaRHf8n+tPzHHkdJ/msOSvoP2VuphWNb9qTNEim0U4CxTaL75Gm3xmEfHMWJ+Wp3E/t7YSD5fsV3zPIfHmF4gYBuTrU4//wXzLZxEDBt1g0h1NJW3SJ4YWmrP3sgdVDfyPRhqE6M0Q7vqgeTIOx6IVNtl2nxua0kiMalgY7Zrv6NhPjH6h4Fjq7UA71r9dSqlI0kX6+/8ClbctuA==", + "align": "center", + "vAlign": "middle", + "offsetX": -30, + "offsetY": -30, + "text": { + "align": "center", + "vAlign": "middle", + "offsetX": -30, + "offsetY": -12, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": false, + "width": 60, + "textAlign": "center" + } + }, + "custom": { + "button": "", + "images": "", + "swf": "" + }, + "error": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": false, + "width": 200, + "textAlign": "center", + "align": "center", + "vAlign": "middle", + "marginX": -100, + "marginY": -30, + "offsetX": -100, + "offsetY": 0, + "lineHeight": 30, + "height": 30 + }, + "advertisement": { + "background": { + "backgroundColor": "0x000000", + "alpha": 1, + "width": "100%", + "height": "100%" + }, + "reserve": { + "spacingLeft": 30, + "spacingTop": 0, + "spacingRight": 30, + "spacingBottom": 0, + "align": "center", + "vAlign": "middle" + }, + "countDown": { + "backgroundColor": "", + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYmQ1NmQyNi1kYmVhLWJkNGYtYTRmNS1kNGYxMzFhZDdkMzkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUQxNUIwMkVFNDEyMTFFQUI1ODVGMDVCNEY4NjRFNzUiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUQxNUIwMkRFNDEyMTFFQUI1ODVGMDVCNEY4NjRFNzUiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MGJkNTZkMjYtZGJlYS1iZDRmLWE0ZjUtZDRmMTMxYWQ3ZDM5IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBiZDU2ZDI2LWRiZWEtYmQ0Zi1hNGY1LWQ0ZjEzMWFkN2QzOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppq1HscAAACESURBVHja7Ng9DkBAGIThsX4S2UKp5hIUOkfgmhI3UGhcwUFWbTZa9a7ITPJu/YTuSwBkbGIdswi7ix1sSfnMbGQFwi9njf8Yhk+P+BtMhN/xNmvwkQkiiCCCCCKIIIIIIoggggjyR4j7gMP5s0TF2siQzUNOVrIaz70i5PyhZmfrLcAAkE4K3cpWYzIAAAAASUVORK5CYII=", + "alpha": 1, + "radius": 0, + "height": 34, + "width": 34, + "align": "right", + "vAlign": "top", + "offsetX": -44, + "offsetY": 10 + }, + "countDownText": { + "size": 16, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xffffff", + "alpha": 1, + "bold": "false", + "width": 25, + "textAlign": "center", + "align": "right", + "vAlign": "top", + "height": 34, + "lineHeight": 34, + "offsetX": -39, + "offsetY": 15, + "marginY": 10 + }, + "muteButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYmQ1NmQyNi1kYmVhLWJkNGYtYTRmNS1kNGYxMzFhZDdkMzkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QjczRUMxMENFNDE3MTFFQTkwNzhDNjNEMzc2MzQwMEQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QjczRUMxMEJFNDE3MTFFQTkwNzhDNjNEMzc2MzQwMEQiIHhtcDpDcmVhdG9yVG9v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kiQGBwdf22y2vOvra2Fzc/On1+uNATC2pqYmm+d59JJvdnY2+KQemZqa0nd0dOQNDw+fDQwM+EOh0J/TGwwG2cjIiHZmZsZQUFBADw0NXTyJR5qbmxXLy8vF/f39p6Ojo//8k8XFxcLy8vKsysrKE8mBMAxDbm9vG2maxnz4+pj+3t6eieM4or6+/lssFhMkq5qysjIGckA+OTkpyt2oh/poJ2n5qlQqKhqN8mIrAvVQH+0kBYJuRmFZlnyUr+VyUqvV0gCG8/l8nKRAIEcIpVJJQXk+Gm/whKDX62moIiYnJ4eUFEggEOB/5worRl8QhL+eL6/XxE+GzCqWgZ/EI5FI5C40wCOikMT14naSAQGWzMLn4eHhjRj9uF7cLi1mVSgUJJxIqKioYD0ej3l6evqis7PzVMzGGo2GWltbK8b+U1pa+iUcDvNpUTxywsHBgRldXF1dfYIdV6wXi4qKZMfHx5b19fWw1Wr1PhhKENtDCTc3N1dYW1srr6urO0l2zggGg/z+/n7U4XDo4AD87u7u1e3tbfIeyc/Pp/FE8/Pzl729vT61Wk0lVhFsKshkMhIbITQ2AskOm+N9cltdXX0DYwHT2Nj4HUJ8k/Q8gvTsdrsj7e3tuQ0NDYpEkqIoioS4czgIIRjssBhGbAH4W2KZG41GdmlpKXB+fs6lnCM6nY5uaWlRmkwmBntNHEhJSQnT2tqa63K5IisrK6Guri4NTGlZY2NjPzCf4kAQ5NHR0c3CwkIIQyXZqJi4dnZ2TAhwY2Mj0tTUpJ6YmPD39PT4UtkrLSDYYWFa0+A05nQ6I+CNy1T3SgvIi71gRTMAx90l3J0BQD4hs7pA3uK1JJ2bXxovapwgjl8CDABU9njZZXI40wAAAABJRU5ErkJggg==", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 34, + "offsetX": -85, + "offsetY": 10, + "clickEvent": "actionScript->adMute" + }, + "escMuteButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG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VFRXBubm6gq0lRFEVC3a24EEIwAMSOZcQWgMec8sWIjo7mLCws3Dtd900cQZWgj8TExNDYa5xAoJ/QZWVlwRsbG8bFxcWHmpoaETS+gIGBAS3yyQkEQUIfMsOC6QFL5belomvs7u7GIMDNzU0jdN2g4eFhXX19veYtY/kERCwWs5qbm0WJiYkB0PKNMBv6t47lE5Df9gWLeQc4HC/hincA5B901g3IWPyPwpc3Px/+qFnDRf//AgwA58gWp0HLAboAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 34, + "offsetX": -85, + "offsetY": 10, + "clickEvent": "actionScript->escAdMute" + }, + "skipAdButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAiCAYAAADI+15nAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9v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49bkq8t/Zrv9xbquOSY1KKWBVjfUBj6F5fU8LqGJhUl0SU68rl9XcZDmUo9PcSyA4TGBiBjEBGICOQgRHICPxXCZxnNKhG8s9FbxgPquGh/w98jbITZRv8otPh/xD0tMiLcvW7AAMA8z53vVF4KjEAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 80, + "height": 34, + "offsetX": -173, + "offsetY": 10, + "clickEvent": "javaScript->adjump" + }, + "skipDelay": { + "backgroundColor": "", + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIsAAAAiCAYAAABvCirZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA0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Bi0CyIJAsCCQLAoFkQSBZEEgWROuSZRfDgLCAXfYvNzqoncBYIPbBt4wsbIz+KLXHqT2MMUGo8CcjCrUb/wgwAFGB9yNs4DNMAAAAAElFTkSuQmCC", + "alpha": 1, + "radius": 0, + "height": 34, + "width": 139, + "align": "right", + "vAlign": "top", + "offsetX": -230, + "offsetY": 10 + }, + "skipDelayText": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": "false", + "width": 25, + "height": 34, + "lineHeight": 34, + "textAlign": "right", + "align": "right", + "vAlign": "top", + "offsetX": -222, + "offsetY": 15, + "marginY": 10 + }, + "adLinkButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAAAiCAYAAAAnOTVZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJj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Yk2YrO6A9iUzTZlP58ZQuxhErol1wzuyb9woRCIxTaQqaNLlqKgibaZ7FtTSV684S/S5l2C3kb52keaOuNC7HVfiUonwSohmlQagW4iyqVOMCG3uo3nbY47WocggFxcVn7oc9cvHTqW++tZHnHiCdcYj5UHmtNV958Pf87t3FBmJuGKpyZazuXmtlMP3dyDpGVVKTBQ1MGhCrlB3EVP4Xn4Av3yRItR0wZ3r/kWx+IwYox/HHhjWkfa9vIPXgJu2CwbeDZtRNw4WIR2xeGuzqS5yK9Hmw4U7589xCiLTdlNPcWWmdr0oM3cJGtcavzMA8hCGnOk0HUcbgRRNbeXaIUKbXVoLSPg/C4Ai4Htt14IJzIkiiMomRjDywZOrWj3BMMZJdR/rE6DqWuUifv+K8ziGLbMXWy3+81LmYNdr1MhMIoc98Tj9Lugw91Kryo9drYQqzriJsVaIgQT0MEsFlSuSX2B4Dp2A3ji8YGVnxoYCWfE+MYbWgLEgEP+9wX9slXEyqeuK1TsiYLvu9HnOEulEQIybrRNZzMdR95X+evQsHF+KrZWFGR9+1E54X+SeLfdZzS9nbn+mtObMZIbt46L+Yfa+TEMEgkhncPGgRCBrFOWVq7eWw58Z8ctu040fpYYyfWQ72wPP0uFURoMdO/dUxOsyNN1hwBUdYvywPmROYs0w49jUuox6mL9ZyIoYlgBj/lZN/aTyfahuj0iINws5zrRLO7c1bT2TNHvQ7vnEwTM7CuVbmipLOvExPwjgO608XZg18sXPwpDofIIXKIXBwih8ghHlKImxyDK2l/aJriHFxpqpC+fKZRQeMkuHyq85/pJw32mOrRLwEGAIpCc5vrKRPzAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "bottom", + "width": 81, + "height": 34, + "offsetX": -90, + "offsetY": -40, + "clickEvent": "actionScript->openAdLink" + }, + "closeButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZ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QRSGb2m1t2Ix+BETrCbq1gIbV3YlLFo1QW3VsPEXuNPoxl+AdKPu3ZgAUtG4MSpxZTBs3WEwRhAWGltFKIUA1/eQ98bxZmY6jUzyNLdzZs47H2dmTqweeM3KIXACXAE50AWO0jYPFsE7MA5mU17ww+YsZhHcA/LgAUXWwWdQjbTbD46D3eALuAleQriu9SqCGrLgFQjALCiDc8DXtPVpK7NtwL7ZIMCfCDqx8+AXOw6DI4ZBbaM6Y9th9hUffc0E+9l4BVyyCekEFWHpuwrWQM4k2AOWwLI0chEzCVI0x4FXxXdUMAXecHYlVzGbIEVL9Cm+U6pgkYahVsSaCVL0Pn0PyH85FnsRrB9AnOdsXhPMh0GNR+OfgvD3Vr2YHIl9+P4etcMmZ/Y9+59uw0+W52jMINYOHoHHIKFxmKBtFN8dmgGJz1FwCvSIYAmsgbeGC2ALfONNM8GVCEucdWKT2ZmukUlqXJU1ngYzIGnZqzR4yr2oKPUV1omt3bKPSWpMy585MOUQIHKjjCkC4QCkzncIHtGYk/XPGPYuWhpgkPt4mXWynIPYpy2H/rLcmTavtRJE9imw7Ju2iOCCvBoObX0wAoqc2QS/RxCdvkN/0VhI8D07AJKMJF1JMfRlKZ9RKFzSa2AXRK9jaVd0nWFLUmPR47PSAHlDsHSC5wyQFyCh2BKsC4MnbQiYPDXKsqQVzu6sZSnSygw3FNsG68TWwS3SlT5qjLtebZ1gCWwarrY4r7aq4WqbAj/Dq20Z3AbHwA3DCGs6MUV0UyfGcotH7y7aNNTnaZJ7UdzB56loep6EXj7Av8GZHX6Ae5ulGPLqD/xHinER1MG6LcUIucCZivA90NVCEiVtH7Kv+Oh3ydqEbvBaSRMlEytY0sQC23xS0sRu3extibA8vAVQZgS7JMIz4I68f6ZbJ+aQ6h8EJ7cfz7+pfoa2r0qq/wR8hFDN5uyPAAMA1I839oJdFXEAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 28, + "height": 28, + "offsetX": -14, + "offsetY": -14, + "clickEvent": "actionScript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yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6s5lchAAACQElEQVR42sxVS2sTURQ+N4nFRwuxaQPFpiBC8AZ0n4KbdtFFs3CZfQLpwnGpFfwBaTdCZpNKsra47biIkIgV4srtDBTERQTJQyeLqDWmHM9kHOeReQRR44EvYb77mHO+85gIAJwnFAm3CBfg39pXwivCLqOfR4QtmK3VNEfezECJCWVCrk5kxbXWu6NkGiA29RrxKqpczMIaQDpW7yJH9IKx75eNfZDdUFHoCMpYAFBNPt2mF2CtCN/czxVUGf3WjTtUJEcGVj7kpVWer3caPQ4PJWHB4CpKM77Rq8LWLrx17pdR5gU4gBRjim3dT12LRZwEKcFz1y3EdimMWOImkQPEnP7ca8D68mbnNcBHv5fMz18MBxVJZFIJpuQdnCC1kvdgHxIZ8cT/ugzUu0d8Y2lypYkYp7/487380O1k6M8WvwSby0xhzMBOXzGUY6zDxmmT+4GKaJGXtlc9ZCyBPUW6vX9298xdKa1zylF40YD+jeAQbIqImcSJGY13VFa4O1FYkbEZH1XZMPVY/jyNloGpqSjl6AJFzaqj4VNJiAXeWKxdQyxHW3ts6NZdUxerXVq9Xdk4ahH2KXXYvc29OmUxK55T7yfmdhjrHwB8MPjB4MvZbymitTD+lJbxvGJLHSmjdUBLEpLOc58Ohe+XWUrRnNDvIDy5c2n1tB02Hb85t7Lk7oxjmgZNRh1U2KPxZqWC2rM8MYWd0xRN69aRBlzbuue/+ugdw+ztWJsZLwlXCVf8i/ev2CmhQXjwQ4ABADqMVHnV8FiXAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 18, + "offsetX": -34, + "offsetY": -18 + } + }, + "video": { + "reserve": { + "spacingLeft": 0, + "spacingTop": 0, + "spacingRight": 0, + "spacingBottom": 0, + "stretched": 1, + "align": "center", + "vAlign": "middle" + }, + "controlBarHideReserve": { + "spacingLeft": 0, + "spacingTop": 0, + "spacingRight": 0, + "spacingBottom": 0, + "stretched": 1, + "align": "center", + "vAlign": "middle" + } + }, + "prompt": { + "height": 25, + "lineHeight": 25, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "bold": "false", + "alpha": 0.8, + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "0x333333", + "radius": 3, + "borderRadius": 3, + "paddingLeft": 15, + "paddingTop": 2, + "paddingRight": 15, + "paddingBottom": 4, + "marginBottom": 5, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "promptSpot": { + "color": "0xFFFFFF", + "alpha": 1, + "width": 6, + "height": 6, + "radius": 6 + }, + "promptSpotH5": { + "width": 6, + "height": 6, + "alpha": 1, + "backgroundColor": "0xFFFFFF", + "vAlign": "top", + "marginY": 4, + "borderRadius": 6 + }, + "previewPrompt": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "lineHeight": 25, + "bold": false, + "alpha": 1, + "backgroundColor": "0x000000", + "backgroundAlpha": 0, + "border": 0, + "borderColor": "0x333333", + "radius": 0, + "paddingLeft": 15, + "paddingTop": 2, + "paddingRight": 15, + "paddingBottom": 8, + "marginBottom": 0, + "textWidth": 150, + "textHeight": 0 + }, + "preview": { + "border": 6, + "borderColor": "0x004eff", + "alpha": 1, + "bottom": 50 + }, + "cktrack": { + "size": 16, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "bold": true, + "alpha": 1, + "leading": 30, + "marginBottom": 50 + }, + "png-1-1": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWF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OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz61AmviAAAAEElEQVR42mL6//8/A0CAAQAJBgMA+A+HZAAAAABJRU5ErkJggg==" +} \ No newline at end of file diff --git a/ckplayer/style.mobile.json b/ckplayer/style.mobile.json new file mode 100644 index 0000000..a5fa916 --- /dev/null +++ b/ckplayer/style.mobile.json @@ -0,0 +1,861 @@ +{ + "background": { + "backgroundColor": "0x000000", + "stretched": 3, + "align": "center", + "vAlign": "middle", + "spacingLeft": 0, + "spacingTop": 0, + "spacingRight": 0, + "spacingBottom": 0 + }, + "controlBar": { + "align": "left", + "vAlign": "bottom", + "width": "100%", + "height": 40, + "offsetX": 0, + "offsetY": -40, + "hideControlBar": { + "hideEnvironment": "all", + "hideDelayTime": "1000", + "hideMode": "alpha", + "hideTweenTime": 0.8, + "showSimpleSchedule": "all", + "simpleSchedule": { + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAABCAIAAACUgoPjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94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AAAAASUVORK5CYII=", + "width": "100%", + "align": "left", + "vAlign": "bottom", + "offsetX": "0", + "offsetY": "-2" + } + }, + "background": { + "backgroundColor": "0x011526", + "backgroundImg": "", + "alpha": 0.8 + }, + "button": { + "play": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjVEOUY1RDc1RUE2ODExRUFBMjU3Qzk5Mzk4NjNFNkY2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjVEOUY1RDc2RUE2ODExRUFBMjU3Qzk5Mzk4NjNFNkY2Ij4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HUBsDqy319O8sUAi+ALElUCHTaFba4YEsAGIS4COu0vX5hYQ/Cci1MqADps+UFUdPk+tAWI9ajmO3BAUwiL2FohrqekwSkLwDRp/GxBb0cJx5IZgNBDPgeqdDHRY76DqkwAddABIqYz26kYdOOrAUQeOOnDUgWAAEGAAwKo+26CmbdkAAAAASUVORK5CYII=", + "width": 40, + "height": 40, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": 0, + "offsetX": 0, + "offsetY": 0, + "clickEvent": "actionScript->videoPlay" + }, + "pause": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbn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fibkqYTELyjtQP7oZZcAOItROqZCcRPgPgeEC8h1YGMo6Nbo7l41IGjDhx14KgDKQIAAQYAyYIjbYMf6kUAAAAASUVORK5CYII=", + "width": 40, + "height": 40, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": 0, + "offsetX": 0, + "offsetY": 0, + "clickEvent": "actionScript->videoPause" + }, + "mute": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjc2QUQwQ0UzRUE2OTExRUFBNzU4RjdBRDMyMkQxNUQxIiB4bXBNTTpEb2N1bWV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cEFDMjFh7WKgdUlhABlD/V2AIrgHin0D2NqBYLBCfGizFTBMQRwMdxgjl7wNiscFUDu4FYmYg1oXy74KS5KBxIDBafwGpl0AsCeV/AlJsg60mARUxf6DpmQ9I/Ro0DgQ6SBSUc4H4JlRIDog5B1MI5gDxO2DUPoHyQbXJ88HkQBsgbkPiBwHxaqqWg0DfM1JQNiYC9T+C6skHpT8gfy/NQxCbo3GogznODkglA3E13epiYh0JdBw7kCoG4nqgnst0bc0Q6UhQsZIMVLt+QNqDhBwJlP8PxG/IMZuFWlmV2Oge7ZOMOnDUgaMOHHXgqAPpCwACDAAr5cn9pIP80AAAAABJRU5ErkJggg==", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -150, + "marginY": 0, + "offsetX": -150, + "offsetY": 0, + "clickEvent": "actionScript->videoMute" + }, + "escMute": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21t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BhY2tldCBlbmQ9InIiPz6gzXV1AAAA+ElEQVR42uyX0Q2CMBCGW+MAuAFuUDeACYyPhCV8dQJf3cQRZATdQDfACc6fpDVNQ6JSKJd4Tb4ATSBf7q7XouqqIgzFlYViPkRQBEVQBEWQ+VjGfkAf3rfkpn55n45pIkicU0xsaxDpJbaLJIXc14skQmYPtmAHWm/egDMowX3ONtOADbiAzJPrnp+f5FIIXkEB1laqsNeHvWfRqENJJ9dy20loSFtKIWi8yJVeJDMOgiZIaxOke3bBTuYW1JyryRXIR+mD2ND1wN54svQtnHzSCPZJs9uLU0iOUYOau+CkktEnau9ErDlHUP7qRFAERVAE/1XwJcAA0FenACPg6tsAAAAASUVORK5CYII=", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -150, + "marginY": 0, + "offsetX": -150, + "offsetY": 0, + "clickEvent": "actionScript->videoEscMute" + }, + "full": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmF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paWQ6QkFBMzJCNzBFQTY4MTFFQThDMDNDRkMwNkZDN0NBQUYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QkFBMzJCNzFFQTY4MTFFQThDMDNDRkMwNkZDN0NBQUYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7YTDS9AAABhElEQVR42uyXu0oDQRSGx1uiENAXEN/BwspOO8FGRIOks/cGJlFLNUbwBnkDtRS1scwLSIg2og+QzkIbNV6yfgfOwrLEQnCZEWbg4wxZ2Hz8w5mZNXPZbMAwrtJpHB9e0At6QS/oBR0f3X/9wo6iGaNcyRQC5QtedX4blMy4NUFGA44hBe/QhC6YgQEYtZog6dxT5mOprlM+4RFaVgVjYmnKNixDAYYg50STICfvLqvcAcmWdblTrnTxHizAIRT1t34XujhD2YzIFUivGT5WrCY4qXJHsBaRk9ELPbabpAazcBGTk7ELJ4kJsnySToM/rrXp1im44dkd9eGHLahOqSe5xJewGpPr0249hWHbZ/EHvLTZ58KGOLd9Fodnayi3A4six/ItuXKbedZaUjnp1hVXrlty+KdJL0+VxPYhT3qtpAR/u8RvMK3zDcS2XLsPZnSzfYJBkqxIorr5yglRQfrapmAVRlQmp/e86NF1ZjVB0pnw3yRe0At6QS/oBf+X4LcAAwBYY9J77BQ29AAAAABJRU5ErkJggg==", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -40, + "marginY": 0, + "offsetX": -40, + "offsetY": 0, + "clickEvent": "actionScript->fullScreen" + }, + "escFull": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek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17WUlNUQkROHBcRS2vjnwEiewRVkXDlu7UuuCHvQofJ+Wxcke4V4b4UVyl5Xo9g/sCJnOnQWDmANuZpupTVdsjpyWZuDI1rj4szF4xFu4FZHruYN/+eR/1XnBb2gF/SC/1vwR4ABAOZRShmnU6I7AAAAAElFTkSuQmCC", + "width": 40, + "height": 40, + "align": "right", + "vAlign": "top", + "marginX": -40, + "marginY": 0, + "offsetX": -40, + "offsetY": 0, + "clickEvent": "actionScript->quitFullScreen" + }, + "backLive": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAbCAYAAADBPvmtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4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c3rxcnVGIXrzW5YlgbIWltjFeRk4khdJ8wPszvZYt7bPN32pcxF5FKpmFttHmwSKmh3XAsu/uTB3uAYbNHEEntOgEinH7uPPpR88VUbOO4nGAWC6cOoVO+1YtA1KiVcLaLMLpYKaGtapI2clrjwIq6ahRpDBYWkBWpekywBKSFmuGdMMp4vFMMHNR5wof5QsXwYSaM8aWyP4eSw9mjTjP7e4YmYz3tneVPM69quFQ2qGyrFqO6UdPFVxUztARiBK2eG5AM++qMiWINIBAlha9SSwloQa7vOc1ofLbiDTVQx8VQXSTFJEcMBe1o9MuI/7emUba98i1W2Qe4F4NTfw/xWUnb+2h+1e2jrhTbC7G6JKEYtkMqpeaMYniH//6cYvodU1i6SKnj/9DrcvuqTFT8W5lsNQalzwvHaImuVyewKRvhBXg0YQC6aryDaVItep+K/x/EL3lT6K4Me/OzgT9Ogg5fEXErzoEMbiWlI86BDA4n5AYEv42kEcIWczNm/7CL359sQ+E1ltoMCeZacUDHgD0ziwB3V28L+5PZiFpHhm14z1141zQX+EWAA7zET48FL/+QAAAAASUVORK5CYII=", + "align": "left", + "vAlign": "top", + "marginX": 110, + "marginY": 0, + "offsetX": 110, + "offsetY": 7, + "clickEvent": "actionScript->backLive" + } + }, + "definition": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 70, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 70, + "height": 28, + "lineHeight":28, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 70, + "height": 28, + "lineHeight":28, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -110, + "marginY": 5, + "offsetX": -110, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -125, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -125, + "offsetY": 45 + }, + "event": "click" + }, + "subtitle": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 60, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 60, + "height": 28, + "lineHeight":28, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 6, + "width": 60, + "height": 28, + "lineHeight":28, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -170, + "marginY": 5, + "offsetX": -170, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -185, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -185, + "offsetY": 45 + }, + "event": "click" + }, + "playbackrate": { + "defaultButton": { + "backgroundColor": "", + "overBackgroundColor": "", + "backgroundAlpha": 1, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0x0078ff", + "bold": false, + "alpha": 1 + }, + "background": { + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 10, + "paddingLeft": 15, + "paddingTop": 10, + "paddingRight": 15, + "paddingBottom": 10, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "button": { + "backgroundColor": "0x333333", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": false, + "alpha": 1 + }, + "buttonHighlight": { + "backgroundColor": "0x005CB2", + "overBackgroundColor": "0x0787FF", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "", + "radius": 3, + "width": 50, + "height": 30, + "lineHeight":30, + "align": "center", + "padding": 0, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "textColor": "0xFFFFFF", + "overTextColor": "0xFFFFFF", + "bold": "false", + "alpha": 1 + }, + "separate": { + "marginLeft": 5, + "marginTop": 5, + "marginRight": 5, + "marginBottom": 5, + "color": "0xFFFFFF", + "alpha": 0, + "height": 1 + }, + "defaultButtonCoor": { + "align": "right", + "vAlign": "top", + "marginX": -90, + "marginY": 5, + "offsetX": 1000, + "offsetY": 5 + }, + "backgroundCoor": { + "align": "right", + "vAlign": "bottom", + "offsetX": -105, + "offsetY": -45, + "height": true + }, + "backgroundCoorH5": { + "align": "right", + "vAlign": "bottom2", + "offsetX": -105, + "offsetY": 45 + }, + "event": "click" + }, + "volumeSchedule": { + "backgroundImg": "data:image/png;base64,iVBOR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yNTI1OTlBRUE2QTExRUFCMDcwOTdFRUNEQkNCOUMyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjAyNTI1OTlCRUE2QTExRUFCMDcwOTdFRUNEQkNCOUMyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDI1MjU5OThFQTZBMTFFQUIwNzA5N0VFQ0RCQ0I5QzIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDI1MjU5OTlFQTZBMTFFQUIwNzA5N0VFQ0RCQ0I5QzIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz49jTFHAAAAVElEQVR42mJkqPjPxsDA0A3EMUAsxDA8wXsgXgzEpSxAoguI8xiGNxCE+vE7IzCG3w7jmEUH75gYRhhggqbtkQLmgPJwGRAzAnEsNK0P50KrFiDAACzSDpFFQRvpAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 60, + "height": 12, + "backgroundHeight": 12, + "marginX": -110, + "marginY": 14, + "offsetX": -110, + "offsetY": 14, + "button": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8x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JEODAyMEUyRTZCNjYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4z4CyEAAAAvElEQVR42mJkqPjPAAWyQBwMxO5AbAwVOwvEO4F4LRA/BgkwQjVYAnE5EPszYAcbgbgTiI+zQE3Gp5gBSS6XBeoMsIAUHwNDmhkDQ6guRHb1ZQaGWacYGJ59gms6wAJ1MxiAFNc7I4yFsRv2wIXcmZA8CDcZGaCJGTMxkAiYoEEHdzM6QBM7ywINZw8QD+RBZGfAPI0EdoLiARSskwkEKywucpmgMdgJFWAgEHGPWaACx0G6QeFMKGkABBgAjZAxHJ8BxLUAAAAASUVORK5CYII=", + "vAlign": "top", + "width": 12, + "height": 12, + "marginX": 0, + "marginY": 0 + } + }, + "timeSchedule": { + "default": { + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAGCAIAAACNcmNmAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4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ASUVORK5CYII=", + "width": "100%", + "height": 6, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": -6, + "offsetX": 0, + "offsetY": -10 + }, + "mouseOut": { + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkZFQkJEREQ3RUE2QjExRUE4N0YxQTMzNzU1ODUzRTQ2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkZFQkJEREQ4RUE2QjExRUE4N0YxQTMzNzU1ODUzRTQ2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0Um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iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjIzQkQxNTY3RUE2QjExRUE4NDZERTIyNjVGODc0MkZBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjIzQkQxNTY4RUE2QjExRUE4NDZERTIyNjVGODc0MkZBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MjNCRDE1NjVFQTZCMTFFQTg0NkRFMjI2NUY4NzQyRkEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MjNCRDE1NjZFQTZCMTFFQTg0NkRFMjI2NUY4NzQyRkEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7hdq0DAAAADklEQVR42mJiqPgPEGAAAfsBeoA9/zQAAAAASUVORK5CYII=", + "width": "100%", + "height": 1, + "align": "left", + "vAlign": "top", + "marginX": 0, + "marginY": -1, + "offsetX": 0, + "offsetY": -1 + }, + "buttonContainer": { + "width": "100%", + "height": 14, + "align": "left", + "vAlign": "bottom", + "offsetX": 0, + "offsetY": -50 + }, + "button": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+ID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BMzc2MTFFNzlEM0Y4MEEwMzFCNEM1REUiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RThGNTI4OEFBMzc2MTFFNzlEM0Y4MEEwMzFCNEM1REUiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RUM3QkM1NjgwMzEyMTFFNjkxQTVFQjEwMjc1NTk0OUUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RUM3QkM1NjkwMzEyMTFFNjkxQTVFQjEwMjc1NTk0OUUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6w77XtAAAA0ElEQVR42mL8//8/AxIwAWIfIHYAYl2o2GUgPgDEW4D4DFwlSCMUpwPx1f+4wVWoGrB6ZE0f/xMGH2GaGYEEyHkLgVgL5IJDD/8yrLzyl2H33b9gF7kqMzOE6zAz2Mkzwxx5DYjjWaB+gmuq2P2b4dzzf3CvzD33h+E8kN/hygDTDFLrwwQNCDAA2YSsCQZAYiA5JODAhBR6cOdhA2hyukwMZAImaDzBAwIXQJO7zASNXDAAhZ6RJKYjQGIgOSRwgOzoIDsBkJ3kGMlN5AABBgAOqhy/RdZztQAAAABJRU5ErkJggg==", + "width": 14, + "height": 14 + }, + "defaultHideTime": "0.3", + "defaultShowTime": "0.3", + "mouseOutHideTime": "0.3", + "mouseOutShowTime": "0.3" + }, + "timeText": { + "vod": { + "text": "[$vodLanguage]", + "align": "left", + "vAlign": "top", + "marginX": 48, + "marginY": 7, + "offsetX": 48, + "offsetY": 7, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 0.8, + "bold": false, + "lineHeight": 25 + }, + "live": { + "text": "[$liveLanguage]", + "align": "left", + "vAlign": "top", + "marginX": 48, + "marginY": 7, + "offsetX": 48, + "offsetY": 7, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 0.8, + "bold": false, + "lineHeight": 25 + } + }, + "custom": { + "button": {}, + "images": { + "playbackrateSeparator": { + "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAmCAYAAAAFvPEHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4QUY5QzVEQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjA4QUY5QzVFQTAzMTExRTdCQjA1QzM3RDE5N0NCNEEyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDhBRjlDNUJBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDhBRjlDNUNBMDMxMTFFN0JCMDVDMzdEMTk3Q0I0QTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5OVecRAAAAFUlEQVR42mJISEg4w8QABEORAAgwAIP7AjcGIX7gAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "marginX": -91, + "marginY": 0, + "offsetX": 1000, + "offsetY": 0, + "width":1, + "height":40 + } + }, + "swf": {} + } + }, + "centerPlay": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bX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UPc8Ggzlrg2jRcI6JeDiutKR5kN4brROgd1Sb8BWaDjaBYSb8o5rLNFo63ab6//aVe9iz18hcbmlxs6C93tWC5q7/g2oIF1/6Sf3/TCec3nfC3PfE33nHHxjv+1k/+5mPu2HzM3/5Ohb8Bo8kNGP0tQE2GvwmtiwRGw98G2aLwN+K2KPyt4C0M/58RWBye/3cY/wkwABTFsKMxq7wRAAAAAElFTkSuQmCC", + "width": 80, + "height": 80, + "align": "center", + "vAlign": "middle", + "offsetX": -40, + "offsetY": -40, + "clickEvent": "actionScript->videoPlay" + }, + "buffer": { + "file": "data:image/swf;base64,Q1dTJA8eAAB4nJVZeTxUbfs/9pAllZm0WbIvKVubJ0siSiHblGZRlBJPpXoYGV5hBlHZJin1UMhajTKZyZync+JJ2Vqk5YfSvgpp8cxvztS55/T+fn+8r4/PxXyd+9z3fd3X9b2+140GGbOwb7IctGLKJAiC3OUl5ur0yRIrBw0d5z/j1ukvgKDlk6qlCO3H81MgNzc3CBJLvrDfxFCE5ANkJ8ZMu+SHHRczEZixk5oIiYEkBhJjpp0rMVypaZeYCKmRvGrd9LVbdWbXHPgkdFEbTX2ttF/u0yK5j+tC1vqFuLZMhaHpaqmjaiz5KWaqDFP2rHbfmaeNagNOvzt3ck6Um+ZrzW2njo2qnsv7qnfJlAWJVbUlK5aXrDlNWVlO8gNykXwWq8aqQZAClPIDlcfQHGUlOQgR+4sreZyj1XbdAJrY+8+VJo5qr+bYOhcoVwp9jZpwEJiMnp9n08vCsTH7b3qCDPv3ZcvbAfahe3yb4EWWzUhFLA3HXnmNzhMZDT40sNqwH8cGJ39UFgWOVWnY/N2LY/dt3hSKUjUTRr0OFeBYh+PzYlHDEt+2VSgYe81qUFf0KMqQ6z22yQU6LMUuT3uohig6Jw4GaByBcLBq/A4TmWG5e3tAWDYLB4sf33yP2NzceizgAhuAWS0oDXEL3HSXIjfQgoPMi0IKEjg7cBfFYoCGg9tR3hMkcubq3ZSAAX0cDP2nWozs93B/TEkYcMFBzx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IAP/3wt3QfimBiTr4GIho0tbGweTeS59SEBgUBCjO28dDq4dNf2KTPHbF8JoIwNxZx4z7ZIod2dMPuf2LqA9tAxUcgXPy2xR8ygVEDFyAuhxk3vUcFFxxXcixm8u1yjKaeMTBwvJ4R0r9eMLWMRp4Jj83Oh0M5lwwRaEvqvPqKCzrXKJS0erqyur6B6yEoVtEt3NRN3octbaRHf8n+tPzHHkdJ/msOSvoP2VuphWNb9qTNEim0U4CxTaL75Gm3xmEfHMWJ+Wp3E/t7YSD5fsV3zPIfHmF4gYBuTrU4//wXzLZxEDBt1g0h1NJW3SJ4YWmrP3sgdVDfyPRhqE6M0Q7vqgeTIOx6IVNtl2nxua0kiMalgY7Zrv6NhPjH6h4Fjq7UA71r9dSqlI0kX6+/8ClbctuA==", + "align": "center", + "vAlign": "middle", + "offsetX": -30, + "offsetY": -30, + "text": { + "align": "center", + "vAlign": "middle", + "offsetX": -30, + "offsetY": -12, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": false, + "width": 60, + "textAlign": "center" + } + }, + "custom": { + "button": "", + "images": "", + "swf": "" + }, + "error": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": false, + "width": 200, + "textAlign": "center", + "align": "center", + "vAlign": "middle", + "marginX": -100, + "marginY": -30, + "offsetX": -100, + "offsetY": 0, + "lineHeight": 30, + "height": 30 + }, + "advertisement": { + "background": { + "backgroundColor": "0x000000", + "alpha": 1, + "width": "100%", + "height": "100%" + }, + "reserve": { + "spacingLeft": 30, + "spacingTop": 0, + "spacingRight": 30, + "spacingBottom": 0, + "align": "center", + "vAlign": "middle" + }, + "countDown": { + "backgroundColor": "", + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ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Zjpkb2N1bWVudElEPSJ4bXAuZGlkOjBiZDU2ZDI2LWRiZWEtYmQ0Zi1hNGY1LWQ0ZjEzMWFkN2QzOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppq1HscAAACESURBVHja7Ng9DkBAGIThsX4S2UKp5hIUOkfgmhI3UGhcwUFWbTZa9a7ITPJu/YTuSwBkbGIdswi7ix1sSfnMbGQFwi9njf8Yhk+P+BtMhN/xNmvwkQkiiCCCCCKIIIIIIoggggjyR4j7gMP5s0TF2siQzUNOVrIaz70i5PyhZmfrLcAAkE4K3cpWYzIAAAAASUVORK5CYII=", + "alpha": 1, + "radius": 0, + "height": 34, + "width": 34, + "align": "right", + "vAlign": "top", + "offsetX": -44, + "offsetY": 10 + }, + "countDownText": { + "size": 16, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xffffff", + "alpha": 1, + "bold": "false", + "width": 25, + "textAlign": "center", + "align": "right", + "vAlign": "top", + "height": 34, + "lineHeight": 34, + "offsetX": -39, + "offsetY": 15, + "marginY": 10 + }, + "muteButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk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n7U4XDo4AD87u7u1e3tbfIeyc/Pp/FE8/Pzl729vT61Wk0lVhFsKshkMhIbITQ2AskOm+N9cltdXX0DYwHT2Nj4HUJ8k/Q8gvTsdrsj7e3tuQ0NDYpEkqIoioS4czgIIRjssBhGbAH4W2KZG41GdmlpKXB+fs6lnCM6nY5uaWlRmkwmBntNHEhJSQnT2tqa63K5IisrK6Guri4NTGlZY2NjPzCf4kAQ5NHR0c3CwkIIQyXZqJi4dnZ2TAhwY2Mj0tTUpJ6YmPD39PT4UtkrLSDYYWFa0+A05nQ6I+CNy1T3SgvIi71gRTMAx90l3J0BQD4hs7pA3uK1JJ2bXxovapwgjl8CDABU9njZZXI40wAAAABJRU5ErkJggg==", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 34, + "offsetX": -85, + "offsetY": 10, + "clickEvent": "actionScript->adMute" + }, + "escMuteButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvY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t1d8fn4uz8vLEwCZ7+Li4j5fXV1ZRkZGpEBQ2q8+AhwhBAIBhYrB/fDwcFZVVdUfLS0toUaj0TY4OKjt7OzU3t7eOjgQFhbGAhXRfD6f9CsQg8HguNn+/r4J2B8M8hTDzdhTU1N6AHOjVqtfXM8HcX3z6TcgIEfzycmJCYxKmp6ezp+bm9P39fXdgZKe/bUwceukpaWlAnDLUJzq09NTU0ZGxuXe3p7J3XV+m5GCggI+SFESGxtLX1xcmMHab0AND1qt1upuYPAbBxLkj8+qqaysDAZ7JktKSlQzMzP3QEaxRCJheTLw2dmZGT+Tk5MDfG56gYGBJDyRPSkpiaNUKmVjY2N3AO7ak4FFIhG1urr6EcrJjo+Pv3x8fLT51H15PB4JvJDhFKempn7BjuspAaOiothQUvn6+vojWL3q1VJC1r1GuMnJyT9BJTwg6Bdv1xko+ePjYwb6jgQewAYEfwbX9X5G0LTwidArGhoaNEFBQZSrT6CVs9lsEhuhxWIh0OywOX6zPGcY+/LycqRUKqULCwv/gxKbvVaNRqOxKhQKY0VFRXBubm6gq0lRFEVC3a24EEIwAMSOZcQWgMec8sWIjo7mLCws3Dtd900cQZWgj8TExNDYa5xAoJ/QZWVlwRsbG8bFxcWHmpoaETS+gIGBAS3yyQkEQUIfMsOC6QFL5belomvs7u7GIMDNzU0jdN2g4eFhXX19veYtY/kERCwWs5qbm0WJiYkB0PKNMBv6t47lE5Df9gWLeQc4HC/hincA5B901g3IWPyPwpc3Px/+qFnDRf//AgwA58gWp0HLAboAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 34, + "offsetX": -85, + "offsetY": 10, + "clickEvent": "actionScript->escAdMute" + }, + "skipAdButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAiCAYAAADI+15nAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2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Dvgj9LF9o1ldKL39LaJOMCi7Mopd5Hjj7ns2atHO9S6TT4sz7dClFxYpRurIDC+eK729NTLfN3QAjPjXYtAY2b152WTEOdeTO8vWT2GqUdqviJFb5Nkhf86Apey2FGZJEJM3a31Rpo9m9GFQ1N30xZ4w7c3gfFIUHrUgMM2Ha/v1xaUdVVhZcWgJOqzsuo60H7kvIGStAOtqsH1hH94/EDYO5Pdp9thne6DZlAmKL5oO24P1566nudIrWKDcWsM/KPJk+CiQWOnotXRULQGFa05/nwF8ZuZ00k0pnXhS4Y+4MU92a606gOwvLHWuzMSSg6iWh2bBcwdwQAk/pudiGZfeYJPuzAYnUODBmFmFE7ehwkYeRHLWchaqrW5TNE55KtKudKsqQ5GYTgA8ayEcLGDh7G3tG6Y+9sI1BQdU4ZpFkN7gyYspq1SeldwxqS11+jCmUG4Devquxe6gJ8JwYl+sTLoNEJnpysWJGJlNWf+LBMy4LBODjiUdxzNu2Ngr2kJq33JDhfhO1zAr7YxUAtuqSBUD2phfpehDclzByCa3gGQYKWcPd49bkq8t/Zrv9xbquOSY1KKWBVjfUBj6F5fU8LqGJhUl0SU68rl9XcZDmUo9PcSyA4TGBiBjEBGICOQgRHICPxXCZxnNKhG8s9FbxgPquGh/w98jbITZRv8otPh/xD0tMiLcvW7AAMA8z53vVF4KjEAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 80, + "height": 34, + "offsetX": -173, + "offsetY": 10, + "clickEvent": "javaScript->adjump" + }, + "skipDelay": { + "backgroundColor": "", + "backgroundImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIsAAAAiCAYAAABvCirZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYW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9ABAeV+DxvFhwxodPZNFGIa4tXtTpov6P3mwytQ0bS4VLx6ise41Wf6X6ipwTfpKHUjM+mtU6l4D1Uc5ZQ/Nbp8bb7HV/VbYpyU5c23Jw7NpYl3glYUNQGoVOnKvWAj+b8Eghj3DpHOw61LeR0Fq7UOnvzDcMW3Kw+qHQdV4qbrJW11OpXiGKpYJUU93dYS0Hx/9yjllGW43+vbftcwfRT8aEBw5kB0WkFqSIFXna0Z5NO+vzthtf94368/Lxhy2pR5lmrLPkUhVmapkghwBspzJOj4a6i4LYrZj/Mj+2dsllHyIry/zrltixZPgiMSycsBDCgK/Hq4dreqftoYBio/L8FcVrj0zc+9gtJ4hEAdKVVzCmHZM4mW+9qt8Ekvn6mIqUpSTmIXy/l/ZaKFLu4SEzTsVAy1MjF0k5NhSZOMrUMrjcb24BA7EQA3qxmOdRzllohaUCSulO3WJuW2na2xbLwpvNnvfmLNI1tuCik67ui6f1Iopyuyp0auwep4JVa9eSqeccij//31qX1zxcpEOenAxLpHmSedFA1C0ftc0AgDlOBi0CyIJAsCCQLAoFkQSBZEEgWROuSZRfDgLCAXfYvNzqoncBYIPbBt4wsbIz+KLXHqT2MMUGo8CcjCrUb/wgwAFGB9yNs4DNMAAAAAElFTkSuQmCC", + "alpha": 1, + "radius": 0, + "height": 34, + "width": 139, + "align": "right", + "vAlign": "top", + "offsetX": -230, + "offsetY": 10 + }, + "skipDelayText": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "alpha": 1, + "bold": "false", + "width": 25, + "height": 34, + "lineHeight": 34, + "textAlign": "right", + "align": "right", + "vAlign": "top", + "offsetX": -222, + "offsetY": 15, + "marginY": 10 + }, + "adLinkButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAAAiCAYAAAAnOTVZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNv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yqeuK1TsiYLvu9HnOEulEQIybrRNZzMdR95X+evQsHF+KrZWFGR9+1E54X+SeLfdZzS9nbn+mtObMZIbt46L+Yfa+TEMEgkhncPGgRCBrFOWVq7eWw58Z8ctu040fpYYyfWQ72wPP0uFURoMdO/dUxOsyNN1hwBUdYvywPmROYs0w49jUuox6mL9ZyIoYlgBj/lZN/aTyfahuj0iINws5zrRLO7c1bT2TNHvQ7vnEwTM7CuVbmipLOvExPwjgO608XZg18sXPwpDofIIXKIXBwih8ghHlKImxyDK2l/aJriHFxpqpC+fKZRQeMkuHyq85/pJw32mOrRLwEGAIpCc5vrKRPzAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "bottom", + "width": 81, + "height": 34, + "offsetX": -90, + "offsetY": -40, + "clickEvent": "actionScript->openAdLink" + }, + "closeButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZW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KPSWpMy585MOUQIHKjjCkC4QCkzncIHtGYk/XPGPYuWhpgkPt4mXWynIPYpy2H/rLcmTavtRJE9imw7Ju2iOCCvBoObX0wAoqc2QS/RxCdvkN/0VhI8D07AJKMJF1JMfRlKZ9RKFzSa2AXRK9jaVd0nWFLUmPR47PSAHlDsHSC5wyQFyCh2BKsC4MnbQiYPDXKsqQVzu6sZSnSygw3FNsG68TWwS3SlT5qjLtebZ1gCWwarrY4r7aq4WqbAj/Dq20Z3AbHwA3DCGs6MUV0UyfGcotH7y7aNNTnaZJ7UdzB56loep6EXj7Av8GZHX6Ae5ulGPLqD/xHinER1MG6LcUIucCZivA90NVCEiVtH7Kv+Oh3ydqEbvBaSRMlEytY0sQC23xS0sRu3extibA8vAVQZgS7JMIz4I68f6ZbJ+aQ6h8EJ7cfz7+pfoa2r0qq/wR8hFDN5uyPAAMA1I839oJdFXEAAAAASUVORK5CYII=", + "align": "right", + "vAlign": "top", + "width": 28, + "height": 28, + "offsetX": -14, + "offsetY": -14, + "clickEvent": "actionScript->closePauseAd" + }, + "closeOtherButton": { + "mouseOut": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAASCAYAAAA+PQxvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6Y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MBOXzGUY6zDxmmT+4GKaJGXtlc9ZCyBPUW6vX9298xdKa1zylF40YD+jeAQbIqImcSJGY13VFa4O1FYkbEZH1XZMPVY/jyNloGpqSjl6AJFzaqj4VNJiAXeWKxdQyxHW3ts6NZdUxerXVq9Xdk4ahH2KXXYvc29OmUxK55T7yfmdhjrHwB8MPjB4MvZbymitTD+lJbxvGJLHSmjdUBLEpLOc58Ohe+XWUrRnNDvIDy5c2n1tB02Hb85t7Lk7oxjmgZNRh1U2KPxZqWC2rM8MYWd0xRN69aRBlzbuue/+ugdw+ztWJsZLwlXCVf8i/ev2CmhQXjwQ4ABADqMVHnV8FiXAAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 34, + "height": 18, + "offsetX": -34, + "offsetY": -18 + } + }, + "video": { + "reserve": { + "spacingLeft": 0, + "spacingTop": 0, + "spacingRight": 0, + "spacingBottom": 0, + "stretched": 1, + "align": "center", + "vAlign": "middle" + }, + "controlBarHideReserve": { + "spacingLeft": 0, + "spacingTop": 0, + "spacingRight": 0, + "spacingBottom": 0, + "stretched": 1, + "align": "center", + "vAlign": "middle" + } + }, + "prompt": { + "height": 25, + "lineHeight": 25, + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "bold": "false", + "alpha": 0.8, + "backgroundColor": "0x333333", + "backgroundAlpha": 0.8, + "border": 0, + "borderColor": "0x333333", + "radius": 3, + "borderRadius": 3, + "paddingLeft": 15, + "paddingTop": 2, + "paddingRight": 15, + "paddingBottom": 4, + "marginBottom": 5, + "triangleWidth": 15, + "triangleHeight": 10, + "triangleBackgroundColor": "0x333333", + "triangleBorder": 0, + "triangleBorderColor": "0xFFFFFF", + "triangleAlpha": 0.8, + "triangleDeviationX": 0, + "triangleDeviationY": 0 + }, + "promptSpot": { + "color": "0xFFFFFF", + "alpha": 1, + "width": 6, + "height": 6, + "radius": 6 + }, + "promptSpotH5": { + "width": 6, + "height": 6, + "alpha": 1, + "backgroundColor": "0xFFFFFF", + "vAlign": "top", + "marginY": 4, + "borderRadius": 6 + }, + "previewPrompt": { + "size": 14, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "lineHeight": 25, + "bold": false, + "alpha": 1, + "backgroundColor": "0x000000", + "backgroundAlpha": 0, + "border": 0, + "borderColor": "0x333333", + "radius": 0, + "paddingLeft": 15, + "paddingTop": 2, + "paddingRight": 15, + "paddingBottom": 8, + "marginBottom": 0, + "textWidth": 150, + "textHeight": 0 + }, + "preview": { + "border": 6, + "borderColor": "0x004eff", + "alpha": 1, + "bottom": 50 + }, + "cktrack": { + "size": 16, + "font": "Microsoft YaHei;\u5fae\u8f6f\u96c5\u9ed1", + "color": "0xFFFFFF", + "bold": true, + "alpha": 1, + "leading": 30, + "marginBottom": 50 + }, + "png-1-1": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkUwREE1RkRCRDZDOTExRUFCOTY4RDQwNjQzMDUyQzUyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkUwREE1RkRDRDZDOTExRUFCOTY4RDQwNjQzMDUyQzUyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RTBEQTVGRDlENkM5MTFFQUI5NjhENDA2NDMwNTJDNTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RTBEQTVGREFENkM5MTFFQUI5NjhENDA2NDMwNTJDNTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz61AmviAAAAEElEQVR42mL6//8/A0CAAQAJBgMA+A+HZAAAAABJRU5ErkJggg==" +} \ No newline at end of file diff --git a/crossdomain.xml b/crossdomain.xml new file mode 100644 index 0000000..c6a5430 --- /dev/null +++ b/crossdomain.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..0c4802f --- /dev/null +++ b/index.html @@ -0,0 +1,60 @@ + + + + + + ckplayer + + + + + + +
+
+ + +

欢迎使用ckplayer,当前版本:X2,官网,帮助手册

+

全功能演示

+

使用框架播放演示

+

仅flashplayer播放演示

+

仅H5播放演示

+

RTMP播放示例

+

在各平台统一播放器风格

+

弹幕演示

+

单独配置广告,支持角标广告和片头贴片,中插,结束广告,暂停广告

+

更多演示

+ + + \ No newline at end of file diff --git a/material/en.srt b/material/en.srt new file mode 100644 index 0000000..e2efdff --- /dev/null +++ b/material/en.srt @@ -0,0 +1,16 @@ +1 +00:00:01,210 --> 00:00:10,400 += subtitle effect = - +Support multiple rows + +2 +00:00:11,210 --> 00:00:30,400 +Encoding requires UTF-8 + +3 +00:00:31,210 --> 00:01:00,400 +The format is .Srt or .vtt. + +4 +00:01:01,210 --> 00:01:55,400 +Thank you for your support for ckplayer diff --git a/material/logo.png b/material/logo.png new file mode 100644 index 0000000..42986c6 Binary files /dev/null and b/material/logo.png differ diff --git a/material/mydream_en1800_1010_01.png b/material/mydream_en1800_1010_01.png new file mode 100644 index 0000000..40d677e Binary files /dev/null and b/material/mydream_en1800_1010_01.png differ diff --git a/material/mydream_en1800_1010_02.png b/material/mydream_en1800_1010_02.png new file mode 100644 index 0000000..a35bce9 Binary files /dev/null and b/material/mydream_en1800_1010_02.png differ diff --git a/material/poster.jpg b/material/poster.jpg new file mode 100644 index 0000000..624aece Binary files /dev/null and b/material/poster.jpg differ diff --git a/material/zh.vtt b/material/zh.vtt new file mode 100644 index 0000000..758bf09 --- /dev/null +++ b/material/zh.vtt @@ -0,0 +1,18 @@ +WEBVTT + +1 +00:00:01.210 --> 00:00:10.400 +-=字幕效果=- +支持多行 + +2 +00:00:11.210 --> 00:00:30.400 +编码需要使用UTF-8 + +3 +00:00:31.210 --> 00:01:00.400 +格式是.srt或.vtt + +4 +00:01:01.210 --> 00:01:55.400 +感谢您对ckplayer的支持 diff --git a/sample/ad.json b/sample/ad.json new file mode 100644 index 0000000..6c6c487 --- /dev/null +++ b/sample/ad.json @@ -0,0 +1,118 @@ +{ + "front": [ + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/front01.mp4", + "type": "mp4", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + }, + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/front02.mp4", + "type": "mp4", + "link": "", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + } + ], + "pause": [ + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/pause01.jpg", + "type": "jpg", + "link": "", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + }, + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/pause02.jpg", + "type": "jpg", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + } + ], + "insert": [ + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/insert01.mp4", + "type": "mp4", + "link": "", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + }, + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/insert02.mp4", + "type": "swf", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + } + ], + "inserttime": "10,40", + "end": [ + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/end01.mp4", + "type": "mp4", + "link": "", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + }, + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/end02.mp4", + "type": "mp4", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "time": 5, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php" + } + ], + "other": [ + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/other-485-60.jpg", + "type": "gif", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "startTime": 3, + "time": 8, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php", + "align": "center", + "vAlign": "bottom", + "offsetX": -243, + "offsetY": -110, + "about": "这是一个gif广告(宽400,高60),当播放器播放startTime=3秒时显示,time=10秒后结束,水平中间对齐align=center,并且在水平轴上向左边偏移200像素,垂直方向是底部对齐并且向上偏移110个像素" + }, + { + "file": "http://ckplayer-video-sample.oss-cn-shanghai.aliyuncs.com/sample-ad/other-120-120.gif", + "type": "gif", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "startTime": 6, + "time": 8, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php", + "align": "right", + "vAlign": "top", + "offsetX": -130, + "offsetY": 10, + "about": "这是一个gif广告(宽400,高60),当播放器播放startTime=3秒时显示,time=10秒后结束,水平中间对齐align=center,并且在水平轴上向左边偏移200像素,垂直方向是底部对齐并且向上偏移110个像素" + }, + { + "file": "adv.swf", + "type": "swf", + "link":"https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hiawluh", + "startTime": 3, + "time": 10, + "exhibitionMonitor": "exhibitionMonitor.php", + "clickMonitor": "clickMonitor.php", + "align": "right", + "vAlign": "right", + "offsetX": -60, + "offsetY": -60 + } + ] +} \ No newline at end of file diff --git a/sample/adother.html b/sample/adother.html new file mode 100644 index 0000000..56f1267 --- /dev/null +++ b/sample/adother.html @@ -0,0 +1,33 @@ + + + + + + ckplayer + + + + + + +
+ + +

本页观看需要在支持h5环境的浏览器上,视频格式需要是h5支持的mp4

+ + + \ No newline at end of file diff --git a/sample/dm.html b/sample/dm.html new file mode 100644 index 0000000..69c1d84 --- /dev/null +++ b/sample/dm.html @@ -0,0 +1,145 @@ + + + + + + ckplayer + + + + + + +
+ +

+ + + +

+ + + \ No newline at end of file diff --git a/sample/flashplayer.html b/sample/flashplayer.html new file mode 100644 index 0000000..2e16074 --- /dev/null +++ b/sample/flashplayer.html @@ -0,0 +1,32 @@ + + + + + + ckplayer + + + + + + +
+ + + + + \ No newline at end of file diff --git a/sample/h5.html b/sample/h5.html new file mode 100644 index 0000000..506cba3 --- /dev/null +++ b/sample/h5.html @@ -0,0 +1,32 @@ + + + + + + ckplayer + + + + + + +
+ + +

本页观看需要在支持h5环境的浏览器上,视频格式需要是h5支持的mp4

+ + + \ No newline at end of file diff --git a/sample/iframe.html b/sample/iframe.html new file mode 100644 index 0000000..7bc508e --- /dev/null +++ b/sample/iframe.html @@ -0,0 +1,15 @@ + + + + + + ckplayer + + + + + + + + + \ No newline at end of file diff --git a/sample/index.html b/sample/index.html new file mode 100644 index 0000000..e884acf --- /dev/null +++ b/sample/index.html @@ -0,0 +1,599 @@ + + + + + + ckplayer + + + + + + +
+ +

+ 官网:http://www.ckplayer.com,版本号:X

+

以下仅列出部分功能,全部功能请至官网 + 《手册》查看

+

+ + + + + + + + + + + +

+

+ + + +

+

+ + + +

+

+ + +

+

+ + + + + + + + + +

+

+ + + +

+

+ + + + + +

+

+ + + +

+

+ + + + + + +

+

+ + + +

+

+ + + + + + + + +

+

+ + + +

+

+ + + + +

+

+ +

单独监听功能:

+

+
+ 播放状态:
+ 跳转状态:无
+ 缓冲:100
+ 加载速率:0
+ 当前音量:0.8
+ 是否全屏:否
+ 控制栏:显示
+ 还未结束
+ 当前播放时间(秒):0
+ 前置广告状态:
+ 鼠标位置
+ 切换清晰度:
+ 点击监听:
+ 监听截图功能(截图功能需要视频权限) + +

+ + + \ No newline at end of file diff --git a/sample/ios.html b/sample/ios.html new file mode 100644 index 0000000..d8f8b51 --- /dev/null +++ b/sample/ios.html @@ -0,0 +1,37 @@ + + + + + + ckplayer + + + + + + +
+ +
+ + +

本页观看需要在支持h5环境的浏览器上,视频格式需要是h5支持的mp4

+ + + \ No newline at end of file diff --git a/sample/rtmp.html b/sample/rtmp.html new file mode 100644 index 0000000..3f4572a --- /dev/null +++ b/sample/rtmp.html @@ -0,0 +1,27 @@ + + + + + + ckplayer + + + + + + +
+ + + + + \ No newline at end of file diff --git a/sample/vue.html b/sample/vue.html new file mode 100644 index 0000000..5e10782 --- /dev/null +++ b/sample/vue.html @@ -0,0 +1,70 @@ + + + + + + ckplayer + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/source/ckaction/C/C.as b/source/ckaction/C/C.as new file mode 100644 index 0000000..de60858 --- /dev/null +++ b/source/ckaction/C/C.as @@ -0,0 +1,168 @@ +package ckaction.C { + public final + class C extends Object { + public static var VERSION: String = "20180215190700"; + public static var CONFIG: Object = { + config: { + schedule: 1, + autoLoad: false, + timeFrequency: 100, + loadNext: 0, + smartRemove: false, + definition: false, + subtitle:false, + bufferTime: 100, + rtmpBufferTime:0, + bufferTimeMax:0, + doubleClick: false, + click: false, + doubleClickInterval: 200, + fullInteractive: false, + delay: 100, + keyDown: { + space: false, + left: false, + right: false, + up: false, + down: false + }, + timeJump: 10, + volumeJump: 0.1, + timeScheduleAdjust: 1, + previewDefaultLoad: false, + promptSpotTime: false, + buttonMode: { + player: false, + controlBar: false, + timeSchedule: false, + volumeSchedule: false + }, + liveAndVod: { + open: false, + vodTime: 1, + start: "start" + }, + timeStamp: "", + time: 0, + crossdomain: "", + playCorrect: false, + timeCorrect:false, + m3u8Definition: { + tags: [] + }, + m3u8MaxBufferLength: 60, + usehardwareeecoder:false,//是否采用硬件加速 + errorNum: 0, + split:",", + addCallback: "adPlay,adPause,playOrPause,videoPlay,videoPause,videoMute,videoEscMute,videoClear,changeVolume,fastBack,fastNext,videoSeek,newVideo,getMetaDate,videoRotation,videoBrightness,videoContrast,videoSaturation,videoHue,videoZoom,videoProportion,videoError,addListener,removeListener,addElement,getElement,deleteElement,animate,animateResume,animatePause,changeConfig,getConfig,openUrl,fullScreen,quitFullScreen,switchFull,screenshot,custom" + }, + menu: { + codes: "", + name: "ckplayer", + link: "http://www.ckplayer.com", + domain: "", + version: "" + }, + language: { + m3u8Definition: { + name: [] + }, + error: { + cannotFindUrl: "", + streamNotFound: "", + formatError: "" + } + }, + style: { + advertisement: { + linkButtonShow: false, + closeButtonShow: false, + frontSkipButtonDelay: 0, + videoVolume: 0.8, + pauseStretched: 2, + time: 5, + muteButtonShow: false, + endStretched: 2, + frontStretched: 2, + endSkipButtonDelay: 0, + videoForce: false, + insertSkipButtonDelay: 0, + insertStretched: 0, + method: "get", + skipButtonShow: false, + closeOtherButtonShow: false, + reserve: { + spacingLeft: 0, + spacingTop: 0, + spacingRight: 0, + spacingBottom: 0, + stretched: 1, + align: "center", + vAlign: "middle" + } + }, + video: { + defaultWidth: 4, + defaultHeight: 3, + reserve: { + spacingLeft: 0, + spacingTop: 0, + spacingRight: 0, + spacingBottom: 0, + stretched: 1, + align: "center", + vAlign: "middle" + }, + controlBarHideReserve: { + spacingLeft: 0, + spacingTop: 0, + spacingRight: 0, + spacingBottom: 0, + stretched: 1, + align: "center", + vAlign: "middle" + } + } + }, + flashvars: { + playerID:"", + variable: "", + autoplay: false, + loop: false, + live: false, + volume: 0.8, + inserttime: "", + rotation: 0, //默认旋转的角度 + loaded: "", + poster: "", + drag: "", + debug: false, + crossdomain: "", + cktrack: null, + cktrackdelay:0, + config: "", + definition: "", + weight: "", + type: "", + video: "", + promptSpot:null, + previewscale:0, + preview:"", + cannotFindUrl:"", + streamNotFound:"", + formatError:"", + securetoken:"", + fcsubscribe:false, + username:"", + password:"", + userid:0, + duration:0, + forceduration:0, + unescape:false + } + }; + public static var CEKEY: String = ""; + public static var CVKEY: String = ""; + public static var PATH: Object = {}; + } +} \ No newline at end of file diff --git a/source/ckaction/act/IntUtil.as b/source/ckaction/act/IntUtil.as new file mode 100644 index 0000000..2c5af44 --- /dev/null +++ b/source/ckaction/act/IntUtil.as @@ -0,0 +1,68 @@ +package ckaction.act { + + import flash.utils.Endian; + + /** + * Contains reusable methods for operations pertaining + * to int values. + */ + public class IntUtil { + + /** + * Rotates x left n bits + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function rol ( x:int, n:int ):int { + return ( x << n ) | ( x >>> ( 32 - n ) ); + } + + /** + * Rotates x right n bits + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function ror ( x:int, n:int ):uint { + var nn:int = 32 - n; + return ( x << nn ) | ( x >>> ( 32 - nn ) ); + } + + /** String for quick lookup of a hex character based on index */ + private static var hexChars:String = "0123456789abcdef"; + + /** + * Outputs the hex value of a int, allowing the developer to specify + * the endinaness in the process. Hex output is lowercase. + * + * @param n The int value to output as hex + * @param bigEndian Flag to output the int as big or little endian + * @return A string of length 8 corresponding to the + * hex representation of n ( minus the leading "0x" ) + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function toHex( n:int, bigEndian:Boolean = false ):String { + var s:String = ""; + + if ( bigEndian ) { + for ( var i:int = 0; i < 4; i++ ) { + s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF ) + + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF ); + } + } else { + for ( var x:int = 0; x < 4; x++ ) { + s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF ) + + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF ); + } + } + + return s; + } + } + +} diff --git a/source/ckaction/act/MD5.as b/source/ckaction/act/MD5.as new file mode 100644 index 0000000..57dc1e1 --- /dev/null +++ b/source/ckaction/act/MD5.as @@ -0,0 +1,274 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package ckaction.act { + + import ckaction.act.IntUtil; + import flash.utils.ByteArray; + /** + * The MD5 Message-Digest Algorithm + * + * Implementation based on algorithm description at + * http://www.faqs.org/rfcs/rfc1321.html + */ + public class MD5 { + + /** + * Performs the MD5 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion Flash 8.5 + * @tiptext + */ + + public static function hash(s:String) :String{ + //Convert to byteArray and send through hashBinary function + // so as to only have complex code in one location + var ba:ByteArray = new ByteArray(); + ba.writeUTFBytes(s); + return hashBinary(ba); + } + /** + * Performs the MD5 hash algorithm on a ByteArray. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion Flash 8.5 + * @tiptext + */ + public static function hashBinary( s:ByteArray ):String { + // initialize the md buffers + var a:int = 1732584193; + var b:int = -271733879; + var c:int = -1732584194; + var d:int = 271733878; + + // variables to store previous values + var aa:int; + var bb:int; + var cc:int; + var dd:int; + + // create the blocks from the string and + // save the length as a local var to reduce + // lookup in the loop below + var x:Array = createBlocks( s ); + var len:int = x.length; + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16) { + // save previous values + aa = a; + bb = b; + cc = c; + dd = d; + + // Round 1 + a = ff( a, b, c, d, x[int(i+ 0)], 7, -680876936 ); // 1 + d = ff( d, a, b, c, x[int(i+ 1)], 12, -389564586 ); // 2 + c = ff( c, d, a, b, x[int(i+ 2)], 17, 606105819 ); // 3 + b = ff( b, c, d, a, x[int(i+ 3)], 22, -1044525330 ); // 4 + a = ff( a, b, c, d, x[int(i+ 4)], 7, -176418897 ); // 5 + d = ff( d, a, b, c, x[int(i+ 5)], 12, 1200080426 ); // 6 + c = ff( c, d, a, b, x[int(i+ 6)], 17, -1473231341 ); // 7 + b = ff( b, c, d, a, x[int(i+ 7)], 22, -45705983 ); // 8 + a = ff( a, b, c, d, x[int(i+ 8)], 7, 1770035416 ); // 9 + d = ff( d, a, b, c, x[int(i+ 9)], 12, -1958414417 ); // 10 + c = ff( c, d, a, b, x[int(i+10)], 17, -42063 ); // 11 + b = ff( b, c, d, a, x[int(i+11)], 22, -1990404162 ); // 12 + a = ff( a, b, c, d, x[int(i+12)], 7, 1804603682 ); // 13 + d = ff( d, a, b, c, x[int(i+13)], 12, -40341101 ); // 14 + c = ff( c, d, a, b, x[int(i+14)], 17, -1502002290 ); // 15 + b = ff( b, c, d, a, x[int(i+15)], 22, 1236535329 ); // 16 + + // Round 2 + a = gg( a, b, c, d, x[int(i+ 1)], 5, -165796510 ); // 17 + d = gg( d, a, b, c, x[int(i+ 6)], 9, -1069501632 ); // 18 + c = gg( c, d, a, b, x[int(i+11)], 14, 643717713 ); // 19 + b = gg( b, c, d, a, x[int(i+ 0)], 20, -373897302 ); // 20 + a = gg( a, b, c, d, x[int(i+ 5)], 5, -701558691 ); // 21 + d = gg( d, a, b, c, x[int(i+10)], 9, 38016083 ); // 22 + c = gg( c, d, a, b, x[int(i+15)], 14, -660478335 ); // 23 + b = gg( b, c, d, a, x[int(i+ 4)], 20, -405537848 ); // 24 + a = gg( a, b, c, d, x[int(i+ 9)], 5, 568446438 ); // 25 + d = gg( d, a, b, c, x[int(i+14)], 9, -1019803690 ); // 26 + c = gg( c, d, a, b, x[int(i+ 3)], 14, -187363961 ); // 27 + b = gg( b, c, d, a, x[int(i+ 8)], 20, 1163531501 ); // 28 + a = gg( a, b, c, d, x[int(i+13)], 5, -1444681467 ); // 29 + d = gg( d, a, b, c, x[int(i+ 2)], 9, -51403784 ); // 30 + c = gg( c, d, a, b, x[int(i+ 7)], 14, 1735328473 ); // 31 + b = gg( b, c, d, a, x[int(i+12)], 20, -1926607734 ); // 32 + + // Round 3 + a = hh( a, b, c, d, x[int(i+ 5)], 4, -378558 ); // 33 + d = hh( d, a, b, c, x[int(i+ 8)], 11, -2022574463 ); // 34 + c = hh( c, d, a, b, x[int(i+11)], 16, 1839030562 ); // 35 + b = hh( b, c, d, a, x[int(i+14)], 23, -35309556 ); // 36 + a = hh( a, b, c, d, x[int(i+ 1)], 4, -1530992060 ); // 37 + d = hh( d, a, b, c, x[int(i+ 4)], 11, 1272893353 ); // 38 + c = hh( c, d, a, b, x[int(i+ 7)], 16, -155497632 ); // 39 + b = hh( b, c, d, a, x[int(i+10)], 23, -1094730640 ); // 40 + a = hh( a, b, c, d, x[int(i+13)], 4, 681279174 ); // 41 + d = hh( d, a, b, c, x[int(i+ 0)], 11, -358537222 ); // 42 + c = hh( c, d, a, b, x[int(i+ 3)], 16, -722521979 ); // 43 + b = hh( b, c, d, a, x[int(i+ 6)], 23, 76029189 ); // 44 + a = hh( a, b, c, d, x[int(i+ 9)], 4, -640364487 ); // 45 + d = hh( d, a, b, c, x[int(i+12)], 11, -421815835 ); // 46 + c = hh( c, d, a, b, x[int(i+15)], 16, 530742520 ); // 47 + b = hh( b, c, d, a, x[int(i+ 2)], 23, -995338651 ); // 48 + + // Round 4 + a = ii( a, b, c, d, x[int(i+ 0)], 6, -198630844 ); // 49 + d = ii( d, a, b, c, x[int(i+ 7)], 10, 1126891415 ); // 50 + c = ii( c, d, a, b, x[int(i+14)], 15, -1416354905 ); // 51 + b = ii( b, c, d, a, x[int(i+ 5)], 21, -57434055 ); // 52 + a = ii( a, b, c, d, x[int(i+12)], 6, 1700485571 ); // 53 + d = ii( d, a, b, c, x[int(i+ 3)], 10, -1894986606 ); // 54 + c = ii( c, d, a, b, x[int(i+10)], 15, -1051523 ); // 55 + b = ii( b, c, d, a, x[int(i+ 1)], 21, -2054922799 ); // 56 + a = ii( a, b, c, d, x[int(i+ 8)], 6, 1873313359 ); // 57 + d = ii( d, a, b, c, x[int(i+15)], 10, -30611744 ); // 58 + c = ii( c, d, a, b, x[int(i+ 6)], 15, -1560198380 ); // 59 + b = ii( b, c, d, a, x[int(i+13)], 21, 1309151649 ); // 60 + a = ii( a, b, c, d, x[int(i+ 4)], 6, -145523070 ); // 61 + d = ii( d, a, b, c, x[int(i+11)], 10, -1120210379 ); // 62 + c = ii( c, d, a, b, x[int(i+ 2)], 15, 718787259 ); // 63 + b = ii( b, c, d, a, x[int(i+ 9)], 21, -343485551 ); // 64 + + a += aa; + b += bb; + c += cc; + d += dd; + } + + // Finish up by concatening the buffers with their hex output + return IntUtil.toHex( a ) + IntUtil.toHex( b ) + IntUtil.toHex( c ) + IntUtil.toHex( d ); + } + + /** + * Auxiliary function f as defined in RFC + */ + private static function f( x:int, y:int, z:int ):int { + return ( x & y ) | ( (~x) & z ); + } + + /** + * Auxiliary function g as defined in RFC + */ + private static function g( x:int, y:int, z:int ):int { + return ( x & z ) | ( y & (~z) ); + } + + /** + * Auxiliary function h as defined in RFC + */ + private static function h( x:int, y:int, z:int ):int { + return x ^ y ^ z; + } + + /** + * Auxiliary function i as defined in RFC + */ + private static function i( x:int, y:int, z:int ):int { + return y ^ ( x | (~z) ); + } + + /** + * A generic transformation function. The logic of ff, gg, hh, and + * ii are all the same, minus the function used, so pull that logic + * out and simplify the method bodies for the transoformation functions. + */ + private static function transform( func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int { + var tmp:int = a + int( func( b, c, d ) ) + x + t; + return IntUtil.rol( tmp, s ) + b; + } + + /** + * ff transformation function + */ + private static function ff ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( f, a, b, c, d, x, s, t ); + } + + /** + * gg transformation function + */ + private static function gg ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( g, a, b, c, d, x, s, t ); + } + + /** + * hh transformation function + */ + private static function hh ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( h, a, b, c, d, x, s, t ); + } + + /** + * ii transformation function + */ + private static function ii ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int { + return transform( i, a, b, c, d, x, s, t ); + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was + * split into. + */ + private static function createBlocks( s:ByteArray ):Array { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ int(i >> 5) ] |= ( s[ i / 8 ] & mask ) << ( i % 32 ); + } + + // append padding and length + blocks[ int(len >> 5) ] |= 0x80 << ( len % 32 ); + blocks[ int(( ( ( len + 64 ) >>> 9 ) << 4 ) + 14) ] = len; + return blocks; + } + + } +} + diff --git a/source/ckaction/act/TEA.as b/source/ckaction/act/TEA.as new file mode 100644 index 0000000..65081be --- /dev/null +++ b/source/ckaction/act/TEA.as @@ -0,0 +1,166 @@ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Licensed under a Creative Creative Commons Attribution 3.0 Unported License */ +/* without any warranty express or implied */ +/* http://creativecommons.org/licenses/by/3.0/ */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Block TEA (xxtea) Tiny Encryption Algorithm implementation in ActionScript */ +/* (c) Wowza Media Systems, Inc 2010: www.wowzamedia.com */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Block TEA (xxtea) Tiny Encryption Algorithm implementation in JavaScript */ +/* (c) Chris Veness 2002-2010: www.movable-type.co.uk/tea-block.html */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Algorithm: David Wheeler & Roger Needham, Cambridge University Computer Lab */ +/* http://www.cl.cam.ac.uk/ftp/papers/djw-rmn/djw-rmn-tea.html (1994) */ +/* http://www.cl.cam.ac.uk/ftp/users/djw3/xtea.ps (1997) */ +/* http://www.cl.cam.ac.uk/ftp/users/djw3/xxtea.ps (1998) */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +package ckaction.act { + +public class TEA { + + /* + * encrypt text using Corrected Block TEA (xxtea) algorithm + * + * @param {string} plaintext String to be encrypted (multi-byte safe) + * @param {string} password Password to be used for encryption (1st 16 chars) + * @returns {string} encrypted text + */ + public static function encrypt(plaintext:String, password:String):String { + if (plaintext.length == 0) return ""; // nothing to encrypt + + // convert string to array of longs after converting any multi-byte chars to UTF-8 + var v:Array = charsToLongs(strToChars(plaintext)); + if (v.length <= 1) v[1] = 0; // algorithm doesn't work for n<2 so fudge by adding a null + // simply convert first 16 chars of password as key + var k:Array = charsToLongs(strToChars(password.substr(0, 16))); + var n:Number = v.length; + + // ---- ---- + + var z:Number = v[n-1], y:Number = v[0], delta:Number = 0x9E3779B9; + var mx:Number, e:Number, q:Number = Math.floor(6 + 52/n), sum:Number = 0; + + while (q-- > 0) { // 6 + 52/n operations gives between 6 & 32 mixes on each word + sum += delta; + e = sum>>>2 & 3; + for (var p:Number = 0; p < n; p++) { + y = v[(p+1)%n]; + mx = (z>>>5 ^ y<<2) + (y>>>3 ^ z<<4) ^ (sum^y) + (k[p&3 ^ e] ^ z); + z = v[p] += mx; + } + } + + // ---- ---- + + var ciphertext:Array = longsToChars(v); + + return charsToHex(ciphertext); + } + + /* + * decrypt text using Corrected Block TEA (xxtea) algorithm + * + * @param {string} ciphertext String to be decrypted + * @param {string} password Password to be used for decryption (1st 16 chars) + * @returns {string} decrypted text + */ + public static function decrypt(ciphertext:String, password:String):String { + + if (ciphertext.length == 0) return ""; + var v:Array = charsToLongs(hexToChars(ciphertext)); + var k:Array = charsToLongs(strToChars(password.substr(0, 16))); + var n:Number = v.length; + + // ---- ---- + + var z:Number = v[n-1], y:Number = v[0], delta:Number = 0x9E3779B9; + var mx:Number, e:Number, q:Number = Math.floor(6 + 52/n), sum:Number = q*delta; + + while (sum != 0) { + e = sum>>>2 & 3; + for (var p:Number = n-1; p >= 0; p--) { + z = v[p>0 ? p-1 : n-1]; + mx = (z>>>5 ^ y<<2) + (y>>>3 ^ z<<4) ^ (sum^y) + (k[p&3 ^ e] ^ z); + y = v[p] -= mx; + } + sum -= delta; + } + + // ---- ---- + + var plaintext:Array = longsToChars(v); + + return charsToStr(plaintext); + } + + /** + * Private methods. + */ + private static function charsToLongs(chars:Array):Array { + var temp:Array = new Array(Math.ceil(chars.length/4)); + for (var i:Number = 0; i>>8 & 0xFF, longs[i]>>>16 & 0xFF, longs[i]>>>24 & 0xFF); + } + return codes; + } + + private static function longToChars(longs:Number):Array { + var codes:Array = new Array(); + codes.push(longs & 0xFF, longs>>>8 & 0xFF, longs>>>16 & 0xFF, longs>>>24 & 0xFF); + return codes; + } + + private static function charsToHex(chars:Array):String { + var result:String = new String(""); + var hexes:Array = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"); + for (var i:Number = 0; i> 4] + hexes[chars[i] & 0xf]; + } + return result; + } + + private static function hexToChars(hex:String):Array { + var codes:Array = new Array(); + for (var i:Number = (hex.substr(0, 2) == "0x") ? 2 : 0; i 0) { + value = { + _content: childNode.children()[0].toString() + }; + var numOfAttributes: int = childNode.attributes().length(); + for (var j: int = 0; j < numOfAttributes; j++) { + value[childNode.attributes()[j].name().toString()] = childNode.attributes()[j]; + } + } else { + value = childNode.children()[0].toString(); + } + } else { + value = parse(childNode); + } + if (obj[childNodeName]) { + if (getTypeof(obj[childNodeName]) == "array") { + obj[childNodeName].push(value); + } else { + obj[childNodeName] = [obj[childNodeName], value]; + } + } else if (isArray(childNodeName)) { + obj[childNodeName] = [value]; + } else { + obj[childNodeName] = value; + } + } + numOfAttributes = node.attributes().length(); + for (i = 0; i < numOfAttributes; i++) { + obj[node.attributes()[i].name().toString()] = node.attributes()[i]; + } + if (numOfChilds == 0) { + if (numOfAttributes == 0) { + obj = ""; + } else { + obj._content = ""; + } + } + return obj; + } + public static function get arrays(): Array { + if (!_arrays) { + _arrays = []; + } + return _arrays; + } + public static function set arrays(a: Array): void { + _arrays = a; + } + private static function isArray(nodeName: String): Boolean { + var numOfArrays: int = _arrays ? _arrays.length : 0; + for (var i: int = 0; i < numOfArrays; i++) { + if (nodeName == _arrays[i]) { + return true; + } + } + return false; + } + private static function getTypeof(o: * ): String { + if (typeof (o) == "object") { + if (o.length == null) { + return "object"; + } else if (typeof (o.length) == "number") { + return "array"; + } else { + return "object"; + } + } else { + return typeof (o); + } + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/act/des.as b/source/ckaction/act/des.as new file mode 100644 index 0000000..2ae1f0c --- /dev/null +++ b/source/ckaction/act/des.as @@ -0,0 +1,121 @@ +package ckaction.act { + import ckaction.C.C; + import com.hurlant.crypto.symmetric.DESKey; + import com.hurlant.crypto.symmetric.ECBMode; + import com.hurlant.util.Base64; + import flash.utils.ByteArray; + import flash.events.ErrorEvent; + import flash.display.BitmapData; + import flash.geom.Rectangle; + + public class des { + public function des() { + + } + public static function getString(s: String): String { + // constructor code + var codes: String = C.CEKEY; + var codes2: String = "ckplayerDesKey"; + var de: String = s; + var type: String = s.substr(0, 3); + s = decodeURI(s); + s=script.replace(s,[" "],["+"]); + if (type == "CE:" || type == "CK:") { + if (type == "CE:") { + s = s.replace("CE:", ""); + } else { + s = s.replace("CK:", ""); + } + try { + var b64: ByteArray = Base64.decodeToByteArray(s); + if (type == "CE:") { + //trace("codes",codes); + de = decrypt(codes, b64); + } else { + de = decrypt(codes2, b64); + } + } catch (event: ErrorEvent) { + return ""; + } + } + if (de.indexOf("base64,") > -1) { + de = de.split("base64,")[1] + } + return de.split("\n").join("").split("\r").join("").split("\n\r").join("").split("\r\n").join(""); + } + + public static function getByteArray(s: String): ByteArray { + // constructor code + var codes: String = C.CEKEY; + var codes2: String = "ckplayerDesKey"; + var de: String = s; + s = decodeURI(s).split("\n").join("").split("\r").join("").split("\n\r").join("").split("\r\n").join(""); + s=script.replace(s,[" "],["+"]); + var type: String = s.substr(0, 3); + if (type == "CE:" || type == "CK:") { + if (type == "CE:") { + s = s.replace("CE:", ""); + } else { + s = s.replace("CK:", ""); + } + try { + var b64: ByteArray = Base64.decodeToByteArray(s); + if (type == "CE:") { + de = decrypt(codes, b64); + } else { + de = decrypt(codes2, b64); + } + } catch (event: ErrorEvent) { + return new ByteArray(); + } + } + if (de.indexOf("base64,") > -1) { + de = de.split("base64,")[1] + } + try { + return Base64.decodeToByteArray(de); + } catch (event: ErrorEvent) { + return new ByteArray(); + } + return new ByteArray(); + } + public static function getVString(s: String): String { + // constructor code + var de: String = s; + s = decodeURI(s); + s=script.replace(s,[" "],["+"]); + try { + var b64: ByteArray = Base64.decodeToByteArray(s); + de = decrypt(C.CVKEY, b64); + } catch (event: ErrorEvent) { + return de; + } + return de; + } + private static function decrypt(key: String, data: ByteArray): String { + //trace("\n执行解密方法,key:", key, ",需要解密的字符串:", data); + //实验化key的Bytearray对象,给DESKey使用 + var b_keyByteArray: ByteArray = new ByteArray(); + b_keyByteArray.writeUTFBytes(key); + //实例化DESKey + var b_desKey: DESKey = new DESKey(b_keyByteArray); + var b_ecb: ECBMode = new ECBMode(b_desKey); + var b_byteArray: ByteArray = new ByteArray(); + b_byteArray.writeBytes(data); + //执行解密 + b_ecb.decrypt(b_byteArray); + + return convertByteArrayToString(b_byteArray); + } + private static function convertByteArrayToString(bytes: ByteArray): String { + var str: String; + if (bytes) { + bytes.position = 0; + str = bytes.readUTFBytes(bytes.length); + } + return str; + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/act/httpload.as b/source/ckaction/act/httpload.as new file mode 100644 index 0000000..ac89f26 --- /dev/null +++ b/source/ckaction/act/httpload.as @@ -0,0 +1,38 @@ +package ckaction.act { + import flash.display.Loader; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.net.URLRequest; + import flash.display.LoaderInfo; + public class httpload { + private var load: Loader = null; + private var file: String = ""; + private var successFun: Function = null; + public function httpload(url: String, success: Function) { + // constructor code + successFun = success; + file = url; + loader(); + } + private function loader(): void { + load = new Loader(); + load.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); + load.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); //监听加载失败 + load.load(new URLRequest(file)); + } + private function completeHandler(event: Event): void { + successFun(load); + remove(); + } + private function errorHandler(event: IOErrorEvent): void { + remove(); + successFun(null); + } + private function remove(): void { + load.removeEventListener(Event.COMPLETE, completeHandler); + load.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); + load = null; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/act/loadXml.as b/source/ckaction/act/loadXml.as new file mode 100644 index 0000000..729e8c5 --- /dev/null +++ b/source/ckaction/act/loadXml.as @@ -0,0 +1,82 @@ +package ckaction.act { + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.net.URLLoader; + import flash.net.URLRequest; + import ckaction.act.XML2JSON; + import flash.events.ErrorEvent; + import ckaction.C.C; + import flash.net.URLVariables; + + public class loadXml { + private var f: Function; //加载成功或失败都返回该函数 + private var l: URLLoader = null; + public function loadXml(m: String, c: Function, met: String = "get"): void { + if(!m){ + trace("没有文件路径"); + c(null); + return; + } + f = c; + var r: URLRequest = new URLRequest(m); + //var params: URLVariables = new URLVariables(); + //params["path"]=C.PATH["path"]+C.PATH["file"]; + //r.data=params; + //r.method = met; + l = new URLLoader(); + l.addEventListener(Event.COMPLETE, com); + l.addEventListener(IOErrorEvent.IO_ERROR, err); + l.load(r); + } + private function remove(): void { + l.removeEventListener(Event.COMPLETE, com); + l.removeEventListener(IOErrorEvent.IO_ERROR, err); + } + private function com(event: Event): void { + var str: String = event.currentTarget.data.toString(); + if (str.indexOf(" -1 || str.indexOf(" -1) { + var xml: XML = new XML(event.currentTarget.data); + if (xml) { + try { + analysis(xml); + } catch (event: Error) { + f(null); + } + } else { + f(null); + } + } else if (str.indexOf("{") == 0 || str.indexOf("[") == 0) { + try { + var json: Object = JSON.parse(event.currentTarget.data); + if (json != null) { + + f(json); + } else { + f(null); + } + } catch (event: Error) { + new log(event); + trace(event); + f(null); + } + } else { + f(str); + } + remove(); + } + private function analysis(xml: XML): void { + var obj: Object = XML2JSON.parse(xml); + try { + f(obj); + } catch (event: Error) { + f(null); + } + } + private function err(event: IOErrorEvent) { + f(null); + remove(); + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/act/log.as b/source/ckaction/act/log.as new file mode 100644 index 0000000..488716d --- /dev/null +++ b/source/ckaction/act/log.as @@ -0,0 +1,17 @@ +package ckaction.act { + import ckaction.C.C; + + public class log { + + public function log(val: * ) { + // constructor code + //trace("log:", val); + if (C.CONFIG["flashvars"]["debug"]) { + script.callJs("console.log", val); + } + + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/act/requestController.as b/source/ckaction/act/requestController.as new file mode 100644 index 0000000..b76cb18 --- /dev/null +++ b/source/ckaction/act/requestController.as @@ -0,0 +1,46 @@ +package ckaction.act { + import flash.events.Event; + import flash.events.EventDispatcher; + import flash.events.IEventDispatcher; + import flash.events.IOErrorEvent; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.URLRequestHeader; + import flash.net.URLRequestMethod; + import flash.net.URLStream; + import flash.net.URLVariables; + public class requestController { + private var stream: URLLoader; + private var req: URLRequest; + public function requestController(method: String, url: String,paramsObj:Object=null ) { + stream = new URLLoader(); + req = new URLRequest(url); + if(paramsObj){ + var params: URLVariables=new URLVariables(); + for(var k:String in paramsObj){ + params[k]=paramsObj[k]; + } + req.data = params; + } + req.method = method; + //setHeaders(request); + stream.addEventListener(Event.COMPLETE, completeHandler); + stream.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + stream.load(req); + } + private function ioErrorHandler(event: Event): void { + //将异常事件发出,由调用者处理 + trace("error",event); + } + private function completeHandler(event: Event): void { + //trace(event.currentTarget.data); + } + public function dispose(): void { + stream.removeEventListener(Event.COMPLETE, completeHandler); + stream.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + stream = null; + req = null; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/act/script.as b/source/ckaction/act/script.as new file mode 100644 index 0000000..2410227 --- /dev/null +++ b/source/ckaction/act/script.as @@ -0,0 +1,679 @@ +package ckaction.act { + import flash.external.ExternalInterface; + import flash.net.URLRequest; + import flash.net.navigateToURL; + import flash.utils.ByteArray; + import flash.events.ErrorEvent; + //import ckaction.C.C; + + public class script { + + public static function formatTime(seconds: Number = 0, hourc: int = 0, hours: int = 0): Array { //格式化秒数为时分秒 + //seconds = 3800; + var timeh: int = Math.floor(seconds / 3600), + timei = Math.floor(Math.floor(seconds % 3600) / 60), + timeI = Math.floor(seconds / 60), + times = Math.floor(Math.floor(seconds % 60)); + if (hourc > 0) { + timeh += (hours - hourc + 1); + if (timeh < 0) { + timeh = 24 + timeh; + } + } + var array: Array = [ + timeh < 10 ? "0" + timeh : timeh.toString(), + timei < 10 ? "0" + timei : timei.toString(), + timeI < 10 ? "0" + timeI : timeI.toString(), + times < 10 ? "0" + times : times.toString(), + seconds < 10 ? "0" + seconds : seconds.toString() + ]; + return array; + } + public static function formatInsertTime(str: String = "", total: Number = 0): Array { + //trace(str,total); + if (!str) { + return null; + } + var arr: Array = str.split(","); + var newArr: Array = []; + for (var i: int = 0; i < arr.length; i++) { + var s: String = arr[i].toString(); + if (s.indexOf("%") > -1) { + newArr.push(total * Number(s.replace("%", "")) * 0.01); + } else { + newArr.push(Number(s)); + } + } + //trace("jfuj",newArr); + return newArr; + } + public static function formatM3u8Definition(url: String, n: int = 0, tags: Array = null, name: Array = null): String { + var i: int = 0; + if (!name) { + return ""; + } + if (tags.length > 0) { + var ti: int = 0; + for (i = 0; i < tags.length; i++) { + if (url.indexOf(tags[i]) > -1) { + ti = i; + break; + } + } + if (ti < name.length) { + return name[ti]; + } else { + return name[name.length - 1]; + } + + } else { + if (n < name.length) { + return name[n]; + } else { + return name[name.length - 1]; + } + } + } + public static function getNowDate(b: Boolean = true): String { //获取当前时间 + var nowDate: Date = new Date(); + var month: int = nowDate.month + 1; + var date: int = nowDate.date; + var hours: int = nowDate.hours; + var minutes: int = nowDate.minutes; + var seconds: int = nowDate.seconds; + var tMonth: String = "", + tDate: String = "", + tHours: String = "", + tMinutes: String = "", + tSeconds: String = "" + tSeconds = (seconds < 10) ? "0" + seconds : seconds + ""; + tMinutes = (minutes < 10) ? "0" + minutes : minutes + ""; + tHours = (hours < 10) ? "0" + hours : hours + ""; + tDate = (date < 10) ? "0" + date : date + ""; + tMonth = (month < 10) ? "0" + month : month + ""; + if (b) { + return tMonth + "/" + tDate + " " + tHours + ":" + tMinutes + ":" + tSeconds; + } + return nowDate.fullYear + tMonth + tDate + tHours + tMinutes + tSeconds; + } + public static function getFileExt(filepath: String = null): String { //判断后缀,和rtmp协议 + if (filepath != "") { + if (filepath.substr(0, 7) == "rtmp://") { + return "rtmp"; + } + if (filepath.indexOf("?") > -1) { + filepath = filepath.split("?")[0]; + } + var pos: String = "." + filepath.replace(/.+\./, ""); + return pos; + } + return ""; + } + public static function arrSort(arr: Array): Array { //对二维数组进行冒泡排序 + var temp: Array = []; + for (var i: int = 0; i < arr.length; i++) { + for (var j: int = 0; j < arr.length - i; j++) { + if (arr[j + 1] && arr[j][3] < arr[j + 1][3]) { + temp = arr[j + 1]; + arr[j + 1] = arr[j]; + arr[j] = temp; + } + } + } + return arr; + } + public static function getCoor(obj: Object): Object { + /*根据宽高计算元素的长宽和坐标 + obj={ + stageW=播放器的宽 + stageH=播放器的高 + eleW=元件的宽 + eleH=元件的高 + stretched=缩放形式:0=原始大小,1=自动缩放,2=只有当元件的宽或高大于播放器宽高时才进行缩放,3=参考播放器宽高,4=宽度参考播放器宽、高度自动,5=高度参考播放器高、宽度自动 + align=水平对齐方式 left,center,right + vAlign=垂直对齐方式 top.middle,bottom + spacingLeft=左方预留间距 + spacingTop=上方预留间距 + spacingRight=右方预留间距 + spacingBottom=下方预留间距 + } + */ + var nObj: Object = mergeObject({ + stageW: 0, + stageH: 0, + eleW: 0, + eleH: 0, + stretched: 0, + align: "center", + vAlign: "middle", + spacingLeft: 0, + spacingTop: 0, + spacingRight: 0, + spacingBottom: 0 + }, obj); + //traceObject(nObj); + var stageW: int = nObj["stageW"] - nObj["spacingLeft"] - nObj["spacingRight"]; + var stageH: int = nObj["stageH"] - nObj["spacingTop"] - nObj["spacingBottom"]; + var eleW: int = nObj["eleW"]; + var eleH: int = nObj["eleH"]; + var w: int = eleW, + h: int = eleH, + x: int = 0, + y: int = 0; + + if (nObj["stretched"] == 2) { + if (eleW > stageW) { + nObj["stretched"] = 4; + } + if (eleH > stageH) { + nObj["stretched"] = 5; + } + if (eleW > stageW && eleH > stageH) { + nObj["stretched"] = 1; + } + } + switch (nObj["stretched"]) { + case 1: + if (stageW / stageH < eleW / eleH) { + w = stageW; + h = w * eleH / eleW; + } else { + h = stageH; + w = h * eleW / eleH; + } + break; + case 3: + w = stageW; + h = stageH; + break; + case 4: + w = stageW; + h = w * eleH / eleW; + break; + case 5: + h = stageH; + w = h * eleW / eleH; + break; + default: + break; + + } + switch (nObj["align"]) { + case "left": + x = nObj["spacingLeft"]; + break; + case "center": + x = (stageW - w) * 0.5 + nObj["spacingLeft"]; + break; + case "right": + x = stageW - w + nObj["spacingLeft"]; + break; + default: + break; + + } + switch (nObj["vAlign"]) { + case "top": + y = nObj["spacingTop"]; + break; + case "middle": + y = (stageH - h) * 0.5 + nObj["spacingTop"]; + break; + case "bottom": + y = stageH - h + nObj["spacingTop"]; + break; + default: + break; + + } + //trace(w,h,x,y); + return { + width: w, + height: h, + x: x, + y: y + }; + } + public static function mergeOldFlashvars(nObj: Object, oObj: Object): Object { + for (var k: String in oObj) { + switch (k) { + case "p": + if (Number(oObj[k]) == 1) { + nObj["autoplay"] = true; + } else { + nObj["autoplay"] = false; + } + break; + case "lv": + if (Number(oObj[k]) == 1) { + nObj["live"] = true; + } else { + nObj["live"] = false; + } + break + case "i": + nObj["poster"] = oObj[k]; + break; + case "v": + nObj["volume"] = Number(oObj[k]) * 0.01; + break; + case "h": + var h: int = Number(oObj[k]); + var q: String =""; + if(oObj.hasOwnProperty("q")){ + q = oObj["q"]; + } + switch (h) { + case 1: + q = q != "" ?"frames_"+ q : "frames_start"; + break; + case 2: + q = q != "" ? "time_"+q : "time_start"; + break; + case 3: + case 4: + q = q != "" ? q : "start" + break; + } + nObj["drag"] = h > 0 ? q : ""; + break; + case "g": + nObj["seek"] = Number(oObj[k]); + break; + case "er": + nObj["error"] = oObj[k]; + break; + case "k": + if (oObj["n"] != "" && oObj["k"] != "") { + var arrk: Array = oObj["k"].toString().split("|"); + var arrn: Array = oObj["n"].toString().split("|"); + if (arrk.length == arrn.length) { + var arrx: Array = []; + for (var i: int = 0; i < arrk.length; i++) { + arrx.push({ + time: arrk[i], + words: arrn[i] + }); + + } + nObj["promptSpot"] = arrx; + } + } + break; + default: + break; + } + } + return nObj; + } + public static function simpleMergeObject(newObj: Object, oldObject: Object): Object { //简单形式直接替换对象 + //简单合并对象 + for (var k: String in oldObject) { + newObj[k] = oldObject[k]; + } + return newObj; + } + public static function supplementObject(newObj: Object, oldObject: Object): Object { //把旧对象合并到新对象里,主要用来补充参数,即如果原对象中包含了该参数就不需要再加入了 + + for (var k: String in oldObject) { + if (!newObj.hasOwnProperty(k)) { + newObj[k] = oldObject[k]; + } else { + if (!newObj[k] || k == "volume") { + if(getType(newObj[k])=="number"){ + newObj[k] = Number(oldObject[k]); + } + else{ + newObj[k] = oldObject[k]; + } + + } + } + } + return newObj; + } + public static function formatSsl(str:String):String{ + var arr:Array=str.split(""); + var newStr:String=""; + for(var i:int=0; i='0' && str.charAt(i)<='9'){ + newStr+=arr[i]; + }else if((str.charAt(i)>='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i) <= 'Z')){ + newStr+=arr[i]; + } + } + return newStr; + } + public static function mergeObject(obj: Object = null, old: Object = null): Object { //把旧对象合并到新对象里,主要用来格式化参数 + function sendObj(nObj: Object, oObj: Object): Object { + for (var k: String in oObj) { + if (oObj[k] != undefined) { + //trace(k,nObj[k] , getType(nObj[k])); + var type: String = ""; + if (nObj.hasOwnProperty(k)) { + type = getType(nObj[k]); + + if (oObj[k]) { + //trace(k,nObj[k],oObj[k],type,getType(nObj[k]),typeof(nObj[k])); + switch (type) { + case "object": + nObj[k] = sendObj(nObj[k], oObj[k]); + break; + case "boolean": + nObj[k] = (oObj[k] != "false" && oObj[k] != false) ? true : false; + break; + case "number": + nObj[k] = Number(oObj[k]); + //trace(k,nObj[k]); + break; + default: + nObj[k] = oObj[k]; + if(nObj[k]=="true"){ + nObj[k]=true; + } + if(nObj[k]=="false"){ + nObj[k]=false; + } + break; + } + } else { + if (type == "number" && (oObj[k] == 0 || oObj[k] == "0")) { + nObj[k] = 0; + } + if(oObj[k]=="true"){ + nObj[k] =true; + } + if(oObj[k]=="false"){ + nObj[k] =false; + } + } + } else { + if (oObj[k]) { + nObj[k] = oObj[k]; + } + } + + } + } + return nObj; + } + return sendObj(obj, old); + } + + public static function getStringLen(str): int { //计算字符长度,中文算2,字母数字算1 + var len: int = 0; + for (var i: int = 0; i < str.length; i++) { + if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) { + len += 2; + } else { + len++; + } + } + return len; + } + public static function copyObject(obj: Object): * { //复制对象 + var newObj: ByteArray = new ByteArray() + newObj.writeObject(obj); + newObj.position = 0; + return newObj.readObject(); + } + public static function getLen(str: String = ""): Number { //获取字符的长度 + if (!str) { + return 0; + } + var digital: int = 0; //数字 + var character: int = 0; //字母 + var space: int = 0; //空格 + var other: int = 0; //其它字符 + for (var i: int = 0; i < str.length; i++) { + if (str.charAt(i) >= '0' && str.charAt(i) <= '9') { + digital++; + } else if ((str.charAt(i) >= 'a' && str.charAt(i) <= 'z') || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z')) { + character++; + } else if (str.charAt(i) == ' ') { + space++; + } else { + other++; + } + } + return (digital + character + space + other * 2) * 0.5 + } + + public static function addListenerArr(listenerArr: Array, ele: String = "", fun: String = ""): Array { //添加监听函数数组 + if (ele != "" && fun != "") { + var have: Boolean = false; + for (var i: int = 0; i < listenerArr.length; i++) { + var arr = listenerArr[i]; + if (arr[0] == ele && arr[1] == fun) { + have = true; + break; + } + } + if (!have) { + listenerArr.push([ele, fun]); + } + } + return listenerArr; + } + + public static function removeListenerArr(listenerArr: Array, ele: String = "", fun: String = ""): Array { //删除监听函数数组 + if (ele != "" && fun != "") { + for (var i: int = 0; i < listenerArr.length; i++) { + var arr = listenerArr[i]; + if (arr[0] == ele && arr[1] == fun) { + listenerArr.splice(i, 1); + break; + } + } + } + return listenerArr; + } + public static function callJs(js: String, val: *= null,val2:*=null): void { + //trace(js); + var arr: Array = js.split("."); + if (arr[0] == "" || !ExternalInterface.available) { + return; + } + if(val2 != null){ + if (val != null) { + try { + ExternalInterface.call(js, val,val2); + } catch (event:Error) { + new log(event) + } + } else { + try { + ExternalInterface.call(js,val2); + } catch (event:Error) { + new log(event) + } + } + } + else{ + if (val != null) { + try { + ExternalInterface.call(js, val); + } catch (event:Error) { + log(event) + } + } else { + try { + ExternalInterface.call(js); + } catch (event:Error) { + new log(event) + } + } + } + } + public static function openLink(url: String, target: String = '_blank', features: String = ""): void { + var myURL: URLRequest = new URLRequest(url); + //trace(url,myURL); + try { + ExternalInterface.call("window.open", url, target, features); + } catch (event:Error) { + try { + ExternalInterface.call("function setWMWindow() {window.open('" + url + "', '" + target + "', '" + features + "');}"); + } catch (event: Error) { + navigateToURL(myURL, target); + } + } + } + public static function getHttpKey(info: Object): Object { + var k: String = ""; + var vf: Array = [], + vt: Array = []; + //script.traceObject(info); + if (info.hasOwnProperty("keyframes")) { + var keyframes: Object = info["keyframes"]; + for (k in keyframes) { + switch (k) { + case "times": + vt.push(keyframes[k]); + break; + case "filepositions": + vf.push(keyframes[k]); + break; + default: + break; + } + } + if(keyframes.hasOwnProperty("filepositions") && keyframes["filepositions"]){ + vf=keyframes["filepositions"]; + } + if(keyframes.hasOwnProperty("times") && keyframes["times"]){ + vt=keyframes["times"]; + } + } else if (info.hasOwnProperty("seekpoints")) { + var seekpoints: Object = info["seekpoints"]; + for (k in seekpoints) { + var seekpoints2 = seekpoints[k]; + for (var k2: String in seekpoints2) { + switch (k2) { + case "time": + vt.push(seekpoints2[k2]); + break; + case "offset": + vf.push(seekpoints2[k2]); + break; + default: + break; + } + } //end for k2 + } //end for k + } + if (vt.length > 0) { + info["keytime"] = vt; + info["keyframes"] = vf; + } + return info; + } + public static function randomString(len: int = 16): String { //获取一个随机值 + var chars: String = "abcdefghijklmnopqrstuvwxyz"; + var maxPos: int = chars.length;   + var val: String = ""; + for (var i: int = 0; i < len; i++) { + val += chars.charAt(Math.floor(Math.random() * maxPos)); + } + return 'ckv' + val; + } + public static function getPath(file: String): Object { //获取路径和对应ckplayer.swf的 + var p: String = file.split("?")[0]; + var a: Array = []; + var g: String = "\/"; + var h: String = ""; + if (p.indexOf("\/") > -1) { + a = p.split("\/"); + } else { + a = p.split("/"); + g = "/"; + } + for (var i: int = 0; i < a.length - 1; i++) { + h += a[i] + g; + } + var fa: Array = a[a.length - 1].split("?"); + var xa: Array = fa[0].toString().split("."); + return { + path: h, + file: fa[0], + fileName: xa[0] + }; + } + public static function arrSum(arr: Array, sort: int = -1): Number { //将数组里的值相加,sort=指定截断 + var num: Number = 0; + //trace(sort > 0 ? sort : arr.length); + if (sort > arr.length || sort == -1) { + sort = arr.length; + } + for (var i: int = 0; i < sort; i++) { + num += Number(arr[i]); + } + return num; + } + public static function replace(val: String, oldArr: Array, newArr: Array): String { + if (!val || oldArr.length != newArr.length) { + return val; + } + for (var i: int = 0; i < oldArr.length; i++) { + val = val.split(oldArr[i]).join(newArr[i]); + } + return val; + } + public static function getType(val: * ): String { //获取变量类型 + if (val == undefined) { + return undefined + } + if (typeof (val) == "object") { + if (val.length != undefined) { + return "array"; + } else { + return "object"; + } + } + return typeof (val); + } + public static function traceObject(cObj: Object): void { //输出对象和数组 + function tr(obj: Object, jg: String = "") { + for (var k: String in obj) { + //trace(jg, k, obj[k]); + + if (typeof (obj[k]) == "object") { + trace(jg, k, "{"); + tr(obj[k], jg + " "); + trace(jg, "},"); + } else { + if (typeof (obj[k]) == "string") { + trace(jg, k, ":\"", obj[k], "\","); + } else { + trace(jg, k, ":", obj[k], ","); + } + } + + + } + } + tr(cObj); + } + public static function strReplace(str: String, find: Array, replace: Array): String { + if (str != "" && find.length == replace.length) { + for (var i: int = 0; i < find.length; i++) { + str = str.split(find[i]).join(replace[i]); + } + } + return str; + } + public static function trackToArray(str: String):Array { + var arr:Array=str.split(","); + var tempArr:Array=[]; + var newArr:Array=[]; + for(var i=0;i-1){ + success(parNum); + } + else{ + //trace("++",success); + success(); + //trace("+---+",success); + } + stop(); + } + public function stop():void{ + isStop=true; + if (timer != null) { + if (timer.running) { + timer.stop(); + } + timer.removeEventListener(TimerEvent.TIMER, timerHandler); + timer = null; + }; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/ad/adOtherPlayer.as b/source/ckaction/ad/adOtherPlayer.as new file mode 100644 index 0000000..e01c6b3 --- /dev/null +++ b/source/ckaction/ad/adOtherPlayer.as @@ -0,0 +1,273 @@ +package ckaction.ad { + import flash.display.Sprite; + import flash.display.Loader; + import ckaction.player.gifPlayer; + import ckaction.act.httpload; + import flash.display.MovieClip; + import flash.display.Stage; + import flash.events.Event; + import flash.events.MouseEvent; + import ckaction.act.script; + import ckaction.act.requestController; + import ckaction.style.element; + import ckaction.C.C; + import ckaction.act.timeOut; + + public class adOtherPlayer { + private var STAGE: Stage = null; + private var THIS: Sprite = null; + private var adObj: Object = null; + private var adNum: int = 0; + private var isClose: Boolean = false; + private var stageW: int = 0, + stageH: int = 0; + private var load: Loader = null; + private var gif: gifPlayer = null; + private var httpLoad: httpload = null; + private var loadGif: MovieClip = null; + private var adMask: Sprite = null; + private var adMetaData: Object = { + width: 0, + height: 0 + }; + private var CONFIG: Object = C.CONFIG; + private var STYLE: Object = {}; + private var closeOtherButtonShow: Boolean = true; + private var closeButton: Sprite = null; + private var timeOutVal: timeOut = null; + public function adOtherPlayer(stage: Stage, sprite: Sprite, obj: Object, num: int = 0) { + // constructor code + STYLE = CONFIG["style"] + adObj = obj; + adNum = num; + STAGE = stage; + THIS = sprite; + closeOtherButtonShow = STYLE["advertisement"]["closeOtherButtonShow"]; + stageW = STAGE.stageWidth, + stageH = STAGE.stageHeight; + STAGE.addEventListener(Event.RESIZE, function (event: Event) { + resizeHandler(); + }); + adPlay(); + if (adObj.hasOwnProperty("time") && Number(adObj["time"]) > 0) { + timeOutVal = new timeOut(Number(adObj["time"]) * 1000, closeAd); + } + } + //当修改了C.CONFIG后 + public function changeConfig() { + var config: Object = C.CONFIG; + STYLE = config["style"]; + } + private function adPlay(): void { + if (isClose) { + return; + } + if (!adObj["type"]) { + adObj["type"] = script.getFileExt(adObj["file"]); + } + adObj["type"] = adObj["type"].replace(".", ""); + switch (adObj["type"]) { + case "png": + case "jpg": + case "jpeg": + case "swf": + httpLoad = new httpload(adObj["file"], loaderHandler); + break; + case "gif": + gif = new gifPlayer(adObj["file"], gifHandler); + break; + default: + break; + } + } + //图片,swf加载成功 + private function loaderHandler(ld: Loader = null): void { + if (isClose) { + return; + } + if (ld) { + load = ld; + adMetaData = { + width: load.width, + height: load.height + }; + THIS.addChild(load); + resizeHandler(); + if (adObj.hasOwnProperty("exhibitionMonitor")) { + new requestController(STYLE["advertisement"]["method"], adObj["exhibitionMonitor"], adObj); + } + if (adObj["link"]) { + addAdMask(); + } + if (closeOtherButtonShow) { + addCloseOtherButton(); + } + } + } + //gif加载成功 + private function gifHandler(mc: MovieClip = null): void { + if (isClose) { + return; + } + //trace("==="); + if (mc != null) { + loadGif = mc; + adMetaData = { + width: loadGif.width, + height: loadGif.height + }; + //trace(loadGif.width); + THIS.addChild(loadGif); + resizeHandler(); + if (adObj.hasOwnProperty("exhibitionMonitor") && adObj["exhibitionMonitor"]!="") { + new requestController(STYLE["advertisement"]["method"], adObj["exhibitionMonitor"], adObj); + } + if (adObj.hasOwnProperty("link") && adObj["link"]) { + addAdMask(); + } + if (closeOtherButtonShow) { + addCloseOtherButton(); + } + } + } + private function addCloseOtherButton(): void { + if (isClose) { + return; + } + if (STYLE.hasOwnProperty("advertisement") && STYLE["advertisement"].hasOwnProperty("closeOtherButton")) { + closeButton = element.imgButton(STYLE["advertisement"]["closeOtherButton"], "closeOtherAd", function () {}); + THIS.addChild(closeButton); + closeButton.addEventListener(MouseEvent.CLICK, mouseClickHandler); + resizeHandler(); + } + } + private function mouseClickHandler(event: MouseEvent): void { + closeAd(); + } + private function closeAd(): void { + THIS["closeOtherAd"](adNum); + } + public function close(): void { + isClose = true; + if (load) { + THIS.removeChild(load); + load = null; + } + if (loadGif) { + THIS.removeChild(loadGif); + loadGif = null; + } + if (adMask) { + THIS.removeChild(adMask); + adMask = null; + } + if (closeButton) { + THIS.removeChild(closeButton); + closeButton = null; + } + if (timeOutVal) { + timeOutVal.stop(); + timeOutVal = null; + } + } + private function addAdMask(): void { + if (!adMask) { + var spObj: Object = { + backgroundColor: 0xFF0000, + border: 0, + backgroundAlpha: 0, //背景透明度 + width: adMetaData["width"], + height: adMetaData["height"] + }; + adMask = element.newSprite(spObj); + adMask.addEventListener(MouseEvent.CLICK, adMaskClickHandler); + adMask.buttonMode = true; + } + THIS.addChild(adMask); + resizeHandler(); + } + private function adMaskClickHandler(event: MouseEvent): void { + openAdLink(); + } + //打开广告链接 + public function openAdLink(): void { + if (adObj.hasOwnProperty("clickMonitor")) { + new requestController(STYLE["advertisement"]["method"], adObj["clickMonitor"], adObj); + } + script.openLink(adObj["link"], adObj["target"]); + } + private function resizeHandler(): void { + if (isClose) { + return; + } + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + var coor: Object = coorDinate(adObj); + //trace(coor["width"],coor["height"]); + if (load) { + load.x = coor["x"]; + load.y = coor["y"]; + } + if (loadGif) { + loadGif.x = coor["x"]; + loadGif.y = coor["y"]; + gif.changeWH(adMetaData["width"], adMetaData["height"]); + } + if (adMask) { + adMask.x = coor["x"]; + adMask.y = coor["y"]; + } + if (closeButton) { + coor = coorDinate(STYLE["advertisement"]["closeOtherButton"], adMask || load || loadGif); + closeButton.x = coor["x"] + (adMask || load || loadGif).x; + closeButton.y = coor["y"] + (adMask || load || loadGif).y; + } + } + private function coorDinate(obj: Object, refer: * = null): Object { + //script.traceObject(obj); + //根据坐标及参考对象参数计算位置 + var nObj: Object = { + align: "left", + vAlign: "top", + offsetX: "0", + offsetY: "0" + }; + nObj = script.mergeObject(nObj, obj); + var x: int = 0, + y: int = 0, + w: int = refer != null ? refer.width : stageW, + h: int = refer != null ? refer.height : stageH; + switch (nObj["align"]) { + case "left": + x = 0; + break; + case "center": + x = w * 0.5; + break; + default: + x = w; + break; + } + switch (nObj["vAlign"]) { + case "top": + y = 0; + break; + case "middle": + y = h * 0.5; + break; + default: + y = h; + break; + } + //trace(x,y); + x += nObj["offsetX"].toString().indexOf("%") > -1 ? w * Number(nObj["offsetX"].toString().replace("%", "")) * 0.01 : Number(nObj["offsetX"]); + y += nObj["offsetY"].toString().indexOf("%") > -1 ? h * Number(nObj["offsetY"].toString().replace("%", "")) * 0.01 : Number(nObj["offsetY"]); + //trace(x,y); + return { + x: x, + y: y + }; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/ad/adPlayer.as b/source/ckaction/ad/adPlayer.as new file mode 100644 index 0000000..d9e9a38 --- /dev/null +++ b/source/ckaction/ad/adPlayer.as @@ -0,0 +1,732 @@ +package ckaction.ad { + import ckaction.act.script; + import flash.display.Sprite; + import ckaction.act.timeInterval; + import flash.display.Stage; + import flash.events.Event; + import ckaction.act.httpload; + import flash.display.Loader; + import ckaction.player.httpstream; + import ckaction.player.rtmpstream; + import ckaction.player.httpm3u8; + import ckaction.player.gifPlayer; + import flash.display.MovieClip; + import ckaction.act.requestController; + import flash.events.MouseEvent; + import ckaction.style.element; + import flash.net.NetStream; + import flash.media.Video; + import ckaction.act.log; + + public class adPlayer { + + //播放广告所要用到的变量 + private var FUN: Object = null; //调用主局函数 + private var ADV: Object = null; //有关于广告的配置函数 + private var STAGE: Stage = null; + private var THIS: Sprite = null; + public var STYLE: String = ""; + private var isClose: Boolean = false; + private var stageW: int = 0, + stageH: int = 0; + private var adIndex: int = -1; //广告的深度用来做了第二次加载广告时用 + // + private var adList: Array = []; //广告数组 + private var timeArr: Array = []; //时间数组 + private var timeTotal: int = 0; //总时间 + private var timeNow: int = 0; //总时间,用于计算当前倒计时的 + private var adNum: int = 0; //当前需要播放的编号 + private var timerInter: timeInterval = null; + private var bg: Object = {}; + //播放函数列表 + private var load: Loader = null; + private var gif: gifPlayer = null; + private var video: Video = null; + private var httpLoad: httpload = null; + private var httpNetStream: httpstream = null; + private var rtmpNetStream: rtmpstream = null; + private var httpM3u8: httpm3u8 = null; + + private var loadGif: MovieClip = null; + private var adMetaData: Object = null; + private var adMask: Sprite = null; + private var mute: Boolean = false; //是否静音状态 + private var showButton: Boolean = false; //是否需要显示功能按钮 + private var showSkipDelay: int = 0; + private var streamObj:Object=null; + + public function adPlayer(stage: Stage, sprite: Sprite, fun: Object, obj: Array, advertisement: Object, style: String = "") { + trace("新建了一个adPlayer"); + FUN = fun; + ADV = advertisement; + //script.traceObject(ADV); + bg = ADV["reserve"]; + STAGE = stage; + THIS = sprite; + STYLE = style; + adList = obj; + stageW = STAGE.stageWidth, + stageH = STAGE.stageHeight; + + STAGE.addEventListener(Event.RESIZE, function (event: Event) { + resizeHandler(); + }); + //计算总时间 + for (var i: int = 0; i < adList.length; i++) { + var adv: Object = adList[i]; + if (adv.hasOwnProperty("time")) { + timeArr.push(adv["time"]); + } else { + timeArr.push(ADV["time"]); + } + if (!adv.hasOwnProperty("method")) { + adList[i]["method"] = ADV["method"]; + } + } + + timeTotal = script.arrSum(timeArr); + timeNow = timeTotal; + + trace("timeNow:", timeNow); + if (style == "front" || style == "insert" || style == "end") { + showButton = true; + FUN["advertisementShow"]("background"); + showSkipDelay = ADV[style + "SkipButtonDelay"]; + } + adPlay(); + + } + private function adPlay(): void { + if (isClose) { + return; + } + if (adNum >= adList.length) { + if (showButton) { + adNum = -1; + closeNowAd(false); + closeAdAll(); + FUN["adStop"](); + return; + } else { + adNum = -1; + timeNow = timeTotal + closeNowAd(); + return; + } + } + //trace("播放广告",adNum); + var ad: Object = adList[adNum]; + //script.traceObject(ad); + if (!ad["type"]) { + ad["type"] = script.getFileExt(ad["file"]); + } + ad["type"] = ad["type"].replace(".", ""); + switch (ad["type"]) { + case "png": + case "jpg": + case "jpeg": + case "swf": + httpLoad = new httpload(ad["file"], loaderHandler); + break; + case "mp4": + case "flv": + case "f4v": + httpNetStream = new httpstream(); + httpNetStream.videoUrl = ad["file"]; + httpNetStream.netStatus = netStatusHandler; + httpNetStream.streamSendOut = streamSendOutHandler; + httpNetStream.error = streamErrorHandler; + httpNetStream.load(); + break; + case "rtmp": + rtmpNetStream = new rtmpstream(); + rtmpNetStream.videoUrl = ad["file"]; + rtmpNetStream.netStatus = netStatusHandler; + rtmpNetStream.streamSendOut = streamSendOutHandler; + rtmpNetStream.error = streamErrorHandler; + rtmpNetStream.load(); + break; + case "m3u8": + httpM3u8 = new httpm3u8(); + httpM3u8.videoUrl = ad["file"]; + httpM3u8.netStatus = netStatusHandler; + httpM3u8.streamSendOut = streamSendOutHandler; + httpM3u8.error = streamErrorHandler; + httpM3u8.stage = STAGE; + httpM3u8.load(); + break; + case "gif": + gif = new gifPlayer(ad["file"], gifHandler); + break; + default: + timeNow -= timeArr[adNum]; + adNum++; + adPlay(); + break; + } + + } + //图片,swf加载成功 + private function loaderHandler(ld: Loader = null): void { + if (isClose) { + return; + } + if (ld) { + trace("加载成功"); + load = ld; + adMetaData = { + width: load.width, + height: load.height + }; + if (adIndex > -1) { + THIS.addChildAt(load, adIndex); + } else { + THIS.addChild(load); + adIndex = THIS.getChildIndex(load) + } + if (mute) { + load.unloadAndStop(); + } + + if (adList[adNum].hasOwnProperty("exhibitionMonitor")) { + new requestController(adList[adNum]["method"], adList[adNum]["exhibitionMonitor"], adList[adNum]); + } + if (adList[adNum]["link"]) { + addAdMask(); + if (ADV["linkButtonShow"] && showButton) { + FUN["advertisementShow"]("adLinkButton"); + } else { + FUN["advertisementShow"]("adLinkButton", false); + } + } + + addTimerInter(); //使用计时器 + if (showButton) { + muteButtonShow(); + } + resizeHandler(); + + } else { + timeNow -= timeArr[adNum]; + adNum++; + adPlay(); + } + closeButtonShow(); + } + //视频状态 + private function netStatusHandler(status: String): void { + //trace("status", status); + switch (status) { + case "NetStream.Play.Stop": + case "NetConnection.Connect.Closed": //针对rtmp流暂停后被关闭的操作 + timerInter.stop(); + timerInter = null; + closeNowAd(); + break; + } + } + //视频加载成功 + private function streamSendOutHandler(obj: Object): void { + //script.traceObject(obj); + if (isClose || !obj) { + return; + } + streamObj=obj; + var videoTime: int = Math.floor(obj["metaData"]["duration"]); + var timeTotalTemp: int = 0; + var correctionTime: Boolean = false; + if (ADV["videoForce"] == "true" || ADV["videoForce"] == true) { + correctionTime = true; + } else { + if (timeArr[adNum] > videoTime && videoTime > 0) { + correctionTime = true; + } + } + if (correctionTime) { + timeArr[adNum] = videoTime + timeTotalTemp = script.arrSum(timeArr, -1); + var cTemp: int = timeTotalTemp - timeTotal; + timeTotal = timeTotalTemp; + timeNow += cTemp; + } + adMetaData = { + width: obj["metaData"]["width"], + height: obj["metaData"]["height"] + }; + script.traceObject(bg); + var cObj: Object = { + stageW: stageW, + stageH: stageH, + eleW: adMetaData["width"], + eleH: adMetaData["height"], + stretched: ADV[STYLE + "Stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + var coor: Object = script.getCoor(cObj); + if (video) { + video.clear(); + video = null; + } + video = new Video(coor["width"], coor["height"]); + video.x = coor["x"]; + video.y = coor["y"]; + if (adIndex > -1) { + THIS.addChildAt(video, adIndex); + } else { + THIS.addChild(video); + adIndex = THIS.getChildIndex(video) + } + video.attachNetStream(obj["netStream"]); + video.smoothing = true; + + if (mute) { + if (httpNetStream) { + httpNetStream.videoVolume(0); + } + if (rtmpNetStream) { + rtmpNetStream.videoVolume(0); + } + if (httpM3u8) { + httpM3u8.videoVolume(0); + } + + } else { + if (httpNetStream) { + httpNetStream.videoVolume(ADV["videoVolume"]); + } + if (rtmpNetStream) { + rtmpNetStream.videoVolume(ADV["videoVolume"]); + } + if (httpM3u8) { + httpM3u8.videoVolume(ADV["videoVolume"]); + } + } + if (adList[adNum].hasOwnProperty("exhibitionMonitor")) { + new requestController(adList[adNum]["method"], adList[adNum]["exhibitionMonitor"], adList[adNum]); + } + if (adList[adNum]["link"]) { + addAdMask(); + if (ADV["linkButtonShow"] && showButton) { + FUN["advertisementShow"]("adLinkButton"); + } else { + FUN["advertisementShow"]("adLinkButton", false); + } + } + + if (ADV["videoForce"] == "false" || !ADV["videoForce"]) { + addTimerInter(); //使用计时器 + } else { + changeTimer(); + } + if (showButton) { + muteButtonShow(); + } + closeButtonShow(); + } + //视频接收到错误 + private function streamErrorHandler(error: String): void { + if (isClose) { + return; + } + timeNow -= timeArr[adNum]; + adNum++; + adPlay(); + } + //gif加载成功 + private function gifHandler(mc: MovieClip = null): void { + if (isClose) { + return; + } + if (mc != null) { + loadGif = mc; + adMetaData = { + width: loadGif.width, + height: loadGif.height + }; + + THIS.addChild(loadGif); + resizeHandler(); + if (adList[adNum].hasOwnProperty("exhibitionMonitor")) { + new requestController(adList[adNum]["method"], adList[adNum]["exhibitionMonitor"], adList[adNum]); + } + if (adList[adNum]["link"]) { + addAdMask(); + if (ADV["linkButtonShow"] && showButton) { + FUN["advertisementShow"]("adLinkButton"); + } else { + FUN["advertisementShow"]("adLinkButton", false); + } + } + + addTimerInter(); //使用计时器 + if (showButton) { + muteButtonShow(); + } + closeButtonShow(); + } else { + //加载错误 + timeNow -= timeArr[adNum]; + adNum++; + adPlay(); + } + + } + private function closeButtonShow(): void { + if (isClose) { + return; + } + if (STYLE == "pause" && ADV["closeButtonShow"]) { + var w: int = 0, + h: int = 0, + x: int = 0, + y: int = 0; + if (loadGif) { + w = loadGif.width; + h = loadGif.height; + x = loadGif.x; + y = loadGif.y; + } + if (load) { + w = load.width; + h = load.height; + x = load.x; + y = load.y; + } + if (video) { + w = video.width; + h = video.height; + x = video.x; + y = video.y; + } + FUN["changeFaceWh"]({ + x: x, + y: y, + w: w, + h: h + }); + FUN["advertisementShow"]("closeButton"); + } + } + private function muteButtonShow(): void { + if (ADV["muteButtonShow"]) { + if (mute) { + FUN["advertisementShow"]("muteButton", false); + FUN["advertisementShow"]("escMuteButton"); + } else { + FUN["advertisementShow"]("muteButton"); + FUN["advertisementShow"]("escMuteButton", false); + } + + } + } + public function adMute(b: Boolean = true): void { + if (b) { + if (load) { + + } + if (streamObj) { + httpNetStream.videoVolume(0); + } + } else { + if (load) { + + } + if (httpNetStream) { + httpNetStream.videoVolume(ADV["videoVolume"]); + } + } + mute = b; + muteButtonShow(); + } + + private function addAdMask(): void { + if (isClose) { + return; + } + if (!adMask) { + var spObj: Object = { + backgroundColor: 0xFF0000, + border: 0, + backgroundAlpha: 0.1, //背景透明度 + width: STAGE.stageWidth, + height: STAGE.stageHeight + }; + adMask = element.newSprite(spObj); + adMask.addEventListener(MouseEvent.CLICK, adMaskClickHandler); + adMask.buttonMode = true; + } + THIS.addChild(adMask); + resizeHandler(); + } + private function hideAdMask(): void { + if (adMask && THIS.contains(adMask)) { + THIS.removeChild(adMask); + } + } + //计时 + private function addTimerInter(): void { + var nowTimeNum: int = timeArr[adNum]; + if (showButton) { + FUN["advertisementShow"]("countDown"); + FUN["advertisementShow"]("countDownText"); + FUN["changeAdCountDown"](timeNow); + } + if (timerInter) { + timerInter.stop(); + timerInter = null; + } + trace("timeNow", timeNow, nowTimeNum); + timerInter = new timeInterval(1000, function () { + nowTimeNum--; + timeNow--; + if (showButton) { + FUN["changeAdCountDown"](timeNow); + } + if (nowTimeNum <= 0) { + if (STYLE != "pause" || adList.length > 1) { + timerInter.close(); + timerInter = null; + closeNowAd(); + } + + } else { + if (showButton) { + skipButtonShow(); + } + } + + }); + timerInter.start(); + if (showButton) { + skipButtonShow(); + } + } + //手动计时 + private function changeTimer(): void { + if (showButton) { + FUN["advertisementShow"]("countDown"); + FUN["advertisementShow"]("countDownText"); + FUN["changeAdCountDown"](timeNow); + } + if (timerInter) { + timerInter.close(); + timerInter = null; + } + timeNow = timeTotal; + if (adNum > 0) { + timeNow -= script.arrSum(timeArr, adNum); + } + //trace("timeNow:", timeNow); + var timeNowTemp: int = timeNow; + function timerInterFun(): void { + var vTime: Number = 0; + if (httpNetStream) { + vTime = httpNetStream.getTime(); + } + timeNow = int(timeNowTemp - Math.floor(vTime)); + //trace("vTime", timeNow, vTime); + if (showButton) { + FUN["changeAdCountDown"](timeNow); + skipButtonShow(); + } + + } + timerInter = new timeInterval(200, timerInterFun); + timerInter.start(); + if (showButton) { + timerInterFun(); + skipButtonShow(); + } + } + //显示跳过广告按钮 + private function skipButtonShow(): void { + //showSkipDelay + //trace("运行了一次skipButtonShow()"); + if (showButton && ADV["skipButtonShow"]) { + if (timeTotal - timeNow >= showSkipDelay) { + FUN["advertisementShow"]("skipAdButton"); + FUN["advertisementShow"]("skipDelay", false); + FUN["advertisementShow"]("skipDelayText", false); + } else { + FUN["advertisementShow"]("skipAdButton", false); + FUN["advertisementShow"]("skipDelay"); + FUN["changeAdSkipDelay"](showSkipDelay - (timeTotal - timeNow)); + } + } + } + + private function adMaskClickHandler(event: MouseEvent): void { + openAdLink(); + } + //打开广告链接 + public function openAdLink(): void { + if (adList[adNum].hasOwnProperty("clickMonitor")) { + new requestController(adList[adNum]["method"], adList[adNum]["clickMonitor"], adList[adNum]); + } + script.openLink(adList[adNum]["link"], adList[adNum]["target"]); + } + private function resizeHandler(): void { + if (isClose) { + return; + } + var coor: Object = null; + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + if (adMetaData) { + var obj: Object = { + stageW: stageW, + stageH: stageH, + eleW: adMetaData["width"], + eleH: adMetaData["height"], + stretched: ADV[STYLE + "Stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + //script.traceObject(obj); + coor = script.getCoor(obj); + } else { + return; + } + //script.traceObject(adMetaData); + //trace("================="); + //script.traceObject(coor); + if (load) { + load.width = coor["width"]; + load.height = coor["height"]; + load.x = coor["x"]; + load.y = coor["y"]; + } + if (video) { + video.width = coor["width"]; + video.height = coor["height"]; + video.x = coor["x"]; + video.y = coor["y"]; + } + if (loadGif) { + loadGif.width = coor["width"]; + loadGif.height = coor["height"]; + loadGif.x = coor["x"]; + loadGif.y = coor["y"]; + gif.changeWH(coor["width"], coor["height"]); + } + if (adMask) { + adMask.width = coor["width"]; + adMask.height = coor["height"]; + adMask.x = coor["x"]; + adMask.y = coor["y"]; + } + closeButtonShow(); + } + //关闭当前的广告 + private function closeNowAd(next: Boolean = true): void { //next是否要播放下一集 + //trace("播放下一庥",adNum); + hideAdMask(); + if (timerInter) { + timerInter.stop(); + timerInter = null; + } + if (httpLoad) { + httpLoad = null; + } + if (load) { + load.unloadAndStop(); + THIS.removeChild(load); + load = null; + } + if (httpNetStream) { + httpNetStream.clear(); + httpNetStream = null; + } + if (rtmpNetStream) { + rtmpNetStream.clear(); + rtmpNetStream = null; + } + if (video) { + THIS.removeChild(video); + video = null; + } + if (gif) { + gif.underChild(); + gif = null; + } + if (loadGif) { + THIS.removeChild(loadGif); + loadGif = null + } + if (httpM3u8) { + httpM3u8.clear(); + httpM3u8 = null; + } + if (next) { + timeNow = timeTotal - script.arrSum(timeArr, adNum + 1); + adNum++; + adPlay(); + } + + } + private function closeAdAll(): void { + if (timerInter) { + timerInter.stop(); + timerInter = null; + } + FUN["advertisementShow"]("background", false); + FUN["advertisementShow"]("skipAdButton", false); + FUN["advertisementShow"]("adLinkButton", false); + FUN["advertisementShow"]("muteButton", false); + FUN["advertisementShow"]("countDown", false); + FUN["advertisementShow"]("countDownText", false); + FUN["advertisementShow"]("skipDelay", false); + FUN["advertisementShow"]("skipDelayText", false); + FUN["advertisementShow"]("closeButton", false); + } + public function play():void{ + if(isClose){ + return; + } + if(timerInter){ + timerInter.start(); + } + if(streamObj){ + streamObj["netStream"].resume(); + } + if(loadGif){ + loadGif.play(); + } + new log(STYLE+"Ad:play"); + THIS["sendJS"](STYLE+"Ad","play"); + } + public function pause():void{ + if(isClose){ + return; + } + if(timerInter){ + timerInter.stop(); + } + if(streamObj){ + streamObj["netStream"].pause(); + } + if(loadGif){ + loadGif.stop(); + } + new log(STYLE+"Ad:pause"); + THIS["sendJS"](STYLE+"Ad","pause"); + } + public function close(): void { + trace("关闭"); + isClose = true; + closeNowAd(false); + closeAdAll(); + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/main.as b/source/ckaction/main.as new file mode 100644 index 0000000..134e43d --- /dev/null +++ b/source/ckaction/main.as @@ -0,0 +1,1791 @@ +package ckaction { + import flash.display.Sprite; + import flash.display.StageScaleMode; + import flash.display.StageAlign; + import flash.events.Event; + import flash.system.Security; + import flash.display.StageDisplayState; + import flash.events.KeyboardEvent; + import ckaction.process.config; + import ckaction.act.script; + import ckaction.style.face; + import ckaction.process.analysisVideoUrl; + import ckaction.act.timeOut; + import ckaction.process.analysis; + import ckaction.style.poster; + import ckaction.ad.adPlayer; + import ckaction.C.C; + import ckaction.player.player; + import ckaction.act.timeInterval; + import ckaction.ad.adOtherPlayer; + import ckaction.style.newElement; + import flash.external.ExternalInterface; + import ckaction.act.log; + import ckaction.menu.rightMenu; + import ckaction.act.script; + import flash.desktop.Clipboard; + import flash.desktop.ClipboardFormats; + import ckaction.process.analysisVideoUrlNum; + import ckaction.act.loadXml; + import ckaction.style.track; + import flash.events.ErrorEvent; + import flash.events.MouseEvent; + + + public class main extends Sprite { + Security.allowDomain("*"); + Security.allowInsecureDomain("*"); + private var FLASHVARS: Object = {}; //flashvars + private var FACE: face = null; + // + private var tempVolume: Number = 0, + nowVolume: Number = 0; + // + private var controlBarShow: Boolean = true; + // + private var videoUrl: Array = null; //视频地址 + private var adUrl: Object = null; //广告地址 + private var autoPlay: Boolean = false; //是否自动播放 + private var noPlay: Boolean = false; //加载完但不播放(因为前置广告在播放,或默认加载没有前置广告但默认暂停) + private var autoLoad: Boolean = false; //默认加载 + private var firstPlay: Boolean = false; //是否第一次播放 + private var posterFun: poster = null; //用来加载封面图片的 + private var trackClass: track = null; + private var mouseCoorObj:Object={x:0,y:0};//保存鼠标坐标 + //广告类 + private var adPlayClass: adPlayer = null; + private var adName: String = ""; + private var adFrontPlayed: Boolean = false; //前置广告是否已播放 + private var adInsertPlayed: Boolean = false; //插入广告是否在播放 + private var adEndPlayed: Boolean = false; //结束广告是否已播放 + private var adFunObj: Object = {}; + private var insertTimeArr: Array = null; //插入广告的开始时间数组 + private var insertPlay: Array = []; //插入广告保存是否播放的数组 + private var otherTimeArr: Array = null; //其它广告的开始时间数组 + private var otherAdArr: Array = []; //其它广告数组 + private var otherPlay: Array = []; //其它广告保存是否播放的数组 + private var otherAd: Array = []; //其它广告数组 + // + private var vPlayer: player = null; + private var time: Number = 0; //当前播放时间 + private var timeTotal: Number = 0; + private var newVideoTimeOut: timeOut = null; + // + private var loadIndex: int = 0; //视频显示的深度,因为界面加载完后在有背景的情况下深度不一定 + //状态 + private var videoState: Object = {}; + private var isKeyClock: Boolean = false; //是否锁定按键 + //其它广告 + private var otherInterVal: timeInterval = null; + private var otherTime: int = 0; + // + private var timeMax: Number = 0, + timeSeek: Number = -1; + //构建弹幕文件 + private var element: newElement = null; + //监听函数列表 + private var listenerArr: Array = []; + private var playNum: int = 0; + + private var errorShow: Boolean = false; + //是否可以加载官方广告 + private var changeNum: int = 0; + public function main() { + // constructor code + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.align = StageAlign.TOP_LEFT; + var flashvars: Object = stage.loaderInfo.parameters; + if (flashvars.hasOwnProperty("log")) { + if (flashvars["log"] == "true" || flashvars["log"] == "yes" || flashvars["log"] == 1 || flashvars["log"] == "1") { + C.CONFIG["flashvars"]["log"] = true; + } + } + stage.addEventListener(Event.RESIZE, resizeHandler); + adFunObj = { + advertisementShow: advertisementShow, + changeAdCountDown: changeAdCountDown, + changeAdSkipDelay: changeAdSkipDelay, + adStop: videoPlay, + changeFaceWh: changeFaceWh + }; + config(); //加载配置文件 + new log("process:Loaded"); + } + private function config(): void { + //加载配置文件 + new log("process:Config load"); + new ckaction.process.config(stage, configHandler); + } + private function configHandler(): void { + //配置文件加载完成 + new log("process:Config loaded"); + //new log(C.CONFIG); + if (C.CONFIG["config"]["buttonMode"]["player"]) { + this.buttonMode = true; + } + + //adUrl=C.CONFIG["flashvars"]["adUrl"]; + new rightMenu(this);//构建右键 + stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); //监听键盘事件 + stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler); + stage.addEventListener(MouseEvent.MOUSE_WHEEL, wheelHandler); + addCallback(); + if (C.CONFIG["flashvars"]["loaded"] != "") { + new log("process:Config loaded:"+C.CONFIG["flashvars"]["loaded"]); + if (C.CONFIG["flashvars"]["variable"] != "") { + script.callJs(script.formatSsl(C.CONFIG["flashvars"]["variable"]) + ".loadedHandler"); + } else { + script.callJs(script.formatSsl(C.CONFIG["flashvars"]["loaded"])); + } + } else { + if (C.CONFIG["flashvars"]["variable"] != "") { + script.callJs(script.formatSsl(C.CONFIG["flashvars"]["variable"]) + ".loadedHandler"); + } + } + + if (C.CONFIG["config"]["time"] > 0) { + var tempTimer: timeInterval = new timeInterval(1000, function () { + var tempNowTime: Number = C.CONFIG["config"]["time"]; + C.CONFIG["config"]["time"] = tempNowTime + 1000; + }); + tempTimer.start(); + } + //script.traceObject(C.CONFIG["config"]); + + } + public function loadFace(): void { //加载风格 + if (C.CONFIG.hasOwnProperty("style") && C.CONFIG.hasOwnProperty("language")) { + if (C.CONFIG["style"].hasOwnProperty("controlBar")) { + new log("process:Face load"); + FACE = new face(stage, this, into); + } else { + into(); + } + } else { + into(); + } + //script.traceObject(C.CONFIG["flashvars"]); + } + private function into(index: int = -1): void { //界面加载完成后开始的动作 + //trace("动作开始"); + //custom('controlBar','button','previousPage',false) + //script.traceObject(getConfig("config")); + new log("process:Player start"); + sendJS("playerStart"); + if (C.CONFIG["flashvars"]["crossdomain"] != "") { + //如果在flashvars里指定了跨域策略,则加载 + flash.system.Security.loadPolicyFile(C.CONFIG["flashvars"]["crossdomain"]); + } else { + if (C.CONFIG["config"]["crossdomain"] != "") { + //如果在配置文件里指定了跨域策略,则加载 + flash.system.Security.loadPolicyFile(C.CONFIG["config"]["crossdomain"]); + } + } + + videoError(); + if (loadIndex != index && index != -1) { + loadIndex = index; + } + if (newVideoTimeOut != null) { + newVideoTimeOut.stop(); + newVideoTimeOut = null; + } + + if (FACE) { //如果界面对象存在,则初始化 + FACE.changeLoadTotal(); + FACE.timeLoadSliderChange(); + FACE.timeLoadSimpleChange(); + FACE.changeTimeTotal(C.CONFIG["flashvars"]["duration"]); + FACE.timePlaySimpleChange(); + FACE.timePlaySliderChange(); + if (!C.CONFIG["flashvars"]["live"]) { + FACE.changeVodTime(); + } + FACE.showLoading(); + FACE.showCenterPlay(false); + } + if (trackClass) { + trackClass.close(); + trackClass = null; + } + new log("process:Analysis video url"); + if (C.CONFIG["flashvars"].hasOwnProperty("video") && C.CONFIG["flashvars"]["video"]) { + trace("分析视频"); + new analysisVideoUrl(newPlayerHandler); //分析视频地址 + } else { + new log("error:There is no video in the flashvars"); + videoError(C.CONFIG["flashvars"]["cannotFindUrl"] != "" ? C.CONFIG["flashvars"]["cannotFindUrl"] : C.CONFIG["language"]["error"]["cannotFindUrl"]); + } + + } + private function newPlayerHandler(arr: Array = null, m: int = 0): void { + //视频地址分析完成 + trace("===||"); + script.traceObject(arr); + new log(arr); + trace("==="); + if (!arr) { + new log("error:flashvars[\"video\"] format error"); + videoError(C.CONFIG["flashvars"]["formatError"] != "" ? C.CONFIG["flashvars"]["formatError"] : C.CONFIG["language"]["error"]["formatError"]); + //trace("已经出错"); + return; + } + if (FACE && C.CONFIG["flashvars"]["duration"] > 0) { //如果界面对象存在,则初始化 + FACE.changeTimeTotal(C.CONFIG["flashvars"]["duration"]); + if (!C.CONFIG["flashvars"]["live"]) { + FACE.changeVodTime(); + } + } + new log("process:Video url analysis completed"); + playNum = m; //要播放的数组索引 + if (C.CONFIG["config"]["definition"] && FACE) { + FACE.loadDefinition(playNum); + FACE.newDefinition(playNum); + } + //C.CONFIG["flashvars"]["video"] = arr; + //C.CONFIG["flashvars"]["weight"] = weight; + FLASHVARS = C.CONFIG["flashvars"]; + autoPlay = FLASHVARS["autoplay"]; //是否自动播放 + //script.traceObject(C.CONFIG["flashvars"]); + //trace("autoPlay:",autoPlay,FLASHVARS["autoplay"]); + autoLoad = C.CONFIG["config"]["autoLoad"]; + nowVolume = FLASHVARS["volume"]; + //trace("autoPlay",autoPlay,autoLoad,nowVolume); + //script.traceObject(C.CONFIG); + //return; + + + if (otherInterVal) { + otherInterVal.close(); + otherInterVal = null; + } + //script.traceObject(C.CONFIG["flashvars"]); + if (!FLASHVARS.hasOwnProperty("advertisements") || !FLASHVARS["advertisements"]) { + advsHandler(null); + } else { + //trace("进行分析"); + //script.traceObject(FLASHVARS["advertisements"]); + new log("process:Analysis advertisements"); + new analysis(FLASHVARS["advertisements"], advsHandler); //分析广告内容 + } + } + private function advsHandler(obj: Object): void { //广告分析结束 + advertisementsHandler(obj); + } + private function advertisementsHandler(obj: Object): void { //广告分析结束 + //script.traceObject(obj); + new log("process:Advertisements analysis completed"); + if (obj) { + adUrl = obj; + if (adUrl.hasOwnProperty("inserttime")) { + FLASHVARS["inserttime"] = adUrl["inserttime"]; + } + } + //script.traceObject(adUrl); + //分析其它广告 + if (adUrl && adUrl.hasOwnProperty("other") && adUrl["other"]) { + otherPlay = []; + otherTimeArr = []; + otherAdArr = adUrl["other"]; + for (var i: int = 0; i < otherAdArr.length; i++) { + otherPlay.push(0); + otherAd.push(null); + if (otherAdArr[i].hasOwnProperty("startTime") && otherAdArr[i]["startTime"] > 0) { + otherTimeArr.push(otherAdArr[i]["startTime"]); + } else { + otherTimeArr.push(0); + } + } + } + //script.traceObject(otherTimeArr); + //其它广告分析完成 + + if (vPlayer) { + vPlayer.clear(); + vPlayer = null; + } + //trace(C.CONFIG["flashvars"]["cktrack"]); + loadSubbtitle(); + if (C.CONFIG["config"]["delay"] > 0) { + new timeOut(C.CONFIG["config"]["delay"], addPlayer); + } else { + addPlayer(); + } + //script.traceObject(C.CONFIG["flashvars"]); + } + private function loadSubbtitle():void{//加载字幕文件 + var trackS:String=C.CONFIG["flashvars"]["cktrack"]; + var trackDelay:Number=C.CONFIG["flashvars"]["cktrackdelay"]; + var trackArr=[]; + if(trackS && trackS.indexOf(",")>-1){ + trackArr=script.trackToArray(trackS); + var index:int=0; + for(var i:int=0;iindex){ + index=trackArr[i][2]; + } + } + trackS=trackArr[index][0]; + } + if (trackS) { + trackClass = new track(this, C.CONFIG["style"]["cktrack"],trackS,trackDelay); + } + if (C.CONFIG["config"]["subtitle"] && FACE && trackArr.length>0) { + FACE.loadSubtitles(index); + FACE.newSubtitles(index); + } + } + private function addPlayer(): void { + if (!FLASHVARS.hasOwnProperty("video") || !FLASHVARS["video"]) { + videoError(C.CONFIG["language"]["error"]["cannotFindUrl"]); + return; + } + noPlay = false; + firstPlay = true; + if (autoPlay) { //如果自动播放 + //trace("===========", adUrl.hasOwnProperty("front"), adUrl["front"]); + //script.traceObject(adUrl); + /*-----------------------------------------------------*/ + + if (adUrl && adUrl.hasOwnProperty("front") && adUrl["front"]) { //如果有前置广告 + frontAdPlay(); + //trace("autoLoad", autoLoad); + if (autoLoad) { + noPlay = true; + newPlayer(); + } + } else { + newPlayer(); + } + /*-----------------------------------------------------*/ + } else { //如果不自动播放 + loadPoster(); + if (autoLoad) { + noPlay = true; + newPlayer(); + } + } + } + //======================================================加载初始化图片================================================================== + private function loadPoster(): void { + if (FLASHVARS.hasOwnProperty("poster") && FLASHVARS["poster"]) { + if (posterFun) { + posterFun.hide(); + posterFun = null; + } + new log("process:Poster load"); + posterFun = new poster(stage, this, videoPlay, getControlBarShow, posterHandler); + posterFun.loadPoster(FLASHVARS["poster"], C.CONFIG["style"]["video"], loadIndex); + } else { + //如果没有封面图,则隐藏loading + if (FACE) { //如果界面对象存在 + FACE.showLoading(false); + FACE.showCenterPlay(); + } + } + } + private function posterHandler(loaded: Boolean = false): void { + if (FACE) { //如果界面对象存在 + FACE.showLoading(false); + FACE.showCenterPlay(); + } + if (vPlayer) { + vPlayer.posterHandler(); + } + } + //======================================================开始播放前置广告================================================================== + private function frontAdPlay(): void { //加载前置广告 + if (FACE) { //如果界面对象存在 + FACE.showLoading(false); + FACE.showCenterPlay(false); + } + if (adPlayClass) { + adPlayClass.close(); + adPlayClass = null; + } + trace("播放前置广告"); + adName = "front"; + new log("process:front ad play"); + this.sendJS("frontAd", "play"); + adPlayClass = new adPlayer(stage, this, adFunObj, adUrl["front"], C.CONFIG["style"]["advertisement"], adName); + adFrontPlayed = true; //说明前置广告已经播放了 + } + //控制广告元件(背景,倒计时,跳过广告按钮等)显示 + private function advertisementShow(objName: String, b: Boolean = true): void { + if (FACE) { + FACE.advertisementShow(objName, b); + } + } + //向face里发送广告的尺寸 + private function changeFaceWh(obj: Object): void { + if (FACE) { + FACE.changeFaceWh(obj); + } + } + //改变文本框 + private function changeAdCountDown(t: int = 0): void { + //trace(t); + if (FACE) { + FACE.changeAdCountDown(t); + } + } + //改变跳过广告延时时间 + private function changeAdSkipDelay(t: int = 0): void { + if (FACE) { + FACE.changeAdSkipDelay(t); + } + } + //======================================================开始播放暂停广告================================================================ + private function adPausePlay(): void { + if (adInsertPlayed || firstPlay || adEndPlayed) { //如果正在播放插入广告 + return; + } + if (adUrl && adUrl.hasOwnProperty("pause") && adUrl["pause"]) { + //script.traceObject(adUrl["pause"]); + trace("开始播放暂停广告"); + new log("process:Pause ad play"); + this.sendJS("pauseAd", "play"); + adName = "pause"; + adPlayClass = new adPlayer(stage, this, adFunObj, adUrl["pause"], C.CONFIG["style"]["advertisement"], adName); + } + } + public function closePauseAd(): void { + //trace("关闭了暂停广告"); + if (adPlayClass != null) { + adPlayClass.close(); + adPlayClass = null; + new log("process:Pause ad close"); + this.sendJS("pauseAd", "close"); + } + } + //=======================================================开始播放结束广告============================================================== + private function endAdPlay(): void { + if (adPlayClass) { + adPlayClass.close(); + adPlayClass = null; + } + //trace("播放结束广告"); + var adEndObj: Object = { + advertisementShow: advertisementShow, + changeAdCountDown: changeAdCountDown, + changeAdSkipDelay: changeAdSkipDelay, + adStop: ended, + changeFaceWh: changeFaceWh + }; + new log("process:End ad play"); + this.sendJS("endAd", "play"); + adName = "end"; + trace("播放广告"); + adPlayClass = new adPlayer(stage, this, adEndObj, adUrl["end"], C.CONFIG["style"]["advertisement"], adName); + adEndPlayed = true; //说明结束广告已经播放了 + } + //======================================================播放其它广告==================================================================== + private function otherInterValHandler(): void { + otherTime++; + for (var i: int = 0; i < otherAdArr.length; i++) { + if (otherPlay[i] == 0) { + if (otherTime >= otherTimeArr[i]) { + otherPlay[i] = 1; + otherAd[i] = new adOtherPlayer(stage, this, otherAdArr[i], i); + } + } + } + } + public function closeOtherAd(num: int = 0): void { + if (otherAd.length > num) { + if (otherAd[num]) { + otherAd[num].close(); + otherAd[num] = null; + } + } + } + //======================================================开始播放视频==================================================================== + private function newPlayer(): void { + trace("NOPLAY+++", noPlay); + vPlayer = new player(stage, this, noPlay, loadIndex, playNum, FLASHVARS["seek"]); + vPlayer.volume = nowVolume; + } + public function changeDefinition(n: int = 0): void { + trace("切换清晰度编号:" + n); + playNum = n; + if (vPlayer) { + vPlayer.clear(); + vPlayer = null; + } + if (FACE) { //如果界面对象存在,则初始化 + FACE.changeLoadTotal(); + FACE.timeLoadSliderChange(); + FACE.timeLoadSimpleChange(); + FACE.changeTimeTotal(); + FACE.timePlaySimpleChange(); + FACE.timePlaySliderChange(); + if (!C.CONFIG["flashvars"]["live"]) { + FACE.changeVodTime(); + } + FACE.showLoading(); + FACE.showCenterPlay(false); + } + autoPlay = true; + + var videoArr: Array = C.CONFIG["flashvars"]["video"]; + var vObj: Object = videoArr[playNum]; + if (vObj.hasOwnProperty("video") && vObj["video"]) { + if (vObj["video"].toString().substr(0, 8) == "website:") { + new analysisVideoUrlNum(changeDefinitionHandler, playNum); + } else { + changeDefinitionHandler(); + } + } else { + changeDefinitionHandler(); + } + + } + public function changeSubtitles(n:int=0):void{ + var trackS:String=C.CONFIG["flashvars"]["cktrack"]; + var trackArr=[]; + if(trackS.indexOf(",")>-1){ + trackArr=script.trackToArray(trackS); + trackS=trackArr[n][0]; + } + if (trackS != "") { + if(trackClass){ + trackClass.close(); + trackClass=null; + } + trackClass = new track(this, C.CONFIG["style"]["cktrack"],trackS); + } + if (C.CONFIG["config"]["subtitle"] && FACE && trackArr.length>0) { + trace("FACE.loadSubtitles"); + FACE.loadSubtitles(n); + FACE.newSubtitles(n); + } + } + public function changeSubtitlesSize(n:int=0,m:int=0):void{ + if(trackClass){ + C.CONFIG["style"]["cktrack"]["size"]=n; + C.CONFIG["style"]["cktrack"]["leading"]=m; + trackClass.changeSize(n,m); + } + } + private function changeDefinitionHandler(b: Boolean = true): void { + if (!b) { + if (changeNum < C.CONFIG["config"]["errorNum"]) { + changeNum++; + changeDefinition(playNum); + } else { + videoError(C.CONFIG["flashvars"]["cannotFindUrl"] != "" ? C.CONFIG["flashvars"]["cannotFindUrl"] : C.CONFIG["language"]["error"]["cannotFindUrl"]); + } + return; + } + changeNum = 0; + vPlayer = new player(stage, this, false, loadIndex, playNum); + sendJS("definitionChange",playNum); + vPlayer.firstSeek = time; + vPlayer.volume = nowVolume; + faceDefinition(playNum); + } + public function faceDefinition(n: int = 0): void { + if (C.CONFIG["config"]["definition"] && FACE) { + FACE.loadDefinition(n); + FACE.newDefinition(n); + } + } + public function getPlayerData(obj: Object): void { + //script.traceObject(obj); + var i: int = 0; + switch (obj["name"]) { + case "changeTimeTotal": + timeTotal = obj["val"]; + sendJS("duration", timeTotal); + new log("duration:" + timeTotal); + //trace(FLASHVARS.hasOwnProperty("inserttime"), (FLASHVARS["inserttime"] + ""), timeTotal > 0, adUrl); + if (FLASHVARS.hasOwnProperty("inserttime") && (FLASHVARS["inserttime"] + "") != "" && timeTotal > 0 && adUrl) { + if (adUrl.hasOwnProperty("insert") && adUrl["insert"]) { + insertTimeArr = script.formatInsertTime(FLASHVARS["inserttime"], obj["val"]); + trace("insertTimeArr", insertTimeArr); + insertPlay = []; + if (insertTimeArr) { + for (i = 0; i < insertTimeArr.length; i++) { + insertPlay.push(false); + } + } else { + insertPlay = null; + } + } + } + break; + case "changeLoadTotal": + sendJS("bytesTotal", obj["val"]); + new log("bytesTotal:" + obj["val"]); + break; + case "changeVodTime": + time = obj["val"]; + if (!vPlayer.getPaused()) { + sendJS("time", time); + if (trackClass!=null) { + //trace(trackClass); + trackClass.sendTime(time); + } + } + + //new log("time:"+time); + if (timeMax < time) { + timeMax = time; + } + if (insertPlay && !adInsertPlayed) { //播放中插广告 + for (i = 0; i < insertPlay.length; i++) { + if (insertPlay[i] == false) { + if (obj["val"] >= insertTimeArr[i]) { + insertPlay[i] = true; + + if (adPlayClass) { + adPlayClass.close(); + adPlayClass = null; + } + adInsertPlayed = true; + videoPause(false); + adName = "insert"; + new log("process:Insert ad play"); + this.sendJS("insertAd", "play"); + adPlayClass = new adPlayer(stage, this, adFunObj, adUrl["insert"], C.CONFIG["style"]["advertisement"], adName); + } + break; + } + } + } + break; + case "timeLoadSliderChange": + sendJS("bytes", obj["val"]); + //new log("bytes:" + obj["val"]); + break; + case "showBuffer": + if (obj["val"] < 100) { + sendJS("buffer", obj["val"]); + new log("buffer:" + obj["val"]); + } + + break; + default: + break; + + } + + if (FACE) { + //trace("==="); + //script.traceObject(obj); + if (FACE.hasOwnProperty(obj["name"])) { + FACE[obj["name"]](obj["val"]); + } + } + } + public function netStatus(status: String) { + //trace("-----++------", status); + new log("netStatus:" + status); + this.sendJS("netStatus", status) + switch (status) { + case "NetConnection.Connect.Closed": //针对rtmp流暂停后被关闭的操作 + trace(C.CONFIG["flashvars"]["live"]); + if(vPlayer && vPlayer.vType=="rtmp" && C.CONFIG["flashvars"]["live"]==true){ + break; + } + case "NetConnection.Connect.Failed": + case "NetStream.Play.StreamNotFound": //加载出错 + videoError(C.CONFIG["flashvars"]["streamNotFound"] != "" ? C.CONFIG["flashvars"]["streamNotFound"] : C.CONFIG["language"]["error"]["streamNotFound"]); + break; + case "NetStream.Play.Start": + if (FACE) { //如果界面对象存在 + FACE.showLoading(false); + FACE.showCenterPlay(false); + } + //M.showLoading(false); + //M.definition(); + sendJS("loadedmetadata"); + break; + + case "NetStream.SeekStart.Notify": + case "NetStream.Seek.seeking": + videoState["seeking"] = true; + new log("netStream:seek start"); + this.sendJS("seek", "start"); + new log("netStream:seeking"); + //listenerJs("seeking"); + //M.showLoading(); + break; + //case "NetStream.Seek.Notify": + case "NetStream.Seek.seeked": + case "NetStream.Seek.Complete": + videoState["seeking"] = false; + new log("netStream:seek ended"); + this.sendJS("seek", "ended"); + if (FACE) { + FACE.changeTimePlaySlider(); + } + if (!firstPlay) { + videoPlay(); + } + + videoError(); + //listenerJs("seeked"); + //script.callJs(chplayer + ".resetTrack"); + //videoPlay(); + //M.showLoading(false); + break; + case "NetStream.Buffer.Empty": //开始缓冲 + break; + case "NetStream.Pause.Notify": //暂停状态 + videoState["paused"] = true; + //listenerJs("pause"); + sendJS("loadedmetadata"); + if (FACE) { + FACE.changeTimePlaySlider(); + } + //if(newElement){ + // newElement.changePauseded(true); + //} + break; + case "NetStream.Unpause.Notify": + //return; + videoState["paused"] = false; + closePauseAd(); + //listenerJs("play"); + sendJS("loadedmetadata"); + videoError(); + break; + case "NetStream.Buffer.Full": //缓冲完成,进行播放 + //videoState["seeking"] = false; + //new log("netStream:seek ended"); + //this.sendJS("seek","ended"); + new log("netStream:buffer"); + sendJS("buffer", 100); + new log("buffer:100"); + videoError(); + if (FACE) { + FACE.changeTimePlaySlider(); + } + //M.showLoading(false); + break; + case "NetStream.Play.Stop": //播放完毕 + ended(); + break; + default: + break; + } + } + //-----------------------------------------------------------------------可交互动作--------------------------------------------- + + public function videoSeek(time: Number = 0, face: Boolean = true): void { + if (!firstPlay) { + new log("seekTime:" + time); + this.sendJS("seekTime", time); + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + //videoPlay(); + vPlayer.videoSeek(time); + if (timeSeek == -1) { + timeSeek = time; + } + if (face && FACE) { + FACE.timePlaySliderChange(time); + } + + } + } else { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + vPlayer.firstSeek = time; + } + if (face && FACE) { + FACE.timePlaySliderChange(0); + } + videoPlay(); + } + + } + public function backLive(): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + vPlayer.backLive(); + } + } + public function videoPlay(): void { + trace("执行了main:videoPlay"); + //隐藏封面图 + if (errorShow) { + return; + } + trace("第一次播放", firstPlay); + if (firstPlay) { + if (posterFun) { //如果有封面图片,则隐藏 + posterFun.hide(); + posterFun = null; + } + //隐藏loading和centerPlay + if (FACE) { //如果界面对象存在 + FACE.showLoading(false); + FACE.showCenterPlay(false); + } + + } + //如果广告正在播放 + //trace("adPlayClass",adPlayClass); + if (adPlayClass != null) { + new log("process:" + adPlayClass.STYLE + " ad ended"); + this.sendJS(adPlayClass.STYLE + "Ad", "ended"); + adPlayClass.close(); + adPlayClass = null; + } else { + //trace(adUrl , adFrontPlayed && adUrl.hasOwnProperty("front") , adUrl["front"]); + if (adUrl && !adFrontPlayed && adUrl.hasOwnProperty("front") && adUrl["front"]) { //如果前置广告没有播放而又有前置广告则播放前置广告 + trace("需要播放前置"); + closePauseAd(); + frontAdPlay() + return; + } + } + if (vPlayer) { //如果播放对象存在 + if (vPlayer.haveNetStream()) { //如果播放对象存在流,则播放 + vPlayer.videoPlay(); + new log("netStream:play"); + this.sendJS("play"); + this.sendJS("paused", false); + if (!otherInterVal) { + otherInterVal = new timeInterval(1000, otherInterValHandler); + otherInterVal.start(); + } + } else { //如果不存在,则设置成加载完自动播放 + vPlayer.NOPLAY = false; + } + + } else { + noPlay = false; + newPlayer(); + } + if (FACE) { + FACE.showCenterPlay(false); + FACE.showButton("pause"); + FACE.showButton("play", false); + } + firstPlay = false; + adInsertPlayed = false; + //trace("执行了:videoPlay=="); + if (element) { + element.changePauseded(false); + } + } + public function videoPause(b: Boolean = true): void { + trace("执行了main:videoPause"); + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + vPlayer.videoPause(); + new log("netStream:pause"); + this.sendJS("pause"); + this.sendJS("paused", true); + if (FACE) { + FACE.showCenterPlay(); + FACE.showButton("play"); + FACE.showButton("pause", false); + } + } + if (element) { + element.changePauseded(true); + } + if (!firstPlay) { + closePauseAd(); + } + if (b) { + adPausePlay(); + } + + } + public function playOrPause(): void { + if (vPlayer && vPlayer.haveNetStream()) { + if (vPlayer.getPaused()) { + videoPlay(); + } else { + videoPause(); + } + } else { + videoPlay(); + } + } + public function changeVolume(vol: Number, face: Boolean = true): void { + //如果face=true,则调用face里的相关函数 + //trace("调节音量:", vol); + nowVolume = vol; + if (vPlayer && vPlayer.haveNetStream()) { + vPlayer.changeVolume(vol); + new log("volume:" + vol); + this.sendJS("volume", vol); + //sendVolume + if (C.CONFIG["flashvars"]["variable"] != "") { + script.callJs(C.CONFIG["flashvars"]["variable"] + ".sendVolume", vol); + } + } + if (face && FACE) { + FACE.volumeSliderChange(vol); + } + } + public function videoMute(): void { + //trace("执行了:videoMute"); + new log("mute:true"); + this.sendJS("mute", true); + tempVolume = nowVolume; + nowVolume = 0; + changeVolume(0); + } + public function videoEscMute(): void { + //trace("执行了:videoEscMute"); + new log("mute:false"); + sendJS("mute", false); + + if (tempVolume == 0) { + tempVolume = FLASHVARS["volume"]; + } + if (tempVolume == 0) { + tempVolume = 0.8; + } + changeVolume(tempVolume); + } + public function adMute(): void { + //trace("执行了adMute"); + new log("adMute:true"); + this.sendJS("adMute", true); + if (adPlayClass) { + adPlayClass.adMute(); + } + } + public function escAdMute(): void { + //trace("执行了adEscMute"); + new log("adMute:false"); + this.sendJS("adMute", false); + if (adPlayClass) { + adPlayClass.adMute(false); + } + } + public function videoBrightness(n: int = 0): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoBrightness:" + n); + this.sendJS("videoBrightness", n); + vPlayer.videoBrightness(n); + } + } + public function videoContrast(n: Number = 127.5): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoContrast:" + n); + this.sendJS("videoContrast", n); + vPlayer.videoContrast(n); + } + } + public function videoSaturation(n: int = 1): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoSaturation:" + n); + this.sendJS("videoSaturation", n); + vPlayer.videoSaturation(n); + } + } + public function videoHue(n: int = 0): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoHue:" + n); + this.sendJS("videoHue", n); + vPlayer.videoHue(n); + } + } + public function videoZoom(n: Number = 1): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoZoom:" + n); + this.sendJS("videoZoom", n); + vPlayer.videoZoom(n); + } + } + public function videoProportion(w: int = 0, h: int = 0): void { + if (vPlayer && vPlayer.haveNetStream() && !errorShow) { + new log("videoProportion:width" + w + ",height:" + h); + this.sendJS("videoProportion", { + width: w, + height: h + }); + vPlayer.videoProportion(w, h); + } + } + public function videoError(error: String = ""): void { + if (error) { + errorShow = true; + if (vPlayer) { + vPlayer.clear(); + } + } else { + errorShow = false; + } + if (FACE) { + if (error) { + new log("error:" + error); + this.sendJS("error", error); + //trace(vPlayer["ddd"]["=="]); + //trace(error); + FACE.errorShow(error); + if (posterFun) { + posterFun.hide(); + } + + } else { + FACE.errorShow(""); + } + } + } + public function volumeDown(): void { + nowVolume -= C.CONFIG["config"]["volumeJump"]; + if (nowVolume < 0) { + nowVolume = 0; + } + changeVolume(nowVolume); + } + public function volumeUp(): void { + nowVolume += C.CONFIG["config"]["volumeJump"]; + changeVolume(nowVolume); + } + public function fastBack(): void { //快退 + if (timeTotal == 0) { + return; + } + var value: Number = 0; + if (time - C.CONFIG["config"]["timeJump"] >= 0) { + value = time - C.CONFIG["config"]["timeJump"]; + } else { + value = 0; + } + if (!isFast(value)) { + return; + } + videoSeek(value); + new log("fastBack:" + value); + this.sendJS("fastBack", value); + } + + public function fastNext(): void { //快进 + if (timeTotal == 0) { + return; + } + var value: Number = 0; + if (time + C.CONFIG["config"]["timeJump"] <= timeTotal) { + value = (time + C.CONFIG["config"]["timeJump"]); + } else if (timeTotal > 0) { + value = timeTotal; + } + if (!isFast(value)) { + return; + } + videoSeek(value); + new log("fastNext:" + value); + this.sendJS("fastNext", value); + } + private function isFast(value: Number = 0): Boolean { + switch (C.CONFIG["config"]["timeScheduleAdjust"]) { + case 0: + return false; + break; + case 2: + if (value < time) { + return false; + } + break; + case 3: + if (value > time) { + return false; + } + break; + case 4: + //trace(timeSeek); + if (timeSeek > -1) { + if (value < timeSeek) { + return false; + } + } else { + if (value < time) { + return false; + } + } + break; + case 5: + if (value > timeMax) { + return false; + } + break; + } + return true; + } + public function videoRotation(r: Number = 0): Object { //旋转 + if (vPlayer && vPlayer.haveNetStream()) { + vPlayer.videoRotation(r); + new log("videoRotation:" + r); + this.sendJS("videoRotation", r); + } + return null; + } + public function adPlay(): void { + if (adPlayClass) { + adPlayClass.play(); + } + } + public function adPause(): void { + if (adPlayClass) { + adPlayClass.pause(); + } + } + public function controlBarIsShow(b: Boolean = true): void { + //监听控制栏是否隐藏 + controlBarShow = b; + new log("controlBar:" + b.toString()); + this.sendJS("controlBar", b); + if (vPlayer) { + vPlayer.controlBarIsShow(b); + } + } + public function getControlBarShow(): Boolean { //获取控制栏是否隐藏 + return controlBarShow; + } + public function keyDownClock(b: Boolean): void { + isKeyClock = b; + } + //构建元件 + public function addElement(obj: Object): String { + var n: int = 0; + if (FACE) { + n = FACE.getClickSpriteIndex(); + } + if (!element) { + element = new newElement(stage, this, n); + } + var sp: Sprite = element.addelement(obj); + return sp.name; + } + public function getElement(name: String): Object { + if (element) { + return element.getElement(name); + } + return false; + } + public function deleteElement(name: String): void { + if (element) { + element.deleteElement(name); + } + } + public function elementShow(name:String="",bn:Boolean=true):void { + if (element) { + element.elementShow(name,bn); + } + } + public function animate(obj: Object): String { + if (element) { + return element.animate(obj); + } + return ""; + } + public function animateResume(name: String = ""): void { + if (element) { + element.animateResume(name); + } + } + public function animatePause(name: String = ""): void { + if (element) { + element.animatePause(name); + } + } + public function deleteAnimate(name: String = ""): void { + if (element) { + element.deleteAnimate(name); + } + } + public function copy(k: String = ""): void { //复制flashvars里的值 + if (!FLASHVARS.hasOwnProperty(k)) { + new log(k + " is not present in the flashvars"); + return; + } + Clipboard.generalClipboard.clear(); + Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, FLASHVARS[k], false); + } + //共用的触发事件 + public function clickEvent(call: String = ""): void { + sendJS("clickEvent",call); + if (call == "none" || call == "" || call == null) { + return; + } + var callArr: Array = call.split("->"); + if (callArr.length == 2) { + var callM: String = callArr[0]; + var callE: String = callArr[1]; + //trace(callE,callM); + if (!callE) { + return; + } + var val: String = ""; + var eArr: Array = []; + switch (callM) { + case "actionScript": + //trace(THIS.hasOwnProperty(callE)); + if (callE.indexOf("(") > -1) { + eArr = callE.split("("); + callE = eArr[0]; + val = script.strReplace(eArr[1], [")"], [""]); + } + if (this.hasOwnProperty(callE)) { + if (val == "") { + this[callE](); + } else { + eArr = val.split(","); + switch (eArr.length) { + case 1: + this[callE](eArr[0]); + break; + case 2: + this[callE](eArr[0], eArr[1]); + break; + case 3: + this[callE](eArr[0], eArr[1], eArr[2]); + break; + case 4: + this[callE](eArr[0], eArr[1], eArr[2], eArr[3]); + break; + case 5: + this[callE](eArr[0], eArr[1], eArr[2], eArr[3], eArr[4]); + break; + case 6: + this[callE](eArr[0], eArr[1], eArr[2], eArr[3], eArr[4], eArr[5]); + break; + default: + this[callE](); + break; + } + + } + } + break; + case "javaScript": + if (callE.substr(0, 11) == "[flashvars]") { + callE = script.strReplace(callE, ["[flashvars]"], [""]); + if (FLASHVARS.hasOwnProperty(callE)) { + callE = FLASHVARS[callE]; + } else { + break; + } + } + if (callE.indexOf("(") > -1) { + eArr = callE.split("("); + callE = eArr[0]; + val = script.strReplace(eArr[1], [")"], [""]); + } + new log("callJs:" + callE + "(" + val + ")"); + if (val == "") { + + script.callJs(callE); + + } else { + script.callJs(callE, val); + } + break; + case "link": + var callLink: Array = (callE + ",").split(","); + if (callLink[0].substr(0, 11) == "[flashvars]") { + var fl: String = script.strReplace(callLink[0], ["[flashvars]"], [""]); + if (FLASHVARS.hasOwnProperty(fl)) { + callLink[0] = FLASHVARS[fl]; + } else { + break; + } + } + script.openLink(callLink[0], callLink[1]); + break; + default: + break; + } + } + } + //==============================================修改config + public function changeConfig(...arg): Boolean { + var obj: Object = C.CONFIG; + var i: int = 0; + if (script.getType(arg[0]) == "object") { + var bj: Object = arg[0]; + arg = []; + for (var k: String in bj) { + arg.push(bj[k]); + } + } + for (i = 0; i < arg.length - 1; i++) { + if (obj.hasOwnProperty(arg[i])) { + obj = obj[arg[i]]; + } else { + return false; + } + } + obj = arg[arg.length - 1]; + switch (arg.length) { + case 2: + C.CONFIG[arg[0]] = obj; + break; + case 3: + C.CONFIG[arg[0]][arg[1]] = obj; + break; + case 4: + C.CONFIG[arg[0]][arg[1]][arg[2]] = obj; + break; + case 5: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]] = obj; + break; + case 6: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]] = obj; + break; + case 7: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]] = obj; + break; + case 8: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]] = obj; + break; + case 9: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]] = obj; + break; + case 10: + C.CONFIG[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]][arg[8]] = obj; + break; + default: + return false; + break; + } + //script.traceObject(CONFIG["flashvars"]); + if (vPlayer) { + vPlayer.changeConfig(); + } + if (FACE) { + FACE.changeConfig(); + } + if (element) { + element.changeConfig(); + } + if (otherAd) { + for (i = 0; i < otherAd.length; i++) { + if (otherAd[i] != null) { + otherAd[i].changeConfig(); + } + } + } + new log("configChange"); + new log(C.CONFIG); + this.sendJS("configChange", C.CONFIG); + return true; + } + //获取config + public function getConfig(...arg): * { + if (script.getType(arg[0]) == "object") { + var bj: Object = arg[0]; + arg = []; + for (var k: String in bj) { + arg.push(bj[k]); + } + } + var obj: Object = C.CONFIG; + for (var i: int = 0; i < arg.length; i++) { + if (obj.hasOwnProperty(arg[i])) { + obj = obj[arg[i]]; + } else { + return null; + break; + } + } + return obj; + } + //打开广告链接 + public function openAdLink(): void { + if (adPlayClass) { + adPlayClass.openAdLink(); + } + } + //结束 + public function ended(): void { + //new log("enddd"); + //trace("结束播放",!adEndPlayed ,adUrl.hasOwnProperty("end") , adUrl["end"]); + new log(adUrl); + if (adUrl && !adEndPlayed && adUrl.hasOwnProperty("end")) { //如果结束广告没有播放而又有结束广告则播放结束广告 + if (adUrl["end"]) { + videoPause(); + endAdPlay(); + return; + } + + } + adEndPlayed = false; + if (adEndPlayed) { + new log("process:End ad ended"); + this.sendJS("endAd", "ended"); + } + trace("1429-videoPause"); + videoPause(); + this.sendJS("ended"); + new log("process:Ended"); + if (FLASHVARS["loop"]) { + if (vPlayer && vPlayer.haveNetStream()) { + adEndPlayed = false; + videoSeek(0); + } + } + } + //清除视频 + public function videoClear(): void { + var i: int = 0; + if (vPlayer) { + vPlayer.clear(); + vPlayer = null; + } + + if (adPlayClass) { + adPlayClass.close(); + adPlayClass = null; + } + if (otherPlay.length > 0) { + for (i = 0; i < otherPlay.length; i++) { + otherPlay[i].close(); + otherPlay[i] = null; + } + } + if (posterFun) { + posterFun.hide(); + posterFun = null; + } + if (FACE) { + FACE.clear(); + } + + //重置初始化数据 + videoUrl = null; //视频地址 + adUrl = null; //广告地址 + autoPlay = false; //是否自动播放 + noPlay = false; //加载完但不播放(因为前置广告在播放,或默认加载没有前置广告但默认暂停) + autoLoad = false; //默认加载 + firstPlay = false; //是否第一次播放 + adName = ""; + adFrontPlayed = false; //前置广告是否播放了 + adInsertPlayed = false; //插入广告是否在播放 + adEndPlayed = false; //结束广告是否播放了 + insertTimeArr = null; //插入广告的开始时间数组 + insertPlay = []; //插入广告保存是否播放的数组 + otherTimeArr = null; //其它广告的开始时间数组 + otherAdArr = []; //其它广告数组 + otherPlay = []; //其它广告保存是否播放的数组 + otherAd = []; //其它广告数组 + // + time = 0; //当前播放时间 + timeTotal = 0; + new log("videoClear"); + this.sendJS("videoClear"); + } + //播放新视频 + public function newVideo(obj: * ): void { + videoClear(); + new log("videoChange"); + this.sendJS("videoChange"); + var newObj: Object = {}; + var type: String = script.getType(obj); + switch (type) { + case "string": + case "array": + newObj = { + video: obj + }; + break; + case "object": + if (obj.hasOwnProperty("video")) { + newObj = obj; + } else { + newObj = { + video: obj + }; + } + break; + default: + new log("error:newVideo error"); + break; + + } + C.CONFIG["flashvars"] = script.simpleMergeObject(C.CONFIG["flashvars"], newObj); + C.CONFIG["flashvars"]["volume"] = nowVolume; + newVideoTimeOut = new timeOut(200, into); + + } + public function getStatus(): Object { + return getMetaDate(); + } + public function getMetaDate(): Object { + //获取播放器状态 + var objTemp: Object = {}; + var obj: Object = { + width: stage.stageWidth, + height: stage.stageHeight, + controlBarShow: controlBarShow + }; + if (vPlayer && vPlayer.haveNetStream()) { + objTemp = vPlayer.getStatus(); + obj = script.simpleMergeObject(obj, objTemp); + } + return obj; + } + public function getCurrentSrc():String{ + if (vPlayer) { + return vPlayer.getCurrentSrc(); + } + return ""; + } + //自定义插件 + public function custom(...arg): void { + if (script.getType(arg[0]) == "object") { + var bj: Object = arg[0]; + arg = []; + for (var k: String in bj) { + arg.push(bj[k]); + } + } + if (FACE) { + FACE.custom(arg); + } + } + //注册外部监听函数 + public function addListenerJS(...arg) { + listenerArr = script.addListenerArr(listenerArr, arg[0], arg[1]); + new log("javascript.addListener:" + arg[0] + "," + arg[1]); + //new log(listenerArr); + } + //删除外部监听函数 + public function removeListenerJS(...arg) { + listenerArr = script.removeListenerArr(listenerArr, arg[0], arg[1]); + new log("javascript.removeListener" + arg[0] + "," + arg[1]); + //new log(listenerArr); + } + + public function addListener(...arg): void { + if (arg.length == 2) { + if (FACE) { + FACE.addListener(arg[0], arg[1]); + } + new log("actionscript.addListener:" + arg[0] + "," + arg[1]); + } else { + if (FACE) { + FACE.addListener(arg[1], arg[2]); + } + new log("actionscript.addListener:" + arg[0] + "," + arg[1] + "," + arg[2]); + } + } + public function removeListener(...arg): void { + if (arg.length == 2) { + if (FACE) { + FACE.removeListener(arg[0], arg[1]); + } + new log("actionscript.removeListener:" + arg[0] + "," + arg[1]); + } else { + if (FACE) { + FACE.removeListener(arg[1], arg[2]); + } + new log("actionscript.removeListener:" + arg[0] + "," + arg[1] + "," + arg[2]); + } + } + public function resizeHandler(event: Event): void { + var obj: Object = { + width: stage.stageWidth, + height: stage.stageHeight + } + this.sendJS("resize", obj); + new log("resize"); + new log(obj); + } + public function enterFrameHandler(event: Event): void { + var coor:Object={ + x: mouseX, + y: mouseY + }; + if(mouseCoorObj["x"]!=mouseX && mouseCoorObj["y"]!=mouseY){ + sendJS("mouse", coor); + mouseCoorObj=coor; + } + + } + private function wheelHandler(event: MouseEvent): void { + var n: int = int(event.delta); + sendJS("wheel", n); + } + public function sendJS(name: String, value: *= null): void { + //trace(name,value); + if (name) { + //第一步向swf插件里发送 + if (FACE) { + FACE.sendJS(name, value); + } + if (listenerArr.length == 0) { + return; + } + for (var i: int = 0; i < listenerArr.length; i++) { + var arr: Array = listenerArr[i]; + if (arr[0] == name) { + if(C.CONFIG["flashvars"]["variable"]){ + script.callJs(arr[1], value,C.CONFIG["flashvars"]["variable"]) + + } + else{ + script.callJs(arr[1], value) + } + } + } + } + } + public function openUrl(url: String, target: String = '_blank', features: String = ""): void { + script.openLink(url, target, features) + } + //============================================================================================================================ + //注册外部控制函数 + private function addCallback(): void { + if (!ExternalInterface.available) { + //new log("addCallback error"); + return; + } + new log("register addCallback"); + var i: int = 0; + var ac: String = C.CONFIG["config"]["addCallback"]; + var crr: Array = ac.split(","); + var arr: Array = []; + for (i = 0; i < crr.length; i++) { + switch (crr[i]) { + case "getStatus": + arr.push([crr[i], getMetaDate]); + break; + case "addListener": + arr.push([crr[i], addListenerJS]); + break; + case "removeListener": + arr.push([crr[i], removeListenerJS]); + break; + default: + try{ + arr.push([crr[i], this[crr[i]]]); + + } + catch(event:ErrorEvent){ + + } + break; + } + } + arr.push(["getVersion", getVersion]); + for (i = 0; i < arr.length; i++) { + ExternalInterface.addCallback(arr[i][0], arr[i][1]); + } + } + //控制控制栏隐藏 + public function changeControlBarShow(show: Boolean = true): void { + if (FACE) { + FACE.changeControlBarShow(show); + } + } + //获取内部版本 + public function getVersion(): String { + return C.VERSION; + } + //截图功能 + public function screenshot(obj: String, save: Boolean = false, name: String = ""): void { + if (vPlayer) { + vPlayer.screenshot(obj, save, name); + } + } + //接受截图监听 + public function screenshotJS(obj: String, save: Boolean, name: String, base64: String) { + new log(name + ":" + base64); + this.sendJS("screenshot", { + object: obj, + save: save, + name: name, + base64: base64 + }); + } + //============================================================================================================================ + public function switchFull(): void { //操作全屏/退出全屏 + switch (stage.displayState) { + case "normal": + if (C.CONFIG["fullInteractive"] == "true") { + stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE; + } else { + stage.displayState = "fullScreen"; + } + break; + default: + stage.displayState = "normal"; + break; + } + if (FACE) { + FACE.checkFullScreen(); + } + } + public function fullScreen(): void { + switch (stage.displayState) { + case "normal": + if (C.CONFIG["fullInteractive"] == "true") { + stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE; + } else { + stage.displayState = "fullScreen"; + } + break; + } + if (FACE) { + FACE.checkFullScreen(); + } + } + public function quitFullScreen(): void { + switch (stage.displayState) { + case "fullScreen": + stage.displayState = "normal"; + break; + } + if (FACE) { + FACE.checkFullScreen(); + } + } + //===================================================按下键盘事件 + private function keyDownHandler(event: KeyboardEvent): void { + if (isKeyClock) { + return; + } + var now: Number = 0; + var keyDown: Object = C.CONFIG["config"]["keyDown"]; + //trace("按键", event.keyCode); + this.sendJS("keyDown", event.keyCode); + new log("keyDown:" + event.keyCode); + switch (event.keyCode) { + case 32: + if (adInsertPlayed || (firstPlay && adFrontPlayed) || adEndPlayed) { //如果正在播放插入广告 + break; + } + if (keyDown["space"]) { + playOrPause(); + } + break; + case 37: //左 + if (adInsertPlayed || (firstPlay && adFrontPlayed) || adEndPlayed) { //如果正在播放插入广告 + break; + } + if (keyDown["left"]) { + fastBack(); + } + break; + case 39: //右 + if (adInsertPlayed || (firstPlay && adFrontPlayed) || adEndPlayed) { //如果正在播放插入广告 + break; + } + if (keyDown["right"]) { + fastNext(); + } + break; + case 38: //上 + if (keyDown["up"]) { + volumeUp(); + } + break; + case 40: //下 + if (keyDown["down"]) { + volumeDown(); + } + break; + } + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/menu/rightMenu.as b/source/ckaction/menu/rightMenu.as new file mode 100644 index 0000000..d8f4e6e --- /dev/null +++ b/source/ckaction/menu/rightMenu.as @@ -0,0 +1,141 @@ +package ckaction.menu { + import flash.display.Sprite; + import flash.ui.ContextMenu; + import flash.ui.ContextMenuItem; + import flash.display.Sprite; + import flash.events.ContextMenuEvent; + import ckaction.C.C; + import ckaction.act.script; + import ckaction.act.MD5; + + public class rightMenu { + private var THIS: Sprite = null; + private var menu: Object = {}; + private var moreArr: Array = []; + public function rightMenu(sprite: Sprite) { + trace("构建右键菜单实例"); + // constructor code + THIS = sprite; + // + var ckNemu: Object = { + name: "ckplayer", + link: "http://www.ckplayer.com", + domain: "", + version: "version:X2" + }; + var i:int=0; + menu = C.CONFIG["menu"]; + if (menu["ckkey"] == "") { + menu = ckNemu; + } else { + if (menu["name"]) { + C.CVKEY = md5(menu["ckkey"] + "CKPLAYER_CVKEY_BVS1welO"); + var path:String=C.PATH["path"]; + trace("path",menu["domain"]); + if(menu["domain"]!=""){ + if(path.indexOf(".")==-1){ + C.CVKEY=""; + } + path=script.replace(path,["http://","https://"],["",""]); + var pathArr:Array=path.split("/"); + var startInt:int=0; + var domainArr:Array=menu["domain"].split(","); + var isNull:Boolean=false; + for(i=0;i 1) { + definitionList(urlArr, hls.startLevel); + } + bytesTotal = event.levels[hls.startLevel].fragments.length; + if (isClear) { + return; + } + hls.stream.play(); + duration = event.levels[hls.startLevel].duration; + netStatus("NetConnection.Connect.Success"); + } + private function mediaTimeHandler(event: HLSEvent): void { + //监听时间改变 + time = Math.max(0, event.mediatime.position); + + } + private function stateHandler(event: HLSEvent) { + if (event.level < urlArr.length - 1) { + definitionNow(event.level); + } + switch (event.state) { + case HLSPlayStates.PLAYING_BUFFERING: + break; + case HLSPlayStates.PAUSED_BUFFERING: + break; + case HLSPlayStates.PLAYING: + break; + case HLSPlayStates.PAUSED: + break; + case HLSPlayStates.IDLE: //播放结束 + netStatus("NetStream.Play.Stop"); + break; + default: + break; + } + } + private function fragmentHandler(event: HLSEvent): void { + //trace("hls:fragmentHandler", event.playMetrics) + } + private function ID3Handler(event: HLSEvent) { + //trace("hls:ID3Handler", event); + } + private function netStatusHandler(event: NetStatusEvent): void { + //trace("========",event.info.code); + netStatus(event.info.code); + } + private function fragmentPlayingHandler(event: HLSEvent): void { + if (vWidth == 0 && vHeight == 0) { + vWidth = event.playMetrics.video_width; + vHeight = event.playMetrics.video_height; + hls.stream.pause(); + var metaDataObj: Object = { + netStream: hls.stream, + type: "[object HLSNetStream]", + metaData: { + width: vWidth, + height: vHeight, + duration: duration, + bytesTotal: bytesTotal + + } + }; + //模拟发送监听状态 + netStatus("NetStream.Play.Start"); + streamSendOut(metaDataObj); + } + trace("hls:fragmentPlayingHandler", event); + + } + public function videoVolume(val: Number = 0): void { //修改音量 + var v: SoundTransform = hls.stream.soundTransform; + v.volume = val; + if (hls.stream) { + hls.stream.soundTransform = v; + } + + } + public function videoSeek(time: Number = 0): void { + if (hls.stream) { + var n: int = time/(duration / bytesTotal); + if (bytesLoaded < n) { + bytesLoaded = n; + } + hls.stream.seek(time); + } + } + //提供给外部调用使用 + public function getTime(): Number { + return time; + } + public function getDuration(): Number { + return duration; + } + public function getBytesLoaded(): Number { + return bytesLoaded; + } + public function getBytesTotal(): Number { + return bytesTotal; + } + public function getBufferTime(): Number { + if (hls.stream != null) { + return hls.stream.bufferTime; + } + return 0; + } + public function getBufferLength(): Number { + if (hls.stream != null) { + return hls.stream.bufferLength; + } + return 0; + } + public function videoPlay(): void { + trace("==执行了m3u8-videoPlay"); + if (hls.stream != null) { + hls.stream.resume(); + } + } + public function videoPause(): void { + if (hls.stream != null) { + hls.stream.pause(); + } + } + //提供给外部调用结束 + public function clear(): void { + isClear = true; + if (hls) { + hls.removeEventListener(HLSEvent.PLAYBACK_COMPLETE, completeHandler); + hls.removeEventListener(HLSEvent.ERROR, errorHandler); + hls.removeEventListener(HLSEvent.MANIFEST_LOADED, manifestHandler); + hls.removeEventListener(HLSEvent.MEDIA_TIME, mediaTimeHandler); + hls.removeEventListener(HLSEvent.PLAYBACK_STATE, stateHandler); + hls.removeEventListener(HLSEvent.FRAGMENT_LOADING, fragmentHandler); + hls.removeEventListener(HLSEvent.FRAGMENT_PLAYING, fragmentPlayingHandler); + hls.removeEventListener(HLSEvent.ID3_UPDATED, ID3Handler); + hls.removeEventListener(HLSEvent.FRAGMENT_LOADED, fragmentLoadedHandler); + hls.removeEventListener(HLSEvent.LOADED_BYTES,loadedBytesHandler); + hls.stream.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + hls.stream.close(); + hls = null; + } + + } + } + +} \ No newline at end of file diff --git a/source/ckaction/player/httpmerge.as b/source/ckaction/player/httpmerge.as new file mode 100644 index 0000000..97aeb2d --- /dev/null +++ b/source/ckaction/player/httpmerge.as @@ -0,0 +1,305 @@ +package ckaction.player { + import ckaction.act.script; + import ckaction.act.timeInterval; + import ckaction.C.C; + import ckaction.act.des; + import ckaction.act.timeOut; + import ckaction.process.getVideoMeta; + + public class httpmerge { + public var videoUrl: Array = []; + public var netStatus: Function = null, + streamSendOut: Function = null, + error: Function = null; //发送流状态的函数,发送流的函数,统一用来报错的函数 + public var speedFun:Function=null; + private var timeTotal: Number = 0, + bytesTotal: Number = 0; //总时间,总字节 + private var timeArr: Array = [], + bytesArr: Array = []; //时间数组,字节数组 + //private var DRAG:String=""; + private var isClear: Boolean = false; //默认不清除 + private var nowVolume: Number = 0; + private var playNum: int = 0; //当前播放的视频编号 + private var loadNum: int = 0; //加载编号 + private var bytesMax:int=0;//已加载的编号最大编号 + private var nsArr: Array = [], + streamArr: Array = []; + private var loadedArr: Array = []; //是否已加载0=没有加载,1=正在加载,2=已加载 + private var interBytes: timeInterval = null; + private var loadFrist:Boolean=true; + private var loadNext: int = 0; + private var playSeek: Number = -1; //默认要跳转的秒数,只有在跳转到新时间而相应的视频段没有加载的情况下才需要用到 + private var getMeta:getVideoMeta=null; + public function httpmerge() { + // constructor code + //DRAG=C.CONFIG["flashvars"]["drag"]; + } + public function load(): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + trace("新建了一个视频"); + //script.traceObject(videoUrl); + loadNext = C.CONFIG["config"]["loadNext"]; + var tempUrl:Object=videoUrl[0]; + if(!tempUrl.hasOwnProperty("duration") || !tempUrl.hasOwnProperty("bytesTotal")){ + getMeta=new getVideoMeta(videoUrl,loadUrl,speed); + } + else{ + loadUrl() + } + } + private function speed(t:int=0):void{ + speedFun(Math.ceil(t*100/videoUrl.length)); + } + private function loadUrl(ele:Array=null):void{ + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + if(ele!=null){ + videoUrl=ele; + } + for (var i: int = 0; i < videoUrl.length; i++) { + var stream: httpstream = new httpstream(); + if(C.CONFIG["flashvars"]["unescape"]){ + stream.videoUrl = unescape(des.getString(videoUrl[i]["file"])); + } + else{ + stream.videoUrl = des.getString(videoUrl[i]["file"]); + } + + stream.netStatus = NetStatus; + stream.streamSendOut = StreamSendOut; + stream.error = errorNow; + stream.NUM = i; + loadedArr.push(0); + nsArr.push(stream); + streamArr.push(null); + //计算总时间 + timeArr.push(Number(videoUrl[i]["duration"])); + bytesArr.push(Number(videoUrl[i]["bytesTotal"])); + } + nsArr[0].load(); + loadedArr[0]=1; + timeTotal = script.arrSum(timeArr); + bytesTotal = script.arrSum(bytesArr); + if (loadNext == 0) { + loadNext = nsArr.length; + } + } + private function NetStatus(status: String, n: int = 0) { + //trace(status); + //trace("接爱到状态",n,status,new Date().getMilliseconds()); + + //trace("httpmerge",status); + switch (status) { + case "NetStream.Play.Stop": //播放完毕 + trace(playNum,n); + if (playNum == n && playNum < nsArr.length - 1) { //说明是播放结束 + nsArr[playNum].videoPause(); + trace("开始请求下一段",new Date().getMilliseconds()); + newPlay(playNum+1, 0); //播 + } + break; + default: + break; + } + if (playNum == n) { + if (n == 0) { + if (status != "NetStream.Play.Stop") { + netStatus(status); + } + } + else if (n < nsArr.length - 1) { + if (status != "NetStream.Play.Stop" && status != "NetStream.Play.Start") { + netStatus(status); + } + } + else { + if (status != "NetStream.Play.Start") { + netStatus(status); + } + } + } + } + private function StreamSendOut(obj: Object, n: int = 0): void { + if (isClear) { + return; + } + if (streamArr[n] == null) { + streamArr[n] = obj; + } + bytesArr[n] = obj["metaData"]["bytesTotal"]; //更新当前段的字节 + if (loadFrist) { + //trace("playSeek",playSeek); + loadFrist=false; + obj["metaData"]["duration"] = timeTotal; + obj["metaData"]["bytesTotal"] = bytesTotal; + streamSendOut(obj); + } + else { + if (playNum == n) { + streamSendOut(obj); + //trace("playSeek",playSeek); + if(playSeek>-1){ + nsArr[playNum].videoSeek(playSeek); + + playSeek=-1; + } + videoVolume(nowVolume); + } + else { + nsArr[n].videoPause(); + } + } + if (!interBytes) { + interBytes = new timeInterval(200, interBytesHandler); + } + interBytes.start(); + } + private function interBytesHandler(): void { + + //判断是否需要加载下一项 + var loaded: Number = nsArr[loadNum].getBytesLoaded(); + var loadTotal: Number = nsArr[loadNum].getBytesTotal(); + if (loaded >= loadTotal) { + loadedArr[loadNum] = 2; //说明该段已加载 + if ((loadNum - playNum) < loadNext && loadNum < (nsArr.length - 1)) { + loadNum++; + if (loadedArr[loadNum] == 0) { + nsArr[loadNum].load(); + loadedArr[loadNum] = 1; //说明该段正在加载 + } + } + else { + interBytes.stop(); + } + } + } + //提供给外部调用使用 + public function getTime(): Number { + //trace(nsArr[playNum].getTime()); + //trace(nsArr[playNum].getTime(),script.arrSum(timeArr, playNum)); + //trace("当前播放:",playNum); + var temp:Number=nsArr[playNum].getTime() + script.arrSum(timeArr, playNum); + //trace(temp,"=="); + if(tempbytesMax){ + bytesMax=temp; + } + return bytesMax; + } + public function getDuration(): Number { + return timeTotal; + } + public function getBytesTotal(): Number { + return bytesTotal; + } + public function getBufferTime(): Number { + return nsArr[playNum].getBufferTime(); + } + public function getBufferLength(): Number { + return nsArr[playNum].getBufferLength(); + } + public function videoPlay(): void { + nsArr[playNum].videoPlay(); + } + public function videoPause(): void { + nsArr[playNum].videoPause(); + } + public function videoSeek(time: Number = 0): void { + //nsArr[playNum].videoSeek(); + //计算该时间属于第几段 + + var position: int = 0; //属于第几段 + var t: int = 0; + for (var i: int = 0; i < timeArr.length; i++) { + t += timeArr[i]; + if (t > time) { + position = i; + break; + } + } + + var tempTime: int = time - script.arrSum(timeArr, position); + //trace("客户",time,script.arrSum(timeArr, position-1),script.arrSum(timeArr, position),tempTime); + if (position == playNum) { //在目前已播放的段落里播放 + nsArr[playNum].videoSeek(tempTime); + } + else { //不在目前已播放的段落里播放 + //trace("要跳转的===============",timeArr, position); + nsArr[playNum].videoPause(); + newPlay(position, tempTime); + } + //trace("要跳转的",position,tempTime); + } + private function newPlay(position: int = 0, tempTime: int = 0): void { //播放指定段,指定时间 + //trace("跳转测试",streamArr[position] != null,playNum,position); + playNum = position; + if (streamArr[position] != null) { //如果要跳转的段落已加载 + //trace("执行监测时间01",new Date().getMilliseconds()); + streamSendOut(streamArr[position]); + //trace("执行监测时间02",new Date().getMilliseconds()); + nsArr[position].videoSeek(tempTime); + //trace("执行监测时间03",new Date().getMilliseconds()); + videoPlay(); + videoVolume(nowVolume); + interBytes.start(); + + } + else { + deleteLoad(); + playSeek = tempTime; + loadNum = position; + interBytes.stop(); + nsArr[loadNum].load(); + loadedArr[loadNum] = 1; //说明该段正在加载 + } + } + private function deleteLoad(): void { + //清除所有在加载又没有加载完的段数 + for (var i: int = 0; i < loadedArr.length; i++) { + if (loadedArr[i] == 1 || (i -1) { + netStatus(event.info.code, NUM); + } else { + netStatus(event.info.code); + } + } else { + if (event.info.code != "NetStream.Play.Stop") { + if (NUM > -1) { + netStatus(event.info.code, NUM); + } else { + netStatus(event.info.code); + } + } else { + //trace("=======",getTime() , duration - C.CONFIG["config"]["bufferTime"] * 0.001,duration,C.CONFIG["config"]["bufferTime"] * 0.001); + if (getTime() >= duration - C.CONFIG["config"]["bufferTime"] * 0.01) { + if (NUM > -1) { + netStatus(event.info.code, NUM); + } else { + netStatus(event.info.code); + } + sendStop = true; + } else { + videoPlay(); + if (!stopTimer) { + stopTimer = new timeInterval(C.CONFIG["config"]["bufferTime"] - 1, stopTimerHandler); + } + stopTimer.start(); + //trace("延迟秒数",(duration - getTime())); + new timeOut((duration - getTime()) * 1000, function () { + if (!sendStop) { + //trace("确保发送") + sendStop = true; + if (stopTimer) { + stopTimer.close(); + stopTimer = null; + } + if (NUM > -1) { + netStatus("NetStream.Play.Stop", NUM); + } else { + netStatus("NetStream.Play.Stop"); + } + } + }); + } + } + } + switch (event.info.code) { + case "NetConnection.Connect.Success": + connectStream(); + break; + default: + break; + } + //trace(event.info.code); + + } + private function stopTimerHandler(): void { + if (getTime() >= duration) { + //trace("发送成功"); + if (NUM > -1) { + netStatus("NetStream.Play.Stop", NUM); + } else { + netStatus("NetStream.Play.Stop"); + } + sendStop = true; + stopTimer.close(); + stopTimer = null; + } + //trace("检查发送"); + } + private function securityErrorHandler(event: SecurityErrorEvent): void {} + private function netSteameErrorHandler(event: AsyncErrorEvent): void {} + private function connectStream(): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + if (!playUrl) { + playUrl = videoUrl; + } + var customClient = new Object(); + customClient.onMetaData = metaDataHandler; + ns = new NetStream(nc); + ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + ns.useHardwareDecoder=usehardwareeecoder; + ns.client = customClient; + ns.play(playUrl); + } + private function metaDataHandler(info: Object): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + var metaDataObj: Object = {}; + if (!info.hasOwnProperty("duration")) { + info["duration"] = 0; + } + if (frist) { + info = script.getHttpKey(info); + info["bytesTotal"] = ns.bytesTotal; + videoMeta = info; + if (!info.hasOwnProperty("keytime")) { + DRAG = ""; + } + metaDataObj = { + type: "[object NetStream]", + metaData: info + }; + + } + metaDataObj["netStream"] = ns; + if (bytesTotal == 0 && ns.bytesTotal > 0) { + bytesTotal = ns.bytesTotal; + } + if (duration == 0 && info["duration"] > 0) { + duration = info["duration"]; + } + frist = false; + if (!info.hasOwnProperty("width")) { + clear(); + error("There is no width for video metadata"); + return; + } + if (!info.hasOwnProperty("height")) { + clear(); + error("There is no height for video metadata"); + return; + } + + + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + if (NUM > -1) { + //trace("运行了load",NUM,metaDataObj); + streamSendOut(metaDataObj, NUM); + //trace("运行了load==", NUM); + } else { + streamSendOut(metaDataObj); + } + + } + + + private function newPlayUrl(time: Number = 0): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + //trace(videoMeta["keytime"]); + var keytime: Array = videoMeta["keytime"]; + //trace(keytime.length); + var keyframes: Array = videoMeta["keyframes"]; + var index: int = 0; + var start: String = ""; + for (var i: int = 0; i < keytime.length; i++) { + if (time < keytime[i]) { + index = i > 0 ? i - 1 : i; + break; + } + } + if (time > keytime[keytime.length - 1]) { + index = keytime.length - 1; + } + //trace("++++++++++++++++++++++++++++++++++",time); + //trace(index); + //trace(keytime[index]); + //trace("++++++++++++++++++++++++++==========++++++++"); + //script.log(time); + //script.log(keytime); + //mp4文件按关键时间点 + var drag: String = script.replace(DRAG, ["time_", "frames_"], ["", ""]); + if (script.getFileExt(videoUrl) == ".mp4") { + start = drag + "=" + keytime[index]; + } else { + start = drag + "=" + keyframes[index]; + } + if (DRAG.indexOf("time_") > -1) { + start = drag + "=" + keytime[index]; + } + if (DRAG.indexOf("frames_") > -1) { + start = drag + "=" + keyframes[index]; + } + startTime = keytime[index]; + startBytes = keyframes[index]; + if (videoUrl.indexOf("?") > -1) { + playUrl = videoUrl.replace("?", "?" + start + "&"); //videoUrl + "&" + start; + } else { + playUrl = videoUrl + "?" + start; + } + //trace(keytime[index]); + //trace(playUrl); + + startTimeNum = 0; //重置计数 + startLoadNum=0; + if (ns) { + ns.close(); + ns.play(playUrl); + } + + } + private function getNewTime(time: Number): Number { //根据当前加载量计算跳转时间 + //var bytesLoaded: Number = ns.bytesLoaded; + //var bytesTotal: Number = ns.bytesTotal; + var limitTime: Number = ns.bytesLoaded * duration / bytesTotal; + if (time > limitTime) { + return limitTime; + } + return time; + } + //提供给外部调用使用 + public function getTime(): Number { + if (ns) { + var time: Number = ns.time; + //trace("time:",time,startTime,startTimeNum); + if (time < startTime && startTimeNum<300 && time>0) { + startTimeNum++; + } + if (time < startTime || startTimeNum > 6) { + time += startTime; + } + return time; + } + return 0; + + } + public function getBytesLoaded(): Number { + if (ns) { + var bytesLoaded: Number = ns.bytesLoaded; + //trace("startBytes",startBytes,bytesLoaded); + if (bytesLoaded < startBytes && startLoadNum<300 && bytesLoaded>0) { + startLoadNum ++; + } + if (bytesLoaded < startBytes || startLoadNum > 6) { + bytesLoaded += startBytes; + } + return bytesLoaded; + } + return 0; + } + public function getDuration(): Number { + return duration; + } + public function getBytesTotal(): Number { + //trace(NUM,"总字节:",bytesTotal); + return bytesTotal; + } + public function getBufferTime(): Number { + if (ns && getTime() < getDuration() - C.CONFIG["config"]["bufferTime"] * 0.001) { + return ns.bufferTime; + } + return (C.CONFIG["config"]["bufferTime"] * 0.001) * 2; + } + public function getBufferLength(): Number { + if (ns) { + return ns.bufferLength; + } + return 0.2; + } + public function videoPlay(): void { + if (ns) { + ns.resume(); + } + } + public function videoPause(): void { + if (ns) { + ns.pause(); + } + } + public function videoSeek(time: Number = 0): void { + //trace("要跳转的时间:",time); + if (ns) { + if (DRAG == "") { + ns.seek(getNewTime(time)); + } else { + if (playUrl.indexOf(script.replace(DRAG, ["time_", "frames_"], ["", ""]) + "=") > -1) { + newPlayUrl(time); + } else { + if (time <= getNewTime(time)) { + ns.seek(time); + } else { + newPlayUrl(time); + } + } + } + } + } + public function videoVolume(val: Number = 0): void { //修改音量 + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + var v: SoundTransform = ns.soundTransform; + v.volume = val; + if (ns) { + ns.soundTransform = v; + } + } + + public function clear(): void { + isClear = true; //设置清除 + if (nc != null) { + nc.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + nc.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + nc = null; + } + if (ns != null) { + ns.dispose(); + ns.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + ns = null; + } + } + //提供给外部调用结束 + } + +} \ No newline at end of file diff --git a/source/ckaction/player/player.as b/source/ckaction/player/player.as new file mode 100644 index 0000000..3ad557d --- /dev/null +++ b/source/ckaction/player/player.as @@ -0,0 +1,1037 @@ +package ckaction.player { + import flash.events.Event; + import ckaction.act.script; + import ckaction.C.C; + import ckaction.player.httpstream; + import ckaction.player.rtmpstream; + import ckaction.player.httpm3u8; + import ckaction.player.httpmerge; + import flash.media.Video; + import flash.display.Stage; + import flash.display.Sprite; + import flash.net.NetStream; + import ckaction.act.timeInterval; + import fl.motion.ColorMatrix; + import flash.filters.ColorMatrixFilter; + import ckaction.act.log; + import ckaction.act.des; + import ckaction.act.timeOut; + import flash.net.FileReference; + import com.adobe.images.JPGEncoder; + import flash.display.BitmapData; + import flash.utils.ByteArray; + import com.dynamicflash.util.Base64; + + public class player { + private var STAGE: Stage = null; + private var THIS: Sprite = null; + private var playNum: int = 0; + private var video: Video = null; + private var stageW: int = 0, + stageH: int = 0; + private var stream: Array = new Array(); + private var netStreamObj: Object = new Object(); + private var metaDataObj: Object = {}; //视频默认的元数据 + private var bg: Object = {}; + private var FLASHVARS: Object = {}; + public var NOPLAY: Boolean = false; //是否不自动播放 + public var firstSeek: Number = 0; + public var volume: Number = 0; + public var timeCorrect: Number = 0; + //计时器 + private var timeInterVal: timeInterval = null, + loadInterVal: timeInterval = null, + bufferInterVal: timeInterval = null; + private var timeFrequency: int = 100; + private var isClear: Boolean = false; + private var loadIndex: int = 0; + private var paused: Boolean = false; + private var ended: Boolean = false; + private var nowRotation: int = 0; + //计算加载速度 + private var oldByte: Number = 0; + private var loadSpeed: Number = 0; + //buffer + private var bufferB: Number = 0 + public var vType: String = ""; + private var tempUrl: String = ""; + private var streamClosed: Boolean = false; + private var brightness: int = 0, + contrast: Number = 127.5, + saturation: int = 1, + hue: int = 0; + private var zoom: Number = 1; + private var proportion: Object = { + width: 0, + height: 0 + }; + private var loadTime:Number=0;//加载的时间 + private var errorNum: int = 0; //错误重试次数 + private var rtmpLink: Boolean = false; //是否需要暂停后重连接 + /* + private var httpNetStream: httpstream = null; + private var rtmpNetStream: rtmpstream = null; + private var httpM3u8: httpm3u8 = null; + private var httpMerge:httpmerge=null;//多段视频播放 + */ + private var nowPlayUrl: String = ""; + public function player(stage: Stage, sprite: Sprite, noPlay: Boolean = false, index: int = 0, n: int = 0, seek: int = 0) { + // constructor code + //trace("新建了一个player", firstSeek); + STAGE = stage; + THIS = sprite; + NOPLAY = noPlay; + //trace("NOPLAY===",NOPLAY); + loadIndex = index; + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + playNum = n; + firstSeek = seek; + STAGE.addEventListener(Event.RESIZE, function (event: Event) { + resizeHandler(); + }); + var config: Object = C.CONFIG; + timeFrequency = config["config"]["timeFrequency"]; + bg = config["style"]["video"]["reserve"]; + FLASHVARS = config["flashvars"]; + volume = FLASHVARS["volume"]; + nowRotation = FLASHVARS["rotation"]; + errorNum = 0; + loadHandler(); + } + private function loadHandler(): void { + //trace("调用了一次loadHandler", C.CONFIG["flashvars"]["live"]); + stream = []; + //netStreamObj=null; + if (timeInterVal) { + timeInterVal.stop(); + } + var config: Object = C.CONFIG; + if (!metaDataObj.hasOwnProperty("width") || !metaDataObj.hasOwnProperty("height")) { + metaDataObj = { + width: config["style"]["videoDefault"]["defaultWidth"], + height: config["style"]["videoDefault"]["defaultHeight"] + }; + } + //格式化视频地址 + if (!config["flashvars"]["video"]) { + error("No video url"); + return; + } + var videoArr: Array = config["flashvars"]["video"]; + if (videoArr.length == 0) { + error("No video url"); + return; + } + var vObj: Object = videoArr[playNum]; + //script.traceObject(vObj); + if (vObj.hasOwnProperty("video")) { + var httpMerge: httpmerge = new httpmerge(); + httpMerge.videoUrl = vObj["video"]; + httpMerge.speedFun = speedFunction; + stream.push(httpMerge); + } else { + //script.traceObject(vObj); + if (vObj.hasOwnProperty("type")) { + vType = vObj["type"]; + } + if (!vType && vObj.hasOwnProperty("file")) { + vType = script.getFileExt(vObj["file"]); + } + vType = vType.replace("video/", "").replace(".", ""); + switch (vType) { + case "m3u8": + var httpM3u8: httpm3u8 = new httpm3u8(); + httpM3u8.stage = STAGE; + httpM3u8.definitionList = definitionList; + httpM3u8.definitionNow = definitionNow; + httpM3u8.speedFun=speedFun; + stream.push(httpM3u8); + break; + case "rtmp": + var rtmpNetStream: rtmpstream = new rtmpstream(); + rtmpNetStream.secureToken = C.CONFIG["flashvars"]["securetoken"]; + rtmpNetStream.fcsubscribe = C.CONFIG["flashvars"]["fcsubscribe"]; + rtmpNetStream.username = C.CONFIG["flashvars"]["username"]; + rtmpNetStream.password = C.CONFIG["flashvars"]["password"]; + rtmpNetStream.userid = C.CONFIG["flashvars"]["userid"]; + rtmpNetStream.videoWH = C.CONFIG["style"]["video"]; + rtmpNetStream.bufferTime= C.CONFIG["config"]["rtmpBufferTime"]; + stream.push(rtmpNetStream); + break; + default: + var httpNetStream: httpstream = new httpstream(); + stream.push(httpNetStream); + break; + } + //trace("==========",vObj); + if (!tempUrl && vObj.hasOwnProperty("file")) { + tempUrl = des.getString(vObj["file"]); + } + if (C.CONFIG["flashvars"]["unescape"]) { + if(vObj.hasOwnProperty("file")){ + nowPlayUrl = unescape(des.getString(vObj["file"])); + } + else{ + nowPlayUrl=vObj.toString(); + } + + } else { + if(vObj.hasOwnProperty("file")){ + nowPlayUrl = des.getString(vObj["file"]); + } + else{ + nowPlayUrl=vObj.toString(); + } + } + stream[0].videoUrl = nowPlayUrl; + THIS["sendJS"]("playFile", nowPlayUrl); + } + stream[0].netStatus = netStatus; + try{ + stream[0].usehardwareeecoder = C.CONFIG["config"]["usehardwareeecoder"]; + } + catch(event: Error){ + + } + stream[0].streamSendOut = streamSendOut; //changeNetStream + stream[0].error = error; + stream[0].load(); + } + private function speedFunction(sp: int = 0): void { + //trace("sp:",sp); + THIS["getPlayerData"]({ + name: "showBuffer", + val: sp + }); + } + //当修改了C.CONFIG后 + public function changeConfig() { + var config: Object = C.CONFIG; + timeFrequency = config["config"]["timeFrequency"]; + bg = config["style"]["video"]["reserve"]; + FLASHVARS = config["flashvars"]; + nowRotation = FLASHVARS["rotation"]; + } + //用于交互 + public function haveNetStream(): Boolean { + return netStreamObj.hasOwnProperty("netStream"); + } + public function videoPlay(): void { + + paused = false; + if (streamClosed) { + streamClosed = false; + stream[0].clear(); + stream[0] = null; + //trace("------------------------------------------------------------loadHandler"); + loadHandler(); + return; + } + //trace("firstSeek",firstSeek); + if (firstSeek > 0) { + THIS["videoPause"](false); + var firstSeekTemp: Number = firstSeek; + if (haveNetStream()) { + firstSeek = 0; + } + new timeOut(200, function () { + THIS["videoSeek"](firstSeekTemp); + + }); + + + } else { + //trace(stream[0].getDuration(), stream[0].getTime(), ended ); + if (ended == true) { + ended = false; + //trace("结束"); + if (vType != "m3u8") { + THIS["videoSeek"](0); + } else { + stream[0].clear(); + stream[0] = null; + loadHandler(); + } + + } else { + //trace("=========================================================================调用了stream[0].videoPlay()258"); + stream[0].videoPlay(); + } + } + + + } + public function videoPause(): void { + stream[0].videoPause(); + //trace("暂停"); + paused = true; + if (rtmpLink) { + streamClosed = true; + rtmpLink = false; + NOPLAY = false; + } + } + public function changeVolume(v: Number = 1): void { + //trace("要修改成的音量:", v); + if (stream.length > 0) { + volume = v; + stream[0].videoVolume(v); + } + + } + public function videoSeek(t: Number = 0): void { + //trace("要跳转:",t); + if (stream.length > 0) { + if(t > stream[0].getDuration()){ + if(C.CONFIG["flashvars"]["forceduration"]>0){ + t = 0; + THIS["sendJS"]("ended"); + } + else{ + t = stream[0].getDuration()-0.6; + } + + // + } + if (stream[0].getDuration() > 0 && !C.CONFIG["config"]["liveAndVod"]["open"]) { + if (ended && this.vType == "m3u8") { + ended = false; + //trace("firstSeek====", firstSeek); + firstSeek = t; + stream[0].clear(); + stream[0] = null; + loadHandler(); + return; + } + if (t >= 0) { + stream[0].videoSeek(t); + } + } + if (C.CONFIG["config"]["liveAndVod"]["open"]) { + var nowDate: Date = new Date(); + if (C.CONFIG["config"]["time"] > 0) { + nowDate = new Date(C.CONFIG["config"]["time"]); + } + var minutes: int = nowDate.minutes; + var seconds: int = nowDate.seconds; + var val: Number = (C.CONFIG["config"]["liveAndVod"]["vodTime"] - 1) * 3600 + minutes * 60 + seconds - t; + if (val < 0) { + backLive(); + return; + } + var newUrl: String = tempUrl; + var start: String = C.CONFIG["config"]["liveAndVod"]["start"]; + start += ("=" + val); + if (newUrl.indexOf("?") > -1) { + newUrl = newUrl + "&" + start; + } else { + newUrl = newUrl + "?" + start; + } + //trace(newUrl); + timeCorrect = val; //记录要纠正的时间 + changeVideoUrl(newUrl); + } + + } + ended = false; + } + public function backLive(): void { + if (tempUrl != "") { + changeVideoUrl(tempUrl); + timeCorrect = 0; + } + + } + private function changeVideoUrl(url: String): void { + stream[0].clear(); + stream[0] = null; + C.CONFIG["flashvars"]["video"][playNum]["file"] = url; + loadHandler(); + + } + public function getPaused(): Boolean { + return paused; + } + //用于交互结束 + private function netStatus(status: String) { + trace(status); + THIS["netStatus"](status); + switch (status) { + case "NetStream.Play.Stop": //播放完毕 + ended = true; + break; + case "NetConnection.Connect.Closed": //流被关闭了 + streamClosed = true; + if (!C.CONFIG["flashvars"]["live"]) { + firstSeek = stream[0].getTime(); + } + if (!paused) { + //trace("==================THIS[\"videoPlay\"]();==368"); + THIS["videoPlay"](); + } + break; + default: + break; + } + } + private function formatMetaDataObj(obj):Object{//用来格式化视频的宽和高度 + var k:String=""; + if (!obj.hasOwnProperty("width")) { + for(k in obj){ + if(k.toLowerCase().indexOf("width")>-1){ + if(int(obj[k])>0){ + obj["width"]=obj[k]; + } + } + } + } + if (!obj.hasOwnProperty("height")) { + for(k in obj){ + if(k.toLowerCase().indexOf("height")>-1){ + if(int(obj[k])>0){ + obj["height"]=obj[k]; + } + } + } + } + return obj; + } + private function streamSendOut(obj: Object): void { + if (isClear) { + return; + } + trace("=============接受了一次streamSendOut"); + //script.traceObject(obj["metaData"]); + //trace("没有",obj.hasOwnProperty("metaData")); + if (!obj.hasOwnProperty("metaData")) { + new log("There is no metadata for netStream"); + //return; + } + if (video != null) { + changeNetStream(obj); + return; + } + + netStreamObj = obj; + metaDataObj = script.mergeObject(metaDataObj, obj["metaData"]); + //script.traceObject(netStreamObj); + //trace("metaDataObj", metaDataObj["width"], metaDataObj["height"]); + //metaDataObj=formatMetaDataObj(metaDataObj); + if (!metaDataObj.hasOwnProperty("width")) { + metaDataObj["width"] = C.CONFIG["style"]["video"]["defaultWidth"]; + } + if (metaDataObj["width"] == 0) { + metaDataObj["width"] = C.CONFIG["style"]["video"]["defaultWidth"]; + } + if (!metaDataObj.hasOwnProperty("height")) { + metaDataObj["height"] = C.CONFIG["style"]["video"]["defaultHeight"]; + } + if (metaDataObj["height"] == 0) { + metaDataObj["height"] = C.CONFIG["style"]["video"]["defaultHeight"]; + } + //script.traceObject(metaDataObj); + var cObj: Object = { + stageW: stageW, + stageH: stageH, + eleW: proportion["width"] > 0 ? proportion["width"] : metaDataObj["width"], + eleH: proportion["height"] > 0 ? proportion["height"] : metaDataObj["height"], + stretched: bg["stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + var coor: Object = script.getCoor(cObj); + if (video) { + video.clear(); + video = null; + } + if(vType!="rtmp"){ + netStreamObj["netStream"].bufferTime = C.CONFIG["config"]["bufferTime"] * 0.001; + } + else{ + netStreamObj["netStream"].bufferTime = C.CONFIG["config"]["rtmpBufferTime"] * 0.001; + } + + if (C.CONFIG["config"]["bufferTimeMax"] > 0) { + netStreamObj["netStream"].bufferTimeMax = C.CONFIG["config"]["bufferTimeMax"] * 0.001; + } + changeVolume(volume); + video = new Video(coor["width"], coor["height"]); + video.x = coor["x"]; + video.y = coor["y"]; + video.attachNetStream(netStreamObj["netStream"]); + //trace("当前视频流的宽高", video.videoHeight, video.videoWidth); + video.smoothing = true; + THIS.addChildAt(video, loadIndex); + trace(video.width,video.height,video.x,video.y,loadIndex); + //netStreamObj["netStream"].resume(); + if (nowRotation != 0) { + videoRotation(nowRotation, true); + } + //trace(stream[0].getDuration(), !C.CONFIG["flashvars"]["live"], !C.CONFIG["config"]["liveAndVod"]["open"]); + if (stream[0].getDuration() > 0 && !C.CONFIG["flashvars"]["live"] && !C.CONFIG["config"]["liveAndVod"]["open"]) { + //trace("总时间:",stream[0].getDuration()); + THIS["getPlayerData"]({ + name: "changeTimeTotal", + val: stream[0].getDuration() + }); + //trace("总时间:",stream[0].getDuration()); + } else if (C.CONFIG["config"]["liveAndVod"]["open"] && !C.CONFIG["flashvars"]["live"]) { + THIS["getPlayerData"]({ + name: "changeTimeTotal", + val: C.CONFIG["config"]["liveAndVod"]["vodTime"] * 3600 + }); + } else { + //trace("修改了live"); + C.CONFIG["flashvars"]["live"] = true; + } + //trace("+++",C.CONFIG["flashvars"]["live"]); + timeInterVal = new timeInterval(timeFrequency, timeInterValHandler); + timeInterVal.start(); + //trace("vType:==========================",vType); + if (stream[0].getBytesTotal() > 0) { + if (stream[0].getBytesTotal() > 0) { + THIS["getPlayerData"]({ + name: "changeLoadTotal", + val: stream[0].getBytesTotal() + }); + } + //trace("添加了监听加载量的计算"); + loadInterVal = new timeInterval(timeFrequency, loadInterValHandler); + loadInterVal.start(); + } + bufferInterVal = new timeInterval(100, bufferInterValHandler); + bufferInterVal.start(); + if (vType == "rtmp") { + if (!C.CONFIG["config"]["playCorrect"] || NOPLAY) { + //trace("video执行了暂停"); + THIS["videoPause"](false); + } + } else { + //videoPause(); + THIS["videoPause"](false); + } + //script.traceObject(C.CONFIG["flashvars"]); + //trace("NOPLAY", NOPLAY); + if (!NOPLAY) { + trace("==================THIS[\"videoPlay\"]();==519"); + THIS["videoPlay"](); + } + //trace("=收到一个流"); + THIS["changeVolume"](volume); + if (vType == "rtmp" && C.CONFIG["flashvars"]["live"] && C.CONFIG["config"]["playCorrect"]) { + rtmpLink = true; + } + } + private function changeNetStream(obj: Object): void { + netStreamObj = obj; + //script.traceObject(metaDataObj); + if (video) { + video.clear(); + video.attachNetStream(netStreamObj["netStream"]); + changeVolume(volume); + if (!C.CONFIG["config"]["playCorrect"]) { + THIS["videoPause"](false); + } + trace("==================THIS[\"videoPlay\"]();==537"); + THIS["videoPlay"](); + if (timeInterVal) { + timeInterVal.start(); + } + } + } + private function timeInterValHandler(): void { + var timeTemp: Number = stream[0].getTime(); + //trace(stream[0].getDuration() == 0 , C.CONFIG["flashvars"]["live"] , C.CONFIG["config"]["liveAndVod"]["open"]); + if (!C.CONFIG["flashvars"]["live"] && C.CONFIG["config"]["liveAndVod"]["open"]) { + timeTemp = -timeCorrect - 999; + } + //trace(stream[0].getDuration() , !C.CONFIG["flashvars"]["live"] , !C.CONFIG["config"]["liveAndVod"]["open"]); + if (stream[0].getDuration() > 0 && !C.CONFIG["flashvars"]["live"] && !C.CONFIG["config"]["liveAndVod"]["open"]) { + if (ended == true) { + timeTemp = stream[0].getDuration(); + } + THIS["getPlayerData"]({ + name: "timePlaySliderChange", + val: timeTemp + }); + THIS["getPlayerData"]({ + name: "changeVodTime", + val: timeTemp + }); + THIS["getPlayerData"]({ + name: "timePlaySimpleChange", + val: timeTemp + }); + } else { + THIS["getPlayerData"]({ + name: "changeLiveTime", + val: timeTemp + }); + if (C.CONFIG["config"]["liveAndVod"]["open"]) { + THIS["getPlayerData"]({ + name: "timePlaySliderChange", + val: timeTemp + }); + THIS["getPlayerData"]({ + name: "timePlaySimpleChange", + val: timeTemp + }); + } + + } + } + private function speedFun(b:Number):void{ + THIS["sendJS"]("speed", b); + } + private function loadInterValHandler(): void { + var loadByte: Number = stream[0].getBytesLoaded(); + if (loadByte > oldByte) { + loadSpeed = ((loadByte - oldByte) / C.CONFIG["config"]["timeFrequency"]) * (1000 / C.CONFIG["config"]["timeFrequency"]); + THIS["sendJS"]("speed", loadSpeed); + //计算当前已加载的时间 + var totalT=stream[0].getDuration(); + var totalL=stream[0].getBytesTotal(); + var nT=0; + if(totalL>0){ + nT=totalT*loadByte/totalL; + } + loadTime=nT; + THIS["sendJS"]("loadTime", nT); + THIS["sendJS"]("loadByte", loadByte); + } + oldByte = loadByte; + if (loadByte > 0) { + if (loadByte < stream[0].getBytesTotal()) { + THIS["getPlayerData"]({ + name: "timeLoadSliderChange", + val: loadByte + }); + THIS["getPlayerData"]({ + name: "timeLoadSimpleChange", + val: loadByte + }); + } else { + if (loadInterVal) { + loadInterVal.close(); + loadInterVal = null; + } + THIS["getPlayerData"]({ + name: "timeLoadSliderChange", + val: stream[0].getBytesTotal() + }); + THIS["getPlayerData"]({ + name: "timeLoadSimpleChange", + val: stream[0].getBytesTotal() + }); + THIS["sendJS"]("loadComplete"); + } + } + } + private function bufferInterValHandler(): void { + + var bufferTime: Number = stream[0].getBufferTime(); + var bufferLength: Number = stream[0].getBufferLength(); + if (bufferLength >= bufferTime || (stream[0].getTime() > stream[0].getDuration() - bufferTime)) { + THIS["getPlayerData"]({ + name: "showBuffer", + val: 100 + }); + } else { + bufferB = Math.round(bufferLength * 100 / bufferTime); + THIS["getPlayerData"]({ + name: "showBuffer", + val: bufferB + }); + } + } + //调用亮度 + + public function videoBrightness(n: int = 0): void { + if (video) { + var m: ColorMatrix = new ColorMatrix(); + var f: ColorMatrixFilter = new ColorMatrixFilter(); + m.SetBrightnessMatrix(n); //设置亮度值,值的大小是 -255--255 0为中间值,向右为亮向左为暗。 + f.matrix = m.GetFlatArray(); + video.filters = [f]; + brightness = n; + } + + } + //调整video的对比度 + public function videoContrast(n: Number = 127.5): void { + if (video) { + var m: ColorMatrix = new ColorMatrix(); + var f: ColorMatrixFilter = new ColorMatrixFilter(); + m.SetContrastMatrix(n); //设置对比度值,值的大小是 -255--255 127.5为中间值,向右对比鲜明向左对比偏暗。 + f.matrix = m.GetFlatArray(); + video.filters = [f]; + contrast = n; + } + } + //调整video的饱和度 + public function videoSaturation(n: int = 1): void { + if (video) { + var m: ColorMatrix = new ColorMatrix(); + var f: ColorMatrixFilter = new ColorMatrixFilter(); + m.SetSaturationMatrix(n); //设置饱和度值,值的大小是 -255--255 1为中间值,0为灰度值(即黑白相片)。 + f.matrix = m.GetFlatArray(); + video.filters = [f]; + saturation = n; + } + + } + //调整video的色相 + public function videoHue(n: int = 0): void { + if (video) { + var m: ColorMatrix = new ColorMatrix(); + var f: ColorMatrixFilter = new ColorMatrixFilter(); + m.SetHueMatrix(n); //设置色相值,值的大小是 -255--255 0为中间值,向右向左一试便知。 + f.matrix = m.GetFlatArray(); + video.filters = [f]; + hue = n; + } + } + //截图 + public function screenshot(obj: String, save: Boolean = false, name: String = ""): void { + var fileReference: FileReference = new FileReference(); + var encoder: JPGEncoder = new JPGEncoder(100); + var bitmapData: BitmapData = null; + if (obj == "video" && video) { + //trace("============",THIS.graphics.readGraphicsData()[loadIndex]); + //trace(new GraphicsBitmapFill(.bitmapData)); + try { + bitmapData = new BitmapData(video.width, video.height); + bitmapData.draw(video); + } catch (event: Error) { + new log("screenshot " + obj + " Error:" + event); + } + } else { + bitmapData = new BitmapData(this.stageW, this.stageH); + bitmapData.draw(THIS); + } + var data: ByteArray = encoder.encode(bitmapData); + if (save) { + if (name == "") { + if (haveNetStream()) { + name = script.getNowDate(false) + "-" + stream[0].getTime() + ".jpg"; + } else { + name = script.getNowDate(false) + ".jpg"; + } + //trace(name); + } + try { + fileReference.save(data, name); + data.clear(); + } catch (event: Error) { + new log(event); + } + } + var bs: String = "data:image/jpg;base64," + Base64.encodeByteArray(data); + THIS["screenshotJS"](obj, save, name, bs); + } + //旋转 + public function videoRotation(r: Number = 0, isR: Boolean = false): void { + if (!video || (nowRotation == r && !isR)) { + resizeHandler(); + return; + } + if (r != 1 && r != -1 && r != -90 && r != -180 && r != -270 && r != 90 && r != 270 && r != 180 && r != 0) { + resizeHandler(); + return; + } + var temp: int = 0; + if (r != -1 && r != 1) { + nowRotation = r; + } else { + if (r == 1) { + if (nowRotation < 270) { + nowRotation += 90; + } else { + nowRotation = 0; + resizeHandler(); + return; + } + } else { + if (nowRotation > -270) { + nowRotation -= 90; + } else { + nowRotation = 0; + resizeHandler(); + return; + } + } + + } + if (!isR) { + resizeHandler(); + return; + } + var wh: Object = {}; + if (metaDataObj) { + wh = { + width: metaDataObj["width"], + height: metaDataObj["height"] + } + } else { + wh = { + width: video.videoWidth, + height: video.videoHeight + } + } + var coor: Object = {}; + var obj: Object = { + stageW: stageW, + stageH: stageH, + eleW: wh["width"], + eleH: wh["height"], + stretched: bg["stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + switch (nowRotation) { + case 90: + case -270: + temp = obj["eleW"]; + obj["eleW"] = obj["eleH"]; + obj["eleH"] = temp; + coor = script.getCoor(obj); + coor["x"] = coor["x"] + coor["width"]; + if (zoom == 1) { + video.height = coor["width"]; + video.width = coor["height"]; + } else { + video.height = coor["width"] * zoom; + video.width = coor["height"] * zoom; + coor["x"] += coor["width"] * (zoom - 1) * 0.5; + coor["y"] -= coor["height"] * (zoom - 1) * 0.5; + } + break; + case 180: + case -180: + coor = script.getCoor(obj); + coor["x"] = coor["x"] + coor["width"]; + coor["y"] = coor["y"] + coor["height"]; + if (zoom == 1) { + video.height = coor["height"]; + video.width = coor["width"]; + } else { + video.height = coor["height"] * zoom; + video.width = coor["width"] * zoom; + coor["y"] += coor["height"] * (zoom - 1) * 0.5; + coor["x"] += coor["width"] * (zoom - 1) * 0.5; + } + break; + case 270: + case -90: + temp = obj["eleW"]; + obj["eleW"] = obj["eleH"]; + obj["eleH"] = temp; + coor = script.getCoor(obj); + coor["y"] = coor["y"] + coor["height"]; + if (zoom == 1) { + video.height = coor["width"]; + video.width = coor["height"]; + } else { + video.height = coor["width"] * zoom; + video.width = coor["height"] * zoom; + coor["y"] += (coor["height"] * (zoom - 1) * 0.5); + coor["x"] -= coor["width"] * (zoom - 1) * 0.5; + } + break; + default: + resizeHandler(); + return; + break; + + } + video.rotation = nowRotation; + video.x = coor["x"]; + video.y = coor["y"]; + } + //长宽比例 + public function videoProportion(w: int = 0, h: int = 0): void { + proportion = { + width: w, + height: h + }; + resizeHandler(); + } + //监听控制栏是否显示 + public function controlBarIsShow(b: Boolean): void { + if (b) { + bg = C.CONFIG["style"]["video"]["reserve"]; + } else { + bg = C.CONFIG["style"]["video"]["controlBarHideReserve"]; + } + resizeHandler(); + } + //缩放比例 + public function videoZoom(n: Number = 1): void { + if (n < 0) { + return; + } + zoom = n; + resizeHandler(); + } + private function resizeHandler(): void { + if (isClear) { + return; + } + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + if (video) { + video.rotation = 0; + } + var coor: Object = {}; + if (metaDataObj && video) { + var obj: Object = { + stageW: stageW, + stageH: stageH, + eleW: proportion["width"] > 0 ? proportion["width"] : metaDataObj["width"], + eleH: proportion["height"] > 0 ? proportion["height"] : metaDataObj["height"], + stretched: bg["stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + coor = script.getCoor(obj); + video.width = coor["width"]; + video.height = coor["height"]; + video.x = coor["x"]; + video.y = coor["y"]; + if (zoom != 1 && zoom >= 0) { + video.x -= (video.width * (zoom - 1) * 0.5); + video.y -= (video.height * (zoom - 1) * 0.5); + video.width = video.width * zoom; + video.height = video.height * zoom; + } + if (nowRotation != 0) { + videoRotation(nowRotation, true); + } + } else { + return; + } + } + public function getStatus(): Object { + if (!video) { + return null; + } + var obj: Object = { + videoWidth: video.width, + videoHeight: video.height, + streamWidth: metaDataObj["width"], + streamHeight: metaDataObj["height"], + videoX: video.x, + videoY: video.y, + width: stageW, + height: stageH, + videoRotation: nowRotation, + time: netStreamObj["netStream"].time, + totalTime: metaDataObj.hasOwnProperty("duration") ? metaDataObj["duration"] : 0, + duration: metaDataObj.hasOwnProperty("duration") ? metaDataObj["duration"] : 0, + bytesLoaded: netStreamObj["netStream"].bytesLoaded, + bytesTotal: netStreamObj["netStream"].bytesTotal, + speed: loadSpeed, + volume: volume, + buffer: bufferB, + loadTime:loadTime, + brightness: brightness, + contrast: contrast, + saturation: saturation, + hue: hue, + paused: getPaused(), + metaData: metaDataObj + } + return obj; + } + public function posterHandler(): void { + if (video) { + THIS.setChildIndex(video, loadIndex); + } + } + public function clear(): void { + isClear = true; + if (haveNetStream()) { + stream[0].clear(); + stream[0] = null; + } + if (video) { + THIS.removeChild(video); + video = null; + } + if (timeInterVal) { + timeInterVal.close(); + timeInterVal = null; + } + if (loadInterVal) { + loadInterVal.close(); + loadInterVal = null; + } + if (bufferInterVal) { + bufferInterVal.close(); + bufferInterVal = null; + } + } + public function getCurrentSrc(): String { + return nowPlayUrl; + } + private function definitionList(arr: Array, n: int = 0): void { + //获得列表后将flashvars里的video变成标准格式 + var a: Array = []; + var defTags: Array = C.CONFIG["config"]["m3u8Definition"]["tags"]; + var defName: Array = C.CONFIG["language"]["m3u8Definition"]["name"]; + for (var i: int = 0; i < arr.length; i++) { + var obj: Object = { + file: arr[i], + type: "m3u8", + weight: 0, + definition: script.formatM3u8Definition(arr[i], i, defTags, defName) + }; + if (i == n) { + obj["weight"] = 1; + } + a.push(obj); + } + nowPlayUrl = arr[n]; + C.CONFIG["flashvars"]["video"] = a; + THIS["faceDefinition"](n); + } + private function definitionNow(n: int): void { + if (!C.CONFIG["config"].hasOwnProperty("m3u8Definition")) { + return; + } + THIS["faceDefinition"](n); + } + private function error(error: String = ""): void { + if (errorNum < C.CONFIG["config"]["errorNum"]) { + streamClosed = false; + if (stream[0] != null) { + stream[0].clear(); + stream[0] = null; + } + errorNum++; + //trace("------------------------------------------------------------loadHandler-error"); + loadHandler(); + + } else { + errorNum = 0; + new log("error:" + error); + THIS["videoError"](C.CONFIG["flashvars"]["streamNotFound"] != "" ? C.CONFIG["flashvars"]["streamNotFound"] : C.CONFIG["language"]["error"]["streamNotFound"]); + } + + } + } + +} \ No newline at end of file diff --git a/source/ckaction/player/rtmpstream.as b/source/ckaction/player/rtmpstream.as new file mode 100644 index 0000000..178c7b2 --- /dev/null +++ b/source/ckaction/player/rtmpstream.as @@ -0,0 +1,266 @@ +package ckaction.player { + import flash.net.NetConnection; + import flash.net.NetStream; + import flash.events.NetStatusEvent; + import flash.events.SecurityErrorEvent; + import flash.events.AsyncErrorEvent; + import flash.media.SoundTransform; + import ckaction.act.TEA; + import ckaction.act.timeOut; + import flash.net.ObjectEncoding; + import flash.events.ErrorEvent; + + public class rtmpstream { + public var videoUrl: String = ""; + + public var netStatus: Function = null, + streamSendOut: Function = null, + error: Function = null; //发送流状态的函数,发送流的函数,统一用来报错的函数 + public var secureToken: String = ""; //secureToken验证串 + public var fcsubscribe: Boolean = false; //是否采用FC + public var username: String = "", + password: String = ""; + public var userid:int=0; + public var videoWH:Object={ + defaultWidth:4, + defaultHeight:3 + }; + public var usehardwareeecoder:Boolean=false; + public var bufferTime:int=0; + private var nc: NetConnection = null; + private var ns: NetStream = null; + private var rtmp: String = "", + live: String = ""; + private var isClear: Boolean = false; //默认不清除 + private var ncClose: Boolean = false; + private var first: Boolean = true; + private var duration: Number = 0; + private var isInfo:Boolean=false; + + public function rtmpstream() { + // constructor code + } + + public function load(): void { + trace("新建了一个rtmp_load"); + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + //分析地址 + var arr: Array = videoUrl.split("|"); + if (arr.length == 2) { + rtmp = arr[0]; + live = arr[1]; + } else { + videoUrl.replace("mp4:mp4","mp4"); + arr = videoUrl.split("mp4:"); + if (arr.length >= 2) { + rtmp = arr[0]; + if(rtmp.lastIndexOf("/")==rtmp.length-1){ + rtmp=rtmp.substr(0,rtmp.lastIndexOf("/")); + } + for(var i:int=1;i 0) { + arr.push(videoUrl.substr(0, x), videoUrl.substr(x + 1)); + } + if (arr.length == 2) { + rtmp = arr[0]; + live = arr[1]; + } + } + } + trace("rtmp:"+rtmp); + trace("live:"+live); + //return; + nc = new NetConnection(); + nc.client=this; + nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); + nc.objectEncoding=ObjectEncoding.AMF0; + //nc.connect(rtmp); + if (userid > 0) { + nc.connect(rtmp, userid); + } + else if (username != "" && password == "") { + nc.connect(rtmp + '?' + username.replace("|", "&")); + } + else if (username != "" && password != "") { + nc.connect(rtmp, username, password); + } + else { + nc.connect(rtmp); + } + trace(rtmp); + } + private function netStatusHandler(event: NetStatusEvent): void { + trace(event.info.code); + //return; + netStatus(event.info.code); + switch (event.info.code) { + case "NetConnection.Connect.Success": + if (secureToken && event.info.secureToken != undefined) { + nc.call("secureTokenResponse", null, TEA.decrypt(event.info.secureToken, secureToken)); + } + if (fcsubscribe) { + nc.call("FCSubscribe", null, live); + } + connectStream(); + break; + case "NetStream.Play.Start": + new timeOut(500,function(){ + trace("发送没有"); + if(!isInfo){ + metaDataHandler({ + width:videoWH["defaultWidth"], + height:videoWH["defaultHeight"], + duration:0 + }); + } + }); + break; + case "NetConnection.Connect.Closed": //针对rtmp流暂停后被关闭的操作 + ncClose = true; + break; + default: + break; + } + } + private function securityErrorHandler(event: SecurityErrorEvent): void {} + private function netSteameErrorHandler(event: AsyncErrorEvent): void {} + private function asyncErrorHandler(event: AsyncErrorEvent): void {} + private function connectStream(): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + var customClient = new Object(); + ns = new NetStream(nc); + ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + customClient.onMetaData = metaDataHandler; + ns.client = customClient; + //useHardwareDecoder + ns.useHardwareDecoder=usehardwareeecoder; + trace("缓冲",bufferTime*0.001); + //ns.bufferTime=bufferTime*0.001; + ns.play(live); + trace("live",live); + //ns.pause(); + } + private function metaDataHandler(info: Object): void { + if(isInfo){ + return; + } + isInfo=true; + //ns.pause(); + if (first) { + first = false; + info["bytesTotal"] = 0; + var metaDataObj: Object = {}; + //info["bytesTotal"] = ns.bytesTotal; + metaDataObj = { + type: "[object NetStream]", + metaData: info + }; + metaDataObj["netStream"] = ns; + if(info.hasOwnProperty("duration")){ + duration = info["duration"]; + } + else{ + duration = 0; + } + + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + trace("发送了一次"); + streamSendOut(metaDataObj); + + } + } + //供外部播放时调用 + public function getNs():NetStream{ + return ns; + } + //提供给外部调用使用 + public function getTime(): Number { + if (ns) { + return ns.time; + } + return 0; + } + public function getDuration(): Number { + return duration; + } + public function getBytesLoaded(): Number { + return 0; + } + public function getBytesTotal(): Number { + return 0; + } + public function getBufferTime(): Number { + if (ns) { + return ns.bufferTime; + } + return 0; + } + public function getBufferLength(): Number { + if (ns) { + return ns.bufferLength; + } + return 0; + } + public function videoPlay(): void { + trace("================================================================调用了videoPlay()"); + if (ns) { + trace("================================================================调用了ns.resume()"); + ns.resume(); + } + } + public function videoPause(): void { + if (ns) { + ns.pause(); + } + } + //提供给外部调用结束 + public function clear(): void { + isClear = true; //设置清除 + if (ns) { + if (!ncClose) { + ns.dispose(); + } + ns.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + ns = null; + } + if (nc) { + nc.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + nc.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + nc.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); + nc = null; + } + } + public function videoSeek(time: Number = 0): void { + if (ns) { + ns.seek(time); + } + } + public function videoVolume(val: Number = 0): void { //修改音量 + var v: SoundTransform = ns.soundTransform; + v.volume = val; + if (ns) { + ns.soundTransform = v; + } + + } + } + +} \ No newline at end of file diff --git a/source/ckaction/process/analysis.as b/source/ckaction/process/analysis.as new file mode 100644 index 0000000..ed288f5 --- /dev/null +++ b/source/ckaction/process/analysis.as @@ -0,0 +1,246 @@ +package ckaction.process { + import ckaction.act.script; + import ckaction.act.loadXml; + + public class analysis { + private var success:Function=null; + private var advObj:Object=null; + public function analysis(obj:*,f:Function) { + // constructor code + success=f; + analysisObj(obj); + } + private function analysisObj(obj:*):void{ + var objType=script.getType(obj); + if(objType=="object"){ + advObj=obj; + + front(); + } + else if(objType=="string"){ + if(obj==""){ + success(null); + return; + } + new loadXml(obj.replace("website:",""),analysisObj) + } + else{ + success(null); + } + } + private function front():void{ + //分析前置广告 + if(advObj.hasOwnProperty("front")){ + analysisFrontObj(advObj["front"]); + } + else{ + pause(); + } + } + private function analysisFrontObj(obj:*):void{ + //分析前置广告 + //trace("分析前置广告"); + var objType=script.getType(obj); + if(objType=="object"){ + if(obj.hasOwnProperty("front")){ + obj=obj["front"]; + objType=script.getType(obj); + } + } + if(objType=="object" || objType=="array"){ + //trace("++||++",checkFormat(obj)); + if(checkFormat(obj)){ + advObj["front"]=obj; + } + else{ + advObj["front"]=null; + } + pause(); + } + else{ + if(obj==""){ + pause(); + return; + } + new loadXml(obj,analysisFrontObj) + } + } + private function pause():void{ + //分析暂停广告 + if(advObj.hasOwnProperty("pause")){ + analysisPauseObj(advObj["pause"]); + } + else{ + insert(); + } + } + private function analysisPauseObj(obj:*):void{ + //分析暂停广告 + var objType=script.getType(obj); + if(objType=="object"){ + if(obj.hasOwnProperty("pause")){ + obj=obj["pause"]; + objType=script.getType(obj); + } + } + if(objType=="object" || objType=="array"){ + if(checkFormat(obj)){ + advObj["pause"]=obj; + } + else{ + advObj["pause"]=null; + } + insert(); + } + else{ + if(obj==""){ + insert(); + return; + } + new loadXml(obj,analysisPauseObj) + } + } + private function insert():void{ + //分析中插广告 + if(advObj.hasOwnProperty("insert")){ + analysisInsertObj(advObj["insert"]); + } + else{ + end(); + } + } + private function analysisInsertObj(obj:*):void{ + //分析中插广告 + var objType=script.getType(obj); + if(objType=="object"){ + if(obj.hasOwnProperty("insert")){ + obj=obj["insert"]; + objType=script.getType(obj); + } + } + if(objType=="object" || objType=="array"){ + if(checkFormat(obj)){ + advObj["insert"]=obj; + } + else{ + advObj["insert"]=null; + } + end(); + } + else{ + if(obj==""){ + end(); + return; + } + new loadXml(obj,analysisInsertObj) + } + } + private function end():void{ + //分析结束广告 + if(advObj.hasOwnProperty("end")){ + analysisEndObj(advObj["end"]); + } + else{ + other(); + } + } + private function analysisEndObj(obj:*):void{ + //分析结束广告 + var objType=script.getType(obj); + if(objType=="object"){ + if(obj.hasOwnProperty("end")){ + obj=obj["end"]; + objType=script.getType(obj); + } + } + if(objType=="object" || objType=="array"){ + if(checkFormat(obj)){ + advObj["end"]=obj; + } + else{ + advObj["end"]=null; + } + other(); + } + else{ + if(obj==""){ + other(); + return; + } + new loadXml(obj,analysisEndObj) + } + } + private function other():void{ + //分析其它广告 + if(advObj.hasOwnProperty("other")){ + analysisOtherObj(advObj["other"]); + } + else{ + analysisEnd(); + } + } + private function analysisOtherObj(obj:*):void{ + //分析其它广告 + var objType=script.getType(obj); + if(objType=="object"){ + if(obj.hasOwnProperty("other")){ + obj=obj["other"]; + objType=script.getType(obj); + } + } + if(objType=="object" || objType=="array"){ + if(checkFormat(obj)){ + advObj["other"]=obj; + } + else{ + advObj["other"]=null; + } + analysisEnd(); + } + else{ + if(obj==""){ + analysisEnd(); + return; + } + new loadXml(obj,analysisOtherObj) + } + } + private function analysisEnd():void{ + var obj:Object={ + front:null, + pause:null, + insert:null, + other:null + }; + obj=script.mergeObject(obj,advObj); + for(var k:String in obj){ + if(script.getType(obj[k])=="object"){ + obj[k]=[obj[k]] + } + } + success(obj); + } + private function checkFormat(obj:*):Boolean{ + //判断广告格式是否符合要求 + //script.traceObject(obj); + var objType=script.getType(obj); + var objC:Object=null; + if(objType=="object"){ + objC=obj; + } + else{ + if(script.getType(obj[0])=="object"){ + objC=obj[0]; + } + else{ + return false; + } + } + if(!objC.hasOwnProperty("type") || !objC.hasOwnProperty("file")){ + return false; + } + return true; + } + } + +} diff --git a/source/ckaction/process/analysisVideoUrl.as b/source/ckaction/process/analysisVideoUrl.as new file mode 100644 index 0000000..8e514f9 --- /dev/null +++ b/source/ckaction/process/analysisVideoUrl.as @@ -0,0 +1,432 @@ +package ckaction.process { + import ckaction.act.script; + import ckaction.act.loadXml; + import ckaction.C.C; + import ckaction.act.des; + import ckaction.act.log; + import flash.events.ErrorEvent; + + public class analysisVideoUrl { + private var videoHandler: Function = null; + private var videoArr: Array = []; + public function analysisVideoUrl(fun: Function) { + // constructor code + videoHandler = fun; + //script.traceObject(C.CONFIG["flashvars"]); + analysis(C.CONFIG["flashvars"]["video"]); + } + private function analysis(video: * ): void { + trace("开始分析视频",script.getType(video)); + try { + var obj: Object = {}; + var i: int = 0; + var split:String=C.CONFIG["config"]["split"]; + //trace("开始================="); + //trace(video); + //script.traceObject(video); + //trace("=============", script.getType(video)); + //trace("结束"); + switch (script.getType(video)) { + case "object": + obj = video; + if (obj.hasOwnProperty("video")) { + if (script.getType(obj["video"]) == "array") { + if (obj["video"].length > 0) { + if (obj["video"][0].hasOwnProperty("video")) { + //新数据形式 + trace("新"); + videoArr = obj["video"]; + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + trace("执行analysisArr,39"); + analysisArr(); + } else if (obj["video"][0].hasOwnProperty("seconds")) { + //旧数据形式 + trace("旧"); + analysisOld(obj); + } else { + trace("不知道什么格式"); + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + try { + var aarr: Array = obj["video"]; + videoArr = []; + for (i = 0; i < aarr.length; i++) { + videoArr.push({ + file: aarr[i][0], + type: aarr[i][1].replace("video/", "") != "" ? aarr[i][1].replace("video/", "") : script.getFileExt(aarr[i][0]), + definition: aarr[i][2], + weight: Number(aarr[i][3]) + + }); + } + analysis(videoArr); + } catch (event: Error) { + videoArr = null; + trace("执行analysisArr,63"); + analysisArr(); + } + } + } else { + trace("格式错误"); + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + videoArr = null; + trace("执行analysisArr,71"); + analysisArr(); + } + } else { + if (obj["video"].hasOwnProperty("file") && script.getType(obj["video"]["file"]) == "array") { + analysisOld2(obj); + } else { + //video是个对象需要再加载 + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + analysis(obj["video"]); + } + + } + } else { + if (obj.hasOwnProperty("file")) { + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + videoArr = [obj]; + trace("执行analysisArr,88"); + analysisArr(); + } else if (obj.hasOwnProperty("url")) { + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + if (script.getType(obj["url"]) == "string" && obj["url"].toString().substr(0, 8) == "website:") { + analysis("website:" + obj["url"].replace("website:", "")); + } else { + videoArr = null; + trace("执行analysisArr,96"); + analysisArr(); + } + } else { + C.CONFIG["flashvars"] = script.mergeObject(C.CONFIG["flashvars"], obj); + videoArr = null; + trace("执行analysisArr,101"); + analysisArr(); + } + + } + + break; + case "array": //普通数组调用 + trace("普通数组形式的"); + trace(video); + videoArr = video; + trace("执行analysisArr,114"); + analysisArr(); + break; + default: //普通调用,字符串类型 + var str: String = video; + if (str.substr(0, 8) == "website:") { + str = des.getString(str.replace("website:", "")); + loadUrl(str); + } else { + //trace("只有地址", video); + video=decodeURIComponent(video); + new log("video-split:"+split); + if (video.indexOf(split) == -1) { + video = des.getString(video); + videoArr = [{ + file: video, + type: C.CONFIG["flashvars"]["type"] ? C.CONFIG["flashvars"]["type"] : script.getFileExt(video).replace(".", ""), + weight: 0, + definition: "" + }]; + } else { + new log("video:"+video); + trace("========================================="); + trace(video); + var vArr: Array = video.split(split); + //new log(vArr); + //script.traceObject(vArr); + var dArr: Array = [], + wArr: Array = [], + tArr:Array=[]; + if (C.CONFIG["flashvars"].hasOwnProperty("definition")) { + dArr = C.CONFIG["flashvars"]["definition"].split(","); + } + if (C.CONFIG["flashvars"].hasOwnProperty("weight")) { + wArr = C.CONFIG["flashvars"]["weight"].split(","); + } + + if (C.CONFIG["flashvars"].hasOwnProperty("type")) { + var typeTemp:String=C.CONFIG["flashvars"]["type"]; + if(typeTemp.indexOf(",")>-1){ + tArr = C.CONFIG["flashvars"]["type"].split(","); + } + else{ + tArr = C.CONFIG["flashvars"]["type"].split(split); + } + } + for (var n: int = 0; n < vArr.length; n++) { + var tObj: Object = { + file: vArr[n] + //type: C.CONFIG["flashvars"]["type"] ? C.CONFIG["flashvars"]["type"] : script.getFileExt(vArr[n]) + }; + if (dArr.length > n) { + tObj["definition"] = dArr[n]; + } + if (wArr.length > n) { + tObj["weight"] = wArr[n]; + } + if (tArr.length > n) { + tObj["type"] = tArr[n]; + } + if(!tObj.hasOwnProperty("type")){ + tObj["type"]= script.getFileExt(tObj["file"]); + } + videoArr.push(tObj); + } + } + trace("执行analysisArr,166"); + analysisArr(); + } + break; + } + } catch (event: Error) { + trace("出错"); + videoArr = null; + trace("执行analysisArr,173"); + analysisArr(); + } + } + private function analysisOld(obj: Object): void { + //分析旧版形式 + //script.traceObject(obj); + try { + var vArr: Array = obj["video"]; + var nArr: Array = []; + var type: String = ""; + var i: int = 0; + for (i = 0; i < vArr.length; i++) { + var tArr: Object = { + file: vArr[i]["file"], + bytesTotal: vArr[i]["size"], + duration: vArr[i]["seconds"] + }; + type = script.getFileExt(vArr[i]["file"]).replace(".", ""); + nArr.push(tArr); + } + var nObj: Object = { + video: nArr, + type: type, + weight: 0, + definition: "" + }; + if (obj.hasOwnProperty("flashvars") && obj["flashvars"]) { + var temp: String = script.replace(obj["flashvars"], ["{"], [""]); + var arr: Array = temp.split("}"); + var fObj: Object = {}; + for (i = 0; i < arr.length; i++) { + var temp2: String = arr[i]; + if (temp2 != "") { + var arr2: Array = temp2.split("->"); + if (arr2[0] != "" && arr2[1] != "") { + fObj[arr2[0]] = arr2[1]; + } + } + } + C.CONFIG["flashvars"] = script.mergeOldFlashvars(C.CONFIG["flashvars"], fObj); + } + videoArr = [nObj]; + trace("执行analysisArr,216"); + analysisArr(); + } catch (event: Error) { + videoArr = null; + trace("执行analysisArr,220"); + analysisArr(); + } + } + private function analysisOld2(obj: Object): void { + //分析旧版形式 + //script.traceObject(obj); + try { + var vArr: Array = obj["video"]["file"]; + var sArr: Array = obj["video"]["size"]; + var eArr: Array = obj["video"]["seconds"]; + var nArr: Array = []; + var type: String = ""; + var i: int = 0; + for (i = 0; i < vArr.length; i++) { + var tArr: Object = { + file: vArr[i], + bytesTotal: sArr[i], + duration: eArr[i] + }; + type = script.getFileExt(vArr[i]).replace(".", ""); + nArr.push(tArr); + } + var nObj: Object = { + video: nArr, + type: type, + weight: 0, + definition: "" + }; + if (obj.hasOwnProperty("flashvars") && obj["flashvars"]) { + //trace("包含flashvars"); + var temp: String = script.replace(obj["flashvars"], ["{"], [""]); + var arr: Array = temp.split("}"); + var fObj: Object = {}; + for (i = 0; i < arr.length; i++) { + var temp2: String = arr[i]; + if (temp2 != "") { + var arr2: Array = temp2.split("->"); + if (arr2[0] != "" && arr2[1] != "") { + fObj[arr2[0]] = arr2[1]; + } + } + } + //script.traceObject(fObj); + C.CONFIG["flashvars"] = script.mergeOldFlashvars(C.CONFIG["flashvars"], fObj); + } + videoArr = [nObj]; + trace("执行analysisArr,267"); + analysisArr(); + } catch (event: Error) { + videoArr = null; + trace("执行analysisArr,271"); + analysisArr(); + } + } + private function loadUrl(url: String) { //加载网址获取视频地址后应该判断是旧式的还是新式的 + //trace(url); + new loadXml(url, function (data: * ) { + //trace(data); + //script.traceObject(data); + if (data) { + analysis(data); + } else { + videoArr = null; + trace("执行analysisArr,284"); + analysisArr(); + } + }); + } + private function getAD(adv: String = "", time: String = "", link: String = ""): Array { + var vars: Object = C.CONFIG["flashvars"]; + var adArr: Array = vars[adv].split(","); + var timeArr: Array = [], + linkArr: Array = []; + var ad: Array = []; + if (vars.hasOwnProperty(time)) { + timeArr = vars[time].split(","); + } + if (vars.hasOwnProperty(link)) { + linkArr = vars[link].split(","); + } + for (var i: int = 0; i < adArr.length; i++) { + var obj: Object = { + file: adArr[i], + type: script.getFileExt(adArr[i]).replace(".", "") + }; + if (timeArr.length > i) { + obj["time"] = timeArr[i]; + } else { + obj["time"] = C.CONFIG["style"]["advertisement"]["time"]; + } + if (linkArr.length > i) { + obj["link"] = linkArr[i]; + } else { + obj["link"] = ""; + } + ad.push(obj); + } + return ad; + } + private function analysisArr(): void { + var n: int = 0, + m: int = 0, + i: int = 0; + if (videoArr) { + C.CONFIG["flashvars"]["video"] = videoArr; + for (i = 0; i < videoArr.length; i++) { + if (videoArr[i].hasOwnProperty("weight")) { + if (videoArr[i]["weight"] > n) { + n = videoArr[i]["weight"]; + m = i; + } + } + else{ + n=0; + m=i; + } + } + } + + // + //分析广告 + var fvars: Object = C.CONFIG["flashvars"]; + var front: Array = []; + var ad: Object = {}; + var isAd: Boolean = false; + if (fvars.hasOwnProperty("adfront")) { + ad["front"] = getAD("adfront", "adfronttime", "adfrontlink"); + isAd = true; + } + if (fvars.hasOwnProperty("adpause")) { + ad["pause"] = getAD("adpause", "adpausetime", "adpauselink"); + isAd = true; + } + if (fvars.hasOwnProperty("adinsert")) { + ad["insert"] = getAD("adinsert", "adinserttime", "adinsertlink"); + isAd = true; + } + if (fvars.hasOwnProperty("adend")) { + ad["end"] = getAD("adend", "adendtime", "adendlink"); + isAd = true; + } + if (isAd && ad) { + C.CONFIG["flashvars"]["advertisements"] = ad; + } + + //分析广告 + //分析提示点 + if (fvars.hasOwnProperty("promptspot") && fvars.hasOwnProperty("promptspottime")) { + if (script.getType(fvars["promptspot"]) == "string") { + var prompt: Array = fvars["promptspot"].split(","); + var prompttime: Array = fvars["promptspottime"].split(","); + var promptSpot: Array = []; + if (prompt.length == prompttime.length) { + for (i = 0; i < prompt.length; i++) { + promptSpot.push({ + words: prompt[i], + time: prompttime[i] + }); + } + C.CONFIG["flashvars"]["promptSpot"] = promptSpot; + } + } + } + //trace(fvars["previewscale"]); + if (fvars.hasOwnProperty("preview") && fvars["preview"]) { + if (script.getType(fvars["preview"]) == "string") { + C.CONFIG["flashvars"]["preview"] = { + file: fvars["preview"].split(","), + scale: fvars["previewscale"] + }; + } + } + + if (videoArr) { + //script.traceObject(videoArr[m]); + if (videoArr[m].hasOwnProperty("video")) { + if (script.getType(videoArr[m]["video"]) == "array") { + var nArr: Array = videoArr[m]["video"]; + var timeTotal: Number = 0; + for (i = 0; i < nArr.length; i++) { + if (nArr[i].hasOwnProperty("duration")) { + timeTotal += Number(nArr[i]["duration"]); + } + } + C.CONFIG["flashvars"]["duration"] = timeTotal; + //trace("总时间:",timeTotal); + } + } + } + trace("发送一次newPlayerHandler"); + script.traceObject(videoArr); + videoHandler(videoArr, m); + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/process/analysisVideoUrlNum.as b/source/ckaction/process/analysisVideoUrlNum.as new file mode 100644 index 0000000..6ccd09c --- /dev/null +++ b/source/ckaction/process/analysisVideoUrlNum.as @@ -0,0 +1,35 @@ +package ckaction.process { + import ckaction.act.script; + import ckaction.act.loadXml; + import ckaction.C.C; + import ckaction.act.des; + public class analysisVideoUrlNum { + private var videoHandler: Function = null; + private var videoArr: Array = []; + private var N:int=0; + public function analysisVideoUrlNum(fun: Function,n:int=0) { + // constructor code + videoHandler = fun; + N=n; + analysis(C.CONFIG["flashvars"]["video"][n]["video"]); + } + private function analysis(url:String=""): void { + if(url.substr(0,8)=="website:"){ + loadUrl(des.getString(url.replace("website:", ""))); + } + } + private function loadUrl(url: String) { + new loadXml(url, function (data: * ) { + if (data) { + //script.traceObject(data); + //C.CONFIG["flashvars"]=script.mergeOldFlashvars(C.CONFIG["flashvars"], data); + C.CONFIG["flashvars"]=script.mergeObject(C.CONFIG["flashvars"],data) + videoHandler(true); + } else { + videoHandler(false); + } + }); + } + } + +} diff --git a/source/ckaction/process/config.as b/source/ckaction/process/config.as new file mode 100644 index 0000000..7f7c255 --- /dev/null +++ b/source/ckaction/process/config.as @@ -0,0 +1,342 @@ +package ckaction.process { + import flash.external.ExternalInterface; + import flash.display.Stage; + import ckaction.act.script; + import ckaction.act.loadXml; + import ckaction.C.C; + import ckaction.act.log; + + public class config { + private var path: Object = {}; + private var CONFIG: Object = null; //配置 + private var flashvars: Object = null; //flashvars + private var loadHandler: Function = null; + private var loadxml: loadXml = null; + public function config(stage: Stage, fun: Function) { + loadHandler = fun; + flashvars = stage.loaderInfo.parameters; + if(flashvars.hasOwnProperty("video")){ + if(flashvars["video"].toString().indexOf("%3f")>-1 || flashvars["video"].toString().indexOf("%2f")>-1 || flashvars["video"].toString().indexOf("%26")>-1){ + flashvars["video"]=unescape(flashvars["video"]); + } + } + flashvars = script.mergeObject(C.CONFIG["flashvars"], flashvars); + // + if (flashvars["config"] != "" && (flashvars["config"] == "false" || flashvars["config"] == "no")) { + CONFIG = C.CONFIG; + configHandler(); + return; + } + path = script.getPath(stage.loaderInfo.url); + C.PATH = path; + if (ExternalInterface.available) { + var cf: String = "ckplayerConfig"; + if (flashvars["config"] != "") { + cf = script.formatSsl(flashvars["config"]); + } + var temp = ExternalInterface.call(cf); + if(temp){ + CONFIG=temp; + } + else{ + temp=ExternalInterface.call("function(){return "+flashvars["variable"]+".getCkplayerConfig()}"); + if(temp){ + CONFIG=temp; + } + } + + } + if (CONFIG == null || !CONFIG) { + var url: String = flashvars["config"] ? flashvars["config"] : path["path"] + path["fileName"] + ".json"; + loadxml = new loadXml(url, function (data: Object = null) { + if (data) { + CONFIG = data; + flashvars = script.supplementObject(flashvars, CONFIG["flashvars"]); + //script.traceObject(CONFIG["flashvars"]); + CONFIG["flashvars"] = flashvars; + loadLanguage(); + } else { + new log("error:Failed to load " + url); + //flashvars = script.mergeObject(flashvars, CONFIG["flashvars"]); + CONFIG = C.CONFIG; + CONFIG["flashvars"] = flashvars; + configHandler(); + return; + } + + }); + } else { + flashvars = script.supplementObject(flashvars, CONFIG["flashvars"]); + CONFIG["flashvars"] = flashvars; + loadLanguage(); + } + + } + private function loadLanguage(): void { //加载语言包 + CONFIG["flashvars"]["config"]=script.formatSsl(CONFIG["flashvars"]["config"]); + CONFIG["flashvars"]["loaded"]=script.formatSsl(CONFIG["flashvars"]["loaded"]); + //script.traceObject(C.CONFIG["flashvars"]); + if (ExternalInterface.available) { + var cf: String = "ckplayerLanguage"; + if (flashvars["language"]) { + cf = script.formatSsl(flashvars["language"]); + + } + if (!CONFIG.hasOwnProperty("language")) { + CONFIG["language"] = new Object(); + } else { + if (script.getType(CONFIG["language"]) != "object") { + CONFIG["language"] = new Object(); + } + } + var temp = ExternalInterface.call(cf); + var languageTemp=null; + if(temp){ + languageTemp=temp; + } + else{ + temp=ExternalInterface.call("function(){return "+flashvars["variable"]+".getCkplayerLanguage()}"); + if(temp){ + languageTemp=temp; + } + } + + if(languageTemp){ + CONFIG["language"] = script.mergeObject(CONFIG["language"], temp); + loadStyle(); + return; + } + } + + var languagePath: String = ""; + if (CONFIG.hasOwnProperty("languagePath")) { + languagePath = CONFIG["languagePath"]; + } + + if (languagePath == "false" || languagePath == "no") { + configHandler(); + return; + } + if (languagePath != "" && languagePath != null) { + if (!languagePath.indexOf("/") && !languagePath.indexOf("\\")) { + languagePath = path["path"] + languagePath; + } + } else { + languagePath = path["path"] + "language.json"; + } + if (loadxml) { + loadxml = null; + } + loadxml = new loadXml(languagePath, function (data: Object) { + if (data) { + var language: Object = data; + if (!CONFIG.hasOwnProperty("language")) { + CONFIG["language"] = new Object(); + } else { + if (script.getType(CONFIG["language"]) != "object") { + CONFIG["language"] = new Object(); + } + } + CONFIG["language"] = script.mergeObject(CONFIG["language"], language); + loadStyle(); + + } else { + new log("error:Failed to load " + languagePath); + loadStyle(); + } + + }); + } + private function loadStyle(): void { //加载风格 + if (ExternalInterface.available) { + var cf: String = "ckplayerStyle"; + if (flashvars["style"]) { + cf = script.formatSsl(flashvars["style"]); + + } + var temp = ExternalInterface.call(cf); + var styleTemp=null; + if(temp){ + styleTemp=temp; + } + else{ + temp=ExternalInterface.call("function(){return "+flashvars["variable"]+".getCkplayerStyle()}"); + if(temp){ + styleTemp=temp; + } + } + + if(!styleTemp){ + if (!CONFIG.hasOwnProperty("style")) { + CONFIG["style"] = new Object(); + } else { + if (script.getType(CONFIG["style"]) != "object") { + CONFIG["style"] = new Object(); + } + } + + } + if(styleTemp){ + CONFIG["style"]["advertisement"]=script.mergeObject(CONFIG["style"]["advertisement"], styleTemp["advertisement"]); + CONFIG["style"] = script.mergeObject(CONFIG["style"], styleTemp); + flashvars = script.supplementObject(flashvars, styleTemp["flashvars"]); + CONFIG["flashvars"] = flashvars; + configHandler(); + return; + } + + } + var stylePath: String = CONFIG["stylePath"]; + if (CONFIG["stylePath"] == "false" || CONFIG["stylePath"] == "no") { + CONFIG["style"] = null; + configHandler(); + return; + } + if (stylePath != "" && stylePath != null) { + if (!stylePath.indexOf("/") && !stylePath.indexOf("\\")) { + stylePath = path["path"] + stylePath; + + } + } else { + stylePath = path["path"] + "style.json"; + } + var url: String = stylePath; + //var url: String = CONFIG["stylePath"] ? CONFIG["stylePath"] : path["path"] + "style.xml"; + if (loadxml) { + loadxml = null; + } + loadxml = new loadXml(url, function (data: Object) { + if (data) { + var style: Object = data; + if (!CONFIG.hasOwnProperty("style")) { + CONFIG["style"] = new Object(); + } else { + if (script.getType(CONFIG["style"]) != "object") { + CONFIG["style"] = new Object(); + } + } + CONFIG["style"]["advertisement"]=script.mergeObject(CONFIG["style"]["advertisement"], style["advertisement"]); + CONFIG["style"] = script.mergeObject(CONFIG["style"], style); + flashvars = script.supplementObject(flashvars, style["flashvars"]); + CONFIG["flashvars"] = flashvars + configHandler(); + + } else { + new log("error:Failed to load " + url); + configHandler(); + } + + }); + } + private function configHandler(): void { + if (CONFIG["config"]["timeStamp"]) { + loadxml = new loadXml(CONFIG["config"]["timeStamp"], function (data: * ) { + if (data) { + //script.traceObject(data); + if (script.getType(data) == "string") { + CONFIG["config"]["time"] = Number(data) * 1000; + } else { + CONFIG["config"]["time"] = Number(data["result"]["timestamp"]) * 1000; + } + configEnd(); + } else { + configEnd(); + } + }); + } else { + configEnd(); + } + + } + private function getAD(adv: String = "", time: String = "", link: String = ""): Array { + var vars: Object = CONFIG["flashvars"]; + var adArr: Array = vars[adv].split(","); + var timeArr: Array = [], + linkArr: Array = []; + var ad: Array = []; + if (vars.hasOwnProperty(time)) { + timeArr = vars[time].split(","); + } + if (vars.hasOwnProperty(link)) { + linkArr = vars[link].split(","); + } + for (var i: int = 0; i < adArr.length; i++) { + var obj: Object = { + file: adArr[i], + type: script.getFileExt(adArr[i]).replace(".", "") + }; + if (timeArr.length > i) { + obj["time"] = timeArr[i]; + } else { + obj["time"] = CONFIG["style"]["advertisement"]["time"]; + } + if (linkArr.length > i) { + obj["link"] = linkArr[i]; + } else { + obj["link"] = ""; + } + ad.push(obj); + } + //script.traceObject(ad); + return ad; + } + private function configEnd(): void { + //分析广告 + var fvars: Object = CONFIG["flashvars"]; + var front: Array = []; + var ad: Object = {}; + var isAd: Boolean = false; + if (fvars.hasOwnProperty("adfront")) { + ad["front"] = getAD("adfront", "adfronttime", "adfrontlink"); + isAd = true; + } + if (fvars.hasOwnProperty("adpause")) { + ad["pause"] = getAD("adpause", "adpausetime", "adpauselink"); + isAd = true; + } + if (fvars.hasOwnProperty("adinsert")) { + ad["insert"] = getAD("adinsert", "adinserttime", "adinsertlink"); + isAd = true; + } + if (fvars.hasOwnProperty("adend")) { + ad["end"] = getAD("adend", "adendtime", "adendlink"); + isAd = true; + } + if (isAd && ad) { + CONFIG["flashvars"]["advertisements"] = ad; + } + //分析广告 + //分析提示点 + if (fvars.hasOwnProperty("promptspot") && fvars.hasOwnProperty("promptspottime")) { + if (script.getType(fvars["promptspot"]) == "string") { + var prompt: Array = fvars["promptspot"].split(","); + var prompttime: Array = fvars["promptspottime"].split(","); + var promptSpot: Array = []; + if (prompt.length == prompttime.length) { + for (var i: int = 0; i < prompt.length; i++) { + promptSpot.push({ + words: prompt[i], + time: prompttime[i] + }); + } + CONFIG["flashvars"]["promptSpot"] = promptSpot; + } + } + } + if (fvars.hasOwnProperty("preview") && fvars["preview"]) { + if (script.getType(fvars["preview"]) == "string") { + CONFIG["flashvars"]["preview"] = { + file: fvars["preview"].split(","), + scale: fvars["previewscale"] + }; + } + } + + C.CONFIG = script.mergeObject(C.CONFIG, CONFIG); + //script.traceObject(C.CONFIG); + loadHandler(); + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/process/getVideoMeta.as b/source/ckaction/process/getVideoMeta.as new file mode 100644 index 0000000..5413246 --- /dev/null +++ b/source/ckaction/process/getVideoMeta.as @@ -0,0 +1,73 @@ +package ckaction.process { + import flash.net.NetConnection; + import flash.net.NetStream; + import flash.events.NetStatusEvent; + import flash.events.SecurityErrorEvent; + import flash.events.AsyncErrorEvent; + + public class getVideoMeta { + private var videoArr: Array = []; + private var isClear: Boolean = false; + private var loadI: int = 0; + private var nc: NetConnection = null; + private var ns: NetStream = null; + private var complete:Function=null; + private var speedFun:Function=null; + public function getVideoMeta(arr,fun,speed) { + // constructor code + videoArr = arr; + complete=fun; + speedFun=speed; + nc = new NetConnection(); + nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + nc.connect(null); + } + private function netStatusHandler(event: NetStatusEvent): void { + switch (event.info.code) { + case "NetConnection.Connect.Success": + connectStream(); + break; + default: + break; + } + //trace(event.info.code); + + } + private function securityErrorHandler(event: SecurityErrorEvent): void {} + private function netSteameErrorHandler(event: AsyncErrorEvent): void {} + private function connectStream(): void { + if (isClear) { //如果已被清除,则不进行下面的动作 + return; + } + var customClient = new Object(); + customClient.onMetaData = metaDataHandler; + ns = new NetStream(nc); + ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + ns.client = customClient; + ns.play(videoArr[loadI]["file"]); + } + private function metaDataHandler(info: Object): void { + videoArr[loadI]["duration"] = info["duration"]; + videoArr[loadI]["bytesTotal"] = ns.bytesTotal; + ns.dispose(); + ns.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + ns.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, netSteameErrorHandler); + ns = null; + speedFun(loadI); + if (loadI < videoArr.length - 1) { + loadI++; + connectStream(); + } else { + complete(videoArr); + } + } + public function clear(): void { + isClear = true; + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/element.as b/source/ckaction/style/element.as new file mode 100644 index 0000000..5f94da9 --- /dev/null +++ b/source/ckaction/style/element.as @@ -0,0 +1,273 @@ +package ckaction.style { + import flash.display.Sprite; + import flash.text.TextField; + import ckaction.act.script; + import flash.text.TextFormat; + import flash.display.SimpleButton; + import flash.display.MovieClip; + import flash.utils.ByteArray; + import flash.display.Loader; + import flash.events.Event; + import flash.display.Bitmap; + import flash.events.MouseEvent; + import flash.display.JointStyle; + import flash.display.CapsStyle; + import ckaction.act.des; + + public class element { + + public static function newSprite(obj: Object = null): Sprite { //建立一个圆角矩形 + var con: Object = { + backgroundColor: null, //背景颜色 + backgroundAlpha: 0, //背景透明度 + border: 0, + borderColor: null, //边框颜色 + radius: 0, //圆角弧度 + width: 0, + height: 0 + }; + con = script.mergeObject(con, obj); + //trace(con["width"], con["height"], con["radius"], con["radius"]); + var sprite: Sprite = new Sprite(); + if (con["backgroundColor"] != null) { + sprite.graphics.beginFill(con["backgroundColor"], con["backgroundAlpha"]); //背景色,透明度CapsStyle.NONE + } + if (con["borderColor"] != null && con["border"] > 0) { + sprite.graphics.lineStyle(con["border"], con["borderColor"], con["borderAlpha"], true, "normal", CapsStyle.NONE, JointStyle.MITER, 1.414); + } + sprite.graphics.drawRoundRect(0, 0, con["width"], con["height"], con["radius"], con["radius"]); + return sprite; + } + public static function newLine(obj: Object = null): Sprite { //建立直线 + var o: Object = { + color: 0x000000, //背景颜色 + alpha: 1, //透明度 + width: 1, + height: 1 + }; + o = script.mergeObject(o, obj); + var s: Sprite = new Sprite(); + s.graphics.lineStyle(o["height"], o["color"]); + s.graphics.moveTo(0, 0); + s.graphics.lineTo(o["width"], 0); + s.alpha = o["alpha"]; + return s; + } + public static function newTriangle(obj: Object = null): Sprite { //画三角 + var o: Object = { + width: 0, + height: 0, + backgroundColor: null, + border: 0, + borderColor: null, + alpha: 0 + } + o = script.mergeObject(o, obj); + var sprite: Sprite = new Sprite(); + if (o["backgroundColor"] != null && o["alpha"]) { + sprite.graphics.beginFill(o["backgroundColor"], o["alpha"]); + } + if (o["borderColor"] != null && o["border"] && o["alpha"]) { + sprite.graphics.lineStyle(o["border"], o["borderColor"], o["alpha"]); + } + + sprite.graphics.moveTo(0, 0); + sprite.graphics.lineTo(o["width"], 0); + sprite.graphics.lineTo(o["width"] * 0.5, o["height"]); + sprite.graphics.lineTo(0, 0); + sprite.graphics.endFill(); + return sprite; + } + public static function newText(obj: Object = null): TextField { //建立一个简单的文本框 + var o: Object = { + text: "", + color: 0xFFFFFF, + size: 14, + font: "Microsoft YaHei,\5FAE\8F6F\96C5\9ED1,微软雅黑", + width: 0, + height: 0, + leading: 0, + alpha: 1, + bold: false, + rightMargin: 0, + leftMargin: 0, + textAlign: "left" + + } + o = script.mergeObject(o, obj); + var format: TextFormat = new TextFormat(); + format.leading = o["leading"]; + format.size = o["size"]; + format.font = o["font"]; + format.color = o["color"]; + format.align = o["textAlign"]; + if(o["bold"]==true){ + format.bold=o["bold"]; + } + + var text: TextField = new TextField(); + text.defaultTextFormat = format; + text.mouseEnabled = false; + text.text = o["text"]; + text.wordWrap = o["width"] > 0 ? true : false; + text.width = o["width"] > 0 ? o["width"] : text.textWidth + 5; + text.height = o["height"] > 0 ? o["height"] : text.textHeight + 5; + text.alpha = o["alpha"]; + return text; + } + public static function newButton(obj: Object = null): SimpleButton { //建立一个按钮 + var o: Object = { + backgroundAlpha:0.8, + height: 30 , + alpha: 1 , + font: "Microsoft YaHei,\5FAE\8F6F\96C5\9ED1,微软雅黑", + padding: 0, + align: "right", + overTextColor: 0xFFFFFF, + textColor: 0xEFEFEF, + border: 0, + bold: false, + overBackgroundColor: 0x444444, + size: 14, + borderColor: 0x333333, + width: 60, + backgroundColor: 0x1A1A1A, + radius: 0, + text:"" + } + //script.traceObject(obj); + o = script.mergeObject(o, obj); + //建立背景 + var bg: Object = { + backgroundColor: o["backgroundColor"], //背景颜色 + backgroundAlpha: o["backgroundAlpha"], //背景透明度 + border: o["border"], + borderColor: o["borderColor"], //边框颜色 + radius: o["radius"], //圆角弧度 + width: o["width"], + height: o["height"] + }; + var bgSprite:Sprite=newSprite(bg); + bg["backgroundColor"]=o["overBackgroundColor"]; //背景颜色 + var overSprite:Sprite=newSprite(bg); + //文字 + var textObj:Object={ + text: o["text"], + color: o["textColor"], + size: o["size"], + font: o["font"], + alpha: o["alpha"], + bold: o["bold"] + } + var text:TextField=newText(textObj); + textObj["color"]=o["overTextColor"]; + var overText:TextField=newText(textObj); + var tx:int=0; + switch(o["align"]){ + case "left": + tx=o["padding"] + break; + case "center": + tx=(bgSprite.width-text.width)*0.5; + break; + case "right": + tx=bgSprite.width-text.width-o["padding"]; + break; + } + text.x=tx; + overText.x=tx; + text.y=(bgSprite.height-text.height)*0.5; + overText.y=(bgSprite.height-overText.height)*0.5; + bgSprite.addChild(text); + overSprite.addChild(overText); + var button: SimpleButton = new SimpleButton(); + if (o["over"]) { + button.upState = overSprite; + } + else { + button.upState = bgSprite; + } + + button.overState = overSprite; + button.hitTestState = overSprite; + button.downState = overSprite; + return button; + } + public static function imgButton(obj: Object = null, name: String = "", imgLoadedFun: Function = null): Sprite { //建立一个以图片为元件的按钮 + var o: Object = { + mouseOver: "", + mouseOut: "" + } + o = script.mergeObject(o, obj); + if (!o["mouseOver"] || !o["mouseOut"]) { + return null; + } + var mObj: Object = { + bgAlpha: 0, //背景透明度 + width: 1, + height: 1 + }; + var sp: Sprite = newSprite(mObj); + var over: ByteArray = des.getByteArray(o["mouseOver"]); + var out: ByteArray =des.getByteArray(o["mouseOut"]); + var outBitMap: Bitmap = null, + overBitMap: Bitmap = null; + + var loadOut: Loader = new Loader(), + loadOver: Loader = new Loader(); + + function loadOutImg(): void { + loadOut.loadBytes(out); //读取ByteArray + loadOut.contentLoaderInfo.addEventListener(Event.COMPLETE, function (event: Event) { + outBitMap = event.target.content as Bitmap; //读取Bitmap + sp.addChild(outBitMap); + loadOverImg(); + }); + } + function loadOverImg(): void { + loadOver.loadBytes(over); //读取ByteArray + loadOver.contentLoaderInfo.addEventListener(Event.COMPLETE, function (event: Event) { + overBitMap = event.target.content as Bitmap; //读取Bitmap + sp.addChild(overBitMap); + overBitMap.visible = false; + addListener(); + }); + } + function addListener(): void { + sp.addEventListener(MouseEvent.MOUSE_OVER, function (event: MouseEvent) { + overBitMap.visible = true; + }); + sp.addEventListener(MouseEvent.MOUSE_OUT, function (event: MouseEvent) { + overBitMap.visible = false; + }); + if (imgLoadedFun != null) { + imgLoadedFun(); + } + } + loadOutImg(); + sp.buttonMode = true; + if (name != "") { + sp.name = name; + } + return sp; + } + public static function imgSprite(img: String = ""): Sprite { + var mObj: Object = { + bgAlpha: 0, //背景透明度 + width: 1, + height: 1 + }; + var sp: Sprite = newSprite(mObj); + var byte: ByteArray = des.getByteArray(img); + var ld: Loader = new Loader(); + ld.loadBytes(byte); //读取ByteArray + ld.contentLoaderInfo.addEventListener(Event.COMPLETE, function (event: Event) { + var BitMap: Bitmap = event.target.content as Bitmap; //读取Bitmap + sp.addChild(BitMap); + }); + return sp; + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/face.as b/source/ckaction/style/face.as new file mode 100644 index 0000000..2577039 --- /dev/null +++ b/source/ckaction/style/face.as @@ -0,0 +1,3815 @@ +package ckaction.style { + import flash.display.Stage; + import flash.display.Sprite; + import flash.events.Event; + import flash.display.Loader; + import ckaction.act.script; + import flash.text.TextField; + import flash.events.MouseEvent; + import flash.geom.Point; + import flash.events.ErrorEvent; + import fl.transitions.Tween; + import fl.transitions.easing.None; + import fl.transitions.TweenEvent; + import flash.display.StageDisplayState; + import ckaction.act.timeInterval; + import ckaction.C.C; + import flash.events.DataEvent; + import ckaction.act.timeOut; + import flash.ui.Mouse; + import ckaction.act.log; + import flash.display.SimpleButton; + + public class face { + private var STAGE: Stage = null; + private var THIS: Sprite = null; + private var CONFIG: Object = {}, STYLE: Object = {}, LANGUAGE: Object = {}, FLASHVARS: Object = {}; + private var intoFun: Function = null; //调用主控制台的into + private var stageW: int = 0, + stageH: int = 0; + private var M: Sprite = null; //控制栏元件 + public var MOBJ: Object = {}; //存放控制栏里各元素的 + private var imgButtonI: int = 0; + private var mouseDownName: String = ""; //鼠标在音量和进度上按下时附值 + private var point: Point = null; //进度按钮音量调节按钮坐标 + private var volumeTemp: Number = 0; //保存临时音量 + private var timeTotal: Number = 0; //总时间 + private var timeNow: Number = 0; //播放时间 + private var timeMax: Number = -1; //当前播放的最大时间 + private var timeSeek: Number = -1; //拖动前的时间 + private var loadTotal: int = 0; //总字节 + private var loadNow: int = 0; //当前加载量 + private var timeFollow: Boolean = true; //时间进度条是否走动 + private var seekTime: Number = 0; //要跳转的时间 + private var mUpSeek: Boolean = true; //是否支持在鼠标拖动进度按钮后的动作 + private var loaderNum: int = 0; //要加载的图片总量 + private var showTween: Tween = null, + hideTween: Tween = null; + private var timeSliderShow: Boolean = true, + timeOutSliderShow: Boolean = false, + mShow: Boolean = true; + private var cbHideTimer: timeInterval = null, + cbShowTimer: timeInterval = null; + private var cbTween: Tween = null; + private var oldStageXY: Object = {}; + private var mMinXY: Object = {}; + private var errorText: TextField = null; + private var setTimeClick: timeOut = null; + private var isClick: Boolean = false; + private var pause: Sprite = null; + //提示点 + private var promptSpotArr: Array = []; + private var promptSpotObjArr: Array = []; + //定义元件开始 + //存放播放器背景 + private var background: Object = { + background: null + }; + private var clickSprite: Sprite = null; + private var loading: Loader = null, + logo: Loader = null; + private var prompt: Sprite = null; + private var force: Boolean = false; + //定义元件结束 + //获取状态 + public var full: Boolean = false; //是否全屏状态 + //预览图片 + private var previewElement: newPreview = null; + private var preview: Sprite = null; + private var previewLoad: Boolean = false, + previewLoadIng: Boolean = false; + private var previewTop: Sprite = null; + private var pTween: Tween = null; //预览图片缓动 + private var previewPrompt: Sprite = null; + private var listenerArr: Array = []; + private var definitionTimer: timeInterval = null,subtitleTimer:timeInterval=null; + private var buttonDown: Boolean = false; + private var videoSpriteXY:Object={x:0,y:0}; + public function face(stage: Stage, sprite: Sprite, into: Function) { + // constructor code + STAGE = stage; + THIS = sprite; + CONFIG = C.CONFIG; + STYLE = CONFIG["style"]; + LANGUAGE = CONFIG["language"]; + FLASHVARS = CONFIG["flashvars"]; + script.traceObject(STYLE); + intoFun = into; + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + stage.addEventListener(Event.RESIZE, resizeHandler); + loadBackGround(); + } + + private function resizeHandler(event: Event): void { + resize(); + //resize(); + } + private function resize(): void { + stageW = STAGE.stageWidth; + stageH = STAGE.stageHeight; + //修改背景位置和尺寸 + backgroundResize(); + //控制栏 + controlBarResize(); + //loading + loadingResize(); + //logo + logoResize(); + //buffer + bufferResize(); + //音量 + volumeSliderResize(); + //时间进度 + timeSliderResize(); + //简易时间进度 + simpleScheduleResize(); + //点播时间显示框 + vodTimeTextResize(); + //直播显示框 + liveTimeTextResize(); + //调节全局自定义元件的坐标 + loadCustomResize(); + //如果控制栏是隐藏状态 + if (!mShow) { + mShowHandler(); + if (cbHideTimer) { + cbHideTimer.start(); + } + if (cbShowTimer) { + cbShowTimer.stop(); + } + } + //调整错误文本框 + errorShowResize(); + //调整中间播放按钮 + centerPlayResize(); + //调用前置后置广告 + advertisementResize(); + + checkFullScreen(); + definitionResize(); + subtitlesResize(); + promptSpotResize(); + } + //加载字幕切换组件 + public function loadSubtitles(n:int=-1):void{ + if (!C.CONFIG["config"]["subtitle"]) { + return; + } + var trackS:String=C.CONFIG["flashvars"]["cktrack"]; + var trackArr=[]; + var index:int=0; + if(trackS && trackS.indexOf(",")>-1){ + trackArr=script.trackToArray(trackS); + for(var i:int=0;iindex){ + index=trackArr[i][2]; + } + } + if(n==-1){ + n=index; + } + } + var eventS: String = STYLE["controlBar"]["subtitle"]["event"]; + if (MOBJ.hasOwnProperty("subtitleDefault") && MOBJ["subtitleDefault"] != null) { + if (eventS == "over") { + MOBJ["subtitleDefault"].removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); + } else { + MOBJ["subtitleDefault"].removeEventListener(MouseEvent.CLICK, mouseClickHandler); + MOBJ["subtitleDefault"].removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + MOBJ["subtitleDefault"].removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + } + M.removeChild(MOBJ["subtitleDefault"]); + MOBJ["subtitleDefault"] = null; + } + + var text: String = ""; + if (n > -1) { + text=trackArr[n][1]; + } + + if (text == "") { + text = LANGUAGE["subtitle"]; + } + var buttonObj: Object = script.copyObject(STYLE["controlBar"]["subtitle"]["defaultButton"]); + if (n == -1) { + buttonObj["overBackgroundColor"] = buttonObj["backgroundColor"]; + } + buttonObj["text"] = text; + var button: SimpleButton = element.newButton(buttonObj); + + if (MOBJ.hasOwnProperty("timeSlider")) { + var tc: int = M.getChildIndex(MOBJ["timeSlider"]["backDefaultSprite"]); + M.addChildAt(button, tc); + } else { + M.addChild(button); + } + if (n > -1) { + if (eventS == "over") { + button.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); + } else { + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + button.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + button.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + } + } + MOBJ["subtitleDefault"] = button; + //加载按钮列表 + + subtitlesResize(); + } + public function newSubtitles(high: int = 0): void { //high是高亮编号 + if (!C.CONFIG["config"]["subtitle"]) { + loadSubtitles(-1); + return; + } + var trackS:String=C.CONFIG["flashvars"]["cktrack"]; + var trackArr=[]; + if(trackS.indexOf(",")>-1){ + trackArr=script.trackToArray(trackS); + } + else{ + return; + } + //建立按钮 + if (MOBJ.hasOwnProperty("subtitleBack") && MOBJ["subtitleBack"] != null) { + M.removeChild(MOBJ["subtitleBack"]); + MOBJ["subtitleBack"] = null; + } + var buttonObj: Object = {}; + var text = ""; + var buttonArr: Array = []; + var lineArr: Array = []; + for (var i: int = 0; i < trackArr.length; i++) { + if (i != high) { + buttonObj = STYLE["controlBar"]["subtitle"]["button"]; + } else { + buttonObj = STYLE["controlBar"]["subtitle"]["buttonHighlight"]; + } + if (trackArr[i][1] != "") { + text = trackArr[i][1]; + } + buttonObj["text"] = text; + var button: SimpleButton = element.newButton(buttonObj); + button.name = "subtitle_" + i; + button.addEventListener(MouseEvent.CLICK, function (event: MouseEvent) { + THIS["changeSubtitles"](event.target.name.toString().replace("subtitle_", "")); + }); + buttonArr.push(button); + } + //创建背景 + //计算宽高 + var background: Object = STYLE["controlBar"]["subtitle"]["background"]; + var separate: Object = STYLE["controlBar"]["subtitle"]["separate"]; + var bWidth: int = Number(background["paddingLeft"]) + Number(background["paddingRight"]) + buttonArr[0].width; + var bHeight: int = Number(background["paddingTop"]) + Number(background["paddingBottom"]) + buttonArr[0].height * buttonArr.length; + bHeight += (Number(separate["height"]) + Number(separate["marginTop"]) + Number(separate["marginBottom"])) * (buttonArr.length - 1); + //script.traceObject(); + var bgObj: Object = { + backgroundColor: background["backgroundColor"], //背景颜色 + backgroundAlpha: background["backgroundAlpha"], //背景透明度 + border: background["border"], + borderColor: background["borderColor"], //边框颜色 + radius: background["radius"], //圆角弧度 + width: bWidth, + height: bHeight + } + var bgSprite: Sprite = element.newSprite(bgObj); + //画倒三角 + var triangleObj: Object = { + width: background["triangleWidth"], + height: background["triangleHeight"], + backgroundColor: background["triangleBackgroundColor"], + border: background["triangleBorder"], + borderColor: background["triangleBorderColor"], + alpha: background["triangleAlpha"] + }; + var triangle: Sprite = element.newTriangle(triangleObj); + triangle.y = bgSprite.height + Number(background["triangleDeviationY"]); + triangle.x = (bgSprite.width - triangle.width) * 0.5 + Number(background["triangleDeviationX"]); + bgSprite.addChild(triangle); + //倒三角结束 + //将按钮填充进去并且画个间隔线 + var lineObj: Object = { + color: separate["color"], //背景颜色 + alpha: Number(separate["alpha"]), //透明度 + width: bWidth - Number(separate["marginLeft"]) - Number(separate["marginRight"]), + height: Number(separate["height"]) + }; + var nY: int = Number(background["paddingTop"]); + for (i = 0; i < buttonArr.length; i++) { + buttonArr[i].y = nY; + buttonArr[i].x = Number(background["paddingLeft"]); + bgSprite.addChild(buttonArr[i]); + nY += buttonArr[i].height; + //画间隔线 + if (i < buttonArr.length - 1) { + var line: Sprite = element.newLine(lineObj); + nY += Number(separate["marginTop"]); + line.x = Number(separate["marginLeft"]); + line.y = nY; + nY += line.height; + nY += Number(separate["marginBottom"]); + bgSprite.addChild(line); + } + //画间隔线结束 + } + bgSprite.visible = false; + //填充结束 + M.addChild(bgSprite); + MOBJ["subtitleBack"] = bgSprite; + subtitlesResize(); + //trace(201, "行", bWidth, bHeight); + } + //加载清晰度组件 + public function loadDefinition(n: int = -1): void { + if (!C.CONFIG["config"]["definition"]) { + return; + } + + var eventS: String = STYLE["controlBar"]["definition"]["event"]; + if (MOBJ.hasOwnProperty("definitionDefault") && MOBJ["definitionDefault"] != null) { + if (eventS == "over") { + MOBJ["definitionDefault"].removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); + } else { + MOBJ["definitionDefault"].removeEventListener(MouseEvent.CLICK, mouseClickHandler); + MOBJ["definitionDefault"].removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + MOBJ["definitionDefault"].removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + } + M.removeChild(MOBJ["definitionDefault"]); + MOBJ["definitionDefault"] = null; + } + var text: String = ""; + if (n > -1) { + var video: Array = C.CONFIG["flashvars"]["video"]; + if (video[n].hasOwnProperty("definition")) { + if (video[n]["definition"] != "") { + text = video[n]["definition"]; + } + + } + } + + if (text == "") { + text = LANGUAGE["definition"]; + } + var buttonObj: Object = script.copyObject(STYLE["controlBar"]["definition"]["defaultButton"]); + if (n == -1) { + buttonObj["overBackgroundColor"] = buttonObj["backgroundColor"]; + } + buttonObj["text"] = text; + var button: SimpleButton = element.newButton(buttonObj); + + if (MOBJ.hasOwnProperty("timeSlider")) { + var tc: int = M.getChildIndex(MOBJ["timeSlider"]["backDefaultSprite"]); + M.addChildAt(button, tc); + } else { + M.addChild(button); + } + if (n > -1) { + if (eventS == "over") { + button.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); + } else { + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + button.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + button.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + } + } + MOBJ["definitionDefault"] = button; + //加载按钮列表 + + definitionResize(); + } + public function newDefinition(high: int = 0): void { //high是高亮编号 + if (!C.CONFIG["config"]["definition"]) { + loadDefinition(-1); + return; + } + var video: Array = C.CONFIG["flashvars"]["video"]; + if (video[0].hasOwnProperty("definition")) { + if (video[0]["definition"] == "") { + loadDefinition(-1); + return; + } + } else { + loadDefinition(-1); + return; + } + //建立按钮 + if (MOBJ.hasOwnProperty("definitionBack") && MOBJ["definitionBack"] != null) { + M.removeChild(MOBJ["definitionBack"]); + MOBJ["definitionBack"] = null; + } + var buttonObj: Object = {}; + var text = ""; + var buttonArr: Array = []; + var lineArr: Array = []; + for (var i: int = 0; i < video.length; i++) { + if (i != high) { + buttonObj = STYLE["controlBar"]["definition"]["button"]; + } else { + buttonObj = STYLE["controlBar"]["definition"]["buttonHighlight"]; + } + if (video[i]["definition"] != "") { + text = video[i]["definition"]; + } + buttonObj["text"] = text; + var button: SimpleButton = element.newButton(buttonObj); + button.name = "definition_" + i; + button.addEventListener(MouseEvent.CLICK, function (event: MouseEvent) { + THIS["changeDefinition"](event.target.name.toString().replace("definition_", "")); + }); + buttonArr.push(button); + } + //创建背景 + //计算宽高 + var background: Object = STYLE["controlBar"]["definition"]["background"]; + var separate: Object = STYLE["controlBar"]["definition"]["separate"]; + var bWidth: int = Number(background["paddingLeft"]) + Number(background["paddingRight"]) + buttonArr[0].width; + var bHeight: int = Number(background["paddingTop"]) + Number(background["paddingBottom"]) + buttonArr[0].height * buttonArr.length; + bHeight += (Number(separate["height"]) + Number(separate["marginTop"]) + Number(separate["marginBottom"])) * (buttonArr.length - 1); + //script.traceObject(); + var bgObj: Object = { + backgroundColor: background["backgroundColor"], //背景颜色 + backgroundAlpha: background["backgroundAlpha"], //背景透明度 + border: background["border"], + borderColor: background["borderColor"], //边框颜色 + radius: background["radius"], //圆角弧度 + width: bWidth, + height: bHeight + } + var bgSprite: Sprite = element.newSprite(bgObj); + //画倒三角 + var triangleObj: Object = { + width: background["triangleWidth"], + height: background["triangleHeight"], + backgroundColor: background["triangleBackgroundColor"], + border: background["triangleBorder"], + borderColor: background["triangleBorderColor"], + alpha: background["triangleAlpha"] + }; + var triangle: Sprite = element.newTriangle(triangleObj); + triangle.y = bgSprite.height + Number(background["triangleDeviationY"]); + triangle.x = (bgSprite.width - triangle.width) * 0.5 + Number(background["triangleDeviationX"]); + bgSprite.addChild(triangle); + //倒三角结束 + //将按钮填充进去并且画个间隔线 + var lineObj: Object = { + color: separate["color"], //背景颜色 + alpha: Number(separate["alpha"]), //透明度 + width: bWidth - Number(separate["marginLeft"]) - Number(separate["marginRight"]), + height: Number(separate["height"]) + }; + var nY: int = Number(background["paddingTop"]); + for (i = 0; i < buttonArr.length; i++) { + buttonArr[i].y = nY; + buttonArr[i].x = Number(background["paddingLeft"]); + bgSprite.addChild(buttonArr[i]); + nY += buttonArr[i].height; + //画间隔线 + if (i < buttonArr.length - 1) { + var line: Sprite = element.newLine(lineObj); + nY += Number(separate["marginTop"]); + line.x = Number(separate["marginLeft"]); + line.y = nY; + nY += line.height; + nY += Number(separate["marginBottom"]); + bgSprite.addChild(line); + } + //画间隔线结束 + } + bgSprite.visible = false; + //填充结束 + M.addChild(bgSprite); + MOBJ["definitionBack"] = bgSprite; + definitionResize(); + //trace(201, "行", bWidth, bHeight); + } + private function definitionResize(): void { + if (!C.CONFIG["config"]["definition"]) { + return; + } + //backgroundCoor + var newCoor: Object + if (MOBJ.hasOwnProperty("definitionDefault") && MOBJ["definitionDefault"] != null) { + newCoor = coorDinate(STYLE["controlBar"]["definition"]["defaultButtonCoor"], MOBJ["controlBarBgColor"]); + //script.traceObject(newCoor) + MOBJ["definitionDefault"].x = newCoor["x"]; + MOBJ["definitionDefault"].y = newCoor["y"]; + } + if (MOBJ.hasOwnProperty("definitionBack") && MOBJ["definitionBack"] != null) { + var height: String = STYLE["controlBar"]["definition"]["backgroundCoor"]["height"].toString(); + newCoor = coorDinate(STYLE["controlBar"]["definition"]["backgroundCoor"], MOBJ["controlBarBgColor"]); + MOBJ["definitionBack"].x = newCoor["x"]; + MOBJ["definitionBack"].y = newCoor["y"] - (height == "true" ? MOBJ["definitionBack"].height : 0); + } + } + private function subtitlesResize(): void { + if (!C.CONFIG["config"]["subtitle"]) { + return; + } + //backgroundCoor + var newCoor: Object + if (MOBJ.hasOwnProperty("subtitleDefault") && MOBJ["subtitleDefault"] != null) { + newCoor = coorDinate(STYLE["controlBar"]["subtitle"]["defaultButtonCoor"], MOBJ["controlBarBgColor"]); + //script.traceObject(newCoor) + MOBJ["subtitleDefault"].x = newCoor["x"]; + MOBJ["subtitleDefault"].y = newCoor["y"]; + } + if (MOBJ.hasOwnProperty("subtitleBack") && MOBJ["subtitleBack"] != null) { + var height: String = STYLE["controlBar"]["subtitle"]["backgroundCoor"]["height"].toString(); + newCoor = coorDinate(STYLE["controlBar"]["subtitle"]["backgroundCoor"], MOBJ["controlBarBgColor"]); + MOBJ["subtitleBack"].x = newCoor["x"]; + MOBJ["subtitleBack"].y = newCoor["y"] - (height == "true" ? MOBJ["subtitleBack"].height : 0); + } + } + //-------------------------------------------------------------------------------------------logo + private function logoResize(): void { + if (logo) { + var coor: Object = coorDinate(STYLE["logo"]); + logo.x = coor["x"]; + logo.y = coor["y"]; + } + } + private function loadLogo(): void { + //加载loading元件 + if (STYLE.hasOwnProperty("logo") && STYLE["logo"]["file"]!="" && STYLE["logo"]["file"]!="null") { + loaderNum++; + var newLoader: loadByteImg = new loadByteImg(STYLE["logo"]["file"], function (byte: Loader = null) { + if (byte) { + logo = byte; + THIS.addChild(logo); + imgLoaded(); + logoResize(); + } + }); + } + + } + //-------------------------------------------------------------------------------------------logo 结束 + //-------------------------------------------------------------------------------------------buffer + private function bufferResize(): void { + var coor: Object = {}; + if (MOBJ.hasOwnProperty("buffer")) { + coor = coorDinate(STYLE["buffer"]); + MOBJ["buffer"].x = coor["x"]; + MOBJ["buffer"].y = coor["y"]; + } + if (MOBJ.hasOwnProperty("bufferText")) { + coor = coorDinate(STYLE["buffer"]["text"]); + MOBJ["bufferText"].x = coor["x"]; + MOBJ["bufferText"].y = coor["y"]; + } + } + private function loadBuffer(): void { + //加载loading元件 + if (STYLE.hasOwnProperty("buffer")) { + loaderNum++; + var newLoader: loadByteImg = new loadByteImg(STYLE["buffer"]["file"], function (byte: Loader = null) { + if (byte) { + MOBJ["buffer"] = byte; + THIS.addChild(MOBJ["buffer"]); + MOBJ["buffer"].visible = false; + imgLoaded(); + bufferResize(); + } + }); + if (STYLE["buffer"].hasOwnProperty("text")) { + var obj: Object = STYLE["buffer"]["text"]; + obj["text"] = script.replace(LANGUAGE["buffer"], ["[$percentage]"], [0]); + var newText: TextField = element.newText(obj); + THIS.addChild(newText); + MOBJ["bufferText"] = newText; + MOBJ["bufferText"].visible = false; + } + } + + } + + //-------------------------------------------------------------------------------------------buffer 结束 + //-------------------------------------------------------------------------------------------loading + private function loadingResize(): void { + if (loading) { + var coor: Object = coorDinate(STYLE["loading"]); + loading.x = coor["x"]; + loading.y = coor["y"]; + } + } + private function loadLoading(): void { + //加载loading元件 + if (STYLE.hasOwnProperty("loading") && STYLE["loading"]["file"]!="" && STYLE["loading"]["file"]!="null") { + loaderNum++; + var newLoader: loadByteImg = new loadByteImg(STYLE["loading"]["file"], function (byte: Loader = null) { + if (byte) { + loading = byte; + THIS.addChild(loading); + imgLoaded(); + loadingResize(); + } + }); + } + + } + //-------------------------------------------------------------------------------------------loading 结束 + + private function promptSpotResize(): void { //根据时间点计算坐标 + if (promptSpotArr.length > 0) { + var w = MOBJ["timeSlider"]["backgroundDefaultLoader"].width; + trace("宽度:", w); + //timeTotal + for (var i: int = 0; i < promptSpotArr.length; i++) { + var p: Object = promptSpotObjArr[i]; + var x: int = (p["time"] * w / timeTotal) - promptSpotArr[i].width * 0.5; + if (x < 0) { + x = 0; + } + if (x > w - promptSpotArr[i].width) { + x = w - promptSpotArr[i].width + } + var y: int = (MOBJ["timeSlider"]["backDefaultSprite"].height - promptSpotArr[i].height) * 0.5; + promptSpotArr[i].x = x; + promptSpotArr[i].y = y; + } + } + } + //-------------------------------------------------------------------------------------------提示点结束 + //-------------------------------------------------------------------------------------------提示图片 + private function previewShow(t: int = 0): void { + if (!preview && !previewLoad) { + if (!previewLoadIng) { + previewLoadIng = true; + loadPreview(t); + } + return; + } + if (preview != null) { + var scale: int = FLASHVARS["preview"]["scale"]; + var x: int = M.mouseX; + var nowNum: int = t / scale; + var numTotal: int = timeTotal / scale; + var imgW: int = preview.width * 0.01 / FLASHVARS["preview"]["file"].length; + var imgH: int = preview.height; + var left: int = (imgW * nowNum) - x + imgW * 0.5, + top: int = stageH - STYLE["preview"]["bottom"] - imgH; + //top: int = M.y - imgH - (M.height - STYLE["controlBar"]["height"]); + var topLeft: int = x - imgW * 0.5; + var timepieces: int = 0; + var isTween: Boolean = true; + if (previewTop == null) { + var obj: Object = { + width: imgW - Number(STYLE["preview"]["border"]), + height: imgH - Number(STYLE["preview"]["border"]), + borderAlpha: Number(STYLE["preview"]["alpha"]), + border: STYLE["preview"]["border"], + borderColor: STYLE["preview"]["borderColor"] + } + previewTop = element.newSprite(obj); + THIS.addChildAt(previewTop, THIS.getChildIndex(M)); + previewTop.visible = false; + } + //topLeft-=STYLE["preview"]["border"]; + //trace(THIS.getChildIndex(preview),THIS.getChildIndex(previewTop)); + if (THIS.getChildIndex(preview) > THIS.getChildIndex(previewTop)) { + var temp: int = THIS.getChildIndex(preview); + + //THIS.addChildAt(previewTop, THIS.getChildIndex(preview)); + THIS.addChildAt(preview, THIS.getChildIndex(previewTop)); + } + if (topLeft < 0) { + topLeft = 0; + timepieces = x - topLeft - imgW * 0.5; + } + if (topLeft > stageW - imgW) { + topLeft = stageW - imgW; + timepieces = x - topLeft - imgW * 0.5; + } + if (left < 0) { + left = 0; + } + if (left > numTotal * imgW - stageW) { + left = numTotal * imgW - stageH; + } + if (preview.visible == false) { + isTween = false; + } + previewTop.x = topLeft + STYLE["preview"]["border"] * 0.5; + previewTop.y = top + STYLE["preview"]["border"] * 0.5; + previewTop.visible = true; + preview.visible = true; + preview.y = top; + if (previewPrompt) { + previewPrompt.y = top - previewPrompt.height - Number(C.CONFIG["style"]["previewPrompt"]["marginBottom"]); + THIS.addChildAt(previewPrompt, THIS.getChildIndex(preview) + 1); + } + if (pTween != null) { + pTween.stop(); + pTween = null; + } + if (isTween) { + pTween = new Tween(preview, "x", None.easeOut, preview.x, -(left + timepieces), 0.3, true); + } else { + preview.x = -(left + timepieces); + } + } + } + private function previewHide(): void { + if (previewTop) { + previewTop.visible = false; + } + if (preview) { + preview.visible = false; + } + } + private function loadPreview(t: int = 0): void { + if (timeTotal <= 0) { + return; + } + if (FLASHVARS.hasOwnProperty("preview") && FLASHVARS["preview"] && !previewLoad) { + if (FLASHVARS["preview"].hasOwnProperty("file") && FLASHVARS["preview"].hasOwnProperty("scale")) { + previewElement = new newPreview(FLASHVARS["preview"]["file"], function (sp: Sprite = null) { + if (sp) { + if (preview) { + THIS.removeChild(preview); + preview = null; + } + //TRACE(preview.width) + preview = sp; + THIS.addChildAt(preview, THIS.getChildIndex(M)); + preview.visible = false; + if (t > 0 && prompt) { + previewShow(t); + } + } + previewElement = null; + previewLoad = true; + }); + } + + } + } + //-------------------------------------------------------------------------------------------提示图片 + //-------------------------------------------------------------------------------------------控制栏 + private function controlBarResize(): void { + var newSize: Object = {}, newCoor: Object = {}; + var i: int = 0; + var customArr: Array = []; + var k: String = ""; + if (M) { + var coor: Object = coorDinate({ + align: STYLE["controlBar"]["align"], + vAlign: STYLE["controlBar"]["vAlign"], + offsetX: STYLE["controlBar"]["offsetX"], + offsetY: STYLE["controlBar"]["offsetY"] + }); + M.x = coor["x"]; + M.y = coor["y"]; + } + if (MOBJ.hasOwnProperty("controlBarBgColor")) { + newSize = calculatedSize(STYLE["controlBar"]["width"].toString(), STYLE["controlBar"]["height"].toString()); + MOBJ["controlBarBgColor"].width = newSize["width"]; + MOBJ["controlBarBgColor"].height = newSize["height"]; + } + if (MOBJ.hasOwnProperty("backgroundImg")) { + newSize = calculatedSize(STYLE["controlBar"]["width"].toString(), STYLE["controlBar"]["height"].toString()); + MOBJ["backgroundImg"].width = newSize["width"]; + MOBJ["backgroundImg"].height = newSize["height"]; + } + //MOBJ["button"] + if (MOBJ.hasOwnProperty("button")) { + for (k in MOBJ["button"]) { + newCoor = coorDinate(STYLE["controlBar"]["button"][k], MOBJ["controlBarBgColor"]); + MOBJ["button"][k].x = newCoor["x"]; + MOBJ["button"][k].y = newCoor["y"]; + } + } + //定义自定义按钮的坐标 + if (MOBJ.hasOwnProperty("customButton")) { + for (k in MOBJ["customButton"]) { + newCoor = coorDinate(STYLE["controlBar"]["custom"]["button"][k], MOBJ["controlBarBgColor"]); + //script.traceObject(newCoor); + MOBJ["customButton"][k].x = newCoor["x"]; + MOBJ["customButton"][k].y = newCoor["y"]; + } + } + //自定义图片的坐标 + + if (MOBJ.hasOwnProperty("customImages")) { + for (k in MOBJ["customImages"]) { + newCoor = coorDinate(STYLE["controlBar"]["custom"]["images"][k], MOBJ["controlBarBgColor"]); + MOBJ["customImages"][k].x = newCoor["x"]; + MOBJ["customImages"][k].y = newCoor["y"]; + } + } + //自定义文本框的坐标 + if (MOBJ.hasOwnProperty("customText")) { + for (k in MOBJ["customText"]) { + newCoor = coorDinate(STYLE["controlBar"]["custom"]["text"][k], MOBJ["controlBarBgColor"]); + MOBJ["customText"][k].x = newCoor["x"]; + MOBJ["customText"][k].y = newCoor["y"]; + } + } + //自定swf的坐标 + if (MOBJ.hasOwnProperty("customSwf")) { + for (k in MOBJ["customSwf"]) { + newCoor = coorDinate(STYLE["controlBar"]["custom"]["swf"][k], MOBJ["controlBarBgColor"]); + MOBJ["customSwf"][k].x = newCoor["x"]; + MOBJ["customSwf"][k].y = newCoor["y"]; + } + } + } + private function loadCustomResize(): void { + //定义自定义按钮的坐标 + var k: String = ""; + var newCoor: Object = {}; + if (MOBJ.hasOwnProperty("vcustomButton")) { + for (k in MOBJ["vcustomButton"]) { + newCoor = coorDinate(STYLE["custom"]["button"][k]); + //script.traceObject(newCoor); + MOBJ["vcustomButton"][k].x = newCoor["x"]; + MOBJ["vcustomButton"][k].y = newCoor["y"]; + } + } + //自定义图片的坐标 + //trace("自定义图片",MOBJ.hasOwnProperty("vcustomImages")); + if (MOBJ.hasOwnProperty("vcustomImages")) { + for (k in MOBJ["vcustomImages"]) { + newCoor = coorDinate(STYLE["custom"]["images"][k]); + MOBJ["vcustomImages"][k].x = newCoor["x"]; + MOBJ["vcustomImages"][k].y = newCoor["y"]; + } + } + //自定义文本框的坐标 + if (MOBJ.hasOwnProperty("vcustomText")) { + for (k in MOBJ["vcustomText"]) { + newCoor = coorDinate(STYLE["custom"]["text"][k]); + MOBJ["vcustomText"][k].x = newCoor["x"]; + MOBJ["vcustomText"][k].y = newCoor["y"]; + } + } + //自定swf的坐标 + for( k in MOBJ){ + trace(k,MOBJ[k]); + } + if (MOBJ.hasOwnProperty("vcustomSwf")) { + for (k in MOBJ["vcustomSwf"]) { + newCoor = coorDinate(STYLE["custom"]["swf"][k]); + MOBJ["vcustomSwf"][k].x = newCoor["x"]; + MOBJ["vcustomSwf"][k].y = newCoor["y"]; + } + } + } + private function loadControlBar(): void { + //建立一个基于界面底部的元件 + var mObj: Object = { + backgroundColor: 0xFF0000, + backgroundAlpha: 0, //背景透明度 + width: 1, + height: 1 + }; + M = element.newSprite(mObj); + THIS.addChild(M); + if (CONFIG["config"]["buttonMode"]["controlBar"]) { + M.buttonMode = true; + } + if (STYLE.hasOwnProperty("controlBar")) { + if (STYLE["controlBar"].hasOwnProperty("hideControlBar")) { + if (STYLE["controlBar"]["hideControlBar"].hasOwnProperty("hideDelayTime")) { + if (STYLE["controlBar"]["hideControlBar"]["hideDelayTime"] > 0) { + cbHideTimer = new timeInterval(STYLE["controlBar"]["hideControlBar"]["hideDelayTime"], cbHideTimerHandler); + cbHideTimer.start(); + cbShowTimer = new timeInterval(100, cbShowTimerHandler); + } + } + } + } + + //加载纯色层 + //加载背景 + var background: Object = STYLE["controlBar"]["background"]; + var newSize: Object = calculatedSize(STYLE["controlBar"]["width"].toString(), STYLE["controlBar"]["height"].toString()); + //无论有没有图片都加载一个纯色层 + if (background.hasOwnProperty("backgroundColor") && background["backgroundColor"]) { + mObj = { + backgroundColor: background["backgroundColor"], + backgroundAlpha: (background.hasOwnProperty("backgroundImg") && background["backgroundImg"]) ? 0 : background["alpha"], //背景透明度 + width: newSize["width"], + height: newSize["height"], + radius: background["radius"] + }; + var backgroundColorSprite: Sprite = element.newSprite(mObj); + M.addChild(backgroundColorSprite); + MOBJ["controlBarBgColor"] = backgroundColorSprite; + } + if (background.hasOwnProperty("backgroundImg") && background["backgroundImg"]) { + loaderNum++; + var backgroundImgLoader: loadByteImg = new loadByteImg(background["backgroundImg"], function (byte: Loader = null) { + if (byte) { + var loader: Loader = byte; + loader.alpha = background["alpha"]; + M.addChild(loader); + MOBJ["backgroundImg"] = loader; + + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"background\"][\"backgroundImg\"]"); + + } + imgLoaded(); + controlBarResize(); + controlLoaderHandler(); + backgroundImgLoader = null; + }); + + } else { + controlBarResize(); + controlLoaderHandler(); + //loadLogo(); + } + + } + //统一的在控制栏加载完成后的动作 + private function controlLoaderHandler(): void { + loadControlBarButton(); + loadDefinition(); + loadSubtitles();//加载字幕切换按钮 + loadVolumeSlider(); //构建音量调节滑动条 + loadTimeSlider(); //构建时间进度滑动条 + loadSimpleSchedule(); //简单进度条 + loadTimeText(); + loadLoading(); + loadLogo(); + loadBuffer(); + loadCustom(); + loadAdvertisement(); + if (CONFIG["config"]["previewDefaultLoad"]) { + loadPreview(); + } + } + + //加载音量调节和进度条 + private function volumeSliderResize(): void { + if (MOBJ.hasOwnProperty("volumeSlider")) { + var newCoor: Object = coorDinate(STYLE["controlBar"]["volumeSchedule"], MOBJ["controlBarBgColor"]); + MOBJ["volumeSlider"]["backSprite"].x = newCoor["x"]; + MOBJ["volumeSlider"]["backSprite"].y = newCoor["y"]; + } + } + + //静音切换 + private function muteOrEscMute(volume: Number = 0): void { + if (volume == 0) { + MOBJ["button"]["mute"].visible = false; + MOBJ["button"]["escMute"].visible = true; + } else { + MOBJ["button"]["mute"].visible = true; + MOBJ["button"]["escMute"].visible = false; + } + } + private function mouseMoveHandler(event: MouseEvent): void { + /*MOBJ["volume"] = { + backSprite: backSprite, + backgroundLoader:backgroundLoader, + maskLoader: maskLoader, + maskSprite: maskSprite, + buttonLoader: buttonLoader + };*/ + var pointTemp: Point = new Point(event.localX, event.localY); + var value: Number = 0; + var stageX: int = 0; + //trace(event); + //trace(event.currentTarget.name); + switch (event.currentTarget) { + case MOBJ["timeSlider"]["backgroundDefaultLoader"]: + case MOBJ["timeSlider"]["loadDefaultLoader"]: + case MOBJ["timeSlider"]["playDefaultLoader"]: + //trace(timeTotal,new Date); + if (timeTotal == 0 || FLASHVARS["live"]) { + break; + } + //trace(MOBJ["timeSlider"]["backDefaultSprite"].mouseX,MOBJ["timeSlider"]["backgroundDefaultLoader"].width); + var mx: int = MOBJ["timeSlider"]["backDefaultSprite"].mouseX; + var bw: int = MOBJ["timeSlider"]["backgroundDefaultLoader"].width; + if (mx > bw - 2) { + mx = bw; + } + value = int(mx * timeTotal / bw); + if (value > timeTotal) { + value = timeTotal; + } + if (value < 0) { + value = 0; + } + //trace(MOBJ["timeSlider"]["backDefaultSprite"].mouseX,MOBJ["timeSlider"]["backgroundDefaultLoader"].width,value,"v"); + //trace(event.stageX, event.stageY , pointTemp.y); + stageX = STAGE.mouseX - M.x - MOBJ["timeSlider"]["backDefaultSprite"].x; + //trace(value,LANGUAGE["timeSliderOver"]); + showPrompt(getFormatTime(LANGUAGE["timeSliderOver"], value), stageX, event.stageY - pointTemp.y); + previewShow(value); + break; + case MOBJ["timeSlider"]["buttonDefaultLoader"]: + if (timeTotal == 0 || FLASHVARS["live"]) { + break; + } + value = Number((MOBJ["timeSlider"]["buttonDefaultLoader"].x - MOBJ["timeSlider"]["backDefaultSprite"].x) * timeTotal / (MOBJ["timeSlider"]["backgroundDefaultLoader"].width - MOBJ["timeSlider"]["buttonDefaultLoader"].width)); + //trace("value:",value); + if (value > timeTotal) { + value = timeTotal; + } + if (value < 0) { + value = 0; + } + seekTime = value; + //trace("要跳转的秒数,来之face",seekTime); + showPrompt(getFormatTime(LANGUAGE["timeSliderOver"], value), event.stageX, event.stageY - pointTemp.y); + break; + case MOBJ["definitionDefault"]: + if (STYLE["controlBar"]["definition"]["event"] != "over") { + showPrompt(LANGUAGE["buttonOver"]["definition"], M.x + MOBJ["definitionDefault"].x + MOBJ["definitionDefault"].width * 0.5, event.stageY - pointTemp.y); + } + break; + case MOBJ["subtitleDefault"]: + if (STYLE["controlBar"]["subtitle"]["event"] != "over") { + showPrompt(LANGUAGE["buttonOver"]["subtitles"], M.x + MOBJ["subtitleDefault"].x + MOBJ["subtitleDefault"].width * 0.5, event.stageY - pointTemp.y); + } + break; + case MOBJ["volumeSlider"]["backgroundLoader"]: + case MOBJ["volumeSlider"]["maskLoader"]: + value = MOBJ["volumeSlider"]["backgroundLoader"].mouseX / MOBJ["volumeSlider"]["backSprite"].width; + //changeVolume(vol * 0.01, true, true, false); + if (value > 1) { + value = 1; + } + if (value < 0) { + value = 0; + } + showPrompt(script.strReplace(LANGUAGE["volumeSliderOver"], ["[$volume]"], [Math.ceil(value * 100).toString()]), event.stageX, event.stageY - pointTemp.y); + break; + case MOBJ["volumeSlider"]["buttonLoader"]: + value = getVolumeTemp(); + showPrompt(script.strReplace(LANGUAGE["volumeSliderOver"], ["[$volume]"], [Math.ceil(value * 100).toString()]), event.stageX, event.stageY - pointTemp.y); + break; + case STAGE: + if (M && MOBJ.hasOwnProperty("timeSlider") && MOBJ.hasOwnProperty("timeOutSlider")) { + if (STAGE.mouseX > M.x + mMinXY["x"] && STAGE.mouseX < M.x + mMinXY["x"] + M.width && STAGE.mouseY > M.y + mMinXY["y"] && STAGE.mouseY < M.y + mMinXY["y"] + M.height) { + if (!timeSliderShow) { + timeDefaultShow(); + } + } else { + if (!timeOutSliderShow) { + timeOutShow(); + } + } + } + break; + default: + if (event.target.name.toString().indexOf("spirte_") > -1) { + var ni: int = Number(event.target.name.toString().replace("spirte_", "")); + var timeString: String = ""; + if (CONFIG["config"]["promptSpotTime"]) { + timeString = getFormatTime(LANGUAGE["timeSliderOver"], promptSpotObjArr[ni]["time"]) + " "; + } + stageX = STAGE.mouseX - M.x - MOBJ["timeSlider"]["backDefaultSprite"].x; + showPrompt(getFormatTime(LANGUAGE["timeSliderOver"], promptSpotObjArr[ni]["time"]), stageX, event.stageY - pointTemp.y); + showPreviewPrompt(timeString + promptSpotObjArr[ni]["words"], stageX, event.stageY - pointTemp.y); + previewShow(promptSpotObjArr[ni]["time"]); + } + break; + } + } + private function timeDefaultShow(): void { + if (showTween) { + showTween.stop(); + showTween = null; + } + if (hideTween) { + hideTween.stop(); + hideTween = null; + } + showTween = new Tween(MOBJ["timeSlider"]["backDefaultSprite"], "alpha", None.easeOut, MOBJ["timeSlider"]["backDefaultSprite"].alpha, 1, STYLE["controlBar"]["timeSchedule"]["defaultShowTime"], true); + showTween.start(); + hideTween = new Tween(MOBJ["timeOutSlider"]["backOutSprite"], "alpha", None.easeOut, MOBJ["timeOutSlider"]["backOutSprite"].alpha, 0, STYLE["controlBar"]["timeSchedule"]["mouseOutHideTime"], true); + hideTween.start(); + timeSliderShow = true; + timeOutSliderShow = false; + } + private function timeOutShow(): void { + if (showTween) { + showTween.stop(); + showTween = null; + } + if (hideTween) { + hideTween.stop(); + hideTween = null; + } + showTween = new Tween(MOBJ["timeSlider"]["backDefaultSprite"], "alpha", None.easeOut, MOBJ["timeSlider"]["backDefaultSprite"].alpha, 0, STYLE["controlBar"]["timeSchedule"]["defaultHideTime"], true); + showTween.start(); + hideTween = new Tween(MOBJ["timeOutSlider"]["backOutSprite"], "alpha", None.easeOut, MOBJ["timeOutSlider"]["backOutSprite"].alpha, 1, STYLE["controlBar"]["timeSchedule"]["mouseOutShowTime"], true); + hideTween.start(); + timeOutSliderShow = true; + timeSliderShow = false; + } + private function cbHideTimerHandler(): void { + var nowStageXY: Object = { + x: STAGE.mouseX, + y: STAGE.mouseY + }; + if (MOBJ["button"]["pause"].visible && (nowStageXY["x"] == oldStageXY["x"] || nowStageXY["y"] == oldStageXY["y"]) && (STAGE.mouseX < M.x + mMinXY["x"] || STAGE.mouseX > M.x + mMinXY["x"] + M.width || STAGE.mouseY < M.y + mMinXY["y"] || STAGE.mouseY > M.y + mMinXY["y"] + M.height)) { + var hideEnvironment: String = STYLE["controlBar"]["hideControlBar"]["hideEnvironment"]; + if (mShow && (hideEnvironment == "all" || (hideEnvironment == "full" && full) || (hideEnvironment == "nofull" && !full))) { + mHideHandler(); + if (cbShowTimer) { + cbHideTimer.stop(); + cbShowTimer.start(); + } + } + } + oldStageXY = nowStageXY; + } + private function cbShowTimerHandler(): void { + var nowStageXY: Object = { + x: STAGE.mouseX, + y: STAGE.mouseY + }; + if (nowStageXY["x"] != oldStageXY["x"] || nowStageXY["y"] != oldStageXY["y"]) { + oldStageXY = nowStageXY; + if (!mShow) { + mShowHandler(); + if (cbHideTimer) { + cbHideTimer.start(); + cbShowTimer.stop(); + } + } + + } + } + private function mShowHandler(): void { + if (force) { + return; + } + if (cbTween) { + cbTween.removeEventListener(TweenEvent.MOTION_FINISH, simpleScheduleHandler); + cbTween = null; + } + mShow = true; + var coor: Object = coorDinate({ + align: STYLE["controlBar"]["align"], + vAlign: STYLE["controlBar"]["vAlign"], + offsetX: STYLE["controlBar"]["offsetX"], + offsetY: STYLE["controlBar"]["offsetY"] + }); + if (MOBJ.hasOwnProperty("simpleSchedule")) { + MOBJ["simpleSchedule"]["backDefaultSprite"].visible = false; + } + if(M.visible==false){ + M.visible=true; + } + if (STYLE["controlBar"]["hideControlBar"]["hideMode"] == "alpha") { + cbTween = new Tween(M, "alpha", None.easeOut, M.alpha, 1, STYLE["controlBar"]["hideControlBar"]["hideTweenTime"], true); + } else { + cbTween = new Tween(M, "y", None.easeOut, M.y, coor["y"], STYLE["controlBar"]["hideControlBar"]["hideTweenTime"], true); + } + THIS["controlBarIsShow"](); + Mouse.show(); + } + private function mHideHandler(): void { + trace("控制栏隐藏"); + if (cbTween) { + cbTween.removeEventListener(TweenEvent.MOTION_FINISH, simpleScheduleHandler); + cbTween = null; + } + mShow = false; + THIS["controlBarIsShow"](false); + if (force) { + M.visible=false; + } else { + if (STYLE["controlBar"]["hideControlBar"]["hideMode"] == "alpha") { + cbTween = new Tween(M, "alpha", None.easeOut, M.alpha, 0, STYLE["controlBar"]["hideControlBar"]["hideTweenTime"], true); + } else { + cbTween = new Tween(M, "y", None.easeOut, M.y, stageH + M.height, STYLE["controlBar"]["hideControlBar"]["hideTweenTime"], true); + } + if (cbTween) { + cbTween.addEventListener(TweenEvent.MOTION_FINISH, simpleScheduleHandler); + } + } + + if (!force) { + Mouse.hide(); + } + } + private function simpleScheduleHandler(event: TweenEvent) { + if (MOBJ.hasOwnProperty("simpleSchedule")) { + var showSimpleSchedule: String = STYLE["controlBar"]["hideControlBar"]["showSimpleSchedule"]; + if (showSimpleSchedule == "all" || (showSimpleSchedule == "nofull" && !full) || (showSimpleSchedule == "full" && full)) { + MOBJ["simpleSchedule"]["backDefaultSprite"].visible = true; + } + + } + } + private function getVolumeTemp(): Number { + var vol: Number = volumeTemp; + if (vol > 1) { + vol = 1; + } + if (vol < 0) { + vol = 0; + } + return vol; + } + private function timeSliderResize() { + //timeSliderResize + /* + MOBJ["timeSlider"] = { + backDefaultSprite: backDefaultSprite, + backgroundDefaultLoader: backgroundDefaultLoader, + loadDefaultLoader: loadDefaultLoader, + loadDefaultSprite: loadDefaultSprite, + playDefaultLoader: playDefaultLoader, + playDefaultSprite: playDefaultSprite, + buttonDefaultLoader: buttonDefaultLoader + }; + */ + var newCoor: Object = {}; + var newSize: Object = {}; + if (MOBJ.hasOwnProperty("timeSlider")) { + newCoor = coorDinate(STYLE["controlBar"]["timeSchedule"]["default"], MOBJ["timeSlider"]["backDefaultSprite"]); + script.traceObject(newCoor); + newSize = calculatedSize(STYLE["controlBar"]["timeSchedule"]["default"]["width"].toString(), MOBJ["timeSlider"]["backDefaultSprite"].height.toString(), MOBJ["controlBarBgColor"]); + MOBJ["timeSlider"]["backDefaultSprite"].x = newCoor["x"]; + MOBJ["timeSlider"]["backDefaultSprite"].y = newCoor["y"]; + MOBJ["timeSlider"]["backgroundDefaultLoader"].width = newSize["width"]; + MOBJ["timeSlider"]["loadDefaultLoader"].width = newSize["width"]; + MOBJ["timeSlider"]["playDefaultLoader"].width = newSize["width"]; + trace(MOBJ["timeSlider"]["backDefaultSprite"].height); + timePlaySliderChange(timeNow); + timeLoadSliderChange(loadNow); + } + if (MOBJ.hasOwnProperty("timeOutSlider")) { + //trace(MOBJ["timeOutSlider"]["backOutSprite"].width, "=="); + newCoor = coorDinate(STYLE["controlBar"]["timeSchedule"]["mouseOut"], MOBJ["timeOutSlider"]["backOutSprite"]); + newSize = calculatedSize(STYLE["controlBar"]["timeSchedule"]["mouseOut"]["width"].toString(), MOBJ["timeOutSlider"]["backOutSprite"].height.toString(), MOBJ["controlBarBgColor"]); + MOBJ["timeOutSlider"]["backOutSprite"].x = newCoor["x"]; + MOBJ["timeOutSlider"]["backOutSprite"].y = newCoor["y"]; + MOBJ["timeOutSlider"]["backgroundOutLoader"].width = newSize["width"]; + MOBJ["timeOutSlider"]["loadOutLoader"].width = newSize["width"]; + MOBJ["timeOutSlider"]["playOutLoader"].width = newSize["width"]; + + timePlaySliderChange(timeNow); + timeLoadSliderChange(loadNow); + } + } + private function simpleScheduleResize() { + //timeSliderResize + /* + MOBJ["timeSlider"] = { + backDefaultSprite: backDefaultSprite, + backgroundDefaultLoader: backgroundDefaultLoader, + loadDefaultLoader: loadDefaultLoader, + loadDefaultSprite: loadDefaultSprite, + playDefaultLoader: playDefaultLoader, + playDefaultSprite: playDefaultSprite, + buttonDefaultLoader: buttonDefaultLoader + }; + */ + var newCoor: Object = {}; + var newSize: Object = {}; + if (MOBJ.hasOwnProperty("simpleSchedule")) { + newCoor = coorDinate(STYLE["controlBar"]["hideControlBar"]["simpleSchedule"]); + newSize = calculatedSize(STYLE["controlBar"]["hideControlBar"]["simpleSchedule"]["width"].toString(), MOBJ["simpleSchedule"]["backDefaultSprite"].height.toString()); + MOBJ["simpleSchedule"]["backDefaultSprite"].x = newCoor["x"]; + MOBJ["simpleSchedule"]["backDefaultSprite"].y = newCoor["y"]; + MOBJ["simpleSchedule"]["backgroundDefaultLoader"].width = newSize["width"]; + MOBJ["simpleSchedule"]["loadDefaultLoader"].width = newSize["width"]; + MOBJ["simpleSchedule"]["playDefaultLoader"].width = newSize["width"]; + timePlaySimpleChange(timeNow); + timeLoadSimpleChange(loadNow); + } + } + + private function mouseDownHandler(event: MouseEvent): void { + STAGE.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); + point = new Point(event.localX, event.localY); + switch (event.currentTarget) { + case MOBJ["timeSlider"]["buttonDefaultLoader"]: + if (timeTotal == 0 || FLASHVARS["live"] || CONFIG["config"]["timeScheduleAdjust"] == 0) { + break; + } + mouseDownName = "time"; + timeFollow = false; + buttonDown = true; + trace("是否跟着走timeFollow02", timeFollow); + mUpSeek = true; + //trace("a"); + MOBJ["timeSlider"]["buttonDefaultLoader"].addEventListener(Event.ENTER_FRAME, enterFrameHandler); + break; + case MOBJ["volumeSlider"]["buttonLoader"]: + mouseDownName = "volume"; + MOBJ["volumeSlider"]["buttonLoader"].addEventListener(Event.ENTER_FRAME, enterFrameHandler); + break; + default: + break; + } + + } + private function enterFrameHandler(event: Event): void { + if (point != null) { + var newX: int = 0; + switch (mouseDownName) { + case "time": + var btW: Number = MOBJ["timeSlider"]["buttonDefaultLoader"].width; + var bkW: Number = MOBJ["timeSlider"]["backgroundDefaultLoader"].width; + if (timeTotal == 0 || FLASHVARS["live"] || CONFIG["config"]["timeScheduleAdjust"] == 0) { + return; + } + newX = MOBJ["timeSlider"]["backDefaultSprite"].mouseX - point.x; + if (point.x > btW * 0.5) { + newX += (point.x - btW * 0.5); + } else { + newX -= (btW * 0.5 - point.x); + } + if (newX < 0) { + newX = 0; + } + //trace(newX); + var seekTimeTemp = (newX - MOBJ["timeSlider"]["backDefaultSprite"].x) * timeTotal / (bkW - btW); + //trace("seekTimeTemp",seekTimeTemp,MOBJ["timeSlider"]["backDefaultSprite"].x,MOBJ["timeSlider"]["backDefaultSprite"].width); + var isSeek: Boolean = true; + switch (CONFIG["config"]["timeScheduleAdjust"]) { + case 0: + isSeek = false; + break; + case 2: + if (seekTimeTemp < timeNow) { + isSeek = false; + } + break; + case 3: + if (seekTimeTemp > timeNow) { + isSeek = false; + } + break; + case 4: + //trace(timeSeek); + if (timeSeek > -1) { + if (seekTimeTemp < timeSeek) { + isSeek = false; + } + } else { + if (seekTimeTemp < timeNow) { + isSeek = false; + } + } + break; + case 5: + if (seekTimeTemp > timeMax) { + isSeek = false; + } + break; + } + //trace("-------------------",isSeek); + if (!isSeek) { + mUpSeek = false; + break; + } else { + mUpSeek = true; + } + if (newX >= bkW - btW) { + newX = bkW - btW; + } + MOBJ["timeSlider"]["buttonDefaultLoader"].x = newX; + MOBJ["timeSlider"]["playDefaultSprite"].width = newX + btW * 0.5; + //seekTime = (newX*timeTotal)/(bkW-btW); + if (seekTime < 0) { + seekTime = 0; + } + if (seekTime > timeTotal - 1) { + seekTime = 0; + } + //trace("要跳转的时间",seekTime); + break; + case "volume": + newX = MOBJ["volumeSlider"]["backSprite"].mouseX - point.x; + if (point.x > MOBJ["volumeSlider"]["buttonLoader"].width * 0.5) { + newX += (point.x - MOBJ["volumeSlider"]["buttonLoader"].width * 0.5); + } else { + newX -= (MOBJ["volumeSlider"]["buttonLoader"].width * 0.5 - point.x); + } + if (newX < 0) { + newX = 0; + } + if (newX >= MOBJ["volumeSlider"]["backSprite"].width - MOBJ["volumeSlider"]["buttonLoader"].width) { + newX = MOBJ["volumeSlider"]["backSprite"].width - MOBJ["volumeSlider"]["buttonLoader"].width; + MOBJ["volumeSlider"]["maskSprite"].width = MOBJ["volumeSlider"]["backSprite"].width; + } else { + MOBJ["volumeSlider"]["maskSprite"].width = newX + MOBJ["volumeSlider"]["buttonLoader"].width * 0.5 + } + MOBJ["volumeSlider"]["buttonLoader"].x = newX; + var vol: Number = Math.round(MOBJ["volumeSlider"]["buttonLoader"].x * 100 / (MOBJ["volumeSlider"]["backSprite"].width - MOBJ["volumeSlider"]["buttonLoader"].width)) * 0.01; + if (vol > 1) { + vol = 1; + } + if (vol < 0) { + vol = 0; + } + volumeTemp = vol; + THIS["changeVolume"](vol, false); //调用主程序里的调节音量并且不改变调用滑块 + muteOrEscMute(vol); + break; + default: + break; + } + } + } + private function mouseUpHandler(event: MouseEvent): void { + point = null; + switch (mouseDownName) { + case "time": + //trace(timeTotal); + buttonDown = false; + if (timeTotal == 0 || FLASHVARS["live"] || CONFIG["config"]["timeScheduleAdjust"] == 0) { + return; + } + MOBJ["timeSlider"]["buttonDefaultLoader"].removeEventListener(Event.ENTER_FRAME, enterFrameHandler); + //trace("+++++++++++++++++",mUpSeek); + if (mUpSeek) { + //trace("要跳转的秒数来之Up", seekTime); + THIS["videoSeek"](seekTime, false); //调用主程序里的Seek并且不改变调用滑块 + } else { + timeFollow = true; + } + break; + case "volume": + MOBJ["volumeSlider"]["buttonLoader"].removeEventListener(Event.ENTER_FRAME, enterFrameHandler); + break; + default: + break; + } + //showTips(null, ""); + STAGE.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); + } + + private function loadVolumeSlider(): void { + //音量调节滑块 + var volume: Object = STYLE["controlBar"]["volumeSchedule"]; + var backgroundLoader: Loader = null, + maskLoader: Loader = null, + buttonLoader: Sprite = null, + backSprite: Sprite = null, + maskSprite: Sprite = null; + function loadBackgroundImg(): void { + loaderNum++; + var backgroundImgLoader: loadByteImg = new loadByteImg(volume["backgroundImg"], function (byte: Loader = null) { + if (byte) { + backgroundLoader = byte; + loadMaskImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"volume\"][\"background\"][\"backgroundImg\"]"); + + } + imgLoaded(); + backgroundImgLoader = null; + }); + } + function loadMaskImg(): void { + loaderNum++; + var maskImgLoader: loadByteImg = new loadByteImg(volume["maskImg"], function (byte: Loader = null) { + if (byte) { + maskLoader = byte; + loadButtonImg() + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"volume\"][\"maskImg\"][\"backgroundImg\"]"); + + } + loadButtonImg(); + imgLoaded(); + maskImgLoader = null; + }); + } + function loadButtonImg(): void { + loaderNum++; + buttonLoader = element.imgButton(volume["button"], "volumeSchedule", function () { + loadButtonHandler(); + imgLoaded(); + + }); + } + function loadButtonHandler(): void { + var sObj: Object = { + backgroundColor: 0xFF0000, //背景颜色 + backgroundAlpha: 0, //背景透明度 + width: backgroundLoader.width, + height: backgroundLoader.height > buttonLoader.height ? backgroundLoader.height : buttonLoader.height + }; + backSprite = element.newSprite(sObj); + if (CONFIG["config"]["buttonMode"]["volumeSchedule"]) { + backSprite.buttonMode = true; + } + maskSprite = element.newSprite(sObj); + backgroundLoader.y = (backSprite.height - backgroundLoader.height) * 0.5; + backSprite.addChild(backgroundLoader); + maskLoader.y = (backSprite.height - maskLoader.height) * 0.5; + backSprite.addChild(maskLoader); + backSprite.addChild(maskSprite); + maskLoader.mask = maskSprite; + buttonLoader.y = (backSprite.height - buttonLoader.height) * 0.5; + backSprite.addChild(buttonLoader); + M.addChild(backSprite); + MOBJ["volumeSlider"] = { + backSprite: backSprite, + backgroundLoader: backgroundLoader, + maskLoader: maskLoader, + maskSprite: maskSprite, + buttonLoader: buttonLoader + }; + volumeSliderResize(); + volumeSliderChange(FLASHVARS["volume"]); + buttonLoader.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); + backgroundLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + maskLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + backgroundLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + maskLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + buttonLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + backSprite.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + + } + if (volume.hasOwnProperty("backgroundImg") && volume["backgroundImg"]) { + loadBackgroundImg(); + } + } + //时间进度调节滑动条 + private function loadTimeSlider(): void { + var timeSchedule: Object = STYLE["controlBar"]["timeSchedule"]; + var defaultSchedule: Object = {}, outSchedule: Object = {}; + var backgroundDefaultLoader: Loader = null, + loadDefaultLoader: Loader = null, + playDefaultLoader: Loader = null, + buttonDefaultLoader: Sprite = null, + backDefaultSprite: Sprite = null, + loadDefaultSprite: Sprite = null, + playDefaultSprite: Sprite = null; + var backgroundOutLoader: Loader = null, + loadOutLoader: Loader = null, + playOutLoader: Loader = null, + buttonOutLoader: Sprite = null, + backOutSprite: Sprite = null, + loadOutSprite: Sprite = null, + playOutSprite: Sprite = null; + function loadDefaultBackgroundImg(): void { + loaderNum++; + var backgroundImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["backgroundImg"], function (byte: Loader = null) { + if (byte) { + backgroundDefaultLoader = byte; + loadDefaultLoadImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"default\"][\"background\"][\"backgroundImg\"]"); + + } + imgLoaded(); + backgroundImgDefaultLoader = null; + }); + } + function loadDefaultLoadImg(): void { + loaderNum++; + var loadImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["loadProgressImg"], function (byte: Loader = null) { + if (byte) { + loadDefaultLoader = byte; + loadDefaultPlayImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"default\"][\"background\"][\"loadProgressImg\"]"); + + } + imgLoaded(); + loadImgDefaultLoader = null; + }); + } + function loadDefaultPlayImg(): void { + loaderNum++; + var playImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["playProgressImg"], function (byte: Loader = null) { + if (byte) { + playDefaultLoader = byte; + loadDefaultButtonImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"default\"][\"background\"][\"playProgressImg\"]"); + + } + imgLoaded(); + playImgDefaultLoader = null; + }); + } + function loadDefaultButtonImg(): void { + loaderNum++; + buttonDefaultLoader = element.imgButton(timeSchedule["button"], "timeSchedule", function () { + if (timeSchedule.hasOwnProperty("mouseOut") && timeSchedule["mouseOut"]) { + outSchedule = timeSchedule["mouseOut"]; + loadOutBackgroundImg(); + } else { + loadButtonHandler(); + } + imgLoaded(); + + }); + } + //----------------------------加载鼠标离开进度条 + + function loadOutBackgroundImg(): void { + loaderNum++; + var backgroundImgOutLoader: loadByteImg = new loadByteImg(outSchedule["backgroundImg"], function (byte: Loader = null) { + if (byte) { + backgroundOutLoader = byte; + loadOutLoadImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"out\"][\"background\"][\"backgroundImg\"]"); + + } + imgLoaded(); + backgroundImgOutLoader = null; + }); + } + function loadOutLoadImg(): void { + loaderNum++; + var loadImgOutLoader: loadByteImg = new loadByteImg(outSchedule["loadProgressImg"], function (byte: Loader = null) { + if (byte) { + loadOutLoader = byte; + loadOutPlayImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"out\"][\"background\"][\"loadProgressImg\"]"); + + } + imgLoaded(); + loadImgOutLoader = null; + }); + } + function loadOutPlayImg(): void { + loaderNum++; + var playImgOutLoader: loadByteImg = new loadByteImg(outSchedule["playProgressImg"], function (byte: Loader = null) { + if (byte) { + playOutLoader = byte; + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"timeSchedule\"][\"out\"][\"background\"][\"playProgressImg\"]"); + + } + loadButtonHandler(); + imgLoaded(); + playImgOutLoader = null; + }); + } + + //----------------------------加载鼠标离开进度条结束 + function loadButtonHandler(): void { + + var sObj: Object = {}; + //---------------------- + if (timeSchedule.hasOwnProperty("mouseOut") && timeSchedule["mouseOut"]) { + sObj = { + backgroundColor: 0xFF0000, //背景颜色 + backgroundAlpha: 0, //背景透明度 + width: 11, + height: backgroundOutLoader.height + }; + backOutSprite = element.newSprite(sObj); + loadOutSprite = element.newSprite(sObj); + playOutSprite = element.newSprite(sObj); + + backOutSprite.addChild(backgroundOutLoader); + backgroundOutLoader.y = (backOutSprite.height - backgroundOutLoader.height) * 0.5; + backOutSprite.addChild(loadOutLoader); + loadOutLoader.y = (backOutSprite.height - loadOutLoader.height) * 0.5; + backOutSprite.addChild(loadOutSprite); + loadOutLoader.mask = loadOutSprite; + backOutSprite.addChild(playOutLoader); + + playOutLoader.y = (backOutSprite.height - playOutLoader.height) * 0.5; + + backOutSprite.addChild(playOutSprite); + playOutLoader.mask = playOutSprite; + + M.addChild(backOutSprite); + MOBJ["timeOutSlider"] = { + backOutSprite: backOutSprite, + backgroundOutLoader: backgroundOutLoader, + loadOutLoader: loadOutLoader, + loadOutSprite: loadOutSprite, + playOutLoader: playOutLoader, + playOutSprite: playOutSprite + }; + MOBJ["timeOutSlider"]["backOutSprite"].alpha = 0; + backgroundOutLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + loadOutLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + playOutLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + backgroundOutLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + loadOutLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + playOutLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + } + //--------------------- + sObj = { + backgroundColor: 0xFF0000, //背景颜色 + backgroundAlpha: 0, //背景透明度 + width: 11, + height: backgroundDefaultLoader.height > buttonDefaultLoader.height ? backgroundDefaultLoader.height : buttonDefaultLoader.height + }; + backDefaultSprite = element.newSprite(sObj); + if (CONFIG["config"]["buttonMode"]["timeSchedule"]) { + backDefaultSprite.buttonMode = true; + } + loadDefaultSprite = element.newSprite(sObj); + playDefaultSprite = element.newSprite(sObj); + backDefaultSprite.addChild(backgroundDefaultLoader); + backgroundDefaultLoader.y = (backDefaultSprite.height - backgroundDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(loadDefaultLoader); + loadDefaultLoader.y = (backDefaultSprite.height - loadDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(loadDefaultSprite); + loadDefaultLoader.mask = loadDefaultSprite; + backDefaultSprite.addChild(playDefaultLoader); + playDefaultLoader.y = (backDefaultSprite.height - playDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(playDefaultSprite); + playDefaultLoader.mask = playDefaultSprite; + backDefaultSprite.addChild(buttonDefaultLoader); + buttonDefaultLoader.y = (backDefaultSprite.height - buttonDefaultLoader.height) * 0.5; + M.addChild(backDefaultSprite); + MOBJ["timeSlider"] = { + backDefaultSprite: backDefaultSprite, + backgroundDefaultLoader: backgroundDefaultLoader, + loadDefaultLoader: loadDefaultLoader, + loadDefaultSprite: loadDefaultSprite, + playDefaultLoader: playDefaultLoader, + playDefaultSprite: playDefaultSprite, + buttonDefaultLoader: buttonDefaultLoader + }; + //M.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); + //M.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + buttonDefaultLoader.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); + backgroundDefaultLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + loadDefaultLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + playDefaultLoader.addEventListener(MouseEvent.CLICK, mouseClickHandler); + + backgroundDefaultLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + loadDefaultLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + playDefaultLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + buttonDefaultLoader.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + backDefaultSprite.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + STAGE.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); //注册鼠标经过屏幕时的动作 + timeSliderResize(); + } + if (timeSchedule.hasOwnProperty("default") && timeSchedule["default"]) { + defaultSchedule = timeSchedule["default"]; + loadDefaultBackgroundImg(); + } + } + //时间进度调节滑动条 + private function loadSimpleSchedule(): void { + var defaultSchedule: Object = {}; + if (STYLE["controlBar"].hasOwnProperty("hideControlBar")) { + if (STYLE["controlBar"]["hideControlBar"]["showSimpleSchedule"] != "none") { + defaultSchedule = STYLE["controlBar"]["hideControlBar"]["simpleSchedule"]; + } else { + return; + } + } else { + return; + } + var backgroundDefaultLoader: Loader = null, + loadDefaultLoader: Loader = null, + playDefaultLoader: Loader = null, + buttonDefaultLoader: Sprite = null, + backDefaultSprite: Sprite = null, + loadDefaultSprite: Sprite = null, + playDefaultSprite: Sprite = null; + + function loadDefaultBackgroundImg(): void { + loaderNum++; + var backgroundImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["backgroundImg"], function (byte: Loader = null) { + if (byte) { + backgroundDefaultLoader = byte; + loadDefaultLoadImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"simpleSchedule\"][\"background\"][\"backgroundImg\"]"); + + } + imgLoaded(); + backgroundImgDefaultLoader = null; + + }); + } + function loadDefaultLoadImg(): void { + loaderNum++; + var loadImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["loadProgressImg"], function (byte: Loader = null) { + if (byte) { + loadDefaultLoader = byte; + loadDefaultPlayImg(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"simpleSchedule\"][\"background\"][\"loadProgressImg\"]"); + + } + imgLoaded(); + loadImgDefaultLoader = null; + }); + } + function loadDefaultPlayImg(): void { + loaderNum++; + var playImgDefaultLoader: loadByteImg = new loadByteImg(defaultSchedule["playProgressImg"], function (byte: Loader = null) { + if (byte) { + playDefaultLoader = byte; + loadDefaultHandler(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"simpleSchedule\"][\"background\"][\"playProgressImg\"]"); + + } + imgLoaded(); + playImgDefaultLoader = null; + }); + } + + function loadDefaultHandler(): void { + + var sObj: Object = { + backgroundColor: 0xFF0000, //背景颜色 + backgroundAlpha: 0, //背景透明度 + width: 11, + height: backgroundDefaultLoader.height + }; + + backDefaultSprite = element.newSprite(sObj); + loadDefaultSprite = element.newSprite(sObj); + playDefaultSprite = element.newSprite(sObj); + backDefaultSprite.addChild(backgroundDefaultLoader); + backgroundDefaultLoader.y = (backDefaultSprite.height - backgroundDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(loadDefaultLoader); + loadDefaultLoader.y = (backDefaultSprite.height - loadDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(loadDefaultSprite); + loadDefaultLoader.mask = loadDefaultSprite; + backDefaultSprite.addChild(playDefaultLoader); + playDefaultLoader.y = (backDefaultSprite.height - playDefaultLoader.height) * 0.5; + backDefaultSprite.addChild(playDefaultSprite); + playDefaultLoader.mask = playDefaultSprite; + THIS.addChild(backDefaultSprite); + backDefaultSprite.visible = false; + MOBJ["simpleSchedule"] = { + backDefaultSprite: backDefaultSprite, + backgroundDefaultLoader: backgroundDefaultLoader, + loadDefaultLoader: loadDefaultLoader, + loadDefaultSprite: loadDefaultSprite, + playDefaultLoader: playDefaultLoader, + playDefaultSprite: playDefaultSprite + }; + //script.traceObject(MOBJ); + simpleScheduleResize(); + } + loadDefaultBackgroundImg(); + } + //获取当前播放时间 + private function getFormatTime(timeStr: String, nowTime: Number = -1): String { + var nowDate: Date = new Date(); + if (C.CONFIG["config"]["time"] > 0) { + //trace(C.CONFIG["config"]["time"]); + nowDate = new Date(C.CONFIG["config"]["time"]); + } + //trace(nowDate); + var yearY: int = nowDate.fullYear; + var month: int = nowDate.month + 1; + var date: int = nowDate.date; + var hours: int = nowDate.hours; + var minutes: int = nowDate.minutes; + var seconds: int = nowDate.seconds; + + var yeary: String = yearY.toString().substr(2, 2); + var monthh: String = month < 10 ? "0" + month : month.toString(); + var datee: String = date < 10 ? "0" + date : date.toString(); + var hourss: String = hours < 10 ? "0" + hours : hours.toString(); + var minutess: String = minutes < 10 ? "0" + minutes : minutes.toString(); + var secondss: String = seconds < 10 ? "0" + seconds : seconds.toString(); + /*liveTimey:yeary,//liveTimey + liveTimeY:yearY, + liveTimem:monthh, + liveTimed:hourss, + liveTimeh:hourss, + liveTimei:minutess, + liveTimes:secondss,*/ + //trace(nowTime , timeNow); + var timeArr: Array = script.formatTime(nowTime > -1 ? nowTime : timeNow, C.CONFIG["config"]["liveAndVod"]["open"] ? C.CONFIG["config"]["liveAndVod"]["vodTime"] : 0, C.CONFIG["config"]["liveAndVod"]["open"] ? hours : 0); + //trace(timeArr); + var totalArr: Array = script.formatTime(timeTotal); + for (var i: int = 0; i < totalArr.length; i++) { + timeArr.push(totalArr[i]); + } + timeArr.push(yeary, yearY, monthh, datee, hourss, minutess, secondss); + timeArr.push(LANGUAGE["live"]); + timeArr.push(LANGUAGE["vod"]); + //timeArr.push(LANGUAGE["vod"]); + //timeArr.push(LANGUAGE["liveAndVod"]); + var timeStrArr: Array = ["[$timeh]", "[$timei]", "[$timeI]", "[$times]", "[$timeS]", "[$durationh]", "[$durationi]", "[$durationI]", "[$durations]", "[$durationS]", + "[$liveTimey]", "[$liveTimeY]", "[$liveTimem]", "[$liveTimed]", "[$liveTimeh]", "[$liveTimei]", "[$liveTimes]", "[$liveLanguage]", "[$vodLanguage]" + ]; + //trace(timeStrArr); + if (FLASHVARS["live"]) { + return script.strReplace(script.strReplace(LANGUAGE["live"], timeStrArr, timeArr), timeStrArr, timeArr); + } else if (C.CONFIG["config"]["liveAndVod"]["open"]) { + return script.strReplace(script.strReplace(LANGUAGE["liveAndVod"], timeStrArr, timeArr), timeStrArr, timeArr); + } else { + return script.strReplace(script.strReplace(timeStr, timeStrArr, timeArr), timeStrArr, timeArr); + + } + + } + //获取当前播放时间 + private function getFormatLiveTime(): Object { + var nowDate: Date = new Date(); + if (C.CONFIG["config"]["time"] > 0) { + nowDate = new Date(C.CONFIG["config"]["time"]); + } + var hours: int = nowDate.hours; + var minutes: int = nowDate.minutes; + var seconds: int = nowDate.seconds; + return { + hours: hours, + minutes: minutes, + seconds: seconds + }; + } + //调整点播时间文本框 + private function vodTimeTextResize(): void { + if (MOBJ.hasOwnProperty("timeVodText") && MOBJ["timeVodText"] != null) { + var timeTextArr: Array = MOBJ["timeVodText"]; + var timeText: Object = STYLE["controlBar"]["timeText"]["vod"]; + var vodArr: Array = []; + if (script.getType(timeText) != "array") { + vodArr.push(timeText); + } else { + vodArr = STYLE["controlBar"]["timeText"]["vod"]; + } + for (var i: int = 0; i < timeTextArr.length; i++) { + var coor: Object = coorDinate(vodArr[i]); + timeTextArr[i].x = coor["x"]; + timeTextArr[i].y = coor["y"]; + M.addChild(timeTextArr[i]); + } + } + } + //调整直播时间文本框 + private function liveTimeTextResize(): void { + if (MOBJ.hasOwnProperty("timeLiveText") && MOBJ["timeLiveText"] != null) { + var timeTextArr: Array = MOBJ["timeLiveText"]; + var timeText: Object = STYLE["controlBar"]["timeText"]["live"]; + var liveArr: Array = []; + if (script.getType(timeText) != "array") { + liveArr.push(timeText); + } else { + liveArr = STYLE["controlBar"]["timeText"]["live"]; + } + for (var i: int = 0; i < timeTextArr.length; i++) { + var coor: Object = coorDinate(liveArr[i]); + timeTextArr[i].x = coor["x"]; + timeTextArr[i].y = coor["y"]; + M.addChild(timeTextArr[i]); + } + } + } + //加载点播时间文本框 + private function loadVodTimeText(): void { + if (!STYLE["controlBar"]["timeText"].hasOwnProperty("vod")) { + return; + } + var vodArr: Array = []; + var textArr: Array = []; + var timeTextArr: Array = []; + if (script.getType(STYLE["controlBar"]["timeText"]["vod"]) != "array") { + vodArr.push(STYLE["controlBar"]["timeText"]["vod"]); + } else { + vodArr = STYLE["controlBar"]["timeText"]["vod"]; + } + for (var i: int = 0; i < vodArr.length; i++) { + var obj: Object = { + text: getFormatTime(vodArr[i]["text"]), + color: vodArr[i]["color"], + size: vodArr[i]["size"], + font: vodArr[i]["font"], + alpha: vodArr[i]["alpha"], + bold: vodArr[i]["bold"] + }; + var newText: TextField = element.newText(obj); + M.addChild(newText); + timeTextArr.push(newText); + } + MOBJ["timeVodText"] = timeTextArr; + vodTimeTextResize(); + + } + + //加载直播时间文本框 + private function loadLiveTimeText(): void { + if (!STYLE["controlBar"]["timeText"].hasOwnProperty("live")) { + return; + } + var timeText: Object = STYLE["controlBar"]["timeText"]["live"]; + var liveArr: Array = []; + var textArr: Array = []; + var timeTextArr: Array = []; + if (script.getType(timeText) != "array") { + liveArr.push(timeText); + } else { + liveArr = STYLE["controlBar"]["timeText"]["live"]; + } + for (var i: int = 0; i < liveArr.length; i++) { + var obj: Object = { + text: getFormatTime(liveArr[i]["text"]), + color: liveArr[i]["color"], + size: liveArr[i]["size"], + font: liveArr[i]["font"], + alpha: liveArr[i]["alpha"], + bold: liveArr[i]["bold"] + }; + var newText: TextField = element.newText(obj); + M.addChild(newText); + timeTextArr.push(newText); + } + MOBJ["timeLiveText"] = timeTextArr; + liveTimeTextResize(); + } + //调用错误提示文本框 + private function errorShowResize(): void { + if (errorText) { + var coor: Object = coorDinate(STYLE["error"]); + errorText.x = coor["x"]; + errorText.y = coor["y"]; + } + } + + //加载全局自定义 + private function loadCustom(): void { + var buttonObj: Object = {}; + var k: String = ""; + var obj: Object = {}; + var button: Sprite = null; + if (STYLE.hasOwnProperty("custom")) { + if (STYLE["custom"].hasOwnProperty("button")) { + buttonObj = STYLE["custom"]["button"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, k, imgLoaded); + if (!MOBJ.hasOwnProperty("vcustomButton")) { + MOBJ["vcustomButton"] = {}; + } + MOBJ["vcustomButton"][k] = button + if (STYLE["custom"]["button"][k].hasOwnProperty("show") && STYLE["custom"]["button"][k]["show"] == "false") { + button.visible = false; + } + THIS.addChild(button); + button.addEventListener(MouseEvent.MOUSE_OVER, function (event: MouseEvent) { + //trace("event.target.name:",event.target.name); + showVButtonCustomPrompt(event.target.name); + }); + button.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + } + } + //加载自定义的文本 + if (STYLE["custom"].hasOwnProperty("text")) { + buttonObj = STYLE["custom"]["text"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("text")) { + var textTemp: String = getFormatText(obj["text"]); + if (textTemp) { + var newText: TextField = element.newText({ + text: textTemp, + color: obj["color"], + size: obj["size"], + font: obj["font"], + alpha: obj["alpha"], + bold: obj["bold"] + }); + THIS.addChild(newText); + if (!MOBJ.hasOwnProperty("vcustomText")) { + MOBJ["vcustomText"] = {}; + } + MOBJ["vcustomText"][k] = newText; + if (STYLE["custom"]["text"][k].hasOwnProperty("show") && STYLE["custom"]["text"][k]["show"] == "false") { + newText.visible = false; + } + loadCustomResize(); + } + + } + } + } + //加载自定义的图片 + //trace("是否有自定义的图片",STYLE["custom"].hasOwnProperty("images")); + if (STYLE["custom"].hasOwnProperty("images")) { + buttonObj = STYLE["custom"]["images"]; + //trace(buttonObj); + script.traceObject(buttonObj); + for (k in buttonObj) { + obj = buttonObj[k]; + + if (obj.hasOwnProperty("img")) { + loaderNum++; + var imgLoader: loadByteImg = new loadByteImg(obj["img"], function (byte: Loader = null, myName: String = "") { + //trace("===加载了吗"); + if (byte) { + if (!MOBJ.hasOwnProperty("vcustomImages")) { + MOBJ["vcustomImages"] = {}; + } + MOBJ["vcustomImages"][byte.name] = byte; + THIS.addChild(MOBJ["vcustomImages"][byte.name]); + if (STYLE["custom"]["images"][byte.name].hasOwnProperty("show") && STYLE["custom"]["images"][byte.name]["show"] == "false") { + MOBJ["vcustomImages"][byte.name].visible = false; + } + loadCustomResize(); + } else { + new log("error:Failed to load STYLE[\"custom\"][\"images\"][\"" + myName + "\"]"); + + } + imgLoaded(); + imgLoader = null; + }, k); + } + } + } + //加载自定义的swf插件 + if (STYLE["custom"].hasOwnProperty("swf")) { + buttonObj = STYLE["custom"]["swf"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("swf")) { + loaderNum++; + var swfLoader: loadByteImg = new loadByteImg(obj["swf"], function (byte: Loader = null, myName: String = "") { + if (byte) { + if (!MOBJ.hasOwnProperty("vcustomSwf")) { + MOBJ["vcustomSwf"] = {}; + } + MOBJ["vcustomSwf"][byte.name] = byte; + THIS.addChild(MOBJ["vcustomSwf"][byte.name]); + if (STYLE["custom"]["swf"][byte.name].hasOwnProperty("show") && STYLE["custom"]["swf"][byte.name]["show"] == "false") { + MOBJ["vcustomSwf"][byte.name].visible = false; + } + //传递播放器对象 + var nObj: Object = STYLE["custom"]["swf"][byte.name]; + if (nObj.hasOwnProperty("callActionScript") && nObj["callActionScript"]) { + var swfObj: Object = byte.content; + if (swfObj.hasOwnProperty("setAppObj")) { + if (swfObj.setAppObj.length == 2) { + swfObj.setAppObj(THIS, byte.name); + } else { + swfObj.setAppObj(THIS); + } + } else { + if (swfObj.hasOwnProperty("main")) { + if (swfObj.main.setAppObj.length == 2) { + swfObj.main.setAppObj(THIS, byte.name); + } else { + swfObj.main.setAppObj(THIS); + } + } else { + new log("error:Cannot call function STYLE[\"custom\"][\"swf\"][\"" + myName + "\"][\"callActionScript\"]/" + nObj["callActionScript"] + "()"); + } + } + + // + } + loadCustomResize(); + imgLoaded(); + //传递播放器对象结束 + controlBarResize(); + } else { + new log("error:Failed to load STYLE[\"custom\"][\"swf\"][\"" + myName + "\"]"); + + } + swfLoader = null; + }, k); + } + } + } + } + loadCustomResize(); + } + //加载前置后置广告 + private function loadAdvertisement(): void { + var adObj: Object = STYLE["advertisement"]; + var button: Sprite = null; + MOBJ["advertisement"] = {}; + var obj: Object = {}; + function loadAdBackground() { + //加载纯色层 + //加载背景 + if (adObj.hasOwnProperty("background")) { + var bgSprite: Sprite = null; + var bg: Object = adObj["background"]; + var elementObj: Object = { + backgroundColor: bg["backgroundColor"], + backgroundAlpha: bg["alpha"], + width: stageW, + height: stageH + }; + bgSprite = element.newSprite(elementObj); + MOBJ["advertisement"]["background"] = bgSprite; + } + loadAdCountDown(); + } + function loadAdCountDown() { + //广告倒计时背景 + + if (adObj.hasOwnProperty("countDown")) { + + var countDown: Object = adObj["countDown"]; + if (countDown.hasOwnProperty("backgroundImg")) { + loaderNum++; + var backgroundImgLoader: loadByteImg = new loadByteImg(countDown["backgroundImg"], function (byte: Loader = null) { + if (byte) { + byte.alpha = countDown["alpha"]; + byte.width = countDown["width"]; + byte.height = countDown["height"]; + THIS.addChild(byte); + byte.visible = false; + MOBJ["advertisement"]["countDown"] = byte; + } else { + new log("error:Failed to load STYLE[\"advertisement\"][\"countDown\"][\"backgroundImg\"]"); + } + imgLoaded(); + skipAdButtonLoad(); + advertisementResize(); + backgroundImgLoader = null; + }); + } else { + var mObj: Object = { + backgroundColor: countDown["backgroundColor"], + backgroundAlpha: (countDown.hasOwnProperty("backgroundImg") && countDown["backgroundImg"]) ? 0 : countDown["alpha"], //背景透明度 + width: countDown["width"], + height: countDown["height"], + radius: countDown["radius"] + }; + var background: Sprite = element.newSprite(mObj); + MOBJ["advertisement"]["countDown"] = background; + advertisementResize(); + skipAdButtonLoad(); + } + } else { + skipAdButtonLoad(); + } + advertisementResize(); + } + function skipAdButtonLoad() { + if (adObj.hasOwnProperty("skipAdButton")) { + obj = adObj["skipAdButton"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "skipAdButton", imgLoaded); + MOBJ["advertisement"]["skipAdButton"] = button + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + advertisementResize(); + } + } + loadAdSkipDelay(); + + } + function loadAdSkipDelay() { + //延时显示跳过广告按钮倒计时背景 + if (adObj.hasOwnProperty("skipDelay")) { + var skipDelay: Object = adObj["skipDelay"]; + if (skipDelay.hasOwnProperty("backgroundImg")) { + loaderNum++; + var backgroundImgLoader: loadByteImg = new loadByteImg(skipDelay["backgroundImg"], function (byte: Loader = null) { + if (byte) { + byte.alpha = skipDelay["alpha"]; + byte.width = skipDelay["width"]; + byte.height = skipDelay["height"]; + MOBJ["advertisement"]["skipDelay"] = byte; + } else { + new log("error:Failed to load STYLE[\"advertisement\"][\"skipDelay\"][\"backgroundImg\"]"); + } + imgLoaded(); + nuteButtonLoad(); + advertisementResize(); + backgroundImgLoader = null; + }); + } else { + var mObj: Object = { + backgroundColor: skipDelay["backgroundColor"], + backgroundAlpha: (skipDelay.hasOwnProperty("backgroundImg") && skipDelay["backgroundImg"]) ? 0 : skipDelay["alpha"], //背景透明度 + width: skipDelay["width"], + height: skipDelay["height"], + radius: skipDelay["radius"] + }; + var background: Sprite = element.newSprite(mObj); + MOBJ["advertisement"]["skipDelay"] = background; + advertisementResize(); + nuteButtonLoad(); + } + } else { + nuteButtonLoad(); + } + advertisementResize(); + } + function nuteButtonLoad() { + if (adObj.hasOwnProperty("muteButton") && adObj.hasOwnProperty("escMuteButton")) { + obj = adObj["muteButton"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "muteButton", imgLoaded); + MOBJ["advertisement"]["muteButton"] = button + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + advertisementResize(); + } + obj = adObj["escMuteButton"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "escMuteButton", imgLoaded); + MOBJ["advertisement"]["escMuteButton"] = button; + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + advertisementResize(); + } + } + closeButtonLoad(); + } + function closeButtonLoad() { + if (adObj.hasOwnProperty("closeButton")) { + obj = adObj["closeButton"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "closeButton", imgLoaded); + MOBJ["advertisement"]["closeButton"] = button; + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + advertisementResize(); + } + } + adLinkButtonLoad(); + } + function adLinkButtonLoad() { + if (adObj.hasOwnProperty("adLinkButton")) { + obj = adObj["adLinkButton"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "adLinkButton", imgLoaded); + MOBJ["advertisement"]["adLinkButton"] = button; + button.visible = false; + THIS.addChild(button); + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + + } + advertisementResize(); + } else { + advertisementResize(); + } + } + loadAdBackground(); + } + + //广告相关的变化 + private function advertisementResize(): void { + if (MOBJ.hasOwnProperty("advertisement")) { + var adObj: Object = STYLE["advertisement"]; + var advertisement: Object = MOBJ["advertisement"]; + var newCoor: Object = {}; + if (advertisement.hasOwnProperty("background")) { + advertisement["background"].width = stageW; + advertisement["background"].height = stageH; + } + for (var k: String in advertisement) { + if (k != "background") { + if (k != "closeButton") { + newCoor = coorDinate(adObj[k]); + } else { + newCoor = coorDinate(adObj[k], pause); + newCoor["x"] += pause.x; + newCoor["y"] += pause.y; + if (newCoor["x"] < 0) { + newCoor["x"] = 0; + } + if (newCoor["x"] > stageW - MOBJ["advertisement"]["closeButton"].width) { + newCoor["x"] = stageW - MOBJ["advertisement"]["closeButton"].width; + } + if (newCoor["y"] < 0) { + newCoor["y"] = 0; + } + if (newCoor["y"] > stageH - MOBJ["advertisement"]["closeButton"].height) { + newCoor["y"] = stageH - MOBJ["advertisement"]["closeButton"].height; + } + } + MOBJ["advertisement"][k].x = newCoor["x"]; + MOBJ["advertisement"][k].y = newCoor["y"]; + } + } + + } + } + + //加载中间播放按钮 + private function centerPlayResize(): void { + if (MOBJ.hasOwnProperty("centerPlay")) { + var newCoor: Object = coorDinate(STYLE["centerPlay"]); + MOBJ["centerPlay"].x = newCoor["x"]; + MOBJ["centerPlay"].y = newCoor["y"]; + } + } + + //加载控制栏按钮 + private function loadControlBarButton(): void { + var obj: Object = {}; + var buttonObj: Object = STYLE["controlBar"]["button"]; + var button: Sprite = null; + var k: String = ""; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, k, imgLoaded); + if (!MOBJ.hasOwnProperty("button")) { + MOBJ["button"] = {}; + } + MOBJ["button"][k] = button + M.addChild(button); + button.addEventListener(MouseEvent.MOUSE_OVER, function (event: MouseEvent) { + showButtonPrompt(event.target.name); + }); + button.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + } + if (FLASHVARS["autoplay"]) { + MOBJ["button"]["play"].visible = false; + MOBJ["button"]["pause"].visible = true; + } else { + MOBJ["button"]["play"].visible = true; + MOBJ["button"]["pause"].visible = false; + } + if (FLASHVARS["volume"] > 0) { + MOBJ["button"]["mute"].visible = true; + MOBJ["button"]["escMute"].visible = false; + } else { + MOBJ["button"]["mute"].visible = false; + MOBJ["button"]["escMute"].visible = true; + } + MOBJ["button"]["escFull"].visible = false; + MOBJ["button"]["backLive"].visible = false; + //加载中间播放按钮 + if (STYLE.hasOwnProperty("centerPlay")) { + obj = STYLE["centerPlay"]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOver"]) { + loaderNum++; + button = element.imgButton(obj, "centerPlay", imgLoaded); + MOBJ["centerPlay"] = button + THIS.addChild(button); + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + centerPlayResize(); + showCenterPlay(false); + } + } + //加载自定义的按钮 + if (STYLE["controlBar"].hasOwnProperty("custom")) { + if (STYLE["controlBar"]["custom"].hasOwnProperty("button")) { + buttonObj = STYLE["controlBar"]["custom"]["button"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("mouseOut") && obj["mouseOut"]!="") { + loaderNum++; + button = element.imgButton(obj, k, imgLoaded); + if (!MOBJ.hasOwnProperty("customButton")) { + MOBJ["customButton"] = {}; + } + MOBJ["customButton"][k] = button; + if (STYLE["controlBar"]["custom"]["button"][k].hasOwnProperty("show") && STYLE["controlBar"]["custom"]["button"][k]["show"] == "false") { + button.visible = false; + } + M.addChild(button); + button.addEventListener(MouseEvent.MOUSE_OVER, function (event: MouseEvent) { + showButtonCustomPrompt(event.target.name); + }); + button.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); + button.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + } + } + + //加载自定义的文本 + if (STYLE["controlBar"]["custom"].hasOwnProperty("text")) { + buttonObj = STYLE["controlBar"]["custom"]["text"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("text")) { + var textTemp: String = getFormatText(obj["text"]); + if (textTemp) { + var newText: TextField = element.newText({ + text: textTemp, + color: obj["color"], + size: obj["size"], + font: obj["font"], + alpha: obj["alpha"], + bold: obj["bold"] + }); + M.addChild(newText); + + if (!MOBJ.hasOwnProperty("customText")) { + MOBJ["customText"] = {}; + } + if (STYLE["controlBar"]["custom"]["text"][k].hasOwnProperty("show") && STYLE["controlBar"]["custom"]["text"][k]["show"] == "false") { + newText.visible = false; + } + MOBJ["customText"][k] = newText + } + + } + } + } + //加载自定义的图片 + if (STYLE["controlBar"]["custom"].hasOwnProperty("images")) { + buttonObj = STYLE["controlBar"]["custom"]["images"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("img")) { + loaderNum++; + var imgLoader: loadByteImg = new loadByteImg(obj["img"], function (byte: Loader = null, myName: String = "") { + if (byte) { + if (!MOBJ.hasOwnProperty("customImages")) { + MOBJ["customImages"] = {}; + } + MOBJ["customImages"][byte.name] = byte; + if (STYLE["controlBar"]["custom"]["images"][byte.name].hasOwnProperty("show") && STYLE["controlBar"]["custom"]["images"][byte.name]["show"] == "false") { + MOBJ["customImages"][byte.name].visible = false; + } + M.addChild(MOBJ["customImages"][byte.name]); + controlBarResize(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"custom\"][\"images\"][\"" + myName + "\"]"); + + } + imgLoaded(); + imgLoader = null; + }, k); + } + } + } + //加载自定义的swf插件 + if (STYLE["controlBar"]["custom"].hasOwnProperty("swf")) { + buttonObj = STYLE["controlBar"]["custom"]["swf"]; + for (k in buttonObj) { + obj = buttonObj[k]; + if (obj.hasOwnProperty("swf")) { + loaderNum++; + var swfLoader: loadByteImg = new loadByteImg(obj["swf"], function (byte: Loader = null, myName: String = "") { + if (byte) { + if (!MOBJ.hasOwnProperty("customSwf")) { + MOBJ["customSwf"] = {}; + } + MOBJ["customSwf"][byte.name] = byte; + if (STYLE["controlBar"]["custom"]["swf"][byte.name].hasOwnProperty("show") && STYLE["controlBar"]["custom"]["swf"][byte.name]["show"] == "false") { + MOBJ["customSwf"][byte.name].visible = false; + } + M.addChild(MOBJ["customSwf"][byte.name]); + //传递播放器对象 + var nObj: Object = STYLE["controlBar"]["custom"]["swf"][byte.name]; + if (nObj.hasOwnProperty("callActionScript") && nObj["callActionScript"]) { + var swfObj: Object = byte.content; + if (swfObj.hasOwnProperty("setAppObj")) { + if (swfObj.setAppObj.length == 2) { + swfObj.setAppObj(THIS, byte.name); + } else { + swfObj.setAppObj(THIS); + } + + } else { + if (swfObj.hasOwnProperty("main")) { + if (swfObj.main.setAppObj.length == 2) { + swfObj.main.setAppObj(THIS, byte.name); + } else { + swfObj.main.setAppObj(THIS); + } + } else { + new log("error:Cannot call function STYLE[\"controlBar\"][\"custom\"][\"swf\"][\"" + myName + "\"][\"callActionScript\"]/" + nObj["callActionScript"] + "()"); + } + } + // + } + imgLoaded(); + //传递播放器对象结束 + controlBarResize(); + } else { + new log("error:Failed to load STYLE[\"controlBar\"][\"custom\"][\"swf\"][\"" + myName + "\"]"); + + } + swfLoader = null; + }, k); + } + } + } + } + controlBarResize(); + + } + //格式化文本框里的内容 + private function getFormatText(str: String = ""): String { + var newStr: String = ""; + if (str.substr(0, 11) == "[flashvars]") { + newStr = script.strReplace(str, ["[flashvars]"], [""]); + if (FLASHVARS.hasOwnProperty(newStr)) { + newStr = FLASHVARS[newStr]; + } else { + newStr = ""; + } + } else { + newStr = str; + } + return newStr; + } + private function imgLoaded(): void { + imgButtonI++; + if (imgButtonI > loaderNum - 1 && loaderNum > 1) { + imgButtonI = -1000; + mMinXY = getMMinXY(); + var index: int = 0; + if (background["background"]) { + index = 1; + } + intoFun(index); + } + } + //-------------------------------------------------------------------------------------------提示框结束 + private function showButtonPrompt(k: String = ""): void { + if (k && LANGUAGE["buttonOver"].hasOwnProperty(k)) { + if (MOBJ["button"].hasOwnProperty(k)) { + var x: int = MOBJ["button"][k].x + M.x + MOBJ["button"][k].width * 0.5; + var y: int = MOBJ["button"][k].y + M.y; + showPrompt(LANGUAGE["buttonOver"][k], x, y) + } + } + } + private function showButtonCustomPrompt(k: String = ""): void { + if (k && LANGUAGE["buttonOver"].hasOwnProperty(k)) { + //script.traceObject(MOBJ["customButton"]); + if (MOBJ["customButton"].hasOwnProperty(k)) { + var x: int = MOBJ["customButton"][k].x + M.x + MOBJ["customButton"][k].width * 0.5; + var y: int = MOBJ["customButton"][k].y + M.y; + showPrompt(LANGUAGE["buttonOver"][k], x, y) + } + } + } + private function showVButtonCustomPrompt(k: String = ""): void { + if (k && LANGUAGE["buttonOver"].hasOwnProperty(k)) { + //script.traceObject(MOBJ); + + if(MOBJ.hasOwnProperty("vcustomButton")){ + //trace("==========",MOBJ["vcustomButton"][k].x); + if (MOBJ["vcustomButton"].hasOwnProperty(k)) { + //trace("==========d",MOBJ["vcustomButton"][k].x); + try{ + var x: int = MOBJ["vcustomButton"][k].x + MOBJ["vcustomButton"][k].width * 0.5; + var y: int = MOBJ["vcustomButton"][k].y; + showPrompt(LANGUAGE["buttonOver"][k], x, y); + } + catch(event:ErrorEvent){} + } + } + + } + } + private function showPrompt(str: String = "", x: int = 0, y: int = 0): void { + if (prompt != null) { + THIS.removeChild(prompt); + prompt = null; + } + if (!str || !mShow) { + return; + } + var promptObj: Object = STYLE["prompt"]; + var textObj: Object = { + text: str, + color: promptObj["color"], + size: promptObj["size"], + font: promptObj["font"], + bold: promptObj["bold"], + alpha: promptObj["alpha"] + }; + var text: TextField = element.newText(textObj); + var bgObj: Object = { + backgroundColor: promptObj["backgroundColor"], //背景颜色 + backgroundAlpha: promptObj["backgroundAlpha"], //背景透明度 + border: promptObj["border"], + borderColor: promptObj["borderColor"], //边框颜色 + radius: promptObj["radius"], //圆角弧度 + width: text.width + Number(promptObj["paddingLeft"]) + Number(promptObj["paddingRight"]), + height: text.height + Number(promptObj["paddingTop"]) + Number(promptObj["paddingBottom"]) + } + prompt = element.newSprite(bgObj); + prompt.addChild(text); + text.x = Number(promptObj["paddingLeft"]); + text.y = Number(promptObj["paddingTop"]); + //画倒三角 + var triangleObj: Object = { + width: promptObj["triangleWidth"], + height: promptObj["triangleHeight"], + backgroundColor: promptObj["triangleBackgroundColor"], + border: promptObj["triangleBorder"], + borderColor: promptObj["triangleBorderColor"], + alpha: promptObj["triangleAlpha"] + }; + var triangle: Sprite = element.newTriangle(triangleObj); + triangle.y = prompt.height + Number(promptObj["triangleDeviationY"]); + triangle.x = (prompt.width - triangle.width) * 0.5 + Number(promptObj["triangleDeviationX"]); + prompt.addChild(triangle); + //倒三角结束 + prompt.x = x - prompt.width * 0.5; + prompt.y = y - prompt.height - Number(promptObj["marginBottom"]); + if (prompt.x < 0) { + prompt.x = 0; + } + if (prompt.x > stageW - prompt.width) { + prompt.x = stageW - prompt.width; + } + if (prompt.y < 0) { + prompt.y = 0; + } + if (prompt.y > stageH - prompt.height) { + prompt.y = stageH - prompt.height; + } + THIS.addChild(prompt); + } + //-------------------------------------------------------------------------------------------提示框结束 + //===========================================================================================预览图提示文字 + private function showPreviewPrompt(str: String = "", x: int = 0, y: int = 0): void { + if (previewPrompt != null) { + THIS.removeChild(previewPrompt); + previewPrompt = null; + } + if (!str) { + return; + } + var promptObj: Object = STYLE["previewPrompt"]; + var textObj: Object = { + text: str, + color: promptObj["color"], + size: promptObj["size"], + font: promptObj["font"], + bold: promptObj["bold"], + alpha: promptObj["alpha"] + //height:160 + }; + if (Number(promptObj["textWidth"]) > 0) { + textObj["width"] = Number(promptObj["textWidth"]); + + } + if (Number(promptObj["textHeight"]) > 0) { + textObj["height"] = Number(promptObj["textHeight"]); + + } + var text: TextField = element.newText(textObj); + + var bgObj: Object = { + backgroundColor: promptObj["backgroundColor"], //背景颜色 + backgroundAlpha: promptObj["backgroundAlpha"], //背景透明度 + border: promptObj["border"], + borderColor: promptObj["borderColor"], //边框颜色 + radius: promptObj["radius"], //圆角弧度 + width: text.width + Number(promptObj["paddingLeft"]) + Number(promptObj["paddingRight"]), + height: text.height + Number(promptObj["paddingTop"]) + Number(promptObj["paddingBottom"]) + } + + previewPrompt = element.newSprite(bgObj); + previewPrompt.addChild(text); + text.x = Number(promptObj["paddingLeft"]); + text.y = Number(promptObj["paddingTop"]); + var py: int = y - previewPrompt.height - Number(promptObj["marginBottom"]); + if (preview) { + py -= preview.height; + } else { + if (prompt) { + py -= prompt.height + 10; + } + } + previewPrompt.x = x - previewPrompt.width * 0.5; + previewPrompt.y = py; + + if (previewPrompt.x < 0) { + previewPrompt.x = 0; + } + if (previewPrompt.x > stageW - previewPrompt.width) { + previewPrompt.x = stageW - previewPrompt.width; + } + if (previewPrompt.y < 0) { + previewPrompt.y = 0; + } + if (previewPrompt.y > stageH - previewPrompt.height) { + previewPrompt.y = stageH - previewPrompt.height; + } + //THIS.addChild(previewPrompt); + if (preview) { + THIS.addChildAt(previewPrompt, THIS.getChildIndex(preview) + 1); + } else { + THIS.addChild(previewPrompt); + } + + } + //-------------------------------------------------------------------------------------------控制栏结束 + //-------------------------------------------------------------------------------------------播放器背景 + private function backgroundResize(): void { + //trace("import flash.display.StageDisplayState;",stageH); + if (background["background"]) { + var bg: Object = STYLE["background"]; + var obj: Object = { + stageW: stageW, + stageH: stageH, + eleW: background["width"], + eleH: background["height"], + stretched: bg["stretched"], + align: bg["align"], + vAlign: bg["vAlign"], + spacingLeft: bg["spacingLeft"], + spacingTop: bg["spacingTop"], + spacingRight: bg["spacingRight"], + spacingBottom: bg["spacingBottom"] + }; + var coor: Object = script.getCoor(obj); + background["background"].x = coor["x"]; + background["background"].y = coor["y"]; + background["background"].width = coor["width"]; + background["background"].height = coor["height"]; + } + if (clickSprite) { + clickSprite.width = stageW; + clickSprite.height = stageH; + } + } + private function loadBackGround(): void { //加载窗体背景 + if (STYLE.hasOwnProperty("background")) { + var bg: Object = STYLE["background"]; + var bgSprite: Sprite = null; + var elementObj: Object = {}; + if (bg.hasOwnProperty("backgroundColor")) { + elementObj = { + backgroundColor: bg["backgroundColor"], + backgroundAlpha: bg["alpha"], + width: stageW, + height: stageH + }; + bgSprite = element.newSprite(elementObj); + THIS.addChild(bgSprite); + background = { + background: bgSprite, + width: bgSprite.width, + height: bgSprite.height + }; + } + elementObj = { + backgroundColor: 0xFFFFFF, + backgroundAlpha: 0, + width: stageW, + height: stageH + }; + clickSprite = element.newSprite(elementObj); + clickSprite.addEventListener(MouseEvent.CLICK, mouseClickHandler); + if (bg.hasOwnProperty("backgroundImg") && bg["backgroundImg"]) { + if (bgSprite) { + THIS.removeChild(bgSprite); + } + var bgLoader: Loader = null; + loaderNum++; + var newLoader: loadByteImg = new loadByteImg(bg["backgroundImg"], function (byte: Loader = null) { + if (byte) { + bgLoader = byte; + bgLoader.alpha = bg["alpha"]; + THIS.addChild(bgLoader); + background = { + background: bgLoader, + width: bgLoader.width, + height: bgLoader.height + }; + } else { + new log("error:Failed to load STYLE[\"background\"][\"backgroundImg\"]"); + } + THIS.addChild(clickSprite); + backgroundResize(); + loadControlBar(); //加载控制栏 + imgLoaded(); + newLoader = null; + }); + + } else { + THIS.addChild(clickSprite); + backgroundResize(); + loadControlBar(); //加载控制栏 + } + //clickSprite + } + pause = element.newSprite({ + backgroundColor: 0xFFFFFF, + backgroundAlpha: 0, + width: stageW, + height: stageH + }); + } + //--------------------------------------------------------------------------------------------共用的调用事件 + private function callEvent(buttonStyle: String = "", callName: String = ""): void { + var obj: Object = {}; + //trace(buttonStyle, callName); + switch (buttonStyle) { + case "button": + if (mShow) { + obj = STYLE["controlBar"]["button"][callName]; + } + break; + case "customButton": + if (mShow) { + obj = STYLE["controlBar"]["custom"]["button"][callName]; + } + break; + case "vcustomButton": + obj = STYLE["custom"]["button"][callName]; + break; + case "centerPlay": + obj = STYLE["centerPlay"]; + break; + case "advertisement": + obj = STYLE["advertisement"][callName]; + break; + } + if (!obj) { + return; + } + //script.traceObject(obj); + if (obj.hasOwnProperty("clickEvent") && obj["clickEvent"]) { + THIS["clickEvent"](obj["clickEvent"]); + } + + } + + //--------------------------------------------------------------------------------------------鼠标单击事件 + private function mouseClickHandler(event: MouseEvent): void { + //trace(event.currentTarget.name); + /*MOBJ["volume"] = { + backSprite: backSprite, + maskSprite: maskSprite, + buttonLoader: buttonLoader + };*/ + if (MOBJ.hasOwnProperty("button")) { + if (MOBJ["button"].hasOwnProperty(event.target.name)) { + //trace("button",event.target.name); + callEvent("button", event.target.name); + return; + + } + } + if (MOBJ.hasOwnProperty("vcustomButton")) { + if (MOBJ["vcustomButton"].hasOwnProperty(event.target.name)) { + callEvent("vcustomButton", event.target.name); + return; + + } + } + if (MOBJ.hasOwnProperty("customButton")) { + if (MOBJ["customButton"].hasOwnProperty(event.target.name)) { + callEvent("customButton", event.target.name); + return; + + } + } + if (MOBJ.hasOwnProperty("advertisement")) { + if (MOBJ["advertisement"].hasOwnProperty(event.target.name)) { + callEvent("advertisement", event.target.name); + return; + + } + } + if (MOBJ.hasOwnProperty("centerPlay")) { + if (event.target.name == "centerPlay") { + callEvent("centerPlay", event.target.name); + return; + } + + } + switch (event.currentTarget) { + case clickSprite: + //THIS["videoPlay"](); + //callEvent("videoClick", {x:event.stageX,y:event.stageY}); + videoSpriteXY={x:event.stageX,y:event.stageY} + clickMoveClickHanler(); + break; + case MOBJ["timeSlider"]["backgroundDefaultLoader"]: + case MOBJ["timeSlider"]["loadDefaultLoader"]: + case MOBJ["timeSlider"]["playDefaultLoader"]: + + if (timeTotal == 0 || FLASHVARS["live"]) { + break; + } + //trace(MOBJ["timeSlider"]["backDefaultSprite"].mouseX,MOBJ["timeSlider"]["backgroundDefaultLoader"].width); + var mx: int = MOBJ["timeSlider"]["backDefaultSprite"].mouseX; + + var bw: int = MOBJ["timeSlider"]["backgroundDefaultLoader"].width; + if (mx > bw - 2) { + mx = bw; + } + var value: int = int(mx * timeTotal / bw); + if (value > timeTotal) { + value = timeTotal; + } + if (value < 0) { + value = 0; + } + if (!isFast(value)) { + break; + } + //根据配置进行判断 + //trace("+++++", value, timeNow); + + timeFollow = true; + timePlaySliderChange(value); + timeFollow = false; + //trace("是否跟着走timeFollow03",timeFollow); + THIS["videoSeek"](value, false); //调用主程序里的调节时间并且改变调用滑块 + //trace(MOBJ["timeSlider"]["backDefaultSprite"].mouseX,MOBJ["timeSlider"]["backgroundDefaultLoader"].width,value,"v"); + //showPrompt(getFormatTime(LANGUAGE["timeSliderOver"], value), event.stageX, event.stageY - pointTemp.y); + break; + case MOBJ["volumeSlider"]["backgroundLoader"]: + case MOBJ["volumeSlider"]["maskLoader"]: + var vol: Number = Math.round(MOBJ["volumeSlider"]["backSprite"].mouseX * 100 / MOBJ["volumeSlider"]["backSprite"].width) * 0.01; + THIS["changeVolume"](vol); //调用主程序里的调节音量并且改变调用滑块 + break; + case MOBJ["definitionDefault"]: + if (MOBJ.hasOwnProperty("definitionBack") && MOBJ["definitionBack"] != null) { + MOBJ["definitionBack"].visible = true; + definitionTimerStart(); + } + break; + case MOBJ["subtitleDefault"]: + //trace("===========================",MOBJ.hasOwnProperty("subtitleBack"),MOBJ["subtitleBack"]); + if (MOBJ.hasOwnProperty("subtitleBack") && MOBJ["subtitleBack"] != null) { + //trace("显示"); + MOBJ["subtitleBack"].visible = true; + subtitleTimerStart(); + } + break; + default: + if (event.target.name.toString().indexOf("spirte_") > -1) { + var ni: int = Number(event.target.name.toString().replace("spirte_", "")); + var time: int = promptSpotObjArr[ni]["time"]; + if (!isFast(time)) { + break; + } + timeFollow = true; + timePlaySliderChange(time); + timeFollow = false; + //trace("是否跟着走timeFollow04",timeFollow); + THIS["videoSeek"](time, false); //调用主程序里的调节时间并且改变调用滑块 + } + break; + } + } + private function definitionTimerStart(): void { + //definitionTimer + if (!definitionTimer) { + definitionTimer = new timeInterval(100, definitionTimerHandler); + } + definitionTimer.start(); + } + private function definitionTimerHandler(): void { + var mx: int = M.mouseX, + my: int = M.mouseY; + var minX: int = MOBJ["definitionDefault"].x < MOBJ["definitionBack"].x ? MOBJ["definitionDefault"].x : MOBJ["definitionBack"].x; + var minY: int = MOBJ["definitionDefault"].y < MOBJ["definitionBack"].y ? MOBJ["definitionDefault"].y : MOBJ["definitionBack"].y; + var maxX: int = MOBJ["definitionDefault"].x + MOBJ["definitionDefault"].width > MOBJ["definitionBack"].x + MOBJ["definitionBack"].width ? MOBJ["definitionDefault"].x + MOBJ["definitionDefault"].width : MOBJ["definitionBack"].x + MOBJ["definitionBack"].width; + var maxY: int = MOBJ["definitionDefault"].y + MOBJ["definitionDefault"].height > MOBJ["definitionBack"].y + MOBJ["definitionBack"].height ? MOBJ["definitionDefault"].y + MOBJ["definitionDefault"].height : MOBJ["definitionBack"].y + MOBJ["definitionBack"].height; + if (mx < minX || mx > maxX || my < minY || my > maxY) { + MOBJ["definitionBack"].visible = false; + definitionTimer.stop(); + } + } + private function subtitleTimerStart(): void { + //definitionTimer + if (!subtitleTimer) { + subtitleTimer = new timeInterval(100, subtitleTimerHandler); + } + subtitleTimer.start(); + } + private function subtitleTimerHandler(): void { + var mx: int = M.mouseX, + my: int = M.mouseY; + var minX: int = MOBJ["subtitleDefault"].x < MOBJ["subtitleBack"].x ? MOBJ["subtitleDefault"].x : MOBJ["subtitleBack"].x; + var minY: int = MOBJ["subtitleDefault"].y < MOBJ["subtitleBack"].y ? MOBJ["subtitleDefault"].y : MOBJ["subtitleBack"].y; + var maxX: int = MOBJ["subtitleDefault"].x + MOBJ["subtitleDefault"].width > MOBJ["subtitleBack"].x + MOBJ["subtitleBack"].width ? MOBJ["subtitleDefault"].x + MOBJ["subtitleDefault"].width : MOBJ["subtitleBack"].x + MOBJ["subtitleBack"].width; + var maxY: int = MOBJ["subtitleDefault"].y + MOBJ["subtitleDefault"].height > MOBJ["subtitleBack"].y + MOBJ["subtitleBack"].height ? MOBJ["subtitleDefault"].y + MOBJ["subtitleDefault"].height : MOBJ["subtitleBack"].y + MOBJ["subtitleBack"].height; + if (mx < minX || mx > maxX || my < minY || my > maxY) { + MOBJ["subtitleBack"].visible = false; + subtitleTimer.stop(); + } + } + private function isFast(value: Number = 0): Boolean { + switch (CONFIG["config"]["timeScheduleAdjust"]) { + case 0: + return false; + break; + case 2: + if (value < timeNow) { + return false; + } + break; + case 3: + if (value > timeNow) { + return false; + } + break; + case 4: + //trace(timeSeek); + if (timeSeek > -1) { + if (value < timeSeek) { + return false; + } + } else { + if (value < timeNow) { + return false; + } + } + break; + case 5: + if (value > timeMax) { + return false; + } + break; + } + return true; + } + private function mouseOverHandler(event: MouseEvent): void { + switch (event.currentTarget) { + case MOBJ["definitionDefault"]: + if (MOBJ.hasOwnProperty("definitionBack") && MOBJ["definitionBack"] != null) { + MOBJ["definitionBack"].visible = true; + definitionTimerStart(); + } + break; + case MOBJ["subtitleDefault"]: + if (MOBJ.hasOwnProperty("subtitleBack") && MOBJ["subtitleBack"] != null) { + MOBJ["subtitleBack"].visible = true; + definitionTimerStart(); + } + break; + } + + } + private function mouseOutHandler(event: MouseEvent): void { + showPrompt(); + showPreviewPrompt(); + previewHide(); + } + private function clickMoveClickHanler(): void { //单击视频事件 + if (setTimeClick) { + setTimeClick.stop(); + setTimeClick = null; + } + if (isClick) { + //说明是双击 + isClick = false; + THIS["sendJS"]("videoDoubleClick",videoSpriteXY); + if (CONFIG["config"]["doubleClick"]) { + THIS["switchFull"](); + } + + } else { + setTimeClick = new timeOut(CONFIG["config"]["doubleClickInterval"], setTimeClickHandler); + isClick = true; + } + } + private function setTimeClickHandler(): void { + setTimeClick.stop(); + setTimeClick = null; + isClick = false; + THIS["sendJS"]("videoClick",videoSpriteXY); + if (CONFIG["config"]["click"]) { + //THIS["playOrPause"](); + THIS["playOrPause"](); + //MovieClip(parent.parent).playOrPause(); + } + + } + + //--------------------------------------------------------------------------------------------播放器背景结束 + private function coorDinate(obj: Object, refer: Sprite = null): Object { + //script.traceObject(obj); + //根据坐标及参考对象参数计算位置 + var nObj: Object = { + align: "left", + vAlign: "top", + offsetX: "0", + offsetY: "0" + }; + nObj = script.mergeObject(nObj, obj); + var x: int = 0, + y: int = 0, + w: int = refer != null ? refer.width : stageW, + h: int = refer != null ? refer.height : stageH; + switch (nObj["align"]) { + case "left": + x = 0; + break; + case "center": + x = w * 0.5; + break; + default: + x = w; + break; + } + switch (nObj["vAlign"]) { + case "top": + y = 0; + break; + case "middle": + y = h * 0.5; + break; + default: + y = h; + break; + } + //trace(x,y); + x += nObj["offsetX"].toString().indexOf("%") > -1 ? w * Number(nObj["offsetX"].toString().replace("%", "")) * 0.01 : Number(nObj["offsetX"]); + y += nObj["offsetY"].toString().indexOf("%") > -1 ? h * Number(nObj["offsetY"].toString().replace("%", "")) * 0.01 : Number(nObj["offsetY"]); + //trace(x,y); + return { + x: x, + y: y + }; + } + //根据宽高返回实际的宽高 + private function calculatedSize(w: String, h: String, refer: Sprite = null): Object { + var nw: int = Number(w), + nh: int = Number(h), + ow: int = refer != null ? refer.width : stageW, + oh: int = refer != null ? refer.height : stageH; + if (w.indexOf("%") > -1) { + nw = ow * Number(w.toString().replace("%", "")) * 0.01; + } + if (h.indexOf("%") > -1) { + nh = oh * Number(h.toString().replace("%", "")) * 0.01; + } + return { + width: nw, + height: nh + }; + } + //返回控制栏的位置,主要用于在判断鼠标是否在控制栏里 + private function getMMinXY(): Object { + var w: int = M.width, + h: int = M.height, + x: int = M.x, + y: int = M.y; + var minX: int = 0, + minY: int = 0; + for (var i: int = 0; i <= (M.numChildren - 1); i++) { + //trace(M.getChildAt(j).y); + //trace(M.getChildAt(j).y,(M.getChildAt(j).height+M.getChildAt(j).y),M.height); + if (M.getChildAt(i).x < minX) { + minX = M.getChildAt(i).x; + } + if (M.getChildAt(i).y < minY) { + minY = M.getChildAt(i).y; + } + } + return { + x: minX, + y: minY + }; + } + //============================================================交互函数统一放置 + //当修改了C.CONFIG后 + public function changeConfig() { + CONFIG = C.CONFIG; + STYLE = CONFIG["style"]; + LANGUAGE = CONFIG["language"]; + FLASHVARS = CONFIG["flashvars"]; + resize(); + } + public function addListener(eve: String, fun: Function): void { + var isAdd: Boolean = true; //可以加 + for (var i: int = 0; i < listenerArr.length; i++) { + var arr: Array = listenerArr[i]; + if (arr[0] == eve && arr[1] == fun) { + isAdd = false; + break; + } + } + if (isAdd) { + listenerArr.push([eve, fun]); + } + + } + public function sendJS(name: String, value: *= null): void { + var k: String = ""; + var obj: Object = {}; + var swfObj: Object = {}; + for (var i: int = 0; i < listenerArr.length; i++) { + var arr: Array = listenerArr[i]; + if (arr[0] == name) { + try { + if (value) { + arr[1](value); + } else { + arr[1](); + } + } catch (event: Error) { + new log(event); + } + } + } + } + public function removeListener(eve: String, fun: Function): void { + for (var i: int = 0; i < listenerArr.length; i++) { + var arr: Array = listenerArr[i]; + if (arr[0] == eve && arr[1] == fun) { + listenerArr.splice(i, 1); + break; + } + } + } + public function showBuffer(n: int = 0): void { + var show: Boolean = true; + if (n < 0 || n >= 100 || (loading && loading.visible) || (MOBJ.hasOwnProperty("centerPlay") && MOBJ["centerPlay"].visible)) { + show = false; + } + if (MOBJ.hasOwnProperty("buffer")) { + MOBJ["buffer"].visible = show; + } + if (MOBJ.hasOwnProperty("bufferText")) { + MOBJ["bufferText"].visible = show; + if (MOBJ["bufferText"].visible) { + MOBJ["bufferText"].text = script.replace(LANGUAGE["buffer"], ["[$percentage]"], [n]); + } + + } + } + //-------------------------------------------------------------------------------------------loading + public function showLoading(show: Boolean = true): void { + if (loading) { + loading.visible = show; + } + } + //-------------------------------------------------------------------------------------------提示点 + public function changePromptSpot(): void { + STYLE = C.CONFIG["style"]; + FLASHVARS = C.CONFIG["flashvars"]; + var i: int = 0; + var promptSpot: Object = STYLE["promptSpot"]; + if (promptSpotArr) { + for (i = 0; i < promptSpotArr.length; i++) { + //THIS.removeChild( + MOBJ["timeSlider"]["backDefaultSprite"].removeChild(promptSpotArr[i]); + } + } + if (!FLASHVARS.hasOwnProperty("promptSpot")) { + return; + } + if (!FLASHVARS["promptSpot"]) { + return; + } + if (script.getType(FLASHVARS["promptSpot"]) != "array") { + return; + } + promptSpotArr = []; + promptSpotObjArr = FLASHVARS["promptSpot"]; + for (i = 0; i < promptSpotObjArr.length; i++) { + var mObj: Object = { + backgroundColor: promptSpot["color"], + backgroundAlpha: promptSpot["alpha"], //背景透明度 + radius: promptSpot["radius"], + width: promptSpot["width"], + height: promptSpot["height"] + }; + var sprite: Sprite = element.newSprite(mObj); + sprite.name = "spirte_" + i; + sprite.buttonMode = true; + sprite.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + sprite.addEventListener(MouseEvent.CLICK, mouseClickHandler); + promptSpotArr.push(sprite); + MOBJ["timeSlider"]["backDefaultSprite"].addChildAt(sprite, MOBJ["timeSlider"]["backDefaultSprite"].getChildIndex(MOBJ["timeSlider"]["playDefaultSprite"]) + 1); + } + promptSpotResize(); + } + + //根据音量的大小来调整滑块的位置,提供给外部使用 + public function volumeSliderChange(volume: Number = 0): void { + if (volume < 0) { + volume = 0; + } + if (volume > 1) { + volume = 1; + } + var bkW: int = MOBJ["volumeSlider"]["backSprite"].width; + var mkW: int = MOBJ["volumeSlider"]["maskSprite"].width; + var btW: int = MOBJ["volumeSlider"]["buttonLoader"].width; + var newMkW: int = bkW * volume; + var newBtW: int = 0; + volumeTemp = volume; + newBtW = newMkW - (btW * 0.5); + if (newBtW < 0) { + newBtW = 0; + } + if (newBtW > bkW - btW) { + newBtW = bkW - btW; + } + MOBJ["volumeSlider"]["maskSprite"].width = newMkW; + MOBJ["volumeSlider"]["buttonLoader"].x = newBtW; + muteOrEscMute(volume); + } + //控制时间进度块是否跟着时间走 + public function changeTimePlaySlider(b: Boolean = true): void { + if (buttonDown && b) { + return; + } + timeFollow = b; + //trace("================================================是否跟着走timeFollow01",timeFollow); + } + //根据播放时间调整滑块的位置,提供给外部使用 + public function changeTimeTotal(n: Number = 0): void { + timeTotal = n; + if(C.CONFIG["flashvars"]["forceduration"]>0){ + timeTotal=C.CONFIG["flashvars"]["forceduration"]; + } + if (timeTotal > 0) { + changePromptSpot(); + } + } + public function timePlaySliderChange(time: Number = 0): void { + if (!timeFollow) { + return; + } + if (time <= -999) { + var nowObj: Object = getFormatLiveTime(); + if (time < -999) { + MOBJ["button"]["backLive"].visible = true; + } else { + MOBJ["button"]["backLive"].visible = false; + } + //计算时间 + time = (CONFIG["config"]["liveAndVod"]["vodTime"] - 1) * 3600 + nowObj["minutes"] * 60 + nowObj["seconds"] + time + 999; + } + //trace("跳转",timeSeek,timeNow,time); + if (timeSeek == -1 && (timeNow - time > 2 || timeNow - time < -2)) { + timeSeek = timeNow; + } + timeNow = time; + if (timeMax < time) { + timeMax = time; + } + //trace("timeFollow====",time,timeTotal); + var bw: Number = MOBJ["timeSlider"]["buttonDefaultLoader"].width; //按钮的宽 + var bgw: Number = MOBJ["timeSlider"]["backgroundDefaultLoader"].width //参数背景的宽 + var pw: Number = (time * (bgw - bw)) / timeTotal + bw * 0.5; //进度条的宽度 + MOBJ["timeSlider"]["playDefaultSprite"].width = pw; //进度条的宽 + var bx: Number = pw - bw * 0.5; //按钮的x + if (bx < 0) { + bx = 0; + } + if (bx > bgw - bw) { + bx = bgw - bw + } + //trace("进度按钮的",bx,pw); + if (MOBJ.hasOwnProperty("timeSlider")) { + + MOBJ["timeSlider"]["buttonDefaultLoader"].x = bx; + } + if (MOBJ.hasOwnProperty("timeOutSlider")) { + //简单播放进度 + MOBJ["timeOutSlider"]["playOutSprite"].width = (time * MOBJ["timeOutSlider"]["backgroundOutLoader"].width) / timeTotal; + } + + } + public function timePlaySimpleChange(time: Number = 0): void { + if (MOBJ.hasOwnProperty("simpleSchedule")) { + //简单播放进度 + if (time == -999) { + var nowObj: Object = getFormatLiveTime(); + //计算时间 + time = (CONFIG["config"]["liveAndVod"]["vodTime"] - 1) * 3600 + nowObj["minutes"] * 60 + nowObj["seconds"]; + } + var n: int = (time * MOBJ["simpleSchedule"]["backgroundDefaultLoader"].width) / timeTotal; + MOBJ["simpleSchedule"]["playDefaultSprite"].width = n; + } + + } + //根据加载量调整整滑块的位置,提供给外部使用 + public function changeLoadTotal(n: int = 0): void { + loadTotal = n; + } + public function timeLoadSliderChange(load: int = 0): void { + loadNow = load; + if (MOBJ.hasOwnProperty("timeSlider")) { + var n: int = (load * MOBJ["timeSlider"]["backgroundDefaultLoader"].width) / loadTotal; + MOBJ["timeSlider"]["loadDefaultSprite"].width = n; + } + if (MOBJ.hasOwnProperty("timeOutSlider")) { + var n2: int = (load * MOBJ["timeOutSlider"]["backgroundOutLoader"].width) / loadTotal; + MOBJ["timeOutSlider"]["loadOutSprite"].width = n2; + } + } + public function timeLoadSimpleChange(load: int = 0): void { + loadNow = load; + if (MOBJ.hasOwnProperty("simpleSchedule")) { + var n2: int = (load * MOBJ["simpleSchedule"]["backgroundDefaultLoader"].width) / loadTotal; + MOBJ["simpleSchedule"]["loadDefaultSprite"].width = n2; + } + } + //判断是加载直播时间框还是加载点播文本框 + public function loadTimeText(): void { + var i: int = 0; + if (MOBJ.hasOwnProperty("timeVodText") && MOBJ["timeVodText"] != null) { + for (i = 0; i < MOBJ["timeVodText"].length; i++) { + M.removeChild(MOBJ["timeVodText"][i]); + + } + MOBJ["timeVodText"] = null; + } + if (MOBJ.hasOwnProperty("timeLiveText") && MOBJ["timeLiveText"] != null) { + for (i = 0; i < MOBJ["timeLiveText"].length; i++) { + M.removeChild(MOBJ["timeLiveText"][i]); + } + MOBJ["timeLiveText"] = null; + } + if (!FLASHVARS["live"] && !C.CONFIG["config"]["liveAndVod"]["open"]) { + //trace("vod"); + loadVodTimeText(); + } else { + //trace("live"); + loadLiveTimeText(); //加载时间文本框 + } + } + public function changeVodTime(t: Number = 0): void { //改变点播视频时间 + var val: int = Math.round(t); + if (MOBJ.hasOwnProperty("timeVodText") && MOBJ["timeVodText"] != null) { + var timeText: Object = STYLE["controlBar"]["timeText"]["vod"]; + var textFiledArr: Array = MOBJ["timeVodText"]; + var vodArr: Array = []; + var textArr: Array = []; + var timeTextArr: Array = []; + if (script.getType(STYLE["controlBar"]["timeText"]["vod"]) != "array") { + vodArr.push(STYLE["controlBar"]["timeText"]["vod"]); + } else { + vodArr = STYLE["controlBar"]["timeText"]["vod"]; + } + for (var i: int = 0; i < textFiledArr.length; i++) { + //trace(getFormatTime(vodArr[i]["text"],t)); + MOBJ["timeVodText"][i].text = getFormatTime(vodArr[i]["text"], t); + } + } else { + FLASHVARS["live"] = false; + loadTimeText(); + } + } + public function changeLiveTime(t: int = 0): void { //直播时间的调用 + //trace(t,"==="); + if (MOBJ.hasOwnProperty("timeLiveText") && MOBJ["timeLiveText"] != null) { + var timeText: Object = STYLE["controlBar"]["timeText"]["live"]; + var textFiledArr: Array = MOBJ["timeLiveText"]; + var vodArr: Array = []; + var textArr: Array = []; + var timeTextArr: Array = []; + if (script.getType(STYLE["controlBar"]["timeText"]["live"]) != "array") { + vodArr.push(STYLE["controlBar"]["timeText"]["live"]); + } else { + vodArr = STYLE["controlBar"]["timeText"]["live"]; + } + for (var i: int = 0; i < textFiledArr.length; i++) { + //trace(getFormatTime(vodArr[i]["text"],t)); + //trace(vodArr[i]["text"]); + MOBJ["timeLiveText"][i].text = getFormatTime(vodArr[i]["text"], t); + } + } else { + FLASHVARS["live"] = true; + loadTimeText(); + } + } + //加载或移除错误提示文本框 + public function errorShow(error: String = ""): void { + if (error) { + var textObj: Object = STYLE["error"]; + textObj["text"] = error; + if (errorText) { + THIS.removeChild(errorText); + errorText = null; + } + //script.traceObject(textObj); + errorText = element.newText(textObj); + THIS.addChild(errorText); + errorShowResize(); + showCenterPlay(false); + showLoading(true); + showBuffer(100); + } else { + showLoading(false); + if (errorText) { + THIS.removeChild(errorText); + errorText = null; + } + } + } + //改变参考宽高 + public function changeFaceWh(obj: Object): void { + //trace("改变宽高"); + pause.width = obj["w"]; + pause.height = obj["h"]; + pause.x = obj["x"]; + pause.y = obj["y"]; + advertisementResize(); + THIS.addChild(MOBJ["advertisement"]["closeButton"]); + } + //显示广告相关元件 + public function advertisementShow(objName: String, b: Boolean = true): void { + if (MOBJ.hasOwnProperty("advertisement")) { + var advertisement: Object = MOBJ["advertisement"]; + var newCoor: Object = {}; + if (advertisement.hasOwnProperty(objName)) { + MOBJ["advertisement"][objName].visible = b; + if (b) { + THIS.addChild(MOBJ["advertisement"][objName]); + } + } + } + } + //显示倒计时 + public function changeAdCountDown(t: int = 0): void { + + if (MOBJ.hasOwnProperty("advertisement")) { + if (MOBJ["advertisement"].hasOwnProperty("countDown")) { + if (t < 0) { + t = 0; + } + var textTemp: String = script.replace(LANGUAGE["adCountdown"], ["[$second]","[$Second]"], [t,t<10?"0"+t:t]); + if (!MOBJ["advertisement"].hasOwnProperty("countDownText")) { + var obj: Object = STYLE["advertisement"]["countDownText"]; + var newText: TextField = element.newText({ + text: "0", + color: obj["color"], + size: obj["size"], + font: obj["font"], + alpha: obj["alpha"], + bold: obj["bold"], + textAlign: obj["textAlign"], + width: obj["width"] + }); + MOBJ["advertisement"]["countDownText"] = newText; + } + MOBJ["advertisement"]["countDownText"].text = textTemp; + THIS.addChild(MOBJ["advertisement"]["countDownText"]); + advertisementResize(); + //trace("倒计时时间:",textTemp,MOBJ["advertisement"]["countDownText"].visible,THIS.getChildIndex(MOBJ["advertisement"]["countDown"])); + //trace("countDownText",MOBJ["advertisement"]["countDownText"].x,MOBJ["advertisement"]["countDownText"].y,MOBJ["advertisement"]["countDownText"].width,MOBJ["advertisement"]["countDownText"].height); + } + } + } + //显示跳过广告按钮延时显示的文本 + public function changeAdSkipDelay(t: int): void { + //trace("++"); + if (MOBJ.hasOwnProperty("advertisement")) { + if (MOBJ["advertisement"].hasOwnProperty("skipDelay")) { + if (t < 0) { + t = 0; + } + var textTemp: String = script.replace(LANGUAGE["skipDelay"], ["[$second]","[$Second]"], [t,t<10?"0"+t:t]); + if (!MOBJ["advertisement"].hasOwnProperty("skipDelayText")) { + var obj: Object = STYLE["advertisement"]["skipDelayText"]; + var newText: TextField = element.newText({ + text: textTemp, + color: obj["color"], + size: obj["size"], + font: obj["font"], + alpha: obj["alpha"], + bold: obj["bold"], + textAlign: obj["textAlign"], + width: obj["width"] + }); + MOBJ["advertisement"]["skipDelayText"] = newText; + } + MOBJ["advertisement"]["skipDelayText"].text = textTemp; + THIS.addChild(MOBJ["advertisement"]["skipDelayText"]); + advertisementResize(); + //trace("倒计时时间:",textTemp); + //trace("countDownText",MOBJ["advertisement"]["countDownText"].x,MOBJ["advertisement"]["countDownText"].y,MOBJ["advertisement"]["countDownText"].width,MOBJ["advertisement"]["countDownText"].height); + } + } + } + public function showCenterPlay(b: Boolean = true): void { //显示中间点击播放按钮 + if (MOBJ.hasOwnProperty("centerPlay")) { + MOBJ["centerPlay"].visible = b; + } + } + public function showButton(name: String, b: Boolean = true): void { //显示/隐藏控制栏按钮 + if (MOBJ["button"].hasOwnProperty(name)) { + MOBJ["button"][name].visible = b; + } + } + public function checkFullScreen(): void { //检查是否全屏 + if (STAGE.displayState == "normal") { + MOBJ["button"]["full"].visible = true; + MOBJ["button"]["escFull"].visible = false; + if (full) { + full = false; + THIS["sendJS"]("full", full); + new log("full:" + full); + } + } else { + MOBJ["button"]["full"].visible = false; + MOBJ["button"]["escFull"].visible = true; + if (!full) { + full = true; + THIS["sendJS"]("full", full); + new log("full:" + full); + } + } + + } + public function getClickSpriteIndex(): int { //获取播放器上方用来单击双击层的深度 + return THIS.getChildIndex(clickSprite); + } + public function custom(arr: Array = null): void { + if (!arr) { + return; + } + //trace(arr); + //trace("custom=============="); + var customeName: String = ""; + if (arr.length != 3 && arr.length != 4) { + return + } + var style: String = ""; + var ks: String = ""; + if (arr.length == 3) { + ks = arr[1] + switch (arr[0]) { + case "button": + style = "vcustomButton"; + break; + case "swf": + style = "vcustomSwf"; + break; + case "images": + style = "vcustomImages"; + break; + case "text": + style = "vcustomText"; + break; + } + customeName = arr[0] + "." + arr[1]; + } else { + ks = arr[2]; + switch (arr[1]) { + + case "button": + style = "customButton"; + break; + case "swf": + style = "customSwf"; + break; + case "images": + style = "customImages"; + break; + case "text": + style = "customText"; + break; + } + customeName = arr[0] + "." + arr[1] + "." + arr[2]; + } + //trace("stylename",style,ks); + if (style) { + if (!MOBJ.hasOwnProperty(style) || !MOBJ[style]) { + return; + } + if (!MOBJ[style].hasOwnProperty(ks) || !MOBJ[style][ks]) { + return; + } + MOBJ[style][ks].visible = arr[arr.length - 1]; + new log(customeName + ":" + arr[arr.length - 1]); + THIS["sendJS"](customeName, arr[arr.length - 1]); + } + + } + public function clear(): void { + var i: int = 0; + changeLoadTotal(0); + timeLoadSliderChange(0); + changeTimeTotal(0); + timePlaySliderChange(0); + changeVodTime(0); + showLoading(); + if (previewTop) { + THIS.removeChild(previewTop); + previewTop = null; + } + if (preview) { + THIS.removeChild(preview); + preview = null; + } + previewLoad = false; + previewLoadIng = false; + if (promptSpotArr) { + for (i = 0; i < promptSpotArr.length; i++) { + //THIS.removeChild( + MOBJ["timeSlider"]["backDefaultSprite"].removeChild(promptSpotArr[i]); + } + } + promptSpotArr = []; + } + public function changeControlBarShow(show: Boolean = true): void { + if (show) { + force = false; + mShowHandler(); + } else { + force = true; + mHideHandler(); + } + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/loadByteImg.as b/source/ckaction/style/loadByteImg.as new file mode 100644 index 0000000..3981fcd --- /dev/null +++ b/source/ckaction/style/loadByteImg.as @@ -0,0 +1,39 @@ +package ckaction.style { + import flash.utils.ByteArray; + import flash.display.Loader; + import flash.events.Event; + import flash.display.Bitmap; + import flash.events.ErrorEvent; + import ckaction.act.des; + + public class loadByteImg { + + public function loadByteImg(file: String, success: Function,myName:String="") { + // constructor code + //检查file是否需要解密 + // + var ld: Loader = new Loader(); + try { + var bt: ByteArray = des.getByteArray(file); + ld.loadBytes(bt); + ld.contentLoaderInfo.addEventListener(Event.COMPLETE, function (event: Event) { + if(myName){ + ld.name=myName; + } + success(ld); + }); + } catch (event:ErrorEvent) { + if(myName){ + success(null,myName); + } + else{ + success(null); + } + } + + } + + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/loadImg.as b/source/ckaction/style/loadImg.as new file mode 100644 index 0000000..76fb41f --- /dev/null +++ b/source/ckaction/style/loadImg.as @@ -0,0 +1,42 @@ +package ckaction.style { + import flash.display.Loader; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.net.URLRequest; + import flash.display.LoaderInfo; + import flash.display.Sprite; + + public class loadImg { + private var load: Loader = null; + private var img:String=""; + private var successFun: Function = null; + + + public function loadImg(url:String, success: Function) { + // constructor code + successFun = success; + img = url; + loadimage(); + } + private function loadimage(): void { + load = new Loader(); + load.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); + load.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); //监听加载失败 + load.load(new URLRequest(img)); + } + private function completeHandler(event: Event): void { + successFun(load); + remove(); + } + private function errorHandler(event: IOErrorEvent): void { + remove(); + successFun(null); + } + private function remove(): void { + load.removeEventListener(Event.COMPLETE, completeHandler); + load.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); + load = null; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/style/loadSpriteGif.as b/source/ckaction/style/loadSpriteGif.as new file mode 100644 index 0000000..72d0678 --- /dev/null +++ b/source/ckaction/style/loadSpriteGif.as @@ -0,0 +1,38 @@ +package ckaction.style { + import flash.display.Sprite; + import ckaction.player.gifPlayer; + import flash.display.MovieClip; + + public class loadSpriteGif { + + + public static function loadGif(url: String, w: int = 0, h: int = 0,radius:int=0,num:int=12): Sprite { + //trace(url,w,h,radius); + var sprite: Sprite = new Sprite(); + var gif:gifPlayer=null; + loadImg(); + function loadImg(): void { + gif=new gifPlayer(url,completeHandler) + } + function completeHandler(m:MovieClip): void { + sprite.addChild(m); + var obj:Object={ + width:w, + height:h, + radius:radius, + backgroundColor: 0xFFFFFF, //背景颜色 + backgroundAlpha: 1 //背景透明度 + }; + gif.changeWH(w,h); + + var maskSprit:Sprite=element.newSprite(obj); + sprite.addChild(maskSprit); + sprite.mask=maskSprit; + + } + return sprite; + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/loadSpriteImg.as b/source/ckaction/style/loadSpriteImg.as new file mode 100644 index 0000000..7e7cae0 --- /dev/null +++ b/source/ckaction/style/loadSpriteImg.as @@ -0,0 +1,63 @@ +package ckaction.style { + /* + 软件名称:chplayer + 软件作者:http://www.chplayer.com + 开源软件协议:Mozilla Public License, version 2.0(MPL 2.0) + MPL 2.0协议英文(原文,正本)查看地址:https://www.mozilla.org/en-US/MPL/2.0/ + MPL 2.0协议中文(翻译)查看地址:http://www.chplayer.com/res/Mozilla_Public_License_2.0_Simplified_Chinese_Reference.txt + 文件最后更新日期:2017-03-17 + */ + import flash.display.Loader; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.net.URLRequest; + import flash.display.LoaderInfo; + import flash.display.Sprite; + + public class loadSpriteImg { + + + public static function loadImg(url: String, w: int = 0, h: int = 0,radius:int=0,num:int=12,lname:String=""): Sprite { + //trace(url,w,h,radius); + var load: Loader = null; + var sprite: Sprite = new Sprite(); + loadImg(); + function loadImg(): void { + load = new Loader(); + load.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); + load.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); //监听加载失败 + load.load(new URLRequest(url)); + } + function completeHandler(event: Event): void { + load.width = w; + load.height = h; + sprite.addChild(load); + if(radius>0){ + var spObj:Object={ + backgroundColor:"#FFFFFF", + width:w, + height:h, + radius:radius + }; + var mSprite:Sprite=element.newSprite(spObj); + sprite.addChild(mSprite); + load.mask=mSprite; + } + load.name=lname!=""?lname:"ele_"+num; + } + function errorHandler(event: IOErrorEvent): void { + //trace("加载失败"); + remove(); + } + function remove(): void { + load.removeEventListener(Event.COMPLETE, completeHandler); + load.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); + load = null; + } + + return sprite; + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/newElement.as b/source/ckaction/style/newElement.as new file mode 100644 index 0000000..ea9000b --- /dev/null +++ b/source/ckaction/style/newElement.as @@ -0,0 +1,743 @@ +package ckaction.style { + import flash.display.Sprite; + import flash.text.TextField; + import flash.display.Stage; + import fl.transitions.Tween; + import fl.transitions.easing.None; + import fl.motion.easing.Quadratic; + import fl.motion.easing.Cubic; + import fl.motion.easing.Quartic; + import fl.motion.easing.Quintic; + import fl.motion.easing.Sine; + import fl.motion.easing.Exponential; + import fl.motion.easing.Circular; + import fl.motion.easing.Elastic; + import fl.motion.easing.Back; + import fl.motion.easing.Bounce; + import fl.transitions.TweenEvent; + import flash.events.MouseEvent; + import flash.display.MovieClip; + import flash.events.Event; + import ckaction.act.script; + import ckaction.style.loadSpriteImg; + import ckaction.C.C; + import com.dynamicflash.util.Base64; + //import ckaction.act.log; + + + public class newElement { + private var pauseded: Boolean = false; + private var STAGE: Stage = null; + private var THIS: Sprite = null; + private var FLASHVARS: Object = null; + private var list: Array = []; + //private var C:MovieClip=null + private var alt: int = 0; + private var eleArr: Array = [], + eleNameArr: Array = []; //保存所有在改变舞台尺寸时需要调整位置的元件的数组 + private var eleTempArr: Array = [], + eleNameTempArr: Array = []; //保存所有在改变舞台尺寸时需要调整位置的元件的数组 + private var animateArray: Array = [], + animateElementArray: Array = [], + animatePauseArray: Array = []; //缓动tween数组,缓动的元件ID数组,暂停时需要停止的元件ID数组 + public function newElement(stage: Stage, sprite: Sprite, an: int = 0) { + STAGE = stage; + THIS = sprite; + var config: Object = C.CONFIG; + FLASHVARS = config["flashvars"]; + alt = an; + //C=cm; + stage.addEventListener(Event.RESIZE, resizeHandler); + } + //当修改了C.CONFIG后 + public function changeConfig() { + var config: Object = C.CONFIG; + FLASHVARS = config["flashvars"]; + } + public function addelement(newObj): Sprite { + var obj = { + list: [], + x: "100%", + y: "50%", + position: [], + alpha: 1, + backgroundColor: null, + backAlpha: 1, + backRadius: 0, + border: 0, + borderColor: 0x000000, + clickEvent: "" + } + obj = script.mergeObject(obj, newObj); + //new log(obj); + list = obj["list"]; + if (list.length == 0) { + return null; + } + var bObj: Object = {}; + var elementArr: Array = []; + var i: int = 0; + var ele: Object = {}; + var cx: int = 0, + maxH: int = 0; + for (i = 0; i < list.length; i++) { + ele = list[i]; + var mH: int = 0; + var eleSprite: Sprite = null; + switch (ele["type"]) { + case "image": + case "png": + case "jpg": + case "jpeg": + case "bmp": + case "swf": + bObj = { + type: "image", + file: "", + radius: 0, //圆角弧度 + width: 30, //定义宽,必需要定义 + height: 30, //定义高,必需要定义 + alpha: 1, //透明度 + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + clickEvent: "" + }; + list[i] = ele = script.mergeObject(bObj, ele); + eleSprite = loadSpriteImg.loadImg(bObj["file"], bObj["width"], bObj["height"], bObj["radius"], i,bObj["clickEvent"]!=""?Base64.encode(bObj["clickEvent"]):""); + + cx += ele["marginLeft"]; + eleSprite.x = cx; + cx += (eleSprite.width || ele["width"]) + ele["marginRight"]; + mH = ele["marginTop"]; + eleSprite.y = mH; + mH += (eleSprite.height || ele["height"]) + ele["marginBottom"]; + if (maxH < mH) { + maxH = mH; + } + + if (bObj["clickEvent"] != "") { + eleSprite.name=Base64.encode(bObj["clickEvent"]); + eleSprite.buttonMode = true; + eleSprite.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + elementArr.push(eleSprite); + //eleNameArr.push(); + break; + case "gif": + bObj = { + type: "gif", + file: "", + radius: 0, //圆角弧度 + width: 30, //定义宽,必需要定义 + height: 30, //定义高,必需要定义 + alpha: 1, //透明度 + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + clickEvent: "" + }; + list[i] = ele = script.mergeObject(bObj, ele); + var spObj: Object = { + width: bObj["width"], + height: bObj["height"] + }; + eleSprite = loadSpriteGif.loadGif(bObj["file"], bObj["width"], bObj["height"], bObj["radius"], i); + trace("加载"); + cx += ele["marginLeft"]; + eleSprite.x = cx; + cx += (eleSprite.width || ele["width"]) + ele["marginRight"]; + mH = ele["marginTop"]; + eleSprite.y = mH; + mH += (eleSprite.height || ele["height"]) + ele["marginBottom"]; + if (maxH < mH) { + maxH = mH; + } + + if (bObj["clickEvent"] != "") { + eleSprite.name=Base64.encode(bObj["clickEvent"]); + eleSprite.buttonMode = true; + eleSprite.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + elementArr.push(eleSprite); + //eleNameArr.push(); + break; + case "text": + bObj = { + type: "text", //说明是文本 + text: "", //文本内容 + color: 0xFFFFFF, + size: 14, + font: "Microsoft YaHei,\5FAE\8F6F\96C5\9ED1,微软雅黑", + leading: 0, + alpha: 1, //透明度 + bold: false, + paddingLeft: 0, //左边距离 + paddingRight: 0, //右边距离 + paddingTop: 0, + paddingBottom: 0, + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: null, + backAlpha: 1, + backRadius: 0, + border: 0, + borderColor: 0x000000 + }; + list[i] = ele = script.mergeObject(bObj, ele); + var textObj: Object = { + text: bObj["text"], + color: bObj["color"], + size: bObj["size"], + font: bObj["font"], + bold: bObj["bold"], + width: 0, + height: 0, + alpha: bObj["alpha"] + }; + var text: TextField = element.newText(textObj); + var textBgWidth: int = text.width + bObj["paddingLeft"] + bObj["paddingRight"]; + var textBgHeight: int = bObj["leading"] > 0 ? bObj["leading"] : 0; + text.y = textBgHeight > 0 ? (textBgHeight - text.height) * 0.5 + bObj["paddingTop"] : bObj["paddingTop"]; + textBgHeight += (bObj["paddingTop"] + bObj["paddingBottom"]); + text.x = bObj["paddingLeft"]; + var textBgObj: Object = { + backgroundColor: bObj["backgroundColor"], //背景颜色 + radius: bObj["backRadius"], //圆角弧度 + backgroundAlpha: bObj["backAlpha"], //背景透明度 + border: bObj["border"], + borderColor: bObj["borderColor"], + width: textBgWidth, + height: textBgHeight + }; + eleSprite = element.newSprite(textBgObj); + eleSprite.addChild(text); + //eleSprite.name = "ele_" + i; + cx += ele["marginLeft"]; + eleSprite.x = cx; + cx += eleSprite.width + ele["marginRight"]; + mH = ele["marginTop"]; + eleSprite.y = mH; + mH += eleSprite.height + ele["marginBottom"]; + if (maxH < mH) { + maxH = mH; + } + elementArr.push(eleSprite); + + if (bObj["clickEvent"] != "" && (obj["clickEvent"] == "" || obj["clickEvent"] == null) && bObj["clickEvent"] != null) { + eleSprite.name=Base64.encode(bObj["clickEvent"]); + eleSprite.buttonMode = true; + eleSprite.addEventListener(MouseEvent.CLICK, mouseClickHandler); + } + break; + default: + break; + } + } + + var spBgObj: Object = { + backgroundColor: obj["backgroundColor"] != null ? obj["backgroundColor"] : null, //背景颜色 + radius: obj["backRadius"], //圆角弧度 + backgroundAlpha: obj["backAlpha"], //背景透明度 + border: obj["border"], + borderColor: obj["borderColor"], + width: cx, + height: maxH + }; + var sprite: Sprite = element.newSprite(spBgObj); + for (i = 0; i < elementArr.length; i++) { + sprite.addChild(elementArr[i]); + } + sprite.name = obj["x"] + "$" + obj["y"] + "$" + obj["position"].join(",") + "$" + script.randomString(); + var eleCoor: Object = calculationCoor(sprite); + sprite.x = eleCoor["x"]; + sprite.y = eleCoor["y"]; + sprite.alpha = obj["alpha"]; + THIS.addChildAt(sprite, alt + 1); + eleArr.push(sprite); + eleNameArr.push(sprite.name); + if (obj["clickEvent"] != "") { + sprite.buttonMode = true; + sprite.addEventListener(MouseEvent.CLICK, function (event: MouseEvent): void { + THIS["clickEvent"](obj["clickEvent"]); + }); + } + return sprite; + } + private function mouseClickHandler(event: MouseEvent): void { + //new log(event.target.name); + var ce: String = Base64.decode(event.target.name); + //new log(ce); + THIS["clickEvent"](ce); + + } + + private function calculationCoor(ele: Sprite): Object { + var arr = ele.name.split("$"); + var obj = { + x: arr[0], + y: arr[1], + position: arr[2] != "" ? arr[2].split(",") : [] + } + var x: int = Number(obj["x"].toString().split("%").join("")), + y: int = Number(obj["y"].toString().split("%").join("")), + position: Array = obj["position"]; + var w: int = STAGE.stageWidth, + h: int = STAGE.stageHeight; + var ew: int = ele.width, + eh: int = ele.height; + if (position.length > 0) { + position.push(null, null, null, null); + var i = 0; + for (i = 0; i < position.length; i++) { + if (position[i] == "null" || position[i] == "") { + position[i] = null; + } + if (position[i] != null) { + position[i] = Number(position[i]); + } + + + } + if (position[2] == null) { + switch (position[0]) { + case 0: + x = 0; + break; + case 1: + x = (w - ew) * 0.5; + break; + default: + x = w - ew; + break; + } + } else { + switch (position[0]) { + case 0: + x = position[2]; + break; + case 1: + x = w * 0.5 + position[2]; + break; + default: + x = w + position[2]; + break; + } + } + if (position[3] == null) { + switch (position[1]) { + case 0: + y = 0; + break; + case 1: + y = (h - eh) * 0.5; + break; + default: + y = h - eh; + break; + } + } else { + switch (position[1]) { + case 0: + y = position[3]; + break; + case 1: + y = h * 0.5 + position[3]; + break; + default: + y = h + position[3]; + break; + } + } + } else { + if (obj["x"].toString().search("%") > -1) { + x = Math.floor(Number(obj["x"].toString().split("%").join("")) * w * 0.01); + } + if (obj["y"].toString().search("%") > -1) { + y = Math.floor(Number(obj["y"].toString().split("%").join("")) * h * 0.01); + } + } + + return { + x: x, + y: y + } + } + public function getElement(name: String): Object { + var num: int = eleNameArr.indexOf(name); + var sprite: Sprite =null + if (num > -1) { + sprite = eleArr[num]; + return { + x: sprite.x, + y: sprite.y, + width: sprite.width, + height: sprite.height, + alpha: sprite.alpha + } + } + num = eleNameTempArr.indexOf(name); + if (num > -1) { + sprite = eleTempArr[num]; + return { + x: sprite.x, + y: sprite.y, + width: sprite.width, + height: sprite.height, + alpha: sprite.alpha, + show:sprite.visible + } + } + return null; + } + public function elementShow(name: String="",bn:Boolean=true):void{ + if(name==""){ + var i:int=0; + for(i=0;i -1) { + eleArr[num].visible=bn; + } + num = eleNameTempArr.indexOf(name); + if (num > -1) { + eleTempArr[num].visible=bn; + } + } + public function animate(ob: Object): String { + var obj: Object = { + element: null, + parameter: "x", + static: false, + effect: "None.easeIn", + start: null, + end: null, + speed: 0, + overStop: false, + pauseStop: false, + callBack: null + }; + obj = script.mergeObject(obj, ob); + if (obj["element"] == null || obj["speed"] == 0) { + return ""; + } + var w: int = STAGE.stageWidth, + h: int = STAGE.stageHeight; + var eleCoor = { + x: 0, + y: 0 + }; + + var run: Boolean = true; + var pm = getElement(obj["element"]); //包含x,y,width,height,alpha属性 + //将该元件从元件数组里删除,让其不再跟随播放器的尺寸改变而改变位置 + var num = eleNameArr.indexOf(obj["element"]); + var sprite: Sprite = null; + if (num > -1) { + sprite = eleArr[num]; + eleNameArr.splice(num, 1); + eleArr.splice(num, 1); + eleTempArr.push(sprite); + eleNameTempArr.push(obj["element"]); + } + if (sprite == null) { + return ""; + } + var b: Number = 0; //初始值 + var c: Number = 0; //变化后的值 + var d = obj["speed"]; //持续时间 + //var setTimeOut = null; + //var tweenObj = null; + var start: String = obj["start"] == null ? "" : obj["start"].toString(); + var end: String = obj["end"] == null ? "" : obj["end"].toString(); + switch (obj["parameter"]) { + case "x": + if (obj["start"] == null) { + b = pm["x"]; + } else { + if (start.substr(start.length - 1, start.length) == "%") { + b = Number(start.substr(0, start.length - 1)) * w * 0.01; + } else { + b = Number(start); + } + + } + if (obj["end"] == null) { + c = pm["x"]; + } else { + if (end.substr(end.length - 1, end.length) == "%") { + c = Number(end.substr(0, end.length - 1)) * w * 0.01; + } else if (end.substr(0, 1) == "-" || end.substring(0, 1) == "+") { + if (typeof (obj["end"]) == "number") { + c = obj["end"]; + } else { + c = b + Number(end); + } + } else { + c = Number(end); + } + } + b = Math.floor(b); + c = Math.floor(c); + break; + case "y": + if (obj["start"] == null) { + b = pm["y"]; + } else { + if (start.substr(start.length - 1, start.length) == "%") { + b = Number(start.substr(0, start.length - 1)) * h * 0.01; + } else { + b = Number(start); + } + + } + if (obj["end"] == null) { + c = pm["y"]; + } else { + if (end.substr(end.length - 1, end.length) == "%") { + c = Number(end.substr(0, end.length - 1)) * h * 0.01; + } else if (end.substr(0, 1) == "-" || end.substring(0, 1) == "+") { + if (typeof (obj["end"]) == "number") { + c = obj["end"]; + } else { + c = b + Number(end); + } + } else { + c = Number(end); + } + } + b = Math.floor(b); + c = Math.floor(c); + + break; + case "alpha": + if (obj["start"] == null) { + b = pm["alpha"]; + } else { + if (start.substr(start.length - 1, start.length) == "%") { + b = Number(start.substr(0, start.length - 1)); + } else { + b = Number(obj["start"]); + } + + } + if (obj["end"] == null) { + c = pm["alpha"]; + } else { + if (end.substr(end.length - 1, end.length) == "%") { + c = Number(end.substr(0, end.length - 1)); + } else if (end.substr(0, 1) == "-" || end.substring(0, 1) == "+") { + if (typeof (obj["end"]) == "number") { + c = obj["end"]; + } else { + c = b + Number(end); + } + } else { + c = Number(end); + } + } + break; + + } + var effArr: Array = [None, Quadratic, Cubic, Quartic, Quintic, Sine, Exponential, Circular, Elastic, Back, Bounce]; + var effNameArr: Array = ["None", "Quadratic", "Cubic", "Quartic", "Quintic", "Sine", "Exponential", "Circular", "Elastic", "Back", "Bounce"]; + var arr: Array = obj["effect"].split("."); + num = effNameArr.indexOf(arr[0]); + var effectFun = effArr[num][arr[1]]; + var tween: Tween = new Tween(sprite, obj["parameter"], effectFun, b, c, d, true); + + if (obj["static"]) { + function changeHandler(event: TweenEvent) { + var coor = calculationCoor(sprite); + switch (obj["parameter"]) { + case "x": + sprite.y = coor["y"]; + break; + case "y": + sprite.x = coor["x"]; + break; + case "alpha": + sprite.x = coor["x"]; + sprite.y = coor["y"]; + break; + } + }; + tween.addEventListener(TweenEvent.MOTION_CHANGE, changeHandler); + } + function backCall(): void { + //trace("=====================================backcall"); + var numT:int = eleNameTempArr.indexOf(sprite.name); + if (numT > -1) { + eleNameTempArr.splice(numT, 1); + eleTempArr.splice(numT, 1); + } + eleNameArr.push(sprite.name); + eleArr.push(sprite); + + tween.removeEventListener(TweenEvent.MOTION_FINISH, finishHandler); + tween = null; + if (obj["callBack"] != null && typeof (obj["callBack"]) == "string") { + script.callJs(obj["callBack"], sprite.name); + } + } + function finishHandler(event: TweenEvent): void { + switch (obj["parameter"]) { + case "x": + if (sprite.x != c) { + tween.resume(); + } else { + backCall(); + } + break; + case "y": + if (sprite.y != c) { + tween.resume(); + } else { + backCall(); + } + break; + case "alpha": + if (sprite.alpha != c) { + tween.resume(); + } else { + backCall(); + } + break; + } + } + tween.addEventListener(TweenEvent.MOTION_FINISH, finishHandler); + + if (obj["overStop"]) { + function overHandler(event: MouseEvent) { + tween.stop(); + sprite.removeEventListener(MouseEvent.MOUSE_OVER, overHandler); + sprite.addEventListener(MouseEvent.MOUSE_OUT, outHandler); + }; + function outHandler(event: MouseEvent) { + var start = true; + if (obj["pauseStop"] && pauseded) { + start = false; + } + if (start) { + tween.resume(); + } + sprite.removeEventListener(MouseEvent.MOUSE_OUT, outHandler); + sprite.addEventListener(MouseEvent.MOUSE_OVER, overHandler); + }; + sprite.addEventListener(MouseEvent.MOUSE_OVER, overHandler); + } + tween.start(); + var animateId = "animate" + script.randomString(); + animateArray.push(tween); + animateElementArray.push(animateId); + if (obj["pauseStop"]) { + animatePauseArray.push(animateId); + } + return animateId; + } + /* + 接口函数 + 继续运行animate + */ + public function animateResume(id: String = "") { + var arr: Array = []; + if (id != "" && id != "undefined" && id != "pause") { + arr.push(id); + } else { + if (id === "pause") { + arr = animatePauseArray; + } else { + arr = animateElementArray; + } + } + for (var i: int = 0; i < arr.length; i++) { + var index: int = animateElementArray.indexOf(arr[i]); + + if (index > -1) { + animateArray[index].resume(); + } + } + + } + /* + 接口函数 + 暂停运行animate + */ + public function animatePause(id: String = "") { + + var arr: Array = []; + if (id != "" && id != "undefined" && id != "pause") { + arr.push(id); + } else { + if (id === "pause") { + arr = animatePauseArray; + } else { + arr = animateElementArray; + } + } + for (var i: int = 0; i < arr.length; i++) { + var index: int = animateElementArray.indexOf(arr[i]); + if (index > -1) { + animateArray[index].stop(); + } + } + } + /* + 内置函数 + 根据元件删除数组里对应的内容 + */ + public function deleteAnimate(id:String) { + var index = animateElementArray.indexOf(id); + if (index > -1) { + //animatePause(id); + animateArray[index].fforward(); + //animateArray.splice(index, 1); + //animateElementArray.splice(index, 1); + } + } + /* + 内置函数 + 删除外部新建的元件 + */ + public function deleteElement(name: String): void { + trace(name); + trace(eleNameArr); + var num: int = eleNameArr.indexOf(name); + if (num > -1) { + THIS.removeChild(eleArr[num]); + eleNameArr.splice(num, 1); + eleArr.splice(num, 1); + } + deleteAnimate(name); + } + public function changePauseded(b: Boolean): void { + pauseded = b; + if (animatePauseArray.length == 0) { + return; + } + if (b) { + animatePause("pause"); + } else { + animateResume("pause"); + } + } + public function resizeHandler(event: Event): void { + if (eleArr.length > 0) { + for (var i: int = 0; i < eleArr.length; i++) { + var coor: Object = calculationCoor(eleArr[i]); + eleArr[i].x = coor["x"]; + eleArr[i].y = coor["y"]; + } + } + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/newPreview.as b/source/ckaction/style/newPreview.as new file mode 100644 index 0000000..0d3bb6c --- /dev/null +++ b/source/ckaction/style/newPreview.as @@ -0,0 +1,124 @@ +package ckaction.style { + /* + 软件名称:ckplayer + 软件作者:http://www.chplayer.com + 开源软件协议:Mozilla Public License, version 2.0(MPL 2.0) + MPL 2.0协议英文(原文,正本)查看地址:https://www.mozilla.org/en-US/MPL/2.0/ + MPL 2.0协议中文(翻译)查看地址:http://www.chplayer.com/res/Mozilla_Public_License_2.0_Simplified_Chinese_Reference.txt + 文件最后更新日期:2017-04-07 + */ + import flash.display.Loader; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.net.URLRequest; + import flash.display.LoaderInfo; + import flash.utils.ByteArray; + import flash.display.Bitmap; + import flash.net.URLLoader; + import flash.display.BitmapData; + import flash.geom.Rectangle; + import flash.geom.Point; + import flash.display.Sprite; + import ckaction.act.des; + + public class newPreview { + private var load: Loader = null; + private var imgArr: Array = []; + private var com: Function = null; + private var imageI: int = 0; //加载图片时计数,一张一张图片加载 + private var bytemapArr: Array = []; + private var imgW:int=0,imgH:int=0; + public function newPreview(img: Array, k: Function) { + // constructor code + com = k; + imgArr = img; + loadimage(); + } + private function loadimage(): void { + var s:String=imgArr[imageI]; + + load = new Loader(); + load.contentLoaderInfo.addEventListener(Event.COMPLETE, comLoad); + load.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorLoad); //监听加载失败 + + if(s.substr(0,10)=="data:image" || s.substr(0,3)=="CK:" || s.substr(0,3)=="CE:"){ + var bt: ByteArray = des.getByteArray(s); + load.loadBytes(bt); + } + else{ + load.load(new URLRequest(s)); + } + } + private function comLoad(event: Event): void { + var o: LoaderInfo = load.contentLoaderInfo; + var bitmapdata: BitmapData + var bytearr: ByteArray = new ByteArray(); + var bytemap: Bitmap = new Bitmap(); + imgW=o.width*0.1; + imgH=o.height*0.1; + bitmapdata = new BitmapData(o.width, o.height); + bitmapdata.draw(load); + var temp: ByteArray = bitmapdata.getPixels(bitmapdata.rect); + bytearr.writeBytes(temp); + + var bitmapdata2: BitmapData = new BitmapData(o.width, o.height); + bytearr.position = 0; + bitmapdata2.setPixels(bitmapdata.rect, bytearr); + //bytemap.bitmapData = bitmapdata2; + bytemapArr.push(bitmapdata2); + //com(bytemap); + remove(); + if (imageI < imgArr.length - 1) { + imageI++; + loadimage(); + } + else { + rectAngle(); //全部加载完进行切图 + } + + } + private function rectAngle(): void { + var mov:Sprite = new Sprite(); + var nx: int = 0; //新的X坐标 + + + // + for (var i: int = 0; i < bytemapArr.length; i++) { + var bm: BitmapData = bytemapArr[i]; + var bx: int = 0, + by: int = 0; //定义要切的x,y + for (var y: int = 0; y < 100; y++) { + var picRect: Rectangle = new Rectangle(bx, by, imgW, imgH); //从哪里开始扣,扣多少? + var point: Point = new Point(0, 0); //将抠图放在newBitmapdata的那个位置 + var newBitmapdata: BitmapData = new BitmapData(imgW, imgH); + newBitmapdata.copyPixels(bm, picRect, point); + var newmap: Bitmap = new Bitmap(); + newmap.bitmapData = newBitmapdata; + var newc: Sprite = new Sprite(); + newc.addChild(newmap); + newc.x = nx; + newc.name = i + ":" + y + ""; + mov.addChild(newc); + nx += imgW; + bx += imgW; + if (bx >= bm.width) { + bx = 0; + by += imgH; + + } + } + + } + com(mov); + } + private function errorLoad(event: IOErrorEvent): void { + remove(); + } + private function remove(): void { + load.removeEventListener(Event.COMPLETE, comLoad); + load.removeEventListener(IOErrorEvent.IO_ERROR, errorLoad); + load = null; + } + } + +} \ No newline at end of file diff --git a/source/ckaction/style/poster.as b/source/ckaction/style/poster.as new file mode 100644 index 0000000..9f34d37 --- /dev/null +++ b/source/ckaction/style/poster.as @@ -0,0 +1,102 @@ +package ckaction.style { + import flash.display.Loader; + import flash.display.Stage; + import flash.display.Sprite; + import flash.events.Event; + import ckaction.act.script; + import flash.events.MouseEvent; + import ckaction.act.log; + + public class poster { + private var STAGE: Stage = null; + private var THIS: Sprite = null, + VPLAY:Function = null, + GETCONTROLBARSHOW:Function=null; + private var loadIndex:int=0; + private var loadHandler: Function = null; //调用主控制台的into + private var VIDEO: Object = null; + private var picUrl: String = ""; + private var image: Loader = null; + private var imageW: int = 0,imageH: int = 0; + private var isLoad:Boolean=true; + + public function poster(stage: Stage, sprite: Sprite, vplay:Function,getControlBarShow:Function, loadFun: Function) { + // constructor code + STAGE = stage; + THIS = sprite; + VPLAY = vplay; + GETCONTROLBARSHOW=getControlBarShow + loadHandler = loadFun; + stage.addEventListener(Event.RESIZE, resizeHandler); + } + public function loadPoster(pic: String, video: Object,index:int=0): void { + VIDEO = video; + picUrl = pic; + loadIndex=index; + if (image) { + THIS.removeChild(image); + image = null; + } else { + if(isLoad){ + new loadImg(pic, loaderHandler); + } + + } + } + private function loaderHandler(load: Loader = null): void { + if(!isLoad){ + return; + } + if (load) { + image = load; + imageW = image.width; + imageH = image.height; + THIS.addChildAt(image, loadIndex); + image.addEventListener(MouseEvent.CLICK,function(event:MouseEvent){ + VPLAY(); + }); + imageResize(); + loadHandler(true); + } else { + loadHandler(false); + } + } + private function imageResize(): void { + if (image) { + var obj: Object ={}; + if(GETCONTROLBARSHOW()){ + obj=VIDEO["reserve"]; + } + else{ + obj=VIDEO["controlBarHideReserve"]; + } + obj["stageW"]=STAGE.stageWidth; + obj["stageH"]=STAGE.stageHeight; + obj["eleW"]=imageW; + obj["eleH"]=imageH; + var coor:Object=script.getCoor(obj); + image.x=coor["x"]; + image.y=coor["y"]; + image.width=coor["width"]; + image.height=coor["height"]; + } + } + private function resizeHandler(event: Event): void { + if (image) { + imageResize(); + } + } + public function hide():void{ + //接收外部通知,隐藏卸载掉封面图 + new log("process:Poster hide") + isLoad=false; + if (image) { + THIS.removeChild(image); + image = null; + } + + } + + } + +} \ No newline at end of file diff --git a/source/ckaction/style/track.as b/source/ckaction/style/track.as new file mode 100644 index 0000000..14f18f6 --- /dev/null +++ b/source/ckaction/style/track.as @@ -0,0 +1,220 @@ +package ckaction.style { + import flash.display.Sprite; + import ckaction.act.loadXml; + import ckaction.act.script; + + public class track { + private var THIS: Sprite = null; + private var CFIG: Object = {}; + private var trackList: Array = []; + private var trackIndex: int = 0; + private var trackDelay:Number=0; + private var nowTrackShow: Object = { + sn: "" + }; + private var trackElement: Array = []; + private var time: Number = 0; + private var isClose: Boolean = false; + public function track(sp: Sprite, config: Object, file: String = "",trackD:Number=0) { + if (!file) { + return; + } + THIS = sp; + CFIG = config; + trackDelay=trackD; + new loadXml(file, function (data: String) { + if (isClose) { + return; + } else { + if (data) { + //trace(data); + trackList = parseSrtSubtitles(data); + //script.traceObject(trackList); + } + } + + }); + // constructor code + } + public function changeSize(n:int=0,m:int=0):void{ + CFIG["size"]=n; + CFIG["leading"]=m; + trackHide(); + trackShow(nowTrackShow); + } + public function sendTime(t: Number): void { + if (isClose) { + return; + } + time = t; + if (trackIndex >= trackList.length) { + trackIndex = 0; + } + + + var nowTrack: Object = trackList[trackIndex]; //当前编号对应的字幕内容 + if(nowTrack==null){ + return; + } + /* + this.nowTrackShow=当前显示在界面上的内容 + 如果当前时间正好在nowTrack时间内,则需要判断 + */ + //trace(t,trackIndex,nowTrack["startTime"],nowTrack["endTime"]); + if (t >= nowTrack["startTime"] && t <= nowTrack["endTime"]) { + /* + 如果当前显示的内容不等于当前需要显示的内容时,则需要显示正确的内容 + */ + var nowShow = nowTrackShow; + if (nowShow["sn"] != nowTrack["sn"]) { + trackHide(); + trackShow(nowTrack); + } + } else { + /* + * 如果当前播放时间不在当前编号字幕内,则需要先清空当前的字幕内容,再显示新的字幕内容 + */ + //trace("重新计算编号"); + trackHide(); + checkTrack(); + } + } + //========================================== + private function trackShow(track: Object) { + if (isClose) { + return; + } + nowTrackShow = track; + var arr: Array = track["content"]; + for (var i: int = 0; i < arr.length; i++) { + var tObj:Object=CFIG; + tObj["type"]="text"; + tObj["text"]=arr[i]; + + /*var tObj:Object={ + type: "text", + text: arr[i], + color: CFIG["color"], + size: CFIG["size"], + font: CFIG["font"], + leading: CFIG["leading"], + bold: CFIG["bold"], + alpha: 1 + };*/ + //if(CFIG.hasOwnProperty("backgroundColor")){ + // tObj["backgroundColor"]=CFIG["backgroundColor"]; + //} + + var obj: Object = { + list: [tObj], + position: [1, 2, null, -(arr.length - i) * CFIG["leading"] - CFIG["marginBottom"]] + }; + var ele: String = THIS["addElement"](obj); + trackElement.push(ele); + } + } + /* + 内部函数 + 隐藏字字幕内容 + */ + private function trackHide() { + for (var i: int = 0; i < trackElement.length; i++) { + THIS["deleteElement"](trackElement[i]); + } + trackElement = []; + } + /* + 内部函数 + 重新计算字幕的编号 + */ + private function checkTrack() { + if (isClose) { + return; + } + var num: int = trackIndex; + var arr: Array = trackList; + var i = 0; + var have = false; + for (i = num; i < arr.length; i++) { + if (time >= arr[i]["startTime"] && time <= arr[i]["endTime"]) { + trackIndex = i; + //trace("新的编号:",time,trackIndex); + have = true; + break; + } + } + if (!have) { + trackIndex = 0; + } + } + //================================= + private function delHtmlTag(str: String) { + return str.replace(/<[^>]+>/g, ""); //去掉所有的html标记 + } + private function trim(str: String) { + return str.replace(/(^\s*)|(\s*$)/g, ""); + } + private function toSeconds(t: String) { //将时分秒转换成秒 + var s: int = 0.0; + if (t) { + var p: Array = t.split(":"); + for (var i: int = 0; i < p.length; i++) { + s = s * 60 + parseFloat(p[i].replace(",", ".")); + } + } + return s; + } + private function parseSrtSubtitles(srt: String) { + var subtitles: Array = []; + var textSubtitles: Array = []; + var i: int = 0; + var arrs: Array = srt.split("\n"); + var arr: Array = []; + + for (i = 0; i < arrs.length; i++) { + if (arrs[i].replace(/\s/g, "").length > 0) { + arr.push(arrs[i]); + } else { + if (arr.length > 0) { + textSubtitles.push(arr); + } + arr = []; + } + } + for (i = 0; i < textSubtitles.length; ++i) { + var textSubtitle: Array = textSubtitles[i]; + if (textSubtitle.length >= 2) { + var sn: int = textSubtitle[0]; // 字幕的序号 + var startTime: Number = toSeconds(trim(textSubtitle[1].split(" --> ")[0])); // 字幕的开始时间 + var endTime: Number = toSeconds(trim(textSubtitle[1].split(" --> ")[1])); // 字幕的结束时间 + var content: Array = [delHtmlTag(textSubtitle[2])]; // 字幕的内容 + if(trackDelay!=0){ + startTime+=trackDelay; + endTime+=trackDelay; + } + // 字幕可能有多行 + if (textSubtitle.length > 2) { + for (var j = 3; j < textSubtitle.length; j++) { + content.push(delHtmlTag(textSubtitle[j])); + } + } + // 字幕对象 + var subtitle: Object = { + sn: sn, + startTime: startTime, + endTime: endTime, + content: content + }; + subtitles.push(subtitle); + } + } + return subtitles; + } + public function close(): void { + trackHide(); + isClose=true; + } + + } + +} \ No newline at end of file diff --git a/source/ckplayer.fla b/source/ckplayer.fla new file mode 100644 index 0000000..08503a2 Binary files /dev/null and b/source/ckplayer.fla differ diff --git a/source/ckplayer.js b/source/ckplayer.js new file mode 100644 index 0000000..96548ea --- /dev/null +++ b/source/ckplayer.js @@ -0,0 +1,9013 @@ +/* + 软件名称:ckplayer + 软件版本:X2 + 软件作者:niandeng + 软件网站:http://www.ckplayer.com + -------------------------------------------------------------------------------------------------------------------- + 开发说明: + 使用的主要程序语言:javascript(js)及actionscript3.0(as3.0)(as3.0主要用于flashplayer部分的开发,不在该页面呈现) + 功能:播放视频 + 特点:兼容HTML5-VIDEO(优先)以及FlashPlayer + -------------------------------------------------------------------------------------------------------------------- + 使用开源代码部分: + 1:flashls-http://flashls.org/ + ===================================================================================================================== +*/ + +!(function() { + var ckplayerPath = ''; + !function() { + var scriptList = document.scripts, + thisPath = scriptList[scriptList.length - 1].src; + for(var i=0;i 1) { + if (videoStringTemp[0][0].substr(0, 3) == 'CK:' || videoStringTemp[0][0].substr(0, 3) == 'CE:' || videoStringTemp[0][0].substr(8, 3) == 'CK:' || videoStringTemp[0][0].substr(8, 3) == 'CE:') { + this.vars['flashplayer'] = true; + } + } + } + this.videoString=videoStringTemp; + + this.checkUpConfig(); + }, + /* + 内部函数 + 加载config文件 + */ + checkUpConfig:function(){ + var thisTemp=this; + var configPath=''; + var jsTemp=null; + if (this.vars['config']) { + if (this.vars['config'].substr(0, 8) != 'website:') { + jsTemp= eval(this.vars['config'] + '()'); + if(!this.isUndefined(jsTemp)){ + this.ckConfig=this.newObj(jsTemp); + this.jsonConfig=this.newObj(jsTemp); + this.loadConfig(null); + } + else{ + this.loadConfig(ckplayerPath+this.vars['config']); + } + + } + else{ + this.loadConfig(ckplayerPath+this.vars['config'].substr(8)); + } + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerConfig)==='function'){ + isFun=true; + } + } + catch(e){} + if(isFun) { + jsTemp= ckplayerConfig(); + if(jsTemp){ + this.ckConfig=this.newObj(jsTemp); + this.jsonConfig=this.newObj(jsTemp); + this.loadConfig(null); + } + else{ + this.loadConfig(ckplayerPath+'ckplayer.json'); + } + } + else { + this.loadConfig(ckplayerPath+'ckplayer.json'); + } + } catch(e) { + thisTemp.sysError(thisTemp.errorList[12],e);//系统错误 + } + + } + }, + loadConfig:function(file){ + var thisTemp=this; + if(file){ + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.ckConfig=data; + thisTemp.jsonConfig=thisTemp.newObj(data); + if(!thisTemp.isUndefined(data['flashvars'])){ + thisTemp.vars=thisTemp.objectAssign(data['flashvars'],thisTemp.vars); + } + thisTemp.checkUpLanguage(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'Config');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.checkUpLanguage(); + } + }, + /* + 内部函数 + 加载语言文件 + */ + checkUpLanguage:function(){ + var thisTemp=this; + var languagePath=''; + var jsTemp=null; + if (this.vars['language']) { + languagePath=this.vars['language']; + } + else{ + if (this.ckConfig['languagePath']) { + languagePath=this.ckConfig['languagePath']; + } + } + if (languagePath) { + if (languagePath.substr(0, 8) != 'website:') { + jsTemp = eval(languagePath + '()'); + if(jsTemp){ + this.ckLanguage=this.newObj(jsTemp); + this.jsonLanguage=this.newObj(jsTemp); + this.loadLanguage(null); + } + else{ + this.loadLanguage(ckplayerPath+languagePath); + } + + } + else{ + this.loadLanguage(ckplayerPath+languagePath.substr(8)); + } + + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerLanguage)==='function'){ + isFun=true; + } + } + catch(e){} + if(isFun) { + jsTemp = ckplayerLanguage(); + if(jsTemp){ + this.ckLanguage=this.newObj(jsTemp); + this.jsonLanguage=this.newObj(jsTemp); + this.loadLanguage(null); + } + else{ + this.loadLanguage(ckplayerPath+'language.json'); + } + } + else { + this.loadLanguage(ckplayerPath+'language.json'); + } + } catch(e) { + thisTemp.sysError(thisTemp.errorList[12],e);//系统错误 + } + + } + }, + loadLanguage:function(file){ + var thisTemp=this; + if(file){ + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.ckLanguage=data; + thisTemp.jsonLanguage=thisTemp.newObj(data); + thisTemp.checkUpStyle(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'language.json');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.checkUpStyle(); + } + }, + /* + 内部函数 + 加载皮肤文件 + */ + checkUpStyle:function(){ + var thisTemp=this; + var stylePath=''; + var jsTemp=null; + var configJs=this.newObj(this.ckConfig); + if (this.vars['style']) { + stylePath=this.vars['style']; + } + else{ + if (this.ckConfig['stylePath']) { + stylePath=''+this.ckConfig['stylePath']; + } + } + if (stylePath) { + if (stylePath.substr(0, 8) != 'website:') { + jsTemp = eval(stylePath + '()'); + if(!this.isUndefined(jsTemp)){ + this.jsonStyle=this.newObj(jsTemp); + this.ckStyle=this.newObj(jsTemp); + this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']); + this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle); + this.loadStyle(null); + } + else{ + this.loadStyle(ckplayerPath+stylePath); + } + } + else{ + this.loadStyle(ckplayerPath+stylePath.substr(8)); + } + + } + else { + try { + var isFun=false; + try{ + if(typeof(ckplayerStyle)==='function'){ + isFun=true; + } + } + catch(e){isFun=false;} + if(isFun) { + jsTemp= ckplayerStyle(); + if(!this.isUndefined(jsTemp)){ + this.jsonStyle=this.newObj(jsTemp); + this.ckStyle=this.newObj(jsTemp); + this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']); + this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle); + this.loadStyle(null); + } + else{ + this.loadStyle(ckplayerPath+'style.json'); + } + } + else { + this.loadStyle(ckplayerPath+'style.json'); + } + } catch(e) {} + + } + }, + loadStyle:function(file){ + var thisTemp=this; + if(file){ + var configJs=this.newObj(this.ckConfig); + this.ajax({ + url:file, + success: function(data) { + if(data){ + thisTemp.jsonStyle=thisTemp.newObj(data); + thisTemp.ckStyle=thisTemp.newObj(data); + thisTemp.ckStyle['advertisement']=thisTemp.objectAssign(configJs['style']['advertisement'],thisTemp.ckStyle['advertisement']); + thisTemp.ckStyle=thisTemp.objectAssign(configJs['style'],thisTemp.ckStyle); + thisTemp.loadConfigHandler(); + } + else{ + thisTemp.sysError(thisTemp.errorList[11],'Style');//系统错误 + } + }, + error:function(data){ + thisTemp.sysError(thisTemp.errorList[12],data);//系统错误 + } + }); + } + else{ + this.loadConfigHandler(); + } + }, + /* + 内部函数 + 当config,language,style三个文件或函数处理完成后执行的动作 + */ + loadConfigHandler:function(){ + if ((!this.supportVideo() && this.vars['flashplayer'] != '') || (this.vars['flashplayer'] && this.uploadFlash()) || !this.isMsie()) { + this.html5Video = false; + this.getVideo(); + } + else if (this.videoString) { + //判断视频数据类型 + this.analysedVideoUrl(this.videoString); + } + else { + this.eject(this.errorList[2]); + } + }, + /* + 内部函数 + 根据外部传递过来的video开始分析视频地址 + */ + analysedVideoUrl: function(video) { + var i = 0, + y = 0; + var thisTemp = this; + this.VA = [];//定义全局变量VA:视频列表(包括视频地址,类型,清晰度说明) + if (this.varType(video) == 'string') { //如果是字符形式的则判断后缀进行填充 + if (video.substr(0, 8) != 'website:') { + this.VA = [[video, '', '', 0]]; + var fileExt = this.getFileExt(video); + switch (fileExt) { + case '.mp4': + this.VA[0][1] = 'video/mp4'; + break; + case '.ogg': + this.VA[0][1] = 'video/ogg'; + break; + case '.webm': + this.VA[0][1] = 'video/webm'; + break; + default: + break; + } + this.getVideo(); + } else { + if (this.html5Video) { + var ajaxObj = { + url: video.substr(8), + success: function(data) { + if (data) { + thisTemp.analysedUrl(data); + } else { + thisTemp.eject(thisTemp.errorList[5]); + this.VA = video; + thisTemp.getVideo(); + } + }, + error:function(data){ + thisTemp.eject(thisTemp.errorList[12],data);//系统错误 + } + }; + this.ajax(ajaxObj); + } else { + this.VA = video; + this.getVideo(); + } + + } + } + else if(this.varType(video)=='array'){//如果视频地址是数组 + if (this.varType(video[0])=='array') { //如果视频地址是二维数组 + this.VA = video; + } + this.getVideo(); + } + else if(this.varType(video)=='object'){ + /* + 如果video格式是对象形式,则分二种 + 如果video对象里包含type,则直接播放 + */ + if (!this.isUndefined(video['type'])) { + this.VA.push([video['file'], video['type'], '', 0]); + this.getVideo(); + } else { + this.eject(this.errorList[5]); + } + } + else { + this.eject(this.errorList[4]); + } + }, + /* + 对请求到的视频地址进行重新分析 + */ + analysedUrl: function(data) { + this.vars = this.standardization(this.vars, data); + if (!this.isUndefined(data['video'])) { + this.vars['video'] = data['video']; + } + this.analysedVideoUrl(this.vars['video']); + }, + /* + 内部函数 + 检查浏览器支持的视频格式,如果是则将支持的视频格式重新分组给播放列表 + */ + getHtml5Video: function() { + var va = this.VA; + var nva = []; + var mobile = this.isMobile(); + var video = document.createElement('video'); + var codecs = function(type) { + var cod = ''; + switch (type) { + case 'video/mp4': + cod = 'avc1.4D401E, mp4a.40.2'; + break; + case 'video/ogg': + cod = 'theora, vorbis'; + break; + case 'video/webm': + cod = 'vp8.0, vorbis'; + break; + default: + break; + } + return cod; + }; + var supportType = function(vidType, codType) { + if (!video.canPlayType) { + this.html5Video = false; + return; + } + var isSupp = video.canPlayType(vidType + ';codecs="' + codType + '"'); + if (isSupp == '') { + return false + } + return true; + }; + if (this.vars['flashplayer'] || !this.isMsie()) { + this.html5Video = false; + return; + } + for (var i = 0; i < va.length; i++) { + var v = va[i]; + if (v) { + if (v[1] != '' && !mobile && supportType(v[1], codecs(v[1])) && v[0].substr(0, 4) != 'rtmp') { + nva.push(v); + } + if ((this.getFileExt(v[0]) == '.m3u8' || this.vars['type'] == 'video/m3u8' || this.vars['type'] == 'm3u8' || v[1] == 'video/m3u8' || v[1] == 'm3u8') && this.vars['html5m3u8'] && !mobile) { + this.isM3u8 = true; + nva.push(v); + } + } + } + if (nva.length > 0) { + this.VA = nva; + } else { + if (!mobile) { + this.html5Video = false; + } + } + }, + /* + 内部函数 + 根据视频地址开始构建播放器 + */ + getVideo: function() { + var thisTemp = this; + var v = this.vars; + //如果存在广告字段则开始分析广告 + if (!this.adAnalysisEnd && (v['adfront'] != '' || v['adpause'] != '' || v['adinsert'] != '' || v['adend'] != '' || v['advertisements'] != '')) { + this.adAnalysisEnd = true; + this.adAnalysis(); + return; + } + //如果存在字幕则加载 + if (this.V) { //如果播放器已存在,则认为是从newVideo函数发送过来的请求 + this.changeVideo(); + return; + } + if (this.vars['cktrack']) { + this.loadTrack(); + } + if (this.supportVideo() && !this.vars['flashplayer']) { + this.getHtml5Video(); //判断浏览器支持的视频格式 + } + var src = '', + source = '', + poster = '', + loop = '', + autoplay = '', + track = '', + crossorigin=''; + var video = v['video']; + var i = 0; + var vBg=this.ckStyle['background']['backgroundColor'].replace('0x','#'); + this.CD = this.getByElement(v['container']); + volume = v['volume']; + if (this.isUndefined(this.CD)) { + this.eject(this.errorList[6], v['container']); + return false; + } + + //开始构建播放器容器 + this.V = undefined; + var thisPd = null; + if (v['h5container'] != '') { + thisPd = this.getByElement(v['h5container']); + if (this.isUndefined(thisPd)) { + thisPd = null; + } + } + var isVideoH5 = null; //isUndefined thisPd + if (v['playerID'] != '') { + isVideoH5 = this.getByElement('#' + v['playerID']); + if (this.isUndefined(isVideoH5)) { + isVideoH5 = null; + } + } + if (thisPd != null && isVideoH5 != null) { + this.PD = thisPd; //PD:定义播放器容器对象全局变量 + } else { + var playerID = 'ckplayer-' + this.randomString(); + var playerDiv = document.createElement('div'); + playerDiv.className = playerID; + this.CD.innerHTML = ''; + this.CD.appendChild(playerDiv); + this.PD = playerDiv; //PD:定义播放器容器对象全局变量 + } + this.css(this.CD, { + backgroundColor: vBg, + overflow: 'hidden', + position: 'relative' + }); + this.css(this.PD, { + backgroundColor: vBg, + width: '100%', + height: '100%', + fontFamily: this.fontFamily + }); + if (this.html5Video) { //如果支持HTML5-VIDEO则默认使用HTML5-VIDEO播放器 + + //禁止播放器容器上鼠标选择文本 + this.PD.onselectstart = this.PD.ondrag = function() { + return false; + }; + //播放器容器构建完成并且设置好样式 + //构建播放器 + if (this.VA.length == 1) { + this.videoTemp['src'] = decodeURIComponent(this.VA[0][0]); + src = ' src="' + this.videoTemp['src'] + '"'; + + } else { + var videoArr = this.VA.slice(0); + videoArr = this.arrSort(videoArr); + for (i = 0; i < videoArr.length; i++) { + var type = ''; + var va = videoArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + if (type == ' type="video/m3u8"' || type == ' type="m3u8"') { + type = ''; + } + } + source += ''; + } + this.videoTemp['source'] = source; + } + //分析视频地址结束 + if (v['autoplay']) { + autoplay = ' autoplay="autoplay"'; + } + if (v['poster']) { + poster = ' poster="' + v['poster'] + '"'; + } + if (v['loop']) { + loop = ' loop="loop"'; + } + if (v['seek'] > 0) { + this.needSeek = v['seek']; + } + if (v['track'] != null && v['cktrack'] == null) { + var trackArr = v['track']; + var trackDefault = ''; + var defaultHave = false; + for (i = 0; i < trackArr.length; i++) { + var trackObj = trackArr[i]; + if (trackObj['default'] && !defaultHave) { + trackDefault = ' default'; + defaultHave = true; + } else { + trackDefault = ''; + } + track += ''; + } + } + if(v['crossorigin']){ + crossorigin=' crossorigin="'+v['crossorigin']+'"'; + } + var autoLoad = this.ckConfig['config']['autoLoad']; + var preload = ''; + if (!autoLoad) { + preload = ' preload="meta"'; + } + var vid = this.randomString(); + var controls = ''; + var mobileAutoFull = v['mobileAutoFull']; + var mobileautofull = ''; + if (!mobileAutoFull) { + mobileautofull = ' x-webkit-airplay="true" playsinline webkit-playsinline="true" x5-video-player-type="h5"'; + } + if(this.isMobile()){ + controls = ' controls="controls"'; + } + if (isVideoH5 != null && thisPd != null) { + this.V = isVideoH5; + if (v['poster']) { + this.V.poster = v['poster']; + } + } else { + var html = ''; + if (!this.isM3u8) { + html = ''; + + } else { + html = ''; + } + this.PD.innerHTML = html; + this.V = this.getByElement('#' + vid); //V:定义播放器对象全局变量 + } + try { + this.V.volume = volume; //定义音量 + if (this.playbackRateArr && this.vars['playbackrate'] > -1) { + if (this.vars['playbackrate'] < this.playbackRateArr.length) { + this.playbackRateDefault = this.vars['playbackrate']; + } + this.V.playbackRate = this.playbackRateArr[this.playbackRateDefault][0]; //定义倍速 + } + } catch(error) {} + this.css(this.V, { + backgroundColor: vBg, + width: '100%', + height: '100%' + }); + if (this.isM3u8) { + var loadJsHandler = function() { + thisTemp.embedHls(thisTemp.VA[0][0], v['autoplay']); + }; + this.loadJs(ckplayerPath + 'hls/hls.min.js', loadJsHandler); + } + this.css(this.V, 'backgroundColor', vBg); + //创建一个画布容器 + if (this.ckConfig['config']['videoDrawImage']) { + var canvasDiv = document.createElement('div'); + this.PD.appendChild(canvasDiv); + this.MD = canvasDiv; //定义画布存储容器 + this.css(this.MD, { + backgroundColor: vBg, + width: '100%', + height: '100%', + position: 'absolute', + display: 'none', + cursor: 'pointer', + left: '0px', + top: '0px', + zIndex: '10' + }); + var cvid = 'ccanvas' + this.randomString(); + this.MD.innerHTML = this.newCanvas(cvid, this.MD.offsetWidth, this.MD.offsetHeight); + this.MDC = this.getByElement(cvid + '-canvas'); + this.MDCX = this.MDC.getContext('2d'); + } + this.playerType = 'html5video'; + //播放器构建完成并且设置好样式 + //建立播放器的监听函数,包含操作监听及事件监听 + this.addVEvent(); + if (this.conBarShow) { + //根据清晰度的值构建清晰度切换按钮 + this.definition(); + if (!this.vars['live'] && this.playbackRateArr && this.vars['playbackrate'] > -1) { + this.playbackRate(); + } + if (v['autoplay']) { + this.loadingStart(true); + } + this.subtitleSwitch(); + } + this.playerLoad(); + } else { //如果不支持HTML5-VIDEO则调用flashplayer + this.embedSWF(); + } + }, + /* + 分析广告数据 + */ + adAnalysis: function() { + var thisTemp = this; + var v = this.vars; + var isAdvShow = []; + var i = 0; + if (v['advertisements'] != '' && v['advertisements'].substr(0, 8) == 'website:') { + var ajaxObj = { + url: v['advertisements'].substr(8), + success: function(data) { + if (data) { + var newData = {}; + var val = null; + //对广告进行分析 + try { + if (!thisTemp.isUndefined(data['front']) || !thisTemp.isUndefined(data['pause']) || !thisTemp.isUndefined(data['end']) || !thisTemp.isUndefined(data['insert']) || !thisTemp.isUndefined(data['other'])) { + val = thisTemp.arrayDel(data['front']); + if (!thisTemp.isUndefined(val)) { + newData['front'] = val; + } + val = thisTemp.arrayDel(data['pause']); + if (!thisTemp.isUndefined(val)) { + newData['pause'] = val; + } + val = thisTemp.arrayDel(data['insert']); + if (!thisTemp.isUndefined(val)) { + newData['insert'] = val; + if (!thisTemp.isUndefined(data['inserttime'])) { + newData['inserttime'] = thisTemp.arrayInt(data['inserttime']); + isAdvShow = []; + for (i = 0; i < newData['inserttime'].length; i++) { + isAdvShow.push(false); + } + newData['insertPlay'] = isAdvShow; + } + } + val = thisTemp.arrayDel(data['end']); + if (!thisTemp.isUndefined(val)) { + newData['end'] = val; + } + val = thisTemp.arrayDel(data['other']); + if (!thisTemp.isUndefined(val)) { + newData['other'] = val; + isAdvShow = []; + var arrTemp = []; + for (i = 0; i < val.length; i++) { + isAdvShow.push(false); + arrTemp.push(parseInt('0' + val[i]['startTime'])); + } + newData['othertime'] = arrTemp; + newData['otherPlay'] = isAdvShow; + } + } + } catch(event) { + thisTemp.log(event) + } + thisTemp.advertisements = newData; + //对广告进行分析结束 + } + thisTemp.getVideo(); + }, + error:function(data){} + }; + this.ajax(ajaxObj); + } else { + //根据广告分析 + this.adAnalysisOne('front', 'adfront', 'adfronttime', 'adfrontlink', 'adfronttype'); + this.adAnalysisOne('pause', 'adpause', 'adpausetime', 'adpauselink', 'adpausetype'); + this.adAnalysisOne('insert', 'adinsert', 'adinserttime', 'adinsertlink', 'adinserttype'); + this.adAnalysisOne('end', 'adend', 'adendtime', 'adendlink', 'adendtype'); + if (!this.isUndefined(this.advertisements['insert'])) { + if (!this.isUndefined(v['inserttime'])) { + thisTemp.advertisements['inserttime'] = v['inserttime']; + } + } + if (!this.isUndefined(thisTemp.advertisements['inserttime'])) { + thisTemp.advertisements['inserttime'] = thisTemp.arrayInt(thisTemp.advertisements['inserttime']); + isInsert = []; + for (i = 0; i < thisTemp.advertisements['inserttime'].length; i++) { + isInsert.push(false); + } + thisTemp.advertisements['insertPlay'] = isInsert; + } + thisTemp.getVideo(); + } + }, + /* + 将广告数组数据里不是视频和图片的去除 + */ + arrayDel: function(arr) { + if(this.isUndefined(arr)){ + return arr; + } + if (arr.length == 0) { + return null; + } + var newArr = []; + for (var i = 0; i < arr.length; i++) { + var type = arr[i]['type']; + if (type == 'mp4' || type == 'mov' || this.isStrImage(type)) { + newArr.push(arr[i]); + } + } + if (newArr.length > 0) { + return newArr; + } + return null; + }, + /*分析单个类型的广告*/ + adAnalysisOne: function(adType, adName, adTime, adLink, adStype) { + var v = this.vars; + if (this.isUndefined(v[adName])) { + v[adName] = ''; + } + if (this.isUndefined(v[adTime])) { + v[adTime] = ''; + } + if (this.isUndefined(v[adLink])) { + v[adLink] = ''; + } + if (this.isUndefined(v[adStype])) { + v[adStype] = ''; + } + if (v[adName] != '') { + var adList = []; + var ad = v[adName].split(','); + var adtime = v[adTime].split(','); + var adlink = v[adLink].split(','); + var adstype = v[adStype].split(','); + var i = 0; + if (ad.length > 0) { + var adLinkLen = adlink.length, + adTimeLen = adtime.length; + if (v[adLink] == '') { + adLinkLen = 0; + adlink = []; + } + if (v[adTime] == '') { + adTimeLen = 0; + adtime = []; + } + if (adLinkLen < ad.length) { + for (i = adLinkLen; i < ad.length; i++) { + adlink.push(''); + } + } + if (adTimeLen < ad.length) { + for (i = adTimeLen; i < ad.length; i++) { + adtime.push(''); + } + } + var adstypeLen = adstype.length; + if (v[adStype] == '') { + adstypeLen = 0; + adstype = []; + } + if (adstypeLen < ad.length) { + for (i = adstypeLen; i < ad.length; i++) { + adstype.push(this.getFileExt(ad[i]).replace('.', '')); + } + } + for (i = 0; i < ad.length; i++) { + var type = adstype[i]; + if (type == 'mp4' || type == 'mov' || this.isStrImage(type)) { + var obj = { + file: ad[i], + type: type, + time: parseInt(adtime[i]) > 0 ? parseInt(adtime[i]) : this.ckStyle['advertisement']['time'], + link: adlink[i] + }; + adList.push(obj); + } + + } + if (this.isUndefined(this.advertisements)) { + this.advertisements = {}; + } + if (adList.length > 0) { + this.advertisements[adType] = adList; + } + } + } + }, + /* + 内部函数 + 发送播放器加载成功的消息 + */ + playerLoad: function() { + var thisTemp = this; + if (this.isFirst) { + this.isFirst = false; + setTimeout(function() { + thisTemp.loadedHandler(); + },1); + } + }, + /* + 内部函数 + 建立播放器的监听函数,包含操作监听及事件监听 + */ + addVEvent: function() { + var thisTemp = this; + var duration=0; + //监听视频单击事件 + var eventVideoClick = function(event) { + thisTemp.videoClickXy={x:event.clientX,y:event.clientY}; + thisTemp.videoClick(); + }; + this.addListenerInside('click', eventVideoClick); + this.addListenerInside('click', eventVideoClick, this.MDC); + //延迟计算加载失败事件 + this.timerErrorFun(); + //监听视频加载到元数据事件 + var eventJudgeIsLive = function(event) { + thisTemp.sendJS('loadedmetadata'); + if (thisTemp.varType(thisTemp.V.duration) == 'number' && thisTemp.V.duration > 1) { + duration = thisTemp.V.duration; + if(!duration){ + if(thisTemp.vars['duration']>0){ + duration=thisTemp.vars['duration']; + } + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + thisTemp.sendJS('duration', duration); + thisTemp.formatInserttime(duration); + if (thisTemp.adPlayerPlay) { + thisTemp.advertisementsTime(duration + 1); + } + thisTemp.durationSendJS = true; + } + if (thisTemp.conBarShow) { + thisTemp.V.controls=null; + thisTemp.videoCss(); + } + thisTemp.judgeIsLive(); + }; + //监听视频播放事件 + var eventPlaying = function(event) { + thisTemp.playingHandler(); + thisTemp.sendJS('play'); + thisTemp.sendJS('paused', false); + if (!thisTemp.durationSendJS && thisTemp.varType(thisTemp.V.duration) == 'number' && thisTemp.V.duration > 0) { + duration = thisTemp.V.duration; + if(!duration){ + if(thisTemp.vars['duration']>0){ + duration=thisTemp.vars['duration']; + } + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + thisTemp.durationSendJS = true; + thisTemp.sendJS('duration', duration); + thisTemp.formatInserttime(duration); + } + }; + this.addListenerInside('playing', eventPlaying); + //监听视频暂停事件 + var eventPause = function(event) { + thisTemp.pauseHandler(); + thisTemp.sendJS('pause'); + thisTemp.sendJS('paused', true); + }; + this.addListenerInside('pause', eventPause); + //监听视频播放结束事件 + var eventEnded = function(event) { + thisTemp.endedHandler(); + }; + this.addListenerInside('ended', eventEnded); + //监听视频播放时间事件 + var eventTimeupdate = function(event) { + if (thisTemp.loadingShow) { + thisTemp.loadingStart(false); + } + if (thisTemp.time) { + if (!thisTemp.adPlayerPlay) { + thisTemp.sendJS('time', thisTemp.time); + //监听中间插入广告是否需要播放 + if (!thisTemp.isUndefined(thisTemp.advertisements['insert'])) { + thisTemp.checkAdInsert(thisTemp.time); + } + //监听其它广告 + if (!thisTemp.isUndefined(thisTemp.advertisements['other'])) { + thisTemp.checkAdOther(thisTemp.time); + } + if (thisTemp.time < 3 && thisTemp.adReset) { + thisTemp.adReset = false; + thisTemp.endedAdReset(); + } + } else { //如果是广告则进行广告倒计时 + thisTemp.adPlayerTimeHandler(thisTemp.time); + } + + } + }; + this.addListenerInside('timeupdate', eventTimeupdate); + //监听视频缓冲事件 + var eventWaiting = function(event) { + thisTemp.loadingStart(true); + }; + this.addListenerInside('waiting', eventWaiting); + //监听视频seek开始事件 + var eventSeeking = function(event) { + thisTemp.sendJS('seek', 'start'); + }; + this.addListenerInside('seeking', eventSeeking); + //监听视频seek结束事件 + var eventSeeked = function(event) { + thisTemp.seekedHandler(); + thisTemp.sendJS('seek', 'ended'); + }; + this.addListenerInside('seeked', eventSeeked); + //监听视频音量 + var eventVolumeChange = function(event) { + try { + thisTemp.volumechangeHandler(); + thisTemp.sendJS('volume', thisTemp.volume || thisTemp.V.volume); + } catch(event) {} + }; + this.addListenerInside('volumechange', eventVolumeChange); + //监听全屏事件 + var eventFullChange = function(event) { + var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; + thisTemp.sendJS('full', fullState); + }; + this.addListenerInside('fullscreenchange', eventFullChange); + this.addListenerInside('webkitfullscreenchange', eventFullChange); + this.addListenerInside('mozfullscreenchange', eventFullChange); + //建立界面 + if (this.conBarShow) { + this.interFace(); + } + this.addListenerInside('loadedmetadata', eventJudgeIsLive); + }, + /* + 内部函数 + 重置界面元素 + */ + resetPlayer: function() { + this.timeTextHandler(); + if (this.conBarShow) { + this.timeProgress(0, 1); //改变时间进度条宽 + this.changeLoad(0); + this.initPlayPause(); //判断显示播放或暂停按钮 + this.definition(); //构建清晰度按钮 + this.deletePrompt(); //删除提示点 + this.deletePreview(); //删除预览图 + this.trackHide(); //重置字幕 + this.resetTrack(); + this.trackElement = []; + this.track = []; + } + }, + /* + 内部函数 + 构建界面元素 + */ + interFace: function() { + this.conBarShow = true; + var thisTemp = this; + var html = ''; //控制栏内容 + var i = 0; + var thisStyle=this.ckStyle; + var styleC=thisStyle['controlBar']; + var styleCB=styleC['button']; + var styleAS=thisStyle['advertisement']; + var styleDF=styleC['definition']; + var bWidth = 38;//按钮的宽 + + //var timeInto = this.formatTime(0) + ' / ' + this.formatTime(this.vars['duration']); //时间显示框默认显示内容 + var timeInto = this.formatTime(0,this.vars['duration'],this.ckLanguage['vod']); //时间显示框默认显示内容 + /* + 构建一些PD(播放器容器)里使用的元素 + */ + /* + 构建播放器内的元素 + */ + this.CB={menu:null}; + var divEle={ + controlBarBg:null, + controlBar:null, + pauseCenter:null, + errorText:null, + promptBg:null, + prompt:null, + promptTriangle:null, + definitionP:null, + playbackrateP:null, + subtitlesP:null, + loading:null, + logo:null, + adBackground:null, + adElement:null, + adLink:null, + adPauseClose:null, + adTime:null, + adTimeText:null, + adMute:null, + adEscMute:null, + adSkip:null, + adSkipText:null, + adSkipButton:null + }; + var k=''; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.PD.appendChild(this.CB[k]); + } + /* + 构建鼠标右键容器 + */ + this.CB['menu']=document.createElement('div'); + this.body.appendChild(this.CB['menu']); + if (this.vars['live']) { //如果是直播,时间显示文本框里显示当前系统时间 + timeInto = this.formatTime(0,0,this.ckLanguage['live']); //时间显示框默认显示内容 + } + /* + 构建控制栏的按钮 + */ + divEle={ + play:null, + pause:null, + mute:null, + escMute:null, + full:null, + escFull:null, + definition:null, + playbackrate:null, + subtitles:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + this.CB[k].dataset.title=this.ckLanguage['buttonOver'][k]; + } + this.CB['controlBar'].appendChild(this.CB[k]); + } + divEle={ + timeProgressBg:null, + timeBoBg:null, + volume:null, + timeText:null + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['controlBar'].appendChild(this.CB[k]); + } + this.CB['timeText'].innerHTML=timeInto;//初始化时间 + divEle={ + loadProgress:null, + timeProgress:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['timeProgressBg'].appendChild(this.CB[k]); + } + this.CB['timeButton']=document.createElement('div'); + this.CB['timeBoBg'].appendChild(this.CB['timeButton']); + divEle={ + volumeBg:null, + volumeBO:null, + }; + for(k in divEle){ + this.CB[k]=divEle[k]; + this.CB[k]=document.createElement('div'); + this.CB['volume'].appendChild(this.CB[k]); + } + this.CB['volumeUp']=document.createElement('div'); + this.CB['volumeBg'].appendChild(this.CB['volumeUp']); + //构建loading图标 + var imgTemp=null; + var imgFile=''; + var imgFile=thisStyle['loading']['file']; + if(!this.isUndefined(thisStyle['loading']['fileH5'])){ + imgFile=thisStyle['loading']['fileH5']; + } + if(imgFile){ + imgTemp=document.createElement('img'); + imgTemp.src=imgFile; + imgTemp.border=0; + this.CB['loading'].appendChild(imgTemp); + } + //构建logo图标 + imgFile=thisStyle['logo']['file']; + if(!this.isUndefined(thisStyle['logo']['fileH5'])){ + imgFile=thisStyle['logo']['fileH5']; + } + if(imgFile){ + imgTemp=document.createElement('img'); + imgTemp.src=imgFile; + imgTemp.border=0; + this.CB['logo'].appendChild(imgTemp); + } + //定义界面元素的样式 + if(this.ckConfig['config']['buttonMode']['player']){ + this.css(this.PD, {cursor: 'pointer'}); + } + //控制栏背景 + this.controlBar(); //改变控制栏 + var cssTemp=null; + //定义提示语的样式 + var promptCss=thisStyle['prompt']; + cssTemp=this.getEleCss(promptCss,{overflow: 'hidden',zIndex: 900,display:'none'}); + this.css(this.CB['promptBg'],cssTemp); + this.css(this.CB['promptBg'],'padding','0px'); + cssTemp['backgroundColor']=''; + cssTemp['border']=''; + cssTemp['borderRadius']=''; + cssTemp['whiteSpace']='nowrap'; + this.css(this.CB['prompt'],cssTemp); + //定义提示语下方的三解形的样式 + cssTemp={ + width: 0, + height: 0, + borderLeft: promptCss['triangleWidth']*0.5+'px solid transparent', + borderRight: promptCss['triangleWidth']*0.5+'px solid transparent', + borderTop: promptCss['triangleHeight']+'px solid '+promptCss['triangleBackgroundColor'].replace('0x','#'), + overflow: 'hidden', + opacity:promptCss['triangleAlpha'], + filter:'alpha(opacity:'+promptCss['triangleAlpha']+')', + position:'absolute', + left:'0px', + top:'0px', + zIndex: 900, + display:'none' + }; + this.css(this.CB['promptTriangle'],cssTemp); + this.elementCoordinate();//中间播放按钮,出错文本框,logo,loading + this.css([this.CB['pauseCenter'],this.CB['loading'],this.CB['errorText']],'display','none'); + this.carbarButton();//控制栏按钮 + this.playerCustom();//播放器界面自定义元件 + this.carbarCustom();//控制栏自定义元件 + this.timeProgressDefault();//进度条默认样式 + this.videoCss();//计算video的宽高和位置 + //初始化判断播放/暂停按钮隐藏项 + this.initPlayPause(); + if (this.vars['volume'] > 0) { + this.css(this.CB['escMute'], 'display', 'none'); + } else { + this.css(this.CB['mute'], 'display', 'none'); + } + if (!this.ckConfig['config']['mobileVolumeBarShow'] && this.isMobile()) { + this.css([this.CB['mute'], this.CB['escMute'], this.CB['volume']], { + display: 'none' + }); + } + this.css(this.CB['escFull'],'display', 'none'); + //设置广告背景层样式 + var cssObj={ + align: 'top', + vAlign:'left', + width:'100%', + height:'100%', + offsetX: 0, + offsetY: 0, + zIndex: 910, + display: 'none' + }; + cssTemp=this.getEleCss(styleAS['background'],cssObj); + this.css(this.CB['adBackground'],cssTemp); + this.css(this.CB['adElement'], { + position: 'absolute', + overflow: 'hidden', + top: '0px', + zIndex: 911, + float: 'center', + display: 'none' + }); + //广告控制各元素样式,用一个函数单独定义,这样在播放器尺寸变化时可以重新设置样式 + this.advertisementStyle(); + //初始化广告控制各元素-隐藏 + this.css([this.CB['adTime'],this.CB['adTimeText'],this.CB['adMute'],this.CB['adEscMute'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink'],this.CB['adPauseClose']],'display','none'); + //定义鼠标经过控制栏只显示完整的进度条,鼠标离开进度条则显示简单的进度条 + var timeProgressOut = function(event) { + thisTemp.timeProgressMouseOut(); + }; + this.addListenerInside('mouseout', timeProgressOut, this.CB['timeBoBg']); + var timeProgressOver = function(event) { + thisTemp.timeProgressDefault(); + }; + this.addListenerInside('mouseover', timeProgressOver, this.CB['controlBar']); + //定义各按钮鼠标经过时的切换样式 + this.buttonEventFun(this.CB['play'],styleCB['play']);//播放按钮 + this.buttonEventFun(this.CB['pause'],styleCB['pause']);//暂停按钮 + this.buttonEventFun(this.CB['mute'],styleCB['mute']);//静音按钮 + this.buttonEventFun(this.CB['escMute'],styleCB['escMute']);//恢复音量按钮 + this.buttonEventFun(this.CB['full'],styleCB['full']);//全屏按钮 + this.buttonEventFun(this.CB['escFull'],styleCB['escFull']);//退出全屏按钮 + this.buttonEventFun(this.CB['adMute'],styleAS['muteButton']);//广告静音按钮 + this.buttonEventFun(this.CB['adEscMute'],styleAS['escMuteButton']);//恢复广告音量按钮 + this.buttonEventFun(this.CB['adSkipButton'],styleAS['skipAdButton']);//跳过广告按钮 + this.buttonEventFun(this.CB['adLink'],styleAS['adLinkButton']);//广告查看详情按钮 + this.buttonEventFun(this.CB['adPauseClose'],styleAS['closeButton']);//播放暂停时的广告的关闭按钮 + this.buttonEventFun(this.CB['pauseCenter'],thisStyle['centerPlay']);//播放器中间暂停时的播放按钮 + this.buttonEventFun(this.CB['volumeBO'],styleC['volumeSchedule']['button']);//音量调节框按钮样式 + this.buttonEventFun(this.CB['timeButton'],styleC['timeSchedule']['button']);//时间进度调节框按钮样式 + + this.addButtonEvent(); //注册按钮及音量调节,进度操作事件 + this.controlBarHide(); //单独注册控制栏隐藏事件 + this.newMenu(); //设置右键的样式和事件 + this.keypress(); //注册键盘事件 + //初始化音量调节框 + this.changeVolume(this.vars['volume']); + setTimeout(function() { + thisTemp.elementCoordinate(); //调整中间暂停按钮/loading的位置/error的位置 + }, + 100); + this.checkBarWidth(); + var resize = function() { + thisTemp.log('window.resize'); + thisTemp.playerResize(); + }; + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + var observer = new MutationObserver(function(){ + thisTemp.log('video.resize'); + var cdW=parseInt(thisTemp.css(thisTemp.CD,'width')),cdH=parseInt(thisTemp.css(thisTemp.CD,'height')); + if(cdW!=thisTemp.cdWH['w'] || cdH!=thisTemp.cdWH['h']){ + thisTemp.cdWH={ + w:cdW, + h:cdH + }; + thisTemp.changeSize(cdW,cdH); + } + }); + observer.observe(this.CD, {attributes: true, attributeFilter: ['style'], attributeOldValue: true }); + this.addListenerInside('resize', resize, window); + }, + /* + 内部函数 + 进间进度条默认样式 + */ + timeProgressDefault:function(){ + var styleCT=this.ckStyle['controlBar']['timeSchedule']; + var cssObj=this.newObj(styleCT['default']); + var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg']; + var cssTemp=null; + this.css(this.CB['timeBoBg'],'display','block'); + //时间进度条背景容器 + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow: 'hidden',zIndex: 2},this.CB['controlBarBg']); + this.css(this.CB['timeProgressBg'], cssTemp); + //加载进度 + cssObj={ + align:'left', + vAlign:'top', + width:1, + height:cssObj['height'], + backgroundImg:loadBackImg + }; + //加载进度和时间进度 + if(this.CB['loadProgress'].offsetWidth>1){ + cssObj['width']=this.CB['loadProgress'].offsetWidth; + } + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']); + this.css(this.CB['loadProgress'],cssTemp); + cssObj['width']=0; + if(this.CB['timeProgress'].offsetWidth>1 && parseInt(this.css(this.CB['timeButton'],'left'))>0){ + cssObj['width']=this.CB['timeProgress'].offsetWidth; + + } + cssObj['backgroundImg']=playBackImg; + cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2}); + this.css(this.CB['timeProgress'],cssTemp); + //时间进度按钮容器 + cssTemp=this.getEleCss(styleCT['buttonContainer'],{position: 'absolute',overflow: 'hidden',zIndex: 3},this.CB['controlBar']); + if(this.ckConfig['config']['buttonMode']['timeSchedule']){ + cssTemp['cursor']='pointer'; + } + this.css(this.CB['timeBoBg'],cssTemp); + //时间进度按钮 + cssTemp=this.getEleCss(styleCT['button'],{cursor: 'pointer',overflow: 'hidden',zIndex: 4},this.CB['timeBoBg']); + this.css(this.CB['timeButton'], cssTemp); + }, + /* + 内部函数 + 进间进度条鼠标离开样式 + */ + timeProgressMouseOut:function(){ + var styleCT=this.ckStyle['controlBar']['timeSchedule']; + var cssObj=this.newObj(styleCT['mouseOut']); + var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg']; + var cssTemp=null; + this.css(this.CB['timeBoBg'],'display','block'); + //时间进度条背景容器 + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow: 'hidden',zIndex: 2},this.CB['controlBarBg']); + this.css(this.CB['timeProgressBg'], cssTemp); + //加载进度 + cssObj={ + align:'left', + vAlign:'top', + width:1, + height:cssObj['height'], + backgroundImg:loadBackImg + }; + //加载进度和时间进度 + if(this.CB['loadProgress'].offsetWidth>1){ + cssObj['width']=this.CB['loadProgress'].offsetWidth; + } + cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']); + this.css(this.CB['loadProgress'],cssTemp); + cssObj['width']=1; + if(this.CB['timeProgress'].offsetWidth>1 && parseInt(this.css(this.CB['timeButton'],'left'))>0){ + cssObj['width']=this.CB['timeProgress'].offsetWidth; + cssObj['backgroundImg']=playBackImg; + } + cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2}); + this.css(this.CB['timeProgress'],cssTemp); + this.css(this.CB['timeBoBg'],'display','none'); + }, + /* + 统一注册按钮鼠标经过和离开时的切换动作 + */ + buttonEventFun:function(ele,cssEle){ + var thisTemp=this; + var overFun = function(event) { + thisTemp.css(ele,{ + backgroundImage:'url('+cssEle['mouseOver']+')' + }); + thisTemp.promptShow(ele); + }; + var outFun = function(event) { + thisTemp.css(ele,{ + backgroundImage:'url('+cssEle['mouseOut']+')' + }); + thisTemp.promptShow(false); + }; + outFun(); + this.addListenerInside('mouseover', overFun, ele); + this.addListenerInside('mouseout', outFun, ele); + if(!this.isUndefined(cssEle['clickEvent'])){ + var clickFun=function(event){ + thisTemp.runFunction(cssEle['clickEvent']); + }; + this.addListenerInside('click', clickFun, ele); + } + }, + /* + 内部函数 + 格式化样式用的数字 + */ + formatNumPx:function(str,z){ + if(!str){ + return 0; + } + if(str.toString().indexOf('%')>-1){//说明是根据百分比来计算 + if(!this.isUndefined(z)){//如果有值 + return parseInt(str)*z*0.01+'px'; + } + return str; + } + else{ + return str+'px'; + } + }, + /* + 内部函数 + 格式化样式用的数字,返回类型必需是数字或百分比 + */ + formatZToNum:function(str,z){ + if(!str){ + return 0; + } + if(str.toString().indexOf('%')>-1){//说明是根据百分比来计算 + if(!this.isUndefined(z)){//如果有值 + return parseInt(str)*z*0.01; + } + return str; + } + else{ + return str; + } + }, + /* + 内部函数 + 对对象进行深度复制 + */ + newObj:function(obj) { + if(this.isUndefined(obj)){ + return obj; + } + var str, newobj ={};//constructor 属性返回对创建此对象的数组函数的引用。创建相同类型的空数据 + if (this.varType(obj) != 'object') { + return obj; + } + else { + for (var k in obj) { + if(this.isUndefined(obj[k])){ + newobj[k] = obj[k]; + } + else{ + if(this.varType(obj[k]) == 'object') { //判断对象的这条属性是否为对象 + newobj[k] = this.newObj(obj[k]);//若是对象进行嵌套调用 + } + else{ + newobj[k] = obj[k]; + } + } + } + } + return newobj;//返回深度克隆后的对象 + }, + /* + 内部函数 + 统一的显示图片 + */ + loadImgBg:function(eleid,obj){ + this.css(this.getByElement(eleid),{ + backgroundImage:'url('+obj+')' + }); + }, + /* + 内部函数 + 格式化css + eleObj=样式, + supplement=补充样式, + rrEle=参考对象, + 该函数强制使用position定位的元素 + */ + getEleCss:function(eleObj,supplement,rrEle){ + var eleName=null; + var pdW=this.PD.offsetWidth,pdH=this.PD.offsetHeight; + if(rrEle){ + pdW=rrEle.offsetWidth; + pdH=rrEle.offsetHeight; + } + if(this.isUndefined(eleObj)){ + return null; + } + eleName=this.newObj(eleObj); + var cssObject={}; + if(!this.isUndefined(eleName['width'])){ + cssObject['width']=this.formatZToNum(eleName['width'],pdW)+'px'; + } + if(!this.isUndefined(eleName['height'])){ + cssObject['height']=this.formatZToNum(eleName['height'],pdH)+'px'; + } + if(!this.isUndefined(eleName['background'])){ + var bg=eleName['background']; + if(!this.isUndefined(bg['backgroundColor'])){ + cssObject['backgroundColor']=bg['backgroundColor'].replace('0x','#'); + } + if(!this.isUndefined(bg['backgroundImg'])){ + cssObject['backgroundImage']='url('+bg['backgroundImg']+')'; + } + if(!this.isUndefined(bg['alpha'])){ + cssObject['filter']='alpha(opacity:'+bg['alpha']+')'; + cssObject['opacity']=bg['alpha']; + } + } + if(!this.isUndefined(eleName['backgroundColor'])){ + cssObject['backgroundColor']=eleName['backgroundColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['backgroundImg'])){ + cssObject['backgroundImage']='url('+eleName['backgroundImg']+')'; + } + if(!this.isUndefined(eleName['color'])){ + cssObject['color']=eleName['color'].replace('0x','#'); + } + if(!this.isUndefined(eleName['font'])){ + cssObject['fontFamily']=eleName['font']; + } + if(!this.isUndefined(eleName['size'])){ + cssObject['fontSize']=eleName['size']+'px'; + } + if(!this.isUndefined(eleName['alpha'])){ + cssObject['filter']='alpha(opacity:'+eleName['alpha']+')'; + cssObject['opacity']=eleName['alpha']; + } + if(!this.isUndefined(eleName['lineHeight'])){ + cssObject['lineHeight']=eleName['lineHeight']+'px'; + } + if(!this.isUndefined(eleName['textAlign'])){ + cssObject['textAlign']=eleName['textAlign']; + } + if(!this.isUndefined(eleName['borderRadius'])){ + cssObject['borderRadius']=eleName['borderRadius']+'px'; + } + if(!this.isUndefined(eleName['radius'])){ + cssObject['borderRadius']=eleName['radius']+'px'; + } + if(!this.isUndefined(eleName['padding'])){ + cssObject['padding']=eleName['padding']+'px'; + } + if(!this.isUndefined(eleName['paddingLeft'])){ + cssObject['paddingLeft']=eleName['paddingLeft']+'px'; + } + if(!this.isUndefined(eleName['paddingRight'])){ + cssObject['paddingRight']=eleName['paddingRight']+'px'; + } + if(!this.isUndefined(eleName['paddingTop'])){ + cssObject['paddingTop']=eleName['paddingTop']+'px'; + } + if(!this.isUndefined(eleName['paddingBottom'])){ + cssObject['paddingBottom']=eleName['paddingBottom']+'px'; + } + if(!this.isUndefined(eleName['margin'])){ + cssObject['margin']=eleName['margin']+'px'; + } + if(!this.isUndefined(eleName['marginLeft'])){ + cssObject['marginLeft']=eleName['marginLeft']+'px'; + } + if(!this.isUndefined(eleName['marginRight'])){ + cssObject['marginRight']=eleName['marginRight']+'px'; + } + if(!this.isUndefined(eleName['marginTop'])){ + cssObject['marginTop']=eleName['marginTop']+'px'; + } + if(!this.isUndefined(eleName['marginBottom'])){ + cssObject['marginBottom']=eleName['marginBottom']+'px'; + } + if(!this.isUndefined(eleName['border']) && !this.isUndefined(eleName['borderColor'])){ + cssObject['border']=eleName['border']+'px solid '+eleName['borderColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderLeft']) && !this.isUndefined(eleName['borderLeftColor'])){ + cssObject['borderLeft']=eleName['borderLeft']+'px solid '+eleName['borderLeftColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderRight']) && !this.isUndefined(eleName['borderRightColor'])){ + cssObject['borderRight']=eleName['borderRight']+'px solid '+eleName['borderRightColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderTop']) && !this.isUndefined(eleName['borderTopColor'])){ + cssObject['borderTop']=eleName['borderTop']+'px solid '+eleName['borderTopColor'].replace('0x','#'); + } + if(!this.isUndefined(eleName['borderBottom']) && !this.isUndefined(eleName['borderBottomColor'])){ + cssObject['borderBottom']=eleName['borderBottom']+'px solid '+eleName['borderBottomColor'].replace('0x','#'); + } + if(!this.isUndefined(supplement)){ + for(var k in supplement){ + cssObject[k]=supplement[k]; + } + } + cssObject['position']='absolute'; + var left=-10000,top=-10000,right=-10000,bottom=-10000; + var offsetX=0,offsetY=0; + if(!this.isUndefined(eleName['offsetX'])){ + offsetX=eleName['offsetX']; + } + if(!this.isUndefined(eleName['marginX'])){ + offsetX=eleName['marginX']; + } + if(!this.isUndefined(eleName['offsetY'])){ + offsetY=eleName['offsetY']; + } + if(!this.isUndefined(eleName['marginY'])){ + offsetY=eleName['marginY']; + } + offsetX=this.formatZToNum(offsetX,pdW); + offsetY=this.formatZToNum(offsetY,pdH); + if(!this.isUndefined(eleName['align'])){ + left=0; + switch (eleName['align']) { + case 'left': + left = offsetX; + break; + case 'center': + left = pdW * 0.5 + offsetX; + break; + case 'right': + left = pdW+offsetX; + break; + case 'right2': + left = -10000; + right=offsetX; + break; + } + } + if(!this.isUndefined(eleName['vAlign'])){ + top=0; + switch (eleName['vAlign']) { + case 'top': + top = offsetY; + break; + case 'middle': + top=pdH*0.5+offsetY; + break; + case 'bottom': + top =pdH+offsetY; + break; + case 'bottom2': + top=-10000; + bottom =offsetY; + + break; + } + } + if(left>-10000){ + cssObject['left']=left+'px'; + } + if(right>-10000){ + cssObject['right']=right+'px'; + } + if(top>-10000){ + cssObject['top']=top+'px'; + } + if(bottom>-10000){ + cssObject['bottom']=bottom+'px'; + } + return cssObject; + }, + /* + 内部函数 + 创建按钮,使用canvas画布 + */ + newCanvas: function(id, width, height) { + return ''; + }, + /* + 内部函数 + 注册按钮,音量调节框,进度操作框事件 + */ + addButtonEvent: function() { + var thisTemp = this; + //定义按钮的单击事件 + + //定义各个按钮的鼠标经过/离开事件 + var promptHide = function(event) { + thisTemp.promptShow(false); + }; + var definitionOver = function(event) { + thisTemp.promptShow(thisTemp.CB['definition']); + }; + this.addListenerInside('mouseover', definitionOver, this.CB['definition']); + this.addListenerInside('mouseout', promptHide, this.CB['definition']); + var playbackrateOver = function(event) { + thisTemp.promptShow(thisTemp.CB['playbackrate']); + }; + this.addListenerInside('mouseover', playbackrateOver, this.CB['playbackrate']); + this.addListenerInside('mouseout', promptHide, this.CB['playbackrate']); + var subtitlesOver = function(event) { + thisTemp.promptShow(thisTemp.CB['subtitles']); + }; + this.addListenerInside('mouseover', subtitlesOver, this.CB['subtitles']); + this.addListenerInside('mouseout', promptHide, this.CB['subtitles']); + //定义音量和进度按钮的滑块事件 + var volumePrompt = function(vol) { + var volumeBOXY = thisTemp.getCoor(thisTemp.CB['volumeBO']); + var promptObj = { + title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',vol), + x: volumeBOXY['x'] + thisTemp.CB['volumeBO'].offsetWidth * 0.5, + y: volumeBOXY['y'] + }; + thisTemp.promptShow(false, promptObj); + }; + var volumeObj = { + slider: this.CB['volumeBO'], + follow: this.CB['volumeUp'], + refer: this.CB['volumeBg'], + grossValue: 'volume', + pd: true, + startFun: function(vol) {}, + monitorFun: function(vol) { + thisTemp.changeVolume(vol * 0.01, false, false); + volumePrompt(vol); + }, + endFun: function(vol) {}, + overFun: function(vol) { + volumePrompt(vol); + } + }; + this.slider(volumeObj); + var volumeClickObj = { + refer: this.CB['volumeBg'], + grossValue: 'volume', + fun: function(vol) { + thisTemp.changeVolume(vol * 0.01, true, true); + } + }; + this.progressClick(volumeClickObj); + this.timeButtonMouseDown(); //用单击的函数来判断是否需要建立控制栏监听 + //鼠标经过/离开音量调节框时的 + var volumeBgMove = function(event) { + var volumeBgXY = thisTemp.getCoor(thisTemp.CB['volumeBg']); + var eventX = thisTemp.client(event)['x']; + var eventVolume = parseInt((eventX - volumeBgXY['x']) * 100 / thisTemp.CB['volumeBg'].offsetWidth); + var buttonPromptObj = { + title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',eventVolume), + x: eventX, + y: volumeBgXY['y'] + }; + thisTemp.promptShow(false, buttonPromptObj); + }; + this.addListenerInside('mousemove', volumeBgMove, this.CB['volumeBg']); + this.addListenerInside('mouseout', promptHide, this.CB['volumeBg']); + this.addListenerInside('mouseout', promptHide, this.CB['volumeBO']); + //注册清晰度相关事件 + this.addDefListener(); + //注册倍速相关事件 + this.addPlaybackrate(); + //注册多字幕事件 + this.addSubtitles(); + }, + /* + 内部函数 + 注册单击视频动作 + */ + videoClick: function() { + var thisTemp = this; + var clearTimerClick = function() { + if (thisTemp.timerClick != null) { + if (thisTemp.timerClick.runing) { + thisTemp.timerClick.stop(); + } + thisTemp.timerClick = null; + } + }; + var timerClickFun = function() { + clearTimerClick(); + thisTemp.isClick = false; + thisTemp.sendJS('videoClick',thisTemp.videoClickXy); + if (thisTemp.adPlayerPlay) { + var ad = thisTemp.getNowAdvertisements(); + try { + if (ad['link'] != '') { + window.open(ad['link']); + } + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + } catch(event) {} + } else { + if (thisTemp.ckConfig['config']['click']) { + thisTemp.playOrPause(); + } + } + + }; + clearTimerClick(); + if (this.isClick) { + this.isClick = false; + thisTemp.sendJS('videoDoubleClick',thisTemp.videoClickXy); + if (thisTemp.ckConfig['config']['doubleClick']) { + if (!this.full) { + thisTemp.fullScreen(); + } else { + thisTemp.quitFullScreen(); + } + } + + } else { + this.isClick = true; + this.timerClick = new this.timer(300, timerClickFun, 1) + //this.timerClick.start(); + } + + }, + /* + 内部函数 + 注册鼠标经过进度滑块的事件 + */ + timeButtonMouseDown: function() { + var thisTemp = this; + var timePrompt = function(time) { + if (isNaN(time)) { + time = 0; + } + var timeButtonXY = thisTemp.getCoor(thisTemp.CB['timeButton']); + var promptObj = { + title: thisTemp.formatTime(time,0,thisTemp.ckLanguage['timeSliderOver']), + x: timeButtonXY['x'] - thisTemp.pdCoor['x'] + thisTemp.CB['timeButton'].offsetWidth * 0.5, + y: timeButtonXY['y'] - thisTemp.pdCoor['y'] + }; + thisTemp.promptShow(false, promptObj); + }; + var timeObj = { + slider: this.CB['timeButton'], + follow: this.CB['timeProgress'], + refer: this.CB['timeBoBg'], + grossValue: 'time', + pd: false, + startFun: function(time) { + thisTemp.isTimeButtonMove = false; + }, + monitorFun: function(time) {}, + endFun: function(time) { + if (thisTemp.V) { + if (thisTemp.V.duration > 0) { + thisTemp.needSeek = 0; + thisTemp.videoSeek(parseInt(time)); + } + } + }, + overFun: function(time) { + timePrompt(time); + } + }; + var timeClickObj = { + refer: this.CB['timeBoBg'], + grossValue: 'time', + fun: function(time) { + if (thisTemp.V) { + if (thisTemp.V.duration > 0) { + thisTemp.needSeek = 0; + thisTemp.videoSeek(parseInt(time)); + } + } + } + }; + var timeBoBgmousemove = function(event) { + var timeBoBgXY = thisTemp.getCoor(thisTemp.CB['timeBoBg']); + var eventX = thisTemp.client(event)['x']; + var duration=thisTemp.V.duration; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = thisTemp.vars['duration']; + } + if(thisTemp.vars['forceduration']>0){ + duration=thisTemp.vars['forceduration']; + } + var eventTime = parseInt((eventX - timeBoBgXY['x']) * duration / thisTemp.CB['timeBoBg'].offsetWidth); + var buttonPromptObj = { + title: thisTemp.formatTime(eventTime,0,thisTemp.ckLanguage['timeSliderOver']), + x: eventX, + y: timeBoBgXY['y'] + }; + thisTemp.promptShow(false, buttonPromptObj); + var def = false; + if (!thisTemp.isUndefined(thisTemp.CB['definitionP'])) { + if (thisTemp.css(thisTemp.CB['definitionP'], 'display') != 'block') { + def = true; + } + } + if (thisTemp.vars['preview'] != null && def) { + buttonPromptObj['time'] = eventTime; + thisTemp.preview(buttonPromptObj); + } + }; + var promptHide = function(event) { + thisTemp.promptShow(false); + if (thisTemp.previewDiv != null) { + thisTemp.css([thisTemp.previewDiv, thisTemp.previewTop], 'display', 'none'); + } + }; + if (!this.vars['live']) { //如果不是直播 + this.isTimeButtonDown = true; + this.addListenerInside('mousemove', timeBoBgmousemove, this.CB['timeBoBg']); + this.addListenerInside('mouseout', promptHide, this.CB['timeBoBg']); + } else { + this.isTimeButtonDown = false; + timeObj['removeListenerInside'] = true; + timeClickObj['removeListenerInside'] = true; + } + this.slider(timeObj); + this.progressClick(timeClickObj); + + }, + /* + 内部函数 + 注册调节框上单击事件,包含音量调节框和播放时度调节框 + */ + progressClick: function(obj) { + /* + refer:参考对象 + fun:返回函数 + refer:参考元素,即背景 + grossValue:调用的参考值类型 + pd: + */ + //建立参考元素的mouseClick事件,用来做为鼠标在其上按下时触发的状态 + var thisTemp = this; + var referMouseClick = function(event) { + var referX = thisTemp.client(event)['x'] - thisTemp.getCoor(obj['refer'])['x']; + var rWidth = obj['refer'].offsetWidth; + var grossValue = 0; + if (obj['grossValue'] == 'volume') { + grossValue = 100; + } else { + if (thisTemp.V) { + grossValue = thisTemp.V.duration; + if (isNaN(grossValue) || parseInt(grossValue) < 0.2) { + grossValue = thisTemp.vars['duration']; + } + if(thisTemp.vars['forceduration']>0){ + grossValue=thisTemp.vars['forceduration']; + } + } + } + var nowZ = parseInt(referX * grossValue / rWidth); + if (obj['fun']) { + if (obj['grossValue'] === 'time') { + var sliderXY = thisTemp.getCoor(thisTemp.CB['timeButton']); + sliderLeft = sliderXY['x']; + if (!thisTemp.checkSlideLeft(referX, sliderLeft, rWidth)) { + return; + } + var bimeButtonWB = thisTemp.CB['timeButton'].offsetWidth * 0.5; + thisTemp.css(thisTemp.CB['timeButton'], 'left', (referX - bimeButtonWB) + 'px'); + thisTemp.css(thisTemp.CB['timeProgress'], 'width', (referX) + 'px'); + } + obj['fun'](nowZ); + } + }; + if (this.isUndefined(obj['removeListenerInside'])) { + this.addListenerInside('click', referMouseClick, obj['refer']); + } else { + this.removeListenerInside('click', referMouseClick, obj['refer']); + } + + }, + + /* + 内部函数 + 共用的注册滑块事件 + */ + slider: function(obj) { + /* + obj={ + slider:滑块元素 + follow:跟随滑块的元素 + refer:参考元素,即背景 + grossValue:调用的参考值类型 + startFun:开始调用的元素 + monitorFun:监听函数 + endFun:结束调用的函数 + overFun:鼠标放上去后调用的函数 + pd:是否需要修正 + } + */ + var thisTemp = this; + var clientX = 0, + criterionWidth = 0, + sliderLeft = 0, + referLeft = 0; + var value = 0; + var calculation = function() { //根据滑块的left计算百分比 + var sLeft = parseInt(thisTemp.css(obj['slider'], 'left')); + var rWidth = obj['refer'].offsetWidth - obj['slider'].offsetWidth; + var grossValue = 0; + if (thisTemp.isUndefined(sLeft) || isNaN(sLeft)) { + sLeft = 0; + } + if (obj['grossValue'] == 'volume') { + grossValue = 100; + } else { + if (thisTemp.V) { + grossValue = thisTemp.V.duration; + } + } + return parseInt(sLeft * grossValue / rWidth); + }; + var mDown = function(event) { + thisTemp.addListenerInside('mousemove', mMove, document); + thisTemp.addListenerInside('mouseup', mUp, document); + var referXY = thisTemp.getCoor(obj['refer']); + var sliderXY = thisTemp.getCoor(obj['slider']); + clientX = thisTemp.client(event)['x']; + referLeft = referXY['x']; + sliderLeft = sliderXY['x']; + criterionWidth = clientX - sliderLeft; + if (obj['startFun']) { + obj['startFun'](calculation()); + } + }; + var mMove = function(event) { + clientX = thisTemp.client(event)['x']; + var newX = clientX - criterionWidth - referLeft; + if (newX < 0) { + newX = 0; + } + if (newX > obj['refer'].offsetWidth - obj['slider'].offsetWidth) { + newX = obj['refer'].offsetWidth - obj['slider'].offsetWidth; + } + if (obj['slider'] === thisTemp.CB['timeButton']) { + if (!thisTemp.checkSlideLeft(newX, sliderLeft, obj['refer'].offsetWidth)) { + return; + } + } + thisTemp.css(obj['slider'], 'left', newX + 'px'); + thisTemp.css(obj['follow'], 'width', (newX + obj['slider'].offsetWidth * 0.5) + 'px'); + var nowZ = calculation(); + if (obj['monitorFun']) { + obj['monitorFun'](nowZ); + } + }; + var mUp = function(event) { + thisTemp.removeListenerInside('mousemove', mMove, document); + thisTemp.removeListenerInside('mouseup', mUp, document); + if (obj['endFun']) { + obj['endFun'](calculation()); + } + }; + var mOver = function(event) { + if (obj['overFun']) { + obj['overFun'](calculation()); + } + + }; + if (this.isUndefined(obj['removeListenerInside'])) { + this.addListenerInside('mousedown', mDown, obj['slider']); + this.addListenerInside('mouseover', mOver, obj['slider']); + } else { + this.removeListenerInside('mousedown', mDown, obj['slider']); + this.removeListenerInside('mouseover', mOver, obj['slider']); + } + }, + /* + 内部函数 + 判断是否可以拖动进度按钮或点击进度栏 + */ + checkSlideLeft: function(newX, sliderLeft, refer) { + var timeSA = this.ckConfig['config']['timeScheduleAdjust']; + switch (timeSA) { + case 0: + return false; + break; + case 2: + if (newX < sliderLeft) { + return false; + } + break; + case 3: + if (newX > sliderLeft) { + return false; + } + break; + case 4: + if (!this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = sliderLeft / refer; + } + if (newX < this.timeSliderLeftTemp * refer) { + return false; + } + break; + case 5: + if (!this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = sliderLeft / refer; + } else { + var timeSliderMax = sliderLeft / refer; + if (timeSliderMax > this.timeSliderLeftTemp) { + this.timeSliderLeftTemp = timeSliderMax; + } + } + if (newX > this.timeSliderLeftTemp * refer) { + return false; + } + break; + default: + return true; + break; + } + return true; + }, + /* + 内部函数 + 显示loading + */ + loadingStart: function(rot) { + var thisTemp = this; + if (this.isUndefined(rot)) { + rot = true; + } + if (this.conBarShow) { + this.css(thisTemp.CB['loading'], 'display', 'none'); + this.loadingShow=false; + } + var buffer = 0; + if (rot) { + if (this.conBarShow) { + this.css(thisTemp.CB['loading'], 'display', 'block'); + this.loadingShow=true; + } + } else { + thisTemp.sendJS('buffer', 100); + } + }, + /* + 内部函数 + 显示提示语 + */ + promptShow: function(ele, data) { + if (!this.conBarShow) { + return; + } + var obj = {}; + var eleTitle=''; + if(!this.isUndefined(ele)){ + eleTitle=this.getDataset(ele, 'title'); + if(this.isUndefined(eleTitle)){ + ele=null; + } + } + if (ele || data) { + if (!this.isUndefined(data)) { + obj = data; + } else { + var offsetCoor = this.getCoor(ele); + obj = { + title: eleTitle, + x: offsetCoor['x'] + ele.offsetWidth * 0.5, + y: offsetCoor['y'] + }; + } + this.CB['prompt'].innerHTML = obj['title']; + this.css(this.CB['prompt'], 'display', 'block'); + var promptStye=this.ckStyle['prompt']; + var promoptWidth=this.CB['prompt'].offsetWidth,promoptHeight=this.CB['prompt'].offsetHeight; + this.css(this.CB['promptBg'], {width:promoptWidth + 'px',height:promoptHeight+'px'}); + var x = obj['x'] - (promoptWidth * 0.5); + var y = obj['y'] - this.CB['prompt'].offsetHeight-promptStye['marginBottom']-promptStye['triangleHeight']; + if (x < 0) { + x = 0; + } + if (x > this.PD.offsetWidth - promoptWidth) { + x = this.PD.offsetWidth - promoptWidth; + } + this.css([this.CB['promptBg'], this.CB['prompt']], { + display: 'block', + left: x + 'px', + top: y + 'px' + }); + this.css(this.CB['promptTriangle'], { + display: 'block', + left: x+(promoptWidth-promptStye['triangleWidth'])*0.5+parseInt(promptStye['triangleDeviationX']) + 'px', + top: y +promoptHeight+ 'px' + }); + } else { + this.css([this.CB['promptBg'], this.CB['prompt'],this.CB['promptTriangle']], { + display: 'none' + }); + } + }, + /* + 内部函数 + 监听错误 + */ + timerErrorFun: function() { + var thisTemp = this; + this.errorSend = false; + var clearIntervalError = function(event) { + if (thisTemp.timerError != null) { + if (thisTemp.timerError.runing) { + thisTemp.timerError.stop(); + } + thisTemp.timerError = null; + } + }; + var errorFun = function(event) { + clearIntervalError(); + thisTemp.error = true; + //提取错误播放地址 + thisTemp.errorUrl = thisTemp.getVideoUrl(); + //提取错误播放地址结束 + if (!thisTemp.errorSend) { + thisTemp.errorSend = true; + thisTemp.sendJS('error'); + } + if (thisTemp.conBarShow) { + thisTemp.CB['errorText'].innerHTML=thisTemp.ckLanguage['error']['streamNotFound']; + thisTemp.css(thisTemp.CB['errorText'], 'display', 'block'); + thisTemp.css([thisTemp.CB['pauseCenter'],thisTemp.CB['loading']], 'display', 'none'); + } + thisTemp.V.removeAttribute('poster'); + thisTemp.resetPlayer(); + }; + var errorListenerFun = function(event) { + setTimeout(function() { + if (isNaN(thisTemp.V.duration)) { + errorFun(event); + } + }, + 500); + }; + if (!this.errorAdd) { + this.errorAdd = true; + this.addListenerInside('error', errorListenerFun); + } + clearIntervalError(); + var timerErrorFun = function() { + if (thisTemp.V && parseInt(thisTemp.V.networkState) == 3) { + errorFun(); + } + }; + this.timerError = new this.timer(this.ckConfig['config']['errorTime'], timerErrorFun); + }, + /* + 内部函数 + 构建判断全屏还是非全屏的判断 + */ + judgeFullScreen: function() { + var thisTemp = this; + if (this.timerFull != null) { + if (this.timerFull.runing) { + this.timerFull.stop(); + } + this.timerFull = null; + } + var fullFun = function() { + thisTemp.isFullScreen(); + }; + this.timerFull = new this.timer(20, fullFun); + }, + /* + 内部函数 + 判断是否是全屏 + */ + isFullScreen: function() { + if (!this.conBarShow) { + return; + } + var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement; + if (fullState && !this.full) { + this.full = true; + this.sendJS('full', true); + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//控制栏自定义元件 + this.css(this.CB['full'], 'display', 'none'); + this.css(this.CB['escFull'], 'display', 'block'); + if (this.vars['live'] == 0) { + this.timeUpdateHandler(); + } + this.PD.appendChild(this.CB['menu']); + } + if (!fullState && this.full) { + this.full = false; + this.sendJS('full', false); + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//控制栏自定义元件 + this.css(this.CB['full'], 'display', 'block'); + this.css(this.CB['escFull'], 'display', 'none'); + if (this.timerFull != null) { + if (this.timerFull.runing) { + this.timerFull.stop(); + } + this.timerFull = null; + } + if (this.vars['live'] == 0) { + this.timeUpdateHandler(); + } + this.body.appendChild(this.CB['menu']); + } + }, + /* + 内部函数 + 构建右键内容及注册相关动作事件 + */ + newMenu: function() { + var thisTemp = this; + var i = 0; + this.css(this.CB['menu'], { + backgroundColor: '#FFFFFF', + padding: '5px', + position: 'absolute', + left: '10px', + top: '20px', + display: 'none', + zIndex: '999', + color: '#A1A9BE', + boxShadow: '2px 2px 3px #AAAAAA' + }); + var mArr = this.contextMenu; + var cMenu = this.ckConfig['menu']; + if (cMenu['name']) { + if (cMenu['link']) { + mArr[0] = [cMenu['name'], 'link', cMenu['link']]; + } else { + mArr[0] = [cMenu['name'], 'default']; + } + } + if (cMenu['version']) { + mArr[1] = [cMenu['version'], 'default', 'line']; + } + if (cMenu['more']) { + if (this.varType(cMenu['more']) == 'array') { + if (cMenu['more'].length > 0) { + var moreArr = cMenu['more']; + for (i = 0; i < moreArr.length; i++) { + var mTemp = moreArr[i]; + var arrTemp = []; + if (mTemp['name']) { + arrTemp.push(mTemp['name']); + } + if (mTemp['clickEvent'] && mTemp['clickEvent'] != 'none') { + var eveObj = this.clickEvent(mTemp['clickEvent']); + arrTemp.push(eveObj['type']); + if (eveObj['fun']) { + arrTemp.push(eveObj['fun']); + } + if (eveObj['link']) { + arrTemp.push(eveObj['link']); + } + if (eveObj['target']) { + arrTemp.push(' target="' + eveObj['target'] + '"'); + } + } + if (mTemp['separatorBefore']) { + arrTemp.push('line'); + } + mArr.push(arrTemp); + } + } + } + } + var html = ''; + for (i = 0; i < mArr.length; i++) { + var me = mArr[i]; + switch (me[1]) { + case 'default': + html += '

' + me[0] + '

'; + break; + case 'link': + if (me[3]) { + me[3] = 'target="' + me[3] + '"'; + } + html += '

' + me[0] + '

'; + break; + case 'javaScript': + html += '

' + me[0] + '

'; + break; + case 'actionScript': + html += '

' + me[0] + '

'; + break; + default: + break; + } + } + this.CB['menu'].innerHTML = html; + var pArr = this.CB['menu'].childNodes; + for (i = 0; i < pArr.length; i++) { + this.css(pArr[i], { + height: '30px', + lineHeight: '30px', + margin: '0px', + fontFamily: this.fontFamily, + fontSize: '12px', + paddingLeft: '10px', + paddingRight: '30px' + }); + if (mArr[i][mArr[i].length - 1] == 'line') { + this.css(pArr[i], 'borderBottom', '1px solid #e9e9e9'); + } + var aArr = pArr[i].childNodes; + for (var n = 0; n < aArr.length; n++) { + if (aArr[n].localName == 'a') { + this.css(aArr[n], { + color: '#000000', + textDecoration: 'none' + }); + } + } + } + this.PD.oncontextmenu = function(event) { + var eve = event || window.event; + var client = thisTemp.client(event); + if (eve.button == 2) { + eve.returnvalue = false; + var x = client['x'] + thisTemp.pdCoor['x'] - 2; + var y = client['y'] + thisTemp.pdCoor['y'] - 2; + thisTemp.css(thisTemp.CB['menu'], { + display: 'block', + left: x + 'px', + top: y + 'px' + }); + return false; + } + return true; + }; + var setTimeOutPClose = function() { + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + }; + var setTimeOutP = null; + var mouseOut = function(event) { + setTimeOutPClose(); + setTimeOutP = setTimeout(function(event) { + thisTemp.css(thisTemp.CB['menu'], 'display', 'none'); + }, + 500); + }; + this.addListenerInside('mouseout', mouseOut, thisTemp.CB['menu']); + var mouseOver = function(event) { + setTimeOutPClose(); + }; + this.addListenerInside('mouseover', mouseOver, thisTemp.CB['menu']); + + }, + /* + 内部函数 + 构建控制栏隐藏事件 + */ + controlBarHide: function(hide) { + var thisTemp = this; + var client = { + x: 0, + y: 0 + }, + oldClient = { + x: 0, + y: 0 + }; + var cShow = true, + force = false; + var oldCoor = [0, 0]; + var controlBarShow = function(show) { + if (show && !cShow && thisTemp.controlBarIsShow) { + cShow = true; + thisTemp.sendJS('controlBar', true); + thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'block'); + thisTemp.css(thisTemp.CB['controlBar'], 'display', 'block'); + thisTemp.timeProgressDefault(); + //thisTemp.css(thisTemp.CB['timeProgressBg'], 'display', 'block'); + //thisTemp.css(thisTemp.CB['timeBoBg'], 'display', 'block'); + thisTemp.changeVolume(thisTemp.volume); + thisTemp.changeLoad(); + if (!thisTemp.timerBuffer) { + thisTemp.bufferEdHandler(); + } + } else { + if (cShow) { + cShow = false; + var paused = thisTemp.getMetaDate()['paused']; + if (force) { + paused = false; + } + if (!paused) { + thisTemp.sendJS('controlBar', false); + thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'none'); + thisTemp.css(thisTemp.CB['controlBar'], 'display', 'none'); + thisTemp.promptShow(false); + + } + } + } + thisTemp.videoCss();//计算video的宽高和位置 + }; + var cbarFun = function(event) { + if (client['x'] == oldClient['x'] && client['y'] == oldClient['y']) { + var cdH = parseInt(thisTemp.CD.offsetHeight); + if ((client['y'] < cdH - 50 || client['y'] > cdH - 2) && cShow && !thisTemp.getMetaDate()['paused']) { + controlBarShow(false); + } + } else { + if (!cShow) { + controlBarShow(true); + } + + } + oldClient = { + x: client['x'], + y: client['y'] + } + }; + this.timerCBar = new this.timer(2000, cbarFun); + var cdMove = function(event) { + var getClient = thisTemp.client(event); + client['x'] = getClient['x']; + client['y'] = getClient['y']; + if (!cShow) { + controlBarShow(true); + } + thisTemp.sendJS('mouse',client); + }; + this.addListenerInside('mousemove', cdMove, thisTemp.CD); + this.addListenerInside('ended', cdMove); + this.addListenerInside('resize', cdMove, window); + if (hide === true) { + cShow = true; + force = true; + controlBarShow(false); + } + if (hide === false) { + cShow = false; + force = true; + controlBarShow(true); + } + }, + + /* + 内部函数 + 注册键盘按键事件 + */ + keypress: function() { + var thisTemp = this; + var keyDown = function(eve) { + var keycode = eve.keyCode || eve.which; + if (thisTemp.adPlayerPlay) { + return; + } + switch (keycode) { + case 32: + thisTemp.playOrPause(); + break; + case 37: + thisTemp.fastBack(); + break; + case 39: + thisTemp.fastNext(); + break; + case 38: + now = thisTemp.volume + thisTemp.ckConfig['config']['volumeJump']; + thisTemp.changeVolume(now > 1 ? 1 : now); + break; + case 40: + now = thisTemp.volume - thisTemp.ckConfig['config']['volumeJump']; + thisTemp.changeVolume(now < 0 ? 0 : now); + break; + default: + break; + } + }; + this.addListenerInside('keydown', keyDown, window || document); + }, + /* + 内部函数 + 注册倍速相关 + */ + playbackRate: function() { + if (!this.conBarShow || !this.ckConfig['config']['playbackRate']) { + return; + } + var styleCD=this.ckStyle['controlBar']['playbackrate']; + var cssSup={overflow: 'hidden',display: 'none',zIndex: 995}; + var cssSup2={overflow: 'hidden',align: 'top',vAlign: 'left',offsetX: 0,offsetY: 0,zIndex: 1}; + var thisTemp = this; + var dArr = this.playbackRateArr; + var html = ''; + var nowD = ''; //当前的倍速 + var i = 0,nowI=0; + nowD = dArr[this.playbackRateDefault][1]; + nowI=this.playbackRateDefault; + this.removeChildAll(this.CB['playbackrateP']); + if (dArr.length > 1) { + //设置样式 + this.CB['playbackratePB']=document.createElement('div'),this.CB['playbackratePC']=document.createElement('div'); + this.CB['playbackrateP'].appendChild(this.CB['playbackratePB']); + this.CB['playbackrateP'].appendChild(this.CB['playbackratePC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['playbackratePC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['playbackrateP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['playbackratePB'], cssTemp); + //样式设置结束 + for(i=0;i0){ + this.subtitlesTemp=dArr.length-1; + } + for(i=0;i 1) { + //设置样式 + this.CB['subtitlesPB']=document.createElement('div'),this.CB['subtitlesPC']=document.createElement('div'); + this.CB['subtitlesP'].appendChild(this.CB['subtitlesPB']); + this.CB['subtitlesP'].appendChild(this.CB['subtitlesPC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['subtitlesPC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['subtitlesP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['subtitlesPB'], cssTemp); + //样式设置结束 + for(i=0;i n) { + var arr = vArr[n]; + if (arr.length > 2) { + var title = arr[1]; + if (title) { + this.newSubtitles(title); + } + } + } + }, + /* + 接口函数:修改字幕大小 + 提供给外部api + */ + changeSubtitlesSize:function(n,m){ + if (!this.loaded || n < 0) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeSubtitlesSize(n,m); + return; + } + this.ckStyle['cktrack']['size']=n; + if(!this.isUndefined(m)){ + this.ckStyle['cktrack']['leading']=m; + } + this.trackShowAgain(); + }, + /* + 当切换字幕时的动作 + */ + newSubtitles:function(title){ + var vArr = this.vars['cktrack'];//字幕数组 + var i = 0; + for (i = 0; i < vArr.length; i++) { + var v = vArr[i]; + if (v[1] == title) { + this.subtitlesTemp=i; + if (this.conBarShow) { + this.CB['subtitleButtonText'].innerHTML = v[1]; + this.subtitleSwitch(); + this.loadTrack(i); + } + this.sendJS('subtitles', v); + } + } + }, + /* + 内部函数 + 构建清晰度按钮及切换事件(Click事件) + */ + definition: function() { + if (!this.conBarShow || !this.ckConfig['config']['definition']) { + return; + } + var styleCD=this.ckStyle['controlBar']['definition']; + var cssSup={overflow: 'hidden',display: 'none',zIndex: 995}; + var cssSup2={overflow: 'hidden',align: 'top',vAlign: 'left',offsetX: 0,offsetY: 0,zIndex: 1}; + var thisTemp = this; + var vArr = this.VA; + var dArr = []; + var html = ''; + var nowD = ''; //当前的清晰度 + var i = 0,nowI=0; + for (i = 0; i < vArr.length; i++) { + var d = vArr[i][2]; + if (dArr.indexOf(d) == -1) { + dArr.push(d); + } + if (this.V) { + if (vArr[i][0] == this.V.currentSrc) { + nowD = d; + nowI = i; + } + } + } + if (!nowD) { + nowD = dArr[0]; + } + this.removeChildAll(this.CB['definitionP']); + if (dArr.length > 1) { + //设置样式 + this.CB['definitionPB']=document.createElement('div'),this.CB['definitionPC']=document.createElement('div'); + this.CB['definitionP'].appendChild(this.CB['definitionPB']); + this.CB['definitionP'].appendChild(this.CB['definitionPC']); + //按钮列表容器样式 + var bgCss=this.newObj(styleCD['background']); + bgCss['backgroundColor']=''; + //内容层样式 + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['definitionPC'], cssTemp); + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + //容器层样式 + cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup); + this.css(this.CB['definitionP'], cssTemp); + //背景层样式 + bgCss=this.newObj(styleCD['background']); + bgCss['alpha']=bgCss['backgroundAlpha']; + bgCss['padding']=0; + bgCss['paddingLeft']=0; + bgCss['paddingTop']=0; + bgCss['paddingRight']=0; + bgCss['paddingBottom']=0; + cssTemp=this.getEleCss(bgCss,cssSup2); + this.css(this.CB['definitionPB'], cssTemp); + //样式设置结束 + for(i=0;i=0;i--){ + var childNode=ele.childNodes[i]; + ele.removeChild(childNode); + } + }, + /* + 内部函数 + 注册清晰度相关事件 + */ + addDefListener: function() { + var thisTemp = this; + var setTimeOutP = null; + var defClick = function(event) { + if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block' && !thisTemp.isUndefined(thisTemp.CB['definitionPC'])){ + thisTemp.css(thisTemp.CB['definitionP'],'display','block'); + var tbCss=thisTemp.ckStyle['controlBar']['definition']['background']; + thisTemp.css(thisTemp.CB['definitionPB'], { + width: thisTemp.CB['definitionPC'].offsetWidth+'px', + height: thisTemp.CB['definitionPC'].offsetHeight+'px' + }); + thisTemp.css(thisTemp.CB['definitionP'], { + width: (thisTemp.CB['definitionPC'].offsetWidth+tbCss['triangleDeviationX']+tbCss['triangleWidth'])+'px', + height: (thisTemp.CB['definitionPC'].offsetHeight+tbCss['triangleDeviationY']+tbCss['triangleHeight'])+'px' + }); + thisTemp.promptShow(false); + //设置三角形样式 + var tempELe=thisTemp.CB['definitionPB']; + var tempWidth=tempELe.offsetWidth,tempHeight=tempELe.offsetHeight; + + var x = ((tempWidth-tbCss['triangleWidth']) * 0.5)+tbCss['triangleDeviationX']; + var y = tempELe.offsetHeight+tbCss['triangleDeviationY']; + var cssTemp={ + left:x+'px', + top:y+'px' + }; + thisTemp.css(thisTemp.CB['definitionTriangle'],cssTemp); + } + else{ + thisTemp.css(thisTemp.CB['definitionP'],'display','none'); + } + }; + this.addListenerInside('click', defClick, this.CB['definition']); + var defMouseOut = function(event) { + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + setTimeOutP = setTimeout(function(event) { + thisTemp.css(thisTemp.CB['definitionP'], 'display', 'none'); + }, + 500); + }; + this.addListenerInside('mouseout', defMouseOut, thisTemp.CB['definitionP']); + var defMouseOver = function(event) { + thisTemp.buttonHide=false; + if (setTimeOutP) { + window.clearTimeout(setTimeOutP); + setTimeOutP = null; + } + }; + this.addListenerInside('mouseover', defMouseOver, thisTemp.CB['definitionP']); + }, + /* + 接口函数 + 提供给外部api + */ + changeDefinition: function(n) { + if (!this.loaded || n < 0) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeDefinition(n); + return; + } + if (this.VA.length > n) { + var arr = this.VA[n]; + if (arr.length > 3) { + var title = arr[2]; + if (title) { + this.newDefinition(title); + } + } + } + }, + /* + 内部函数 + 切换清晰度后发生的动作 + */ + newDefinition: function(title) { + var vArr = this.VA; + var nVArr = []; + var i = 0; + for (i = 0; i < vArr.length; i++) { + var v = vArr[i]; + if (v[2] == title) { + nVArr.push(v); + this.sendJS('definitionChange', i + ''); + } + } + if (nVArr.length < 1) { + return; + } + if (this.V != null && this.needSeek == 0) { + this.needSeek = this.V.currentTime; + } + if (this.getFileExt(nVArr[0][0]) != '.m3u8') { + this.isM3u8 = false; + } + if (!this.isM3u8) { + if (nVArr.length == 1) { + this.V.innerHTML = ''; + this.V.src = nVArr[0][0]; + this.V.currentSrc = nVArr[0][0]; + } else { + var source = ''; + nVArr = this.arrSort(nVArr); + for (i = 0; i < nVArr.length; i++) { + var type = ''; + var va = nVArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + } + source += ''; + } + this.V.removeAttribute('src'); + this.V.innerHTML = source; + this.V.currentSrc = nVArr[0][0]; + } + } else { + this.embedHls(vArr[0][0], this.vars['autoplay']); + } + this.V.autoplay = 'autoplay'; + this.V.load(); + if (this.playbackRateTemp!=1) { + this.V.playbackRate = this.playbackRateTemp; //定义倍速 + } + this.timerErrorFun(); + }, + /* + 内置函数 + 播放hls + */ + embedHls: function(url, autoplay) { + var thisTemp = this; + thisTemp.hlsAutoPlay=autoplay; + if (Hls.isSupported()) { + var hls = new Hls(); + hls.loadSource(url); + hls.attachMedia(this.V); + hls.on(Hls.Events.MANIFEST_PARSED, + function() { + thisTemp.playerLoad(); + if (autoplay) { + thisTemp.videoPlay(); + } + }); + } + }, + /* + 内部函数 + 构建提示点 + */ + prompt: function() { + if (!this.conBarShow) { + return; + } + var thisTemp = this; + var prompt = this.vars['promptSpot']; + if (prompt == null || this.promptArr.length > 0) { + return; + } + var showPrompt = function(event) { + if (thisTemp.promptElement == null) { + var random2 = 'prompte-' + thisTemp.randomString(5); + var ele2 = document.createElement('div'); + ele2.className = random2; + thisTemp.PD.appendChild(ele2); + thisTemp.promptElement = thisTemp.getByElement(random2); + thisTemp.css(thisTemp.promptElement, { + overflowX: 'hidden', + lineHeight: thisTemp.ckStyle['previewPrompt']['lineHeight']+'px', + fontFamily: thisTemp.ckStyle['previewPrompt']['font'], + fontSize: thisTemp.ckStyle['previewPrompt']['size']+'px', + color: thisTemp.ckStyle['previewPrompt']['color'].replace('0x','#'), + position: 'absolute', + display: 'block', + zIndex: '90' + }); + } + var pcon = thisTemp.getPromptTest(); + var pW = pcon['pW'], + pT = pcon['pT'], + pL = parseInt(thisTemp.css(this, 'left')) - parseInt(pW * 0.5); + if (pcon['pL'] > 10) { + pL = pcon['pL']; + } + if (pL < 0) { + pL = 0; + } + thisTemp.css(thisTemp.promptElement, { + width: pW + 'px', + left: ( - pW - 10) + 'px', + display: 'block' + }); + thisTemp.promptElement.innerHTML = thisTemp.getDataset(this, 'words'); + thisTemp.css(thisTemp.promptElement, { + left: pL + 'px', + top: (pT - thisTemp.promptElement.offsetHeight-thisTemp.ckStyle['previewPrompt']['marginBottom']) + 'px' + }); + }; + var hidePrompt = function(event) { + if (thisTemp.promptElement != null) { + thisTemp.css(thisTemp.promptElement, { + display: 'none' + }); + } + }; + var i = 0; + for (i = 0; i < prompt.length; i++) { + var pr = prompt[i]; + var words = pr['words']; + var time = pr['time']; + var random = 'prompttitle-' + this.randomString(5); + var ele = document.createElement('div'); + ele.className = random; + this.CB['timeBoBg'].appendChild(ele); + var div = this.getByElement(random); + try{ + div.setAttribute('data-time', time); + if(this.ckConfig['config']['promptSpotTime']){ + words=this.formatTime(time,0,this.ckLanguage['timeSliderOver'])+' '+words; + } + div.setAttribute('data-words', words); + } + catch(event){} + var pCss=this.getEleCss(this.ckStyle['promptSpotH5'],{marginY:-10000,zIndex: 1}); + try{ + this.css(div, pCss); + } + catch(event){} + this.addListenerInside('mouseover', showPrompt, div); + this.addListenerInside('mouseout', hidePrompt, div); + this.promptArr.push(div); + } + this.changePrompt(); + }, + /* + 内部函数 + 计算提示文本的位置 + */ + getPromptTest: function() { + var pW = this.previewWidth, + pT = this.getCoor(this.CB['timeProgressBg'])['y'], + pL = 0; + if (this.previewTop != null) { + pT = parseInt(this.css(this.previewTop, 'top')); + pL = parseInt(this.css(this.previewTop, 'left')); + } else { + pT -= 35; + } + pL += 2; + if (pL < 0) { + pL = 0; + } + if (pL > this.PD.offsetWidth - pW) { + pL = this.PD.offsetWidth - pW; + } + return { + pW: pW, + pT: pT, + pL: pL + }; + }, + /* + 内部函数 + 删除提示点 + */ + deletePrompt: function() { + var arr = this.promptArr; + if (arr.length > 0) { + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + this.deleteChild(arr[i]); + } + } + } + this.promptArr = []; + }, + /* + 内部函数 + 计算提示点坐标 + */ + changePrompt: function() { + if (this.promptArr.length == 0) { + return; + } + var arr = this.promptArr; + var duration = this.getMetaDate()['duration']; + var bw = this.CB['timeBoBg'].offsetWidth; + for (var i = 0; i < arr.length; i++) { + var time = parseInt(this.getDataset(arr[i], 'time')); + var left = parseInt(time * bw / duration) - parseInt(arr[i].offsetWidth * 0.5); + if (left < 0) { + left = 0; + } + if (left > bw - parseInt(arr[i].offsetWidth * 0.5)) { + left = bw - parseInt(arr[i].offsetWidth * 0.5); + } + this.css(arr[i], { + left: left + 'px', + display: 'block' + }); + } + }, + /* + 内部函数 + 构建预览图片效果 + */ + preview: function(obj) { + var thisTemp = this; + var preview = { + file: null, + scale: 0 + }; + preview = this.standardization(preview, this.vars['preview']); + if (preview['file'] == null || preview['scale'] <= 0) { + return; + } + var srcArr = preview['file']; + if (this.previewStart == 0) { //如果还没有构建,则先进行构建 + this.previewStart = 1; + if (srcArr.length > 0) { + var i = 0; + var imgW = 0, + imgH = 0; + var random = 'preview-'+thisTemp.randomString(10); + var loadNum = 0; + var loadImg = function(i) { + srcArr[i] = thisTemp.getNewUrl(srcArr[i]); + var n = 0; + var img = new Image(); + img.src = srcArr[i]; + img.className = random + i; + img.onload = function(event) { + loadNum++; + if (thisTemp.previewDiv == null) { //如果没有建立DIV,则建 + imgW = img.width; + imgH = img.height; + thisTemp.previewWidth = parseInt(imgW * 0.1); + var ele = document.createElement('div'); + ele.className = random; + thisTemp.PD.appendChild(ele); + thisTemp.previewDiv = thisTemp.getByElement(random); + var eleTop = 0; + eleTop=thisTemp.PD.offsetHeight -thisTemp.ckStyle['preview']['bottom']; + thisTemp.css(thisTemp.previewDiv, { + width: srcArr.length * imgW * 10 + 'px', + height: parseInt(imgH * 0.1) + 'px', + backgroundColor: '#000000', + position: 'absolute', + left: '0px', + top: eleTop + 'px', + display: 'none', + zIndex: '80' + }); + ele.setAttribute('data-x', '0'); + ele.setAttribute('data-y', eleTop); + var ele2 = document.createElement('div'); + ele2.className = random + 'd2'; + thisTemp.PD.appendChild(ele2); + thisTemp.previewTop = thisTemp.getByElement(ele2.className); + thisTemp.css(thisTemp.previewTop, { + width: parseInt(imgW * 0.1) + 'px', + height: parseInt(imgH * 0.1) + 'px', + position: 'absolute', + border: thisTemp.ckStyle['preview']['border']+'px solid ' + thisTemp.ckStyle['preview']['borderColor'].replace('0x','#'), + left: '0px', + top: eleTop + 'px', + display: 'none', + zIndex: '81' + }); + var html = ''; + for (n = 0; n < srcArr.length; n++) { + html += thisTemp.newCanvas(random + n, imgW * 10, parseInt(imgH * 0.1)) + } + thisTemp.previewDiv.innerHTML = html; + } + thisTemp.previewDiv.appendChild(img); + var cimg = thisTemp.getByElement(img.className); + var canvas = thisTemp.getByElement(img.className + '-canvas'); + var context = canvas.getContext('2d'); + var sx = 0, + sy = 0, + x = 0, + h = parseInt(imgH * 0.1); + for (n = 0; n < 100; n++) { + x = parseInt(n * imgW * 0.1); + context.drawImage(cimg, sx, sy, parseInt(imgW * 0.1), h, x, 0, parseInt(imgW * 0.1), h); + sx += parseInt(imgW * 0.1); + if (sx >= imgW) { + sx = 0; + sy += h; + } + thisTemp.css(cimg, 'display', 'none'); + } + if (loadNum == srcArr.length) { + thisTemp.previewStart = 2; + } else { + i++; + loadImg(i); + } + }; + }; + } + loadImg(i); + return; + } + if (this.previewStart == 2) { + var isTween = true; + var nowNum = parseInt(obj['time'] / this.vars['preview']['scale']); + var numTotal = parseInt(thisTemp.getMetaDate()['duration'] / this.vars['preview']['scale']); + if (thisTemp.css(thisTemp.previewDiv, 'display') == 'none') { + isTween = false; + } + thisTemp.css(thisTemp.previewDiv, 'display', 'block'); + var imgWidth = thisTemp.previewDiv.offsetWidth * 0.01 / srcArr.length; + var left = (imgWidth * nowNum) - obj['x'] + parseInt(imgWidth * 0.5), + top=thisTemp.PD.offsetHeight- thisTemp.previewDiv.offsetHeight -thisTemp.ckStyle['preview']['bottom']; + thisTemp.css(thisTemp.previewDiv, 'top', top + 2 + 'px'); + var topLeft = obj['x'] - parseInt(imgWidth * 0.5); + var timepieces = 0; + if (topLeft < 0) { + topLeft = 0; + timepieces = obj['x'] - topLeft - imgWidth * 0.5; + } + if (topLeft > thisTemp.PD.offsetWidth - imgWidth) { + topLeft = thisTemp.PD.offsetWidth - imgWidth; + timepieces = obj['x'] - topLeft - imgWidth * 0.5; + } + if (left < 0) { + left = 0; + } + if (left > numTotal * imgWidth - thisTemp.PD.offsetWidth) { + left = numTotal * imgWidth - thisTemp.PD.offsetWidth; + } + thisTemp.css(thisTemp.previewTop, { + left: topLeft + 'px', + top: top + 2 + 'px', + display: 'block' + }); + if (thisTemp.previewTop.offsetHeight > thisTemp.previewDiv.offsetHeight) { + thisTemp.css(thisTemp.previewTop, { + height: thisTemp.previewDiv.offsetHeight - (thisTemp.previewTop.offsetHeight - thisTemp.previewDiv.offsetHeight) + 'px' + }); + } + if (this.previewTween != null) { + this.animatePause(this.previewTween); + this.previewTween = null + } + var nowLeft = parseInt(thisTemp.css(thisTemp.previewDiv, 'left')); + var leftC = nowLeft + left; + if (nowLeft == -(left + timepieces)) { + return; + } + if (isTween) { + var obj = { + element: thisTemp.previewDiv, + start: null, + end: -(left + timepieces), + speed: 0.3 + }; + this.previewTween = this.animate(obj); + } else { + thisTemp.css(thisTemp.previewDiv, 'left', -(left + timepieces) + 'px') + } + } + }, + /* + 内部函数 + 删除预览图节点 + */ + deletePreview: function() { + if (this.previewDiv != null) { + this.deleteChild(this.previewDiv); + this.previewDiv = null; + this.previewStart = 0; + } + }, + /* + 内部函数 + 修改视频地址,属性 + */ + changeVideo: function() { + if (!this.html5Video) { + this.getVarsObject(); + this.V.newVideo(this.vars); + return; + } + var vArr = this.VA; + var v = this.vars; + var i = 0; + if (vArr.length < 1) { + return; + } + if (this.V != null && this.needSeek == 0) { + this.needSeek = this.V.currentTime; + } + if (v['poster']) { + this.V.poster = v['poster']; + } else { + this.V.removeAttribute('poster'); + } + if (v['loop']) { + this.V.loop = 'loop'; + } else { + this.V.removeAttribute('loop'); + } + if (v['seek'] > 0) { + this.needSeek = v['seek']; + } else { + this.needSeek = 0; + } + if (this.getFileExt(vArr[0][0]) != '.m3u8') { + this.isM3u8 = false; + } + if (!this.isM3u8) { + if (vArr.length == 1) { + this.V.innerHTML = ''; + this.V.src = vArr[0][0]; + } else { + var source = ''; + vArr = this.arrSort(vArr); + for (i = 0; i < vArr.length; i++) { + var type = ''; + var va = vArr[i]; + if (va[1]) { + type = ' type="' + va[1] + '"'; + } + source += ''; + } + this.V.removeAttribute('src'); + this.V.innerHTML = source; + } + //分析视频地址结束 + if (v['autoplay']) { + this.V.autoplay = 'autoplay'; + } else { + this.V.removeAttribute('autoplay'); + } + this.V.load(); + } else { + this.embedHls(vArr[0][0], v['autoplay']); + } + if (!this.isUndefined(v['volume'])) { + this.changeVolume(v['volume']); + } + this.resetPlayer(); //重置界面元素 + this.timerErrorFun(); + //如果存在字幕则加载 + if (this.vars['cktrack']) { + this.loadTrack(); + } + }, + /* + 内部函数 + 调整中间暂停按钮,缓冲loading,错误提示文本框的位置 + */ + elementCoordinate: function() { + this.pdCoor = this.getXY(this.PD); + var cssTemp=null; + try { + cssTemp=this.getEleCss(this.ckStyle['centerPlay'],{cursor:'pointer'}); + this.css(this.CB['pauseCenter'], cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['loading']); + this.css(this.CB['loading'],cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['error']); + this.css(this.CB['errorText'], cssTemp); + } catch(event) {this.log(event);} + try { + cssTemp=this.getEleCss(this.ckStyle['logo']); + this.css(this.CB['logo'], cssTemp); + } catch(event) {this.log(event);} + this.checkBarWidth(); + }, + /* + 内部函数 + 控制栏内各按钮的位置 + */ + carbarButton:function(){ + var styleC=this.ckStyle['controlBar']; + var styleCB=styleC['button']; + var cssTemp=null; + var cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + var cssSup2={overflow: 'hidden',cursor: 'default',zIndex: 1}; + var cssSup4={overflow: 'hidden',cursor: 'pointer',display: 'none',zIndex: 995}; + //播放/暂停按钮 + cssTemp=this.getEleCss(styleCB['play'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['play'],cssTemp); + cssTemp=this.getEleCss(styleCB['pause'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['pause'],cssTemp); + //设置静音/取消静音的按钮样式 + cssTemp=this.getEleCss(styleCB['mute'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['mute'],cssTemp); + cssTemp=this.getEleCss(styleCB['escMute'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['escMute'],cssTemp); + //设置全屏/退出全屏按钮样式 + cssTemp=this.getEleCss(styleCB['full'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['full'],cssTemp); + cssTemp=this.getEleCss(styleCB['escFull'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['escFull'],cssTemp); + cssTemp=this.getEleCss(styleC['timeText']['vod'],cssSup2,this.CB['controlBarBg']); + this.css(this.CB['timeText'], cssTemp); + //音量调节框 + var volumeSchedule=this.newObj(styleC['volumeSchedule']); + volumeSchedule['backgroundImg']=''; + cssTemp=this.getEleCss(volumeSchedule,cssSup2,this.CB['controlBarBg']); + this.css(this.CB['volume'],cssTemp); + cssTemp= { + width: cssTemp['width'], + height: styleC['volumeSchedule']['backgroundHeight']+'px', + overflow: 'hidden', + backgroundRepeat:'no-repeat', + backgroundPosition:'left center' + }; + if(this.ckConfig['config']['buttonMode']['volumeSchedule']){ + cssTemp['cursor']='pointer'; + } + this.css(this.CB['volumeBg'],cssTemp); + this.css(this.CB['volumeBg'], { + position: 'absolute', + }); + cssTemp['width']=(this.CB['volumeBO'].offsetWidth*0.5+parseInt(this.css(this.CB['volumeBO'],'left')))+'px'; + this.css(this.CB['volumeUp'],cssTemp); + this.css(this.CB['volumeBg'], 'backgroundImage', 'url('+styleC['volumeSchedule']['backgroundImg']+')'); + this.css(this.CB['volumeUp'], 'backgroundImage', 'url('+styleC['volumeSchedule']['maskImg']+')'); + //音量调节按钮 + cssTemp=this.getEleCss(styleC['volumeSchedule']['button'],{overflow: 'hidden',cursor: 'pointer',backgroundRepeat:'no-repeat',backgroundPosition:'left center'}); + this.css(this.CB['volumeBO'],cssTemp); + //倍速容器 + if(this.ckConfig['config']['playbackRate']){ + if(!this.CB['playbackrateButtonText']){ + this.textButton(this.CB['playbackrate'],styleC['playbackrate']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['playbackrate']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['playbackrate'],'playbackrateButtonText'); + } + cssTemp=this.getEleCss(styleC['playbackrate']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['playbackrate'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['playbackrateP'],'display','none'); + cssTemp=this.getEleCss(styleC['playbackrate']['backgroundCoorH5'],cssSup4); + this.css(this.CB['playbackrateP'], cssTemp); + } + //初始化清晰度按钮 + if(this.ckConfig['config']['definition']){ + if(!this.CB['defaultButtonText']){ + this.textButton(this.CB['definition'],styleC['definition']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['definition']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['definition'],'defaultButtonText'); + } + cssTemp=this.getEleCss(styleC['definition']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['definition'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['definitionP'],'display','none'); + cssTemp=this.getEleCss(styleC['definition']['backgroundCoorH5'],cssSup4); + this.css(this.CB['definitionP'], cssTemp); + } + //初始化字幕切换按钮 + if(this.ckConfig['config']['subtitle']){ + if(!this.CB['subtitleButtonText']){ + this.textButton(this.CB['subtitles'],styleC['subtitle']['defaultButton'],this.objectAssign({overflow: 'hidden',cursor: 'pointer',zIndex: 1},styleC['subtitle']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['subtitle'],'subtitleButtonText'); + } + //字幕按钮列表容器样式 + cssTemp=this.getEleCss(styleC['subtitle']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']); + this.css(this.CB['subtitles'], { + left:cssTemp['left'], + top:cssTemp['top'] + }); + this.css(this.CB['subtitlesP'],'display','none'); + cssTemp=this.getEleCss(styleC['subtitle']['backgroundCoorH5'],cssSup4); + this.css(this.CB['subtitlesP'], cssTemp); + } + }, + /* + 构造一个文字按钮 + ele:当前按钮 + css:样式 + cssSup:补充样式 + upEle:上一级容器对象 + text:显示的文本 + newName:文本框名称 + */ + textButton:function(ele,css,cssSup,upEle,text,newName){ + var thisTemp=this; + var bgCss={ + width:css['width'], + height:css['height'] + }; + if(cssSup){ + bgCss={ + width:css['width'], + height:css['height'], + align:cssSup['align'], + vAlign:cssSup['vAlign'], + marginX: cssSup['marginX'], + marginY: cssSup['marginY'], + offsetX: cssSup['offsetX'], + offsetY: cssSup['offsetY'], + zIndex:2 + }; + } + cssTemp=this.getEleCss(bgCss,null,upEle); + thisTemp.css(ele, cssTemp); + var outCss=this.newObj(css); + var overCss=this.newObj(css); + var textOutCss=this.newObj(css); + var textOverCss=this.newObj(css); + var cssTemp=null; + outCss['alpha']=css['backgroundAlpha']; + overCss['backgroundColor']=css['overBackgroundColor']; + overCss['alpha']=css['backgroundAlpha']; + textOutCss['color']=css['textColor']; + textOverCss['color']=css['overTextColor']; + textOutCss['textAlign']=css['align']; + textOverCss['textAlign']=css['align']; + //修正文字 + textOutCss['backgroundColor']=textOverCss['backgroundColor']=''; + var bgEle=document.createElement('div');//按钮背景层 + this.removeChildAll(ele); + ele.appendChild(bgEle); + if(newName){ + this.CB[newName]=document.createElement('div');//文字层 + ele.appendChild(this.CB[newName]); + this.CB[newName].innerHTML=text; + } + else{ + var newEle=document.createElement('div');//文字层 + ele.appendChild(newEle); + newEle.innerHTML=text; + } + var outFun=function(){ + cssTemp=thisTemp.getEleCss(outCss,{cursor: 'pointer',zIndex:1},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + thisTemp.css(bgEle, cssTemp); + cssTemp=thisTemp.getEleCss(textOutCss,{cursor: 'pointer',zIndex:2},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + if(newName){ + thisTemp.css(thisTemp.CB[newName], cssTemp,bgEle); + } + else{ + thisTemp.css(newEle, cssTemp,bgEle); + } + thisTemp.buttonHide=true;//显示的列表框需要隐藏 + if(thisTemp.timeButtonOver){ + window.clearTimeout(thisTemp.timeButtonOver); + thisTemp.timeButtonOver=null; + } + thisTemp.timeButtonOver=window.setTimeout(function(){thisTemp.buttonListHide()},1000); + }; + var overFun=function(){ + cssTemp=thisTemp.getEleCss(overCss,{zIndex:1},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + thisTemp.css(bgEle, cssTemp); + cssTemp=thisTemp.getEleCss(textOverCss,{zIndex:2},bgEle); + cssTemp['left']=''; + cssTemp['top']=''; + if(newName){ + thisTemp.css(thisTemp.CB[newName], cssTemp); + } + else{ + thisTemp.css(newEle, cssTemp); + } + + }; + outFun(); + this.addListenerInside('mouseout', outFun, ele); + this.addListenerInside('mouseover', overFun, ele); + }, + /* + 隐藏所有的列表框 + */ + buttonListHide:function(){ + if(this.buttonHide){ + this.css([this.CB['definitionP'],this.CB['subtitlesP'],this.CB['playbackrateP']],'display','none'); + } + if(this.timeButtonOver){ + window.clearTimeout(this.timeButtonOver); + this.timeButtonOver=null; + } + this.buttonHide=false; + }, + /* + 计算视频的宽高 + */ + videoCss:function(){ + var cssTemp={}; + + if(this.css(this.CB['controlBar'],'display')=='none'){ + cssTemp=this.ckStyle['video']['controlBarHideReserve']; + } + else{ + cssTemp=this.ckStyle['video']['reserve']; + } + var spacingBottom=cssTemp['spacingBottom']; + if(this.V.controls && this.isMobile()){ + spacingBottom-=40; + } + var pW=this.PD.offsetWidth,pH=this.PD.offsetHeight; + var vW=pW-cssTemp['spacingLeft']-cssTemp['spacingRight']; + var vH=pH-cssTemp['spacingTop']-spacingBottom; + if(!this.MD){ + this.css(this.V,{ + width:vW+'px', + height:vH+'px', + marginLeft:cssTemp['spacingLeft']+'px', + marginTop:cssTemp['spacingTop']+'px' + }); + } + else{ + this.css([this.MD,this.MDC],{ + width:vW+'px', + height:vH+'px', + marginLeft:cssTemp['spacingLeft']+'px', + marginTop:cssTemp['spacingTop']+'px' + }); + } + }, + /* + 播放器界面自定义元素 + */ + playerCustom:function(){ + var custom=this.ckStyle['custom']; + var button=custom['button']; + var images=custom['images']; + var cssTemp=null; + var cssSup=null; + var k='',tempID=''; + var b={}; + var tempDiv; + var i=0; + for(k in button){ + b=button[k]; + cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-button',name:k}); + this.PD.appendChild(tempDiv); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]; + } + i++; + this.buttonEventFun(tempDiv,b); + } + for(k in images){ + b=images[k]; + cssSup={overflow: 'hidden',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-images',name:k}); + this.PD.appendChild(tempDiv); + var img=new Image(); + img.src=images[k]['img']; + tempDiv.appendChild(img); + i++ + } + }, + /* + 控制栏自定义元素 + */ + carbarCustom:function(){ + var custom=this.ckStyle['controlBar']['custom']; + var button=custom['button']; + var images=custom['images']; + var cssTemp=null; + var cssSup=null; + var k='',tempID=''; + var b={}; + var tempDiv; + var i=0; + for(k in button){ + b=button[k]; + cssSup={overflow: 'hidden',cursor: 'pointer',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-button',name:k}); + this.CB['controlBar'].appendChild(tempDiv); + if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){ + tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]; + } + i++; + this.buttonEventFun(tempDiv,b); + } + for(k in images){ + b=images[k]; + cssSup={overflow: 'hidden',zIndex: 1}; + cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']); + tempDiv = document.createElement('div'); + this.css(tempDiv,cssTemp); + this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-images',name:k}); + this.CB['controlBar'].appendChild(tempDiv); + var img=new Image(); + img.src=images[k]['img']; + tempDiv.appendChild(img); + i++; + } + }, + /* + 控制栏自定义元素的位置 + */ + customCoor:function(){ + var cssTemp=null; + if(this.customeElement.length>0){ + for(var i=0;i0){ + for(var i=0;i 0) { + this.videoSeek(this.needSeek); + this.needSeek = 0; + } + if (this.animatePauseArray.length > 0) { + this.animateResume('pause'); + } + if (this.playerType == 'html5video' && this.V != null && this.ckConfig['config']['videoDrawImage']) { + this.sendVCanvas(); + } + if (!this.isUndefined(this.advertisements['pause']) && !this.adPlayStart) { //如果存在暂停广告 + this.closePauseAd(); + } + }, + /*暂停时播放暂停广告*/ + adPausePlayer: function() { + this.adI = 0; + this.adType = 'pause'; + this.adPauseShow = true; + this.loadAdPause(); + this.sendJS('pauseAd','play'); + }, + loadAdPause: function() { + var ad = this.getNowAdvertisements(); + var type = ad['type']; + var thisTemp = this; + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + if (this.isStrImage(type) && this.adPauseShow) { + this.css(this.CB['adElement'], 'display', 'block'); + var imgClass = 'adimg' + this.randomString(10); + var imgHtml = ''; + if (ad['link']) { + imgHtml = '' + imgHtml + ''; + } + this.CB['adElement'].innerHTML = imgHtml; + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css([thisTemp.getByElement(imgClass), thisTemp.CB['adElement']], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + if (thisTemp.ckStyle['advertisement']['closeButtonShow'] && thisTemp.adPauseShow) { + thisTemp.css(thisTemp.CB['adPauseClose'], { + display: 'block' + }); + } + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + thisTemp.adPauseCoor(); + }, + this.getByElement(imgClass)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adElement']); + var newI = this.adI; + if (this.adI < this.advertisements['pause'].length - 1) { + newI++; + } else { + newI = 0; + } + if (ad['time'] > 0) { + setTimeout(function() { + if (thisTemp.adPauseShow) { + thisTemp.adI = newI; + thisTemp.loadAdPause(); + } + }, + ad['time'] * 1000); + } + } + }, + /*调整暂停广告的位置*/ + adPauseCoor: function() { + if (this.css(this.CB['adElement'], 'display') == 'block') { + var w = this.CB['adElement'].offsetWidth, + h = this.CB['adElement'].offsetHeight; + var pw = this.PD.offsetWidth, + ph = this.PD.offsetHeight; + this.css(this.CB['adElement'], { + top: (ph - h) * 0.5 + 'px', + left: (pw - w) * 0.5 + 'px' + }); + if (this.css(this.CB['adPauseClose'], 'display') == 'block') { + var rr=this.ckStyle['advertisement']['closeButton']; + var cxy = this.getPosition(rr,this.CB['adElement']); + this.css(this.CB['adPauseClose'], { + top: cxy['y'] + 'px', + left: cxy['x'] + 'px' + }); + } + } + }, + /* + 关闭暂停广告 + */ + closePauseAd: function() { + this.CB['adElement'].innerHTML = ''; + this.css([this.CB['adElement'], this.CB['adPauseClose']], 'display', 'none'); + this.adPauseShow = false; + this.sendJS('pauseAd','ended'); + }, + /*计算广告时间*/ + advertisementsTime: function(nt) { + if (this.isUndefined(nt)) { + nt = 0; + } + var ad = this.advertisements[this.adType]; + if (nt > 0) { + ad[this.adI]['time'] = Math.ceil(nt); + } + this.adTimeAllTotal = 0; + for (var i = this.adI; i < ad.length; i++) { + if (!this.isUndefined(ad[i]['time'])) { + this.adTimeAllTotal += Math.ceil(ad[i]['time']); + } + } + if (this.adTimeAllTotal > 0) { + this.CB['adTimeText'].innerHTML = this.ckLanguage['adCountdown'].replace('[$second]', this.adTimeAllTotal).replace('[$Second]', this.adTimeAllTotal > 9 ? this.adTimeAllTotal: '0' + this.adTimeAllTotal); + } + if (this.adPauseShow) { + this.closePauseAd(); + } + this.adOtherCloseAll(); + this.adTimeTotal = -1; + }, + /*判断是否需要显示跳过广告按钮*/ + adSkipButtonShow: function() { + var thisTemp = this; + var skipConfig = this.ckStyle['advertisement']; + var delayTimeTemp = skipConfig[this.adType + 'SkipButtonDelay']; + var timeFun = function() { + if (delayTimeTemp >= 0) { + thisTemp.CB['adSkipText'].innerHTML = thisTemp.ckLanguage['skipDelay'].replace('[$second]', delayTimeTemp).replace('[$Second]', delayTimeTemp > 9 ? delayTimeTemp: '0' + delayTimeTemp); + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block'); + thisTemp.css(thisTemp.CB['adSkipButton'],'display','none'); + setTimeout(timeFun, 1000); + } else { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none'); + if(thisTemp.css(thisTemp.CB['adTime'],'display')=='block'){ + thisTemp.css(thisTemp.CB['adSkipButton'],'display','block'); + } + + } + delayTimeTemp--; + }; + if (skipConfig['skipButtonShow']) { + if (skipConfig[this.adType + 'SkipButtonDelay'] > 0 && this.isUndefined(this.adSkipButtonTime)) { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']], 'display', 'block'); + timeFun(); + } else { + thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none'); + thisTemp.css(thisTemp.CB['adSkipButton'],'display','block'); + } + } + }, + /*播放广告*/ + advertisementsPlay: function() { + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText'], this.CB['adSkip'], this.CB['adSkipText'],this.CB['adSkipButton'], this.CB['adLink']], 'display', 'none'); + this.adPlayerPlay = false; + var ad = this.advertisements[this.adType]; + if (this.adI == 0 && (this.adType == 'front' || this.adType == 'insert' || this.adType == 'end')) { + this.sendJS('process', this.adType + ' ad play'); + this.sendJS(this.adType+'Ad','play'); + } + this.trackHide(); + if (this.adI < ad.length) { + if (!this.isUndefined(ad[this.adI]['time'])) { + this.adTimeTotal = parseInt(ad[this.adI]['time']); + } + this.loadAdvertisements(); + } else { + this.adEnded(); + } + }, + /*清除当前所有广告*/ + eliminateAd: function() { + if (this.adType) { + var ad = this.advertisements[this.adType]; + this.adI = ad.length; + this.advertisementsPlay(); + } + + }, + /*广告播放结束*/ + adEnded: function() { + var thisTemp = this; + this.adPlayStart = false; + if(this.adType=='front'){ + this.time=0; + } + this.adPlayerPlay = false; + if (this.adVideoPlay) { + if (this.videoTemp['src'] != '') { + this.V.src = this.videoTemp['src']; + } else { + if (this.V.src) { + this.V.removeAttribute('src'); + } + } + if (this.videoTemp['source'] != '') { + this.V.innerHTML = this.videoTemp['source']; + } + if (this.videoTemp['currentSrc'] != '') { + this.V.src = this.videoTemp['currentSrc']; + this.V.currentSrc = this.videoTemp['currentSrc']; + } + if (this.videoTemp['loop']) { + this.V.loop = true; + this.videoTemp['loop'] = false; + } + if (this.adType == 'end') { + this.endedHandler(); + } else { + this.videoPlay(); + } + } else { + this.videoPlay(); + } + this.changeVolume(this.vars['volume']); + this.sendJS('process', this.adType + ' ad ended'); + this.sendJS(this.adType+'Ad','ended'); + this.changeControlBarShow(true); + this.css(this.CB['logo'], 'display','block'); + this.customShow(true); + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText'], this.CB['adSkip'], this.CB['adSkipText'],this.CB['adSkipButton'], this.CB['adLink'],this.CB['adMute'], this.CB['adEscMute']], 'display', 'none'); + }, + /*加载广告*/ + loadAdvertisements: function() { + //this.videoTemp + var ad = this.getNowAdvertisements(); + var type = ad['type']; + var thisTemp = this; + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + this.changeControlBarShow(false); + this.adPlayerPlay = true; + this.css(this.CB['logo'], 'display','none'); + this.customShow(false); + if (this.isStrImage(type)) { + this.css([this.CB['adBackground'], this.CB['adElement'], this.CB['adTime'], this.CB['adTimeText']], 'display', 'block'); + this.css([this.CB['adMute'], this.CB['adEscMute']], 'display', 'none'); + var imgClass = 'adimg' + this.randomString(10); + var imgHtml = ''; + if (ad['link']) { + imgHtml = '' + imgHtml + ''; + } + this.CB['adElement'].innerHTML = imgHtml; + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css(thisTemp.getByElement(imgClass), { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + thisTemp.css(thisTemp.CB['adElement'], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + top: (height - imgWH['height']) * 0.5 + 'px', + left: (width - imgWH['width']) * 0.5 + 'px' + }); + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + }, + this.getByElement(imgClass)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adElement']); + if (!this.isUndefined(ad['time'])) { + this.adCountDown(); + } + } else { + this.css([this.CB['adTime'], this.CB['adTimeText']], 'display', 'block'); + //判断是否静音 + if (this.adVideoMute) { + this.css(this.CB['adEscMute'], 'display', 'block'); + this.css(this.CB['adMute'], 'display', 'none'); + } else { + this.css(this.CB['adEscMute'], 'display', 'none'); + this.css(this.CB['adMute'], 'display', 'block'); + } + this.CB['adElement'].innerHTML = ''; + if (this.videoTemp['currentSrc'] == '') { + this.videoTemp['currentSrc'] = this.getCurrentSrc(); + } + if (this.V.loop) { + this.videoTemp['loop'] = true; + this.V.loop = false; + } + if (this.V != null && this.V.currentTime > 0 && this.adIsVideoTime && this.adType!='front') { //当有视频广告时而又没有记录下已播放的时间则进行记录 + this.adIsVideoTime = false; + this.needSeek = this.V.currentTime; + } + this.V.src = ad['file']; + this.V.currentSrc = ad['file']; + this.V.innerHTML = ''; + this.V.play(); + this.adVideoPlay = true; + this.ajaxSuccessNull(ad['exhibitionMonitor']); + if (!this.adVideoMute) { + this.escAdMute(); + } + } + if (ad['link']) { + this.css(this.CB['adLink'], 'display', 'block'); + var adLinkClick = function(event) { + thisTemp.sendJS('clickEvent', 'javaScript->adLinkClick'); + }; + this.addListenerInside('click', adLinkClick, this.CB['adLink']); + this.adLinkTemp=ad['link']; + var linkTemp = ''; + this.CB['adLink'].innerHTML = linkTemp; + this.css(this.getByElement('ckadmorelink'), { + color: '#FFFFFF', + textDecoration: 'none' + }); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.CB['adLink']); + } else { + this.css(this.CB['adLink'], 'display', 'none'); + } + + }, + /*普通广告倒计时*/ + adCountDown: function() { + var thisTemp = this; + if (this.adTimeTotal > 0) { + if (!this.adIsPause) { + this.adTimeTotal--; + this.showAdTime(); + this.adCountDownObj = null; + this.adCountDownObj = setTimeout(function() { + thisTemp.adCountDown(); + }, + 1000); + } + } else { + this.adI++; + this.advertisementsPlay(); + } + }, + /*视频广告倒计时*/ + adPlayerTimeHandler: function(time) { + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (this.isStrImage(type)) { + return; + } + if (this.adTimeTotal != parseInt(time)) { + this.adTimeTotal = parseInt(time); + this.showAdTime(); + } + }, + /*格式化广告倒计时显示*/ + showAdTime: function() { + this.adTimeAllTotal--; + var n = this.adTimeAllTotal; + if (n < 0) { + n = 0; + } + this.CB['adTimeText'].innerHTML = this.ckLanguage['adCountdown'].replace('[$second]', n).replace('[$Second]', n < 10 ? '0' + n: n); + }, + /* + 单独监听其它广告 + */ + checkAdOther: function(t) { + if (this.adPlayerPlay) { + return; + } + var adTime = this.advertisements['othertime']; + var adPlay = this.advertisements['otherPlay']; + for (var i = 0; i < adTime.length; i++) { + if (t >= adTime[i] && !adPlay[i]) { //如果播放时间大于广告时间而该广告还没有播放,则开始播放 + adPlay[i] = true; + this.newAdOther(i); + } + } + }, + /* + 新建其它广告 + */ + newAdOther: function(i) { + var thisTemp = this; + var ad = this.advertisements['other'][i]; + var randomS = this.randomString(10); //获取一个随机字符串 + var adDivID = 'adother' + randomS; //广告容器 + imgClassName = 'adimgother' + randomS; + var adDiv = document.createElement('div'); + adDiv.className = adDivID; + this.PD.appendChild(adDiv); + ad['div'] = adDivID; + ad['element'] = imgClassName; + var adHtml=''; + if(ad['link']){ + adHtml=''+adHtml+''; + } + this.getByElement(adDivID).innerHTML =adHtml; + this.css(adDivID, { + position: 'absolute', + overflow: 'hidden', + zIndex: '996', + top: '-600px', + left: '-600px', + cursor: 'pointer' + }); + if (this.ckStyle['advertisement']['closeOtherButtonShow']) { + var closeAdDivID = 'adotherclose-' + randomS; //广告容器 + var closeAdDiv = document.createElement('div'); + closeAdDiv.className = closeAdDivID; + this.PD.appendChild(closeAdDiv); + ad['closeDiv'] = closeAdDivID; + ad['close'] = false; + var closeAdDivCss=this.getEleCss(this.ckStyle['advertisement']['closeOtherButton'],{offsetX:-10000,offsetY:-10000,cursor: 'pointer',zIndex: 997}); + this.css(closeAdDivID, closeAdDivCss); + var adOtherCloseOver = function() { + thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOver']); + }; + var adOtherCloseOut = function() { + thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOut']); + }; + adOtherCloseOut(); + this.addListenerInside('mouseover', adOtherCloseOver, this.getByElement(closeAdDivID)); + this.addListenerInside('mouseout', adOtherCloseOut, this.getByElement(closeAdDivID)); + } + this.addListenerInside('load', + function() { + var imgObj = new Image(); + imgObj.src = this.src; + var imgWH = thisTemp.adjustmentWH(imgObj.width, imgObj.height); + thisTemp.css([thisTemp.getByElement(imgClassName), thisTemp.getByElement(adDivID)], { + width: imgWH['width'] + 'px', + height: imgWH['height'] + 'px', + border: '0px' + }); + thisTemp.advertisements['other'][i] = ad; + thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']); + thisTemp.adOtherCoor(); + }, + this.getByElement(imgClassName)); + this.addListenerInside('click', + function() { + thisTemp.adOtherClose(i); + }, + this.getByElement(closeAdDivID)); + this.addListenerInside('click', + function() { + thisTemp.ajaxSuccessNull(ad['clickMonitor']); + }, + this.getByElement(imgClassName)); + if (ad['time'] > 0) { + setTimeout(function() { + thisTemp.adOtherClose(i); + }, + ad['time'] * 1000); + } + }, + /* + 关闭其它广告 + */ + adOtherClose: function(i) { + var ad = this.advertisements['other'][i]; + if (!this.isUndefined(ad['close'])) { + if (!ad['close']) { + ad['close'] = true; + this.PD.removeChild(this.getByElement(ad['div'])); + this.PD.removeChild(this.getByElement(ad['closeDiv'])); + } + } + }, + adOtherCloseAll: function() { + if (!this.isUndefined(this.advertisements['other'])) { + var ad = this.advertisements['other']; + for (var i = 0; i < ad.length; i++) { + this.adOtherClose(i); + } + } + }, + /* + 计算其它广告的坐标 + */ + adOtherCoor: function() { + if (!this.isUndefined(this.advertisements['other'])) { + var arr = this.advertisements['other']; + for (var i = 0; i < arr.length; i++) { + var ad = arr[i]; + if (!this.isUndefined(ad['close'])) { + if (!ad['close']) { + var rr=this.ckStyle['advertisement']['closeOtherButton']; + var coor = this.getPosition(ad); + var x = coor['x'], + y = coor['y']; + this.css(this.getByElement(ad['div']), { + left: x + 'px', + top: y + 'px' + }); + var cxy = this.getPosition(rr,this.getByElement(ad['div'])); + if (!this.isUndefined(ad['closeDiv'])) { + this.css(this.getByElement(ad['closeDiv']), { + left: cxy['x'] + 'px', + top: cxy['y'] + 'px' + }); + } + } + } + } + } + }, + /* + 单独监听中间插入广告 + */ + checkAdInsert: function(t) { + if (this.adPlayerPlay) { + return; + } + var adTime = this.advertisements['inserttime']; + var adPlay = this.advertisements['insertPlay']; + var duration = this.getMetaDate()['duration']; + for (var i = adTime.length - 1; i > -1; i--) { + if (t >= adTime[i] && t < duration - 2 && t > 1 && !adPlay[i]) { //如果播放时间大于广告时间而该广告还没有播放,则开始播放 + this.adI = 0; + this.adType = 'insert'; + this.adMuteInto(); + this.adIsVideoTime = true; + this.adPlayStart = true; + this.adVideoPlay = false; + this.videoPause(); + this.advertisementsTime(); + this.advertisementsPlay(); + this.adSkipButtonShow(); + adPlay[i] = true; + for (var n = 0; n < i + 1; n++) { + adPlay[n] = true; + } + break; + } + } + }, + /*格式化中间插入广告的播放时间*/ + formatInserttime: function(duration) { + if (!this.isUndefined(this.advertisements['inserttime'])) { + var arr = this.advertisements['inserttime']; + var newArr = []; + for (var i = 0; i < arr.length; i++) { + if (arr[i].toString().substr( - 1) == '%') { + newArr.push(parseInt(duration * parseInt(arr[i]) * 0.01)); + } else { + newArr.push(parseInt(arr[i])); + } + } + this.advertisements['inserttime'] = newArr; + } + }, + /*获取当前的广告*/ + getNowAdvertisements: function() { + if (this.adI == -1) { + return { + file: '', + time: 0, + link: '' + }; + } + return this.advertisements[this.adType][this.adI]; + }, + /*根据元件尺寸和播放器尺寸调整大小*/ + adjustmentWH: function(w, h) { + var width = this.PD.offsetWidth, + height = this.PD.offsetHeight; + var nw = 0, + nh = 0; + if (w >= width || h >= height) { + if (width / w > height / h) { + nh = height - 20; + nw = w * nh / h; + } else { + nw = width - 20; + nh = h * nw / w; + } + } else { + nw = w; + nh = h; + } + return { + width: nw, + height: nh + } + }, + /*单独请求一次地址,但不处理返回的数据*/ + ajaxSuccessNull: function(url) { + if (!this.isUndefined(url)) { + var ajaxObj = { + url: url, + success: function(data) {} + }; + this.ajax(ajaxObj); + } + }, + /* + 内部函数 + 运行指定函数 + */ + runFunction: function(s) { + try { + var arr = s.split('->'); + if(arr.length==2){ + switch (arr[0]) { + case 'javaScript': + if(arr[1].substr(0,11)!='[flashvars]'){ + eval(arr[1] + '()'); + } + else{ + eval(this.vars[arr[1].substr(11)] + '()'); + } + break; + case 'actionScript': + eval('this.' + arr[1] + '()'); + break; + } + } + this.sendJS('clickEvent', s); + } catch(event) {} + }, + /* + 内部函数 + 使用画布附加视频 + */ + sendVCanvas: function() { + if (this.timerVCanvas == null) { + this.css(this.V, 'display', 'none'); + this.css(this.MD, 'display', 'block'); + var thisTemp = this; + var videoCanvas = function() { + if (thisTemp.MDCX.width != thisTemp.MD.offsetWidth) { + thisTemp.MDC.width = thisTemp.MD.offsetWidth; + } + if (thisTemp.MDCX.height != thisTemp.MD.offsetHeight) { + thisTemp.MDC.height = thisTemp.MD.offsetHeight; + } + thisTemp.MDCX.clearRect(0, 0, thisTemp.MDCX.width, thisTemp.MDCX.height); + var coor = thisTemp.getProportionCoor(thisTemp.PD.offsetWidth, thisTemp.PD.offsetHeight, thisTemp.V.videoWidth, thisTemp.V.videoHeight); + thisTemp.MDCX.drawImage(thisTemp.V, 0, 0, thisTemp.V.videoWidth, thisTemp.V.videoHeight, coor['x'], coor['y'], coor['width'], coor['height']); + }; + this.timerVCanvas = new this.timer(0, videoCanvas); + } + }, + /* + 内部函数 + 监听暂停 + */ + pauseHandler: function() { + var thisTemp = this; + this.playShow(false); + if (this.animatePauseArray.length > 0) { + this.animatePause('pause'); + } + if (this.playerType == 'html5video' && this.V != null && this.ckConfig['config']['videoDrawImage']) { + this.stopVCanvas(); + } + if (!this.isUndefined(this.advertisements['pause']) && !this.adPlayStart && !this.adPauseShow) { //如果存在暂停广告 + setTimeout(function() { + if (!thisTemp.isUndefined(thisTemp.advertisements['pause']) && !thisTemp.adPlayStart && !thisTemp.adPauseShow && thisTemp.time > 1) { //如果存在暂停广告 + thisTemp.adPausePlayer(); + } + }, + 300); + } + }, + /* + 内部函数 + 停止画布 + */ + stopVCanvas: function() { + if (this.timerVCanvas != null) { + this.css(this.V, 'display', 'block'); + this.css(this.MD, 'display', 'none'); + if (this.timerVCanvas.runing) { + this.timerVCanvas.stop(); + } + this.timerVCanvas = null; + } + }, + /* + 内部函数 + 根据当前播放还是暂停确认图标显示 + */ + playShow: function(b) { + if (!this.conBarShow) { + return; + } + if (b) { + this.css(this.CB['play'], 'display', 'none'); + this.css(this.CB['pauseCenter'], 'display', 'none'); + this.css(this.CB['pause'], 'display', 'block'); + } else { + this.css(this.CB['play'], 'display', 'block'); + if (this.css(this.CB['errorText'], 'display') == 'none') { + if (!this.adPlayerPlay) { + this.css(this.CB['pauseCenter'], 'display', 'block'); + } + + } else { + this.css(this.CB['pauseCenter'], 'display', 'none'); + } + this.css(this.CB['pause'], 'display', 'none'); + } + }, + /* + 内部函数 + 监听seek结束 + */ + seekedHandler: function() { + this.resetTrack(); + this.isTimeButtonMove = true; + if (this.V.paused) { + if(this.hlsAutoPlay){ + this.videoPlay(); + } + else{ + this.hlsAutoPlay=true; + } + } + }, + /* + 内部函数 + 监听播放结束 + */ + endedHandler: function() { + this.sendJS('ended'); + if (this.adPlayerPlay) { + this.adI++; + this.advertisementsPlay(); + return; + } + if (!this.endAdPlay && !this.isUndefined(this.advertisements['end'])) { + this.endAdPlay = true; + this.adI = 0; + this.adType = 'end'; + this.adMuteInto(); + this.adIsVideoTime = true; + this.adPlayStart = true; + this.adVideoPlay = false; + this.videoPause(); + this.advertisementsTime(); + this.advertisementsPlay(); + this.adSkipButtonShow(); + this.adReset = true; + return; + } + this.endedAdReset(); + if (this.vars['loop']) { + this.videoSeek(0); + } + }, + /* + 重置结束后相关的设置 + */ + endedAdReset: function() { + var arr = []; + var i = 0; + if (!this.isUndefined(this.advertisements['insertPlay'])) { + arr = this.advertisements['insertPlay']; + for (i = 0; i < arr.length; i++) { + this.advertisements['insertPlay'][i] = false; + } + } + if (!this.isUndefined(this.advertisements['otherPlay'])) { + arr = this.advertisements['otherPlay']; + for (i = 0; i < arr.length; i++) { + this.advertisements['otherPlay'][i] = false; + } + } + //this.endAdPlay=false; + }, + /* + 内部函数 + 监听音量改变 + */ + volumechangeHandler: function() { + if (!this.conBarShow) { + return; + } + if ((this.ckConfig['config']['mobileVolumeBarShow'] || !this.isMobile()) && this.css(this.CB['volume'], 'display') != 'none') { + try { + var volume=this.volume || this.V.volume; + if (volume > 0) { + this.css(this.CB['mute'], 'display', 'block'); + this.css(this.CB['escMute'], 'display', 'none'); + } else { + this.css(this.CB['mute'], 'display', 'none'); + this.css(this.CB['escMute'], 'display', 'block'); + } + } catch(event) {} + } + }, + /* + 内部函数 + 监听播放时间调节进度条 + */ + timeUpdateHandler: function() { + var duration = 0; + if (this.playerType == 'html5video') { + try { + duration = this.V.duration; + } catch(event) {} + } + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + if (duration > 0) { + this.time = this.V.currentTime; + this.timeTextHandler(); + this.trackShowHandler(); + if (this.isTimeButtonMove) { + this.timeProgress(this.time, duration); + } + } + }, + /* + 内部函数 + 改变控制栏坐标 + */ + controlBar:function(){ + //控制栏背景 + var cb=this.ckStyle['controlBar']; + var cssObjTemp={ + align:cb['align'], + vAlign:cb['vAlign'], + width:cb['width'], + height:cb['height'], + offsetX:cb['offsetX'], + offsetY:cb['offsetY'] + + }; + var bgCss={ + backgroundColor:cb['background']['backgroundColor'], + backgroundImg:cb['background']['backgroundImg'], + alpha:cb['background']['alpha'] + }; + var cssTemp=this.getEleCss(this.objectAssign(cssObjTemp,bgCss),{zIndex:888}); + this.css(this.CB['controlBarBg'], cssTemp); + //控制栏容器 + cssTemp=this.getEleCss(cssObjTemp,{zIndex:889}); + this.css(this.CB['controlBar'], cssTemp); + }, + /* + 内部函数 + 按时间改变进度条 + */ + timeProgress: function(time, duration) { + if (!this.conBarShow) { + return; + } + var timeProgressBgW = this.CB['timeProgressBg'].offsetWidth; + var timeBOW = parseInt((time * timeProgressBgW / duration) - (this.CB['timeButton'].offsetWidth * 0.5)); + if (timeBOW > timeProgressBgW - this.CB['timeButton'].offsetWidth) { + timeBOW = timeProgressBgW - this.CB['timeButton'].offsetWidth; + } + if (timeBOW < 0) { + timeBOW = 0; + } + this.css(this.CB['timeProgress'], 'width', timeBOW + 'px'); + this.css(this.CB['timeButton'], 'left', parseInt(timeBOW) + 'px'); + }, + /* + 内部函数 + 监听播放时间改变时间显示文本框 + */ + timeTextHandler: function() { //显示时间/总时间 + if (!this.conBarShow) { + return; + } + var duration = this.V.duration; + var time = this.V.currentTime; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + this.CB['timeText'].innerHTML = this.formatTime(time,duration,this.ckLanguage['vod']); + + }, + /* + 内部函数 + 监听是否是缓冲状态 + */ + bufferEdHandler: function() { + if (!this.conBarShow || this.playerType == 'flashplayer') { + return; + } + var thisTemp = this; + var clearTimerBuffer = function() { + if (thisTemp.timerBuffer != null) { + if (thisTemp.timerBuffer.runing) { + thisTemp.sendJS('buffer', 100); + thisTemp.timerBuffer.stop(); + } + thisTemp.timerBuffer = null; + } + }; + clearTimerBuffer(); + var bufferFun = function() { + if (!thisTemp.isUndefined(thisTemp.V) && thisTemp.V.buffered.length > 0) { + var duration = thisTemp.V.duration; + var len = thisTemp.V.buffered.length; + var bufferStart = thisTemp.V.buffered.start(len - 1); + var bufferEnd = thisTemp.V.buffered.end(len - 1); + var loadTime = bufferStart + bufferEnd; + var loadProgressBgW = thisTemp.CB['timeProgressBg'].offsetWidth; + var timeButtonW = thisTemp.CB['timeButton'].offsetWidth; + var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); + if (loadW >= loadProgressBgW) { + loadW = loadProgressBgW; + clearTimerBuffer(); + } + thisTemp.changeLoad(loadTime); + } + }; + this.timerBuffer = new this.timer(200, bufferFun); + }, + /* + 内部函数 + 单独计算加载进度 + */ + changeLoad: function(loadTime) { + if (this.V == null) { + return; + } + if (!this.conBarShow) { + return; + } + var loadProgressBgW = this.CB['timeProgressBg'].offsetWidth; + var timeButtonW = this.CB['timeButton'].offsetWidth; + var duration = this.V.duration; + if (isNaN(duration) || parseInt(duration) < 0.2) { + duration = this.vars['duration']; + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + if (this.isUndefined(loadTime)) { + loadTime = this.loadTime; + } else { + this.loadTime = loadTime; + } + var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); + this.css(this.CB['loadProgress'], 'width', loadW + 'px'); + this.sendJS('loadTime',loadTime); + this.loadTimeTemp=loadTime; + }, + /* + 内部函数 + 判断是否是直播 + */ + judgeIsLive: function() { + var thisTemp = this; + if (this.timerError != null) { + if (this.timerError.runing) { + this.timerError.stop(); + } + this.timerError = null; + } + this.error = false; + if (this.conBarShow) { + this.css(this.CB['errorText'], 'display', 'none'); + } + var timeupdate = function(event) { + thisTemp.timeUpdateHandler(); + }; + if (!this.vars['live']) { + if (this.V != null && this.playerType == 'html5video') { + this.addListenerInside('timeupdate', timeupdate); + thisTemp.timeTextHandler(); + thisTemp.prompt(); //添加提示点 + setTimeout(function() { + thisTemp.bufferEdHandler(); + }, + 200); + } + } else { + this.removeListenerInside('timeupdate', timeupdate); + if (this.timerTime != null) { + window.clearInterval(this.timerTime); + timerTime = null; + } + if (this.timerTime != null) { + if (this.timerTime.runing) { + this.timerTime.stop(); + } + this.timerTime = null; + } + var timeFun = function() { + if (thisTemp.V != null && !thisTemp.V.paused && thisTemp.conBarShow) { + thisTemp.CB['timeText'].innerHTML = thisTemp.formatTime(0,0,thisTemp.ckLanguage['live']); //时间显示框默认显示内容 + } + }; + this.timerTime = new this.timer(1000, timeFun); + //timerTime.start(); + } + this.definition(); + }, + /* + 内部函数 + 加载字幕 + */ + loadTrack: function(def) { + if (this.playerType == 'flashplayer' || this.vars['flashplayer'] == true) { + return; + } + if(this.isUndefined(def)){ + def=-1; + } + var track = this.vars['cktrack']; + var loadTrackUrl=''; + var type=this.varType(track); + var thisTemp = this; + if(type=='array'){ + if(def==-1){ + var index=0; + var indexN=0; + for(var i=0;iindexN){ + indexN=li[2]; + index=i; + } + } + } + else{ + index=def; + } + loadTrackUrl=track[index][0]; + } + else{ + loadTrackUrl=track; + } + var obj = { + method: 'get', + dataType: 'text', + url: loadTrackUrl, + charset: 'utf-8', + success: function(data) { + if(data){ + thisTemp.track = thisTemp.parseSrtSubtitles(data); + thisTemp.trackIndex = 0; + thisTemp.nowTrackShow = { + sn: '' + } + } + + } + }; + this.ajax(obj); + }, + /* + 内部函数 + 重置字幕 + */ + resetTrack: function() { + this.trackIndex = 0; + this.nowTrackShow = { + sn: '' + }; + }, + /* + 内部函数 + 根据时间改变读取显示字幕 + */ + trackShowHandler: function() { + if (!this.conBarShow || this.adPlayerPlay) { + return; + } + if (this.track.length < 1) { + return; + } + if (this.trackIndex >= this.track.length) { + this.trackIndex = 0; + } + var nowTrack = this.track[this.trackIndex]; //当前编号对应的字幕内容 + /* + this.nowTrackShow=当前显示在界面上的内容 + 如果当前时间正好在nowTrack时间内,则需要判断 + */ + if (this.time >= nowTrack['startTime'] && this.time <= nowTrack['endTime']) { + /* + 如果当前显示的内容不等于当前需要显示的内容时,则需要显示正确的内容 + */ + var nowShow = this.nowTrackShow; + if (nowShow['sn'] != nowTrack['sn']) { + this.trackHide(); + this.trackShow(nowTrack); + this.nowTrackTemp=nowTrack; + } + } else { + /* + 如果当前播放时间不在当前编号字幕内,则需要先清空当前的字幕内容,再显示新的字幕内容 + */ + this.trackHide(); + this.checkTrack(); + } + }, + trackShowAgain:function(){ + this.trackHide(); + this.trackShow(this.nowTrackTemp); + }, + /* + 内部函数 + 显示字幕内容 + */ + trackShow: function(track) { + this.nowTrackShow = track; + var arr = track['content']; + for (var i = 0; i < arr.length; i++) { + var obj = { + list: [{ + type: 'text', + text: arr[i], + color: this.ckStyle['cktrack']['color'], + size: this.ckStyle['cktrack']['size'], + fontFamily: this.ckStyle['cktrack']['font'], + lineHeight: this.ckStyle['cktrack']['leading']+'px' + }], + position: [1, 2, null, -(arr.length - i) * this.ckStyle['cktrack']['leading'] - this.ckStyle['cktrack']['marginBottom']] + }; + var ele = this.addElement(obj); + this.trackElement.push(ele); + } + }, + /* + 内部函数 + 隐藏字幕内容 + */ + trackHide: function() { + for (var i = 0; i < this.trackElement.length; i++) { + this.deleteElement(this.trackElement[i]); + } + this.trackElement = []; + }, + /* + 内部函数 + 重新计算字幕的编号 + */ + checkTrack: function() { + var num = this.trackIndex; + var arr = this.track; + var i = 0; + for (i = num; i < arr.length; i++) { + if (this.time >= arr[i]['startTime'] && this.time <= arr[i]['endTime']) { + this.trackIndex = i; + break; + } + } + }, + /* + -----------------------------------------------------------------------------接口函数开始 + 接口函数 + 在播放和暂停之间切换 + */ + playOrPause: function() { + if (!this.loaded) { + return; + } + if (this.V == null) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.playOrPause(); + return; + } + if (this.V.paused) { + this.videoPlay(); + } else { + this.videoPause(); + } + }, + /* + 接口函数 + 播放动作 + */ + videoPlay: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoPlay(); + return; + } + if (this.adPlayerPlay) { + this.eliminateAd(); //清除广告 + return; + } + try { + if (this.V.currentSrc) { + this.V.play(); + } + } catch(event) {} + }, + /* + 接口函数 + 暂停动作 + */ + videoPause: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoPause(); + return; + } + try { + this.V.pause(); + } catch(event) {} + }, + /* + 接口函数 + 跳转时间动作 + */ + videoSeek: function(time) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoSeek(time); + return; + } + var duration = this.V.duration>0.2?this.V.duration:this.getMetaDate()['duration']; + if (duration > 0 && time > duration) { + if(this.vars['forceduration']>0){ + time=0; + this.sendJS('ended'); + } + else{ + time = duration-0.1; + } + } + if (time >= 0) { + this.V.currentTime = time; + this.sendJS('seekTime', time); + } + }, + /* + 接口函数 + 调节音量/获取音量 + */ + changeVolume: function(vol, bg, button) { + if (this.loaded) { + if (this.playerType == 'flashplayer') { + this.V.changeVolume(vol); + return; + } + } + if (isNaN(vol) || this.isUndefined(vol)) { + vol = 0; + } + if (!this.loaded) { + this.vars['volume'] = vol; + } + if (!this.html5Video) { + this.V.changeVolume(vol); + return; + } + try { + if (this.isUndefined(bg)) { + bg = true; + } + } catch(e) {} + try { + if (this.isUndefined(button)) { + button = true; + } + } catch(e) {} + if (!vol) { + vol = 0; + } + if (vol < 0) { + vol = 0; + } + if (vol > 1) { + vol = 1; + } + try { + this.V.volume = vol; + } catch(error) {} + this.volume = vol; + if (bg && this.conBarShow) { + var bgW = vol * this.CB['volumeBg'].offsetWidth; + if (bgW < 0) { + bgW = 0; + } + if (bgW > this.CB['volumeBg'].offsetWidth) { + bgW = this.CB['volumeBg'].offsetWidth; + } + this.css(this.CB['volumeUp'], 'width', bgW + 'px'); + } + + if (button && this.conBarShow) { + var buLeft = parseInt(this.CB['volumeUp'].offsetWidth - (this.CB['volumeBO'].offsetWidth * 0.5)); + if (buLeft > this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth) { + buLeft = this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth + } + if (buLeft < 0) { + buLeft = 0; + } + this.css(this.CB['volumeBO'], 'left', buLeft + 'px'); + } + }, + /* + 接口函数 + 静音 + */ + videoMute: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoMute(); + return; + } + this.volumeTemp = this.V ? (this.V.volume > 0 ? this.V.volume: this.vars['volume']) : this.vars['volume']; + this.changeVolume(0); + }, + /* + 接口函数 + 取消静音 + */ + videoEscMute: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoEscMute(); + return; + } + this.changeVolume(this.volumeTemp > 0 ? this.volumeTemp: this.vars['volume']); + }, + /* + 接口函数 + 视频广告静音 + */ + adMute: function() { + if (!this.loaded) { + return; + } + this.changeVolume(0); + this.adVideoMute = true; + this.css(this.CB['adEscMute'], 'display', 'block'); + this.css(this.CB['adMute'], 'display', 'none'); + }, + /* + 接口函数 + 视频广告取消静音 + */ + escAdMute: function() { + if (!this.loaded) { + return; + } + var v = this.ckStyle['advertisement']['videoVolume']; + this.changeVolume(v); + this.adMuteInto(); + }, + /* + 初始化广告的音量按钮 + */ + adMuteInto: function() { + this.adVideoMute = false; + this.css(this.CB['adEscMute'], 'display', 'none'); + this.css(this.CB['adMute'], 'display', 'block'); + }, + /* + 接口函数 + 快退 + */ + fastBack: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.fastBack(); + return; + } + var time = this.time - this.ckConfig['config']['timeJump']; + if (time < 0) { + time = 0; + } + this.videoSeek(time); + }, + /* + 接口函数 + 快进 + */ + fastNext: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.fastNext(); + return; + } + var time = this.time + this.ckConfig['config']['timeJump']; + if (time > this.V.duration) { + time = this.V.duration; + } + this.videoSeek(time); + }, + /* + 接口函数 + 获取当前播放的地址 + */ + getCurrentSrc: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + return this.V.getCurrentSrc(); + } + return this.V.currentSrc; + }, + /* + 内置函数 + 全屏/退出全屏动作,该动作只能是用户操作才可以触发,比如用户点击按钮触发该事件 + */ + switchFull: function() { + if (this.full) { + this.quitFullScreen(); + } else { + this.fullScreen(); + } + }, + /* + 内置函数 + 全屏动作,该动作只能是用户操作才可以触发,比如用户点击按钮触发该事件 + */ + fullScreen: function() { + if (this.html5Video && this.playerType == 'html5video') { + var element = this.PD; + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else if (element.oRequestFullscreen) { + element.oRequestFullscreen(); + } + this.judgeFullScreen(); + } else { + //this.V.fullScreen(); + } + }, + /* + 接口函数 + 退出全屏动作 + */ + quitFullScreen: function() { + if (this.html5Video && this.playerType == 'html5video') { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.oRequestFullscreen) { + document.oCancelFullScreen(); + } else if (document.requestFullscreen) { + document.requestFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else { + this.css(document.documentElement, 'cssText', ''); + this.css(document.document.body, 'cssText', ''); + this.css(this.PD, 'cssText', ''); + } + this.judgeFullScreen(); + } + }, + /* + 下面列出只有flashplayer里支持的 + */ + videoRotation: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoRotation(n); + return; + } + if (this.isUndefined(n)) { + n = 0; + } + var tf = this.css(this.V, 'transform'); + if (this.isUndefined(tf) && !tf) { + tf = 'rotate(0deg)'; + } + var reg = tf.match(/rotate\([^)]+\)/); + reg = reg ? reg[0].replace('rotate(', '').replace('deg)', '') : ''; + if (reg == '') { + reg = 0; + } else { + reg = parseInt(reg); + } + if (n == -1) { + reg -= 90; + } else if (n == 1) { + reg += 90; + } else { + if (n != 90 && n != 180 && n != 270 && n != -90 && n != -180 && n != -270) { + reg = 0; + } else { + reg = n; + } + } + n = reg; + var y90 = n % 90, + y180 = n % 180, + y270 = n % 270; + var ys = false; + if (y90 == 0 && y180 == 90 && y270 == 90) { + ys = true; + } + if (y90 == 0 && y180 == 90 && y270 == 0) { + ys = true; + } + if (y90 == -0 && y180 == -90 && y270 == -90) { + ys = true; + } + if (y90 == -0 && y180 == -90 && y270 == -0) { + ys = true; + } + tf = tf.replace(/rotate\([^)]+\)/, '').replace(/scale\([^)]+\)/, '') + ' rotate(' + n + 'deg)'; + var cdW = this.CD.offsetWidth, + cdH = this.CD.offsetHeight, + vW = this.V.videoWidth, + vH = this.V.videoHeight; + if (vW > 0 && vH > 0) { + if (ys) { + if (cdW / cdH > vH / vW) { + nH = cdH; + nW = vH * nH / vW; + } else { + nW = cdW; + nH = vW * nW / vH; + } + this.css(this.V, 'transform', 'rotate(0deg)'); + this.css(this.V, 'transform', 'scale(' + nH / cdW + ',' + nW / cdH + ')' + tf); + } else { + this.css(this.V, 'transform', tf); + } + } else { + this.css(this.V, 'transform', tf); + } + return; + }, + videoBrightness: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoBrightness(n); + return; + } + }, + videoContrast: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoContrast(n); + return; + } + }, + videoSaturation: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoSaturation(n); + return; + } + }, + videoHue: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoHue(n); + return; + } + }, + videoZoom: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoZoom(n); + return; + } + if (this.isUndefined(n)) { + n = 1; + } + if (n < 0) { + n = 0; + } + if (n > 2) { + n = 2; + } + var tf = this.css(this.V, 'transform'); + tf = tf.replace(/scale\([^)]+\)/, '') + ' scale(' + n + ')'; + this.videoScale = n; + this.css(this.V, 'transform', tf); + return; + }, + videoProportion: function(w, h) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoProportion(w, h); + return; + } + }, + adPlay: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.adPlay(); + return; + } + if (this.adPlayerPlay) { + this.adIsPause = false; + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (this.isStrImage(type)) { + this.adCountDown(); + } else { + this.V.play(); + } + } + }, + adPause: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.adPause(); + return; + } + if (this.adPlayerPlay) { + this.adIsPause = true; + var ad = this.getNowAdvertisements(); + var type = ad['type']; + if (type != 'jpg' && type != 'jpeg' && type != 'png' && type != 'svg' && type != 'gif') { + this.videoPause(); + } + } + }, + videoError: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoError(n); + return; + } + }, + changeConfig: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + var args = Array.prototype.slice.call(arguments); + switch(args.length){ + case 1: + this.V.changeConfig(args[0]); + break; + case 2: + this.V.changeConfig(args[0],args[1]); + break; + case 3: + this.V.changeConfig(args[0],args[1],args[2]); + break; + case 4: + this.V.changeConfig(args[0],args[1],args[2],args[3]); + break; + case 5: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4]); + break; + case 6: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5]); + break; + case 7: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6]); + break; + case 8: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]); + break; + case 8: + this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]); + break; + } + return; + } + var obj = this.ckConfig; + var arg = arguments; + for (var i = 0; i < arg.length - 1; i++) { + if (obj.hasOwnProperty(arg[i])) { + obj = obj[arg[i]]; + } else { + return; + } + } + var val = arg[arg.length - 1]; + switch (arg.length) { + case 2: + this.ckConfig[arg[0]] = val; + break; + case 3: + this.ckConfig[arg[0]][arg[1]] = val; + break; + case 4: + this.ckConfig[arg[0]][arg[1]][arg[2]] = val; + break; + case 5: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]] = val; + break; + case 6: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]] = val; + break; + case 7: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]] = val; + break; + case 8: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]] = val; + break; + case 9: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]] = val; + break; + case 10: + this.ckConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]][arg[8]] = val; + break; + default: + break; + } + this.sendJS('configChange', this.ckConfig); + }, + custom: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.custom(arguments); + return; + } + if(this.isUndefined(arguments)){ + return; + } + var type='',name='',display=''; + if(arguments.length==4){//控制栏 + type='controlBar-'+arguments[1]; + name=arguments[2]; + display=arguments[3]?'block':'none'; + } + else if(arguments.length==3){//播放器 + type='player-'+arguments[0]; + name=arguments[1]; + display=arguments[2]?'block':'none'; + } + else{ + return; + } + for(var k in this.customeElement){ + var obj=this.customeElement[k]; + if(obj['type']==type && obj['name']==name){ + this.css(obj['ele'],'display',display); + } + } + }, + getConfig: function() { + if (!this.loaded) { + return null; + } + if (this.playerType == 'flashplayer') { + return this.V.getConfig(arguments); + } + else{ + var temp=this.ckConfig; + for(var index in arguments) { + try{ + temp=temp[arguments[index]]; + } + catch(error){ + temp=null; + } + }; + return temp; + } + }, + openUrl: function(n) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.openUrl(n); + return; + } + }, + /* + 接口函数 + 清除视频 + */ + videoClear: function() { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.videoClear(); + return; + } + this.V.innerHTML=''; + this.V.src=''; + }, + /* + 接口函数 + 向播放器传递新的视频地址 + */ + newVideo: function(c) { + if (this.playerType == 'flashplayer') { + this.V.newVideo(c); + return; + } else { + this.embed(c); + } + }, + /* + 接口函数 + 截图 + */ + screenshot: function(obj, save, name) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + try { + this.V.screenshot(obj, save, name); + } catch(error) { + this.log(error); + } + return; + } + if (obj == 'video') { + var newCanvas = document.createElement('canvas'); + newCanvas.width = this.V.videoWidth; + newCanvas.height = this.V.videoHeight; + newCanvas.getContext('2d').drawImage(this.V, 0, 0, this.V.videoWidth, this.V.videoHeight); + try { + var base64 = newCanvas.toDataURL('image/jpeg'); + this.sendJS('screenshot', { + object: obj, + save: save, + name: name, + base64: base64 + }); + } catch(error) { + this.log(error); + } + } + }, + /* + 接口函数 + 改变播放器尺寸 + */ + changeSize: function(w, h) { + if (this.isUndefined(w)) { + w = 0; + } + if (this.isUndefined(h)) { + h = 0; + } + if (w > 0) { + this.css(this.CD, 'width', w + 'px'); + } + if (h > 0) { + this.css(this.CD, 'height', h + 'px'); + } + if (this.html5Video) { + this.playerResize(); + } + }, + /* + 重置播放器界面 + */ + playerResize:function(){ + this.controlBar();//控制栏按钮 + this.elementCoordinate(); + this.carbarButton(); + this.customCoor();//自定义元件的位置重置 + this.timeProgressDefault();//进度条默认样式 + this.videoCss();//计算video的宽高和位置 + this.timeUpdateHandler();//修改进度条样式 + this.changeElementCoor(); //修改新加元件的坐标 + this.changePrompt();//重置提示点 + this.advertisementStyle();//广告控制样式 + this.adPauseCoor(); + this.adOtherCoor(); + this.changeLoad(); + this.sendJS('resize'); + }, + /* + 接口函数 + 改变视频播放速度 + */ + changePlaybackRate: function(n) { + if (this.html5Video) { + var arr = this.playbackRateArr; + n = parseInt(n); + if (n < arr.length) { + this.newPlaybackrate(arr[n][1]); + } + } + }, + /* + 内部函数 + 注册控制控制栏显示与隐藏函数 + */ + changeControlBarShow: function(show) { + if (!this.loaded) { + return; + } + if (this.playerType == 'flashplayer') { + this.V.changeControlBarShow(show); + return; + } + if (show) { + this.controlBarIsShow = true; + this.controlBarHide(false); + } else { + this.controlBarIsShow = false; + this.controlBarHide(true); + } + }, + /* + ----------------------------------------------------------------------- + 调用flashplayer + */ + embedSWF: function() { + var vid = 'ckplayer-'+this.randomString(); + var flashvars = this.getFlashVars(); + var param = this.getFlashplayerParam(); + var flashplayerUrl = 'http://www.macromedia.com/go/getflashplayer'; + var html = '', + src = ckplayerPath + 'ckplayer.swf'; + id = 'id="' + vid + '" name="' + vid + '" '; + html += ''; + html += param['v']; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + this.PD.innerHTML = html; + this.V = this.getObjectById(vid); //V:定义播放器对象全局变量 + this.playerType = 'flashplayer'; + }, + /* + 判断浏览器是否支持flashplayer + */ + checkShockwaveFlash:function(){ + if(window.ActiveXObject) { + try { + var s = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + if(s) { + return true; + } + } catch(e) {} + } else { + try { + var s = navigator.plugins['Shockwave Flash']; + if(s) { + return true; + } + } catch(e) {} + } + return false; + }, + /* + 内置函数 + 将vars对象转换成字符 + */ + getFlashVars: function() { + this.getVarsObject(); + var v = this.vars; + var z = ''; + for (k in v) { + if (k != 'flashplayer' && k != 'container' && v[k] != '') { + if (z != '') { + z += '&'; + } + var vk = v[k]; + if (vk == true) { + vk = 1; + } + if (vk == false) { + vk = 0; + } + z += k + '=' + vk; + } + + } + if (!v.hasOwnProperty('volume') || !v['volume']) { + if (z != '') { + z += '&'; + } + z += 'volume=0'; + } + return z; + }, + /*判断字符串是否是图片*/ + isStrImage: function(s) { + if (s == 'jpg' || s == 'jpeg' || s == 'png' || s == 'svg' || s == 'gif') { + return true; + } + return false; + }, + /* + 内置函数 + 将vars格式化成flash能接受的对象。再由getFlashVars函数转化成字符串或由newVideo直接使用 + */ + getVarsObject: function() { + var v = this.vars; + var f = '', + d = '', + w = ''; //f=视频地址,d=清晰度地址,w=权重,z=最终地址 + var arr = this.VA; + var prompt = v['promptSpot']; + var i = 0; + var video = this.vars['video']; + if (this.varType(video) == 'array') { //对象或数组 + var arr = video; + for (i = 0; i < arr.length; i++) { + var arr2 = arr[i]; + if (arr2) { + if (f != '') { + f += this.ckConfig['config']['split']; + d += ','; + w += ','; + v['type'] += this.ckConfig['config']['split']; + } + f += encodeURIComponent(decodeURIComponent(arr2[0])); + d += arr2[2]; + w += arr2[3]; + v['type'] += arr2[1].replace('video/', ''); + } + } + } + else if (this.varType(video) == 'object') { //对象或数组 + f = encodeURIComponent(decodeURIComponent(video['file'])); + if (!this.isUndefined(video['type'])) { + v['type'] = video['type']; + } + d = ''; + w = ''; + } + else { + f = encodeURIComponent(decodeURIComponent(video)); + } + if (v['preview'] != null) { + v['previewscale'] = v['preview']['scale']; + v['preview'] = v['preview']['file'].join(','); + + } + if (prompt != null) { + v['promptspot'] = ''; + v['promptspottime'] = ''; + for (i = 0; i < prompt.length; i++) { + if (v['promptspot'] != '') { + v['promptspot'] += ','; + v['promptspottime'] += ','; + } + v['promptspot'] += prompt[i]['words']; + v['promptspottime'] += prompt[i]['time']; + } + + } + if (f != '') { + v['video'] = f; + v['definition'] = d; + v['weight'] = w; + } + if (!v['volume']) { + v['volume'] = 0; + } + var newV = {}; + + for (var k in v) { + if (v[k] != null) { + newV[k] = v[k]; + } + if (k == 'type') { + newV[k] = v[k].replace('video/m3u8', 'm3u8'); + } + } + + this.vars = newV; + }, + /* + 内置函数 + 将embedSWF里的param的对象进行转换 + */ + getFlashplayerParam: function() { + var w = '', + v = '', + o = { + allowScriptAccess: 'always', + allowFullScreen: true, + quality: 'high', + bgcolor: '#000' + }; + for (var e in o) { + w += e + '="' + o[e] + '" '; + v += ''; + } + w = w.replace('movie=', 'src='); + return { + w: w, + v: v + }; + }, + + /* + 操作动作结束 + ----------------------------------------------------------------------- + + 接口函数 + 获取元数据部分 + */ + getMetaDate: function() { + if (!this.loaded || this.V == null) { + return false; + } + if (this.playerType == 'html5video') { + var duration = 0; + try { + duration = !isNaN(this.V.duration) ? this.V.duration: 0; + if (isNaN(duration) || parseInt(duration) < 0.2) { + if(this.vars['duration']>0){ + duration=this.vars['duration']; + } + } + if(this.vars['forceduration']>0){ + duration=this.vars['forceduration']; + } + } catch(event) { + this.log(event); + } + var data = { + duration: duration, + volume: this.V.volume, + playbackRate: this.V.playbackRate, + width: this.PD.offsetWidth || this.V.offsetWidth || this.V.width, + height: this.PD.offsetHeight || this.V.offsetHeight || this.V.height, + streamWidth: this.V.videoWidth, + streamHeight: this.V.videoHeight, + videoWidth: this.V.offsetWidth, + videoHeight: this.V.offsetHeight, + paused: this.V.paused, + loadTime:this.loadTimeTemp + }; + return data; + } else { + try { + return this.V.getMetaDate(); + } catch(event) { + this.log(event); + } + } + return false; + }, + /* + 接口函数 + 取当前提供给播放器播放的视频列表 + */ + getVideoUrl: function() { + if (this.playerType == 'flashplayer') { + return this.V.getVideoUrl(); + } + var arr = []; + if (this.V.src) { + arr.push(this.V.src); + } else { + var uArr = this.V.childNodes; + for (var i = 0; i < uArr.length; i++) { + arr.push(uArr[i].src); + } + } + return arr; + }, + /* + 内置函数 + 格式化函数 + */ + clickEvent: function(call) { + if (call == 'none' || call == '' || call == null) { + return { + type: 'none' + }; + } + var callArr = call.split('->'); + var type = '', + fun = '', + link = '', + target = ''; + if (callArr.length == 2) { + var callM = callArr[0]; + var callE = callArr[1]; + if (!callE) { + return { + type: 'none' + }; + } + var val = ''; + var eArr = []; + type = callM; + switch (callM) { + case 'actionScript': + //trace(THIS.hasOwnProperty(callE)); + if (callE.indexOf('(') > -1) { + eArr = callE.split('('); + callE = eArr[0]; + val = eArr[1].replace(')', ''); + } + if (val == '') { + fun = 'thisTemp.' + callE + '()'; + } else { + fun = 'thisTemp.' + callE + '(' + val + ')'; + } + break; + case 'javaScript': + if (callE.substr(0, 11) == '[flashvars]') { + callE = callE.substr(11); + if (this.vars.hasOwnProperty(callE)) { + callE = this.vars[callE]; + } else { + break; + } + + } + if (callE.indexOf('(') > -1) { + eArr = callE.split('('); + callE = eArr[0]; + val = eArr[1].replace(')', ''); + } + if (val == '') { + fun = callE + '()'; + } else { + fun = callE + '(' + val + ')'; + } + break; + case "link": + var callLink = (callE + ',').split(','); + if (callLink[0].substr(0, 11) == '[flashvars]') { + var fl = callLink[0].replace('[flashvars]', ''); + if (this.vars.hasOwnProperty(fl)) { + callLink[0] = this.vars[fl]; + } else { + break; + } + } + if (!callLink[1]) { + callLink[1] = '_blank'; + } + link = callLink[0]; + target = callLink[1]; + break; + } + } + return { + type: type, + fun: fun, + link: link, + target: target + } + }, + /* + 内置函数 + 根据指定的align,valign,offsetX,offsetY计算坐标 + */ + getPosition: function(obj,rEle) { + /* + { + "align": "right", + "vAlign": "right", + "offsetX": -60, + "offsetY": -60 + } + */ + var pw = this.PD.offsetWidth, + ph = this.PD.offsetHeight; + var x = 0, + y = 0; + var left=0,top=0,rw=0,rh=0; + if(!this.isUndefined(rEle)){ + left=parseInt(this.css(rEle,'left')),top=parseInt(this.css(rEle,'top')),rw=rEle.offsetWidth,rh=rEle.offsetHeight; + } + switch (obj['align']) { + case 'left': + x = obj['offsetX']+left; + break; + case 'center': + x = pw * 0.5 + obj['offsetX']; + if(left){ + x-=(pw*0.5-rw*0.5-left); + } + break; + case 'right': + x = pw + obj['offsetX']; + if(left){ + x-=(pw-left-rw); + } + break; + } + switch (obj['vAlign']) { + case 'top': + y = obj['offsetY']+top; + break; + case 'middle': + y = ph * 0.5 + obj['offsetY']-top-(rh*0.5); + if(top){ + x-=(ph*0.5-rh*0.5-top); + } + break; + case 'bottom': + y = ph + obj['offsetY']; + if(top){ + y-=(ph-top-rh); + } + break; + } + return { + x: x, + y: y + }; + }, + /* + 内置函数 + 向播放器界面添加一个文本 + */ + addElement: function(attribute) { + var thisTemp = this; + if (this.playerType == 'flashplayer') { + return this.V.addElement(attribute); + } + var i = 0; + var obj = { + list: null, + x: '100%', + y: "50%", + position: null, + alpha: 1, + backgroundColor: '', + backAlpha: 1, + backRadius: 0, + clickEvent: '' + }; + obj = this.standardization(obj, attribute); + var list = obj['list']; + if (list == null) { + return ''; + } + var id = 'element-' + this.randomString(10); + var ele = document.createElement('div'); + ele.className = id; + if (obj['x']) { + ele.setAttribute('data-x', obj['x']); + } + if (obj['y']) { + ele.setAttribute('data-y', obj['y']); + } + if (obj['position'] != null) { + ele.setAttribute('data-position', obj['position'].join(',')); + } + + this.PD.appendChild(ele); + this.css(ele, { + position: 'absolute', + filter: 'alpha(opacity:' + obj['alpha'] + ')', + opacity: obj['alpha'].toString(), + width: '800px', + zIndex: '20' + }); + var bgid = 'elementbg' + this.randomString(10); + var bgAlpha = obj['alpha'].toString(); + var bgColor = obj['backgroundColor'].replace('0x', '#'); + var html = ''; + var idArr = []; + var clickArr = []; + if (!this.isUndefined(list) && list.length > 0) { + var textObj, returnObj, clickEvent; + for (i = 0; i < list.length; i++) { + var newEleid = 'elementnew' + this.randomString(10); + switch (list[i]['type']) { + case 'image': + case 'png': + case 'jpg': + case 'jpeg': + case 'gif': + textObj = { + type: 'image', + file: '', + radius: 0,//圆角弧度 + width: 30,//定义宽,必需要定义 + height: 30,//定义高,必需要定义 + alpha: 1,//透明度 + paddingLeft: 0,//左边距离 + paddingRight: 0,//右边距离 + paddingTop: 0, + paddingBottom: 0, + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: '', + clickEvent: '' + }; + + list[i] = this.standardization(textObj, list[i]); + clickEvent = this.clickEvent(list[i]['clickEvent']); + clickArr.push(clickEvent); + if (clickEvent['type'] == 'link') { + html += '
'; + } else { + html += '
'; + } + break; + case 'text': + textObj = { + type: 'text',//说明是文本 + text: '',//文本内容 + color: '0xFFFFFF', + size: 14, + fontFamily: this.fontFamily, + leading: 0, + alpha: 1,//透明度 + paddingLeft: 0,//左边距离 + paddingRight: 0,//右边距离 + paddingTop: 0, + paddingBottom: 0, + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: '', + backAlpha: 1, + backRadius: 0,//背景圆角弧度,支持数字统一设置,也支持分开设置[30,20,20,50],对应上左,上右,下右,下左 + clickEvent: '' + }; + list[i] = this.standardization(textObj, list[i]); + clickEvent = this.clickEvent(list[i]['clickEvent']); + clickArr.push(clickEvent); + if (clickEvent['type'] == 'link') { + html += ''; + } else { + html += '
' + list[i]['text'] + '
'; + } + break; + default: + break; + } + idArr.push(newEleid); + } + } + var objClickEvent = this.clickEvent(obj['clickEvent']); + ele.innerHTML = '
' + html + '
'; + if (objClickEvent['type'] == 'javaScript' || objClickEvent['type'] == 'actionScript') { + var objClickHandler = function() { + eval(objClickEvent['fun']); + thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); + }; + this.addListenerInside('click', objClickHandler, this.getByElement(bgid + '_c')) + } + this.css(bgid + '_c', { + position: 'absolute', + zIndex: '2' + }); + for (i = 0; i < idArr.length; i++) { + var clk = clickArr[i]; + if (clk['type'] == 'javaScript' || clk['type'] == 'actionScript') { + var clickHandler = function() { + //clk = clickArr[this.getAttribute('data-i')]; + clk = clickArr[thisTemp.getDataset(this,'i')]; + eval(clk['fun']); + thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); + }; + this.addListenerInside('click', clickHandler, this.getByElement(idArr[i])) + } + switch (list[i]['type']) { + case 'image': + case 'png': + case 'jpg': + case 'jpeg': + case 'gif': + this.css(idArr[i], { + float: 'left', + width: list[i]['width'] + 'px', + height: list[i]['height'] + 'px', + filter: 'alpha(opacity:' + list[i]['alpha'] + ')', + opacity: list[i]['alpha'].toString(), + marginLeft: list[i]['marginLeft'] + 'px', + marginRight: list[i]['marginRight'] + 'px', + marginTop: list[i]['marginTop'] + 'px', + marginBottom: list[i]['marginBottom'] + 'px', + borderRadius: list[i]['radius'] + 'px', + cursor: 'pointer' + }); + this.css(idArr[i] + '_image', { + width: list[i]['width'] + 'px', + height: list[i]['height'] + 'px', + borderRadius: list[i]['radius'] + 'px' + }); + break; + case 'text': + this.css(idArr[i] + '_text', { + filter: 'alpha(opacity:' + list[i]['alpha'] + ')', + opacity: list[i]['alpha'].toString(), + borderRadius: list[i]['radius'] + 'px', + fontFamily: list[i]['font'], + fontSize: list[i]['size'] + 'px', + color: list[i]['color'].replace('0x', '#'), + lineHeight: list[i]['leading'] > 0 ? list[i]['leading'] + 'px': '', + paddingLeft: list[i]['paddingLeft'] + 'px', + paddingRight: list[i]['paddingRight'] + 'px', + paddingTop: list[i]['paddingTop'] + 'px', + paddingBottom: list[i]['paddingBottom'] + 'px', + whiteSpace: 'nowrap', + position: 'absolute', + zIndex: '3', + cursor: 'pointer' + }); + this.css(idArr[i], { + float: 'left', + width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', + height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', + marginLeft: list[i]['marginLeft'] + 'px', + marginRight: list[i]['marginRight'] + 'px', + marginTop: list[i]['marginTop'] + 'px', + marginBottom: list[i]['marginBottom'] + 'px' + }); + this.css(idArr[i] + '_bg', { + width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', + height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', + filter: 'alpha(opacity:' + list[i]['backAlpha'] + ')', + opacity: list[i]['backAlpha'].toString(), + borderRadius: list[i]['backRadius'] + 'px', + backgroundColor: list[i]['backgroundColor'].replace('0x', '#'), + position: 'absolute', + zIndex: '2' + }); + break; + default: + break; + } + } + this.css(bgid, { + width: this.getByElement(bgid + '_c').offsetWidth + 'px', + height: this.getByElement(bgid + '_c').offsetHeight + 'px', + position: 'absolute', + filter: 'alpha(opacity:' + bgAlpha + ')', + opacity: bgAlpha, + backgroundColor: bgColor.replace('0x', '#'), + borderRadius: obj['backRadius'] + 'px', + zIndex: '1' + }); + this.css(ele, { + width: this.getByElement(bgid).offsetWidth + 'px', + height: this.getByElement(bgid).offsetHeight + 'px' + }); + var eidCoor = this.calculationCoor(ele); + this.css(ele, { + left: eidCoor['x'] + 'px', + top: eidCoor['y'] + 'px' + }); + + this.elementArr.push(ele.className); + return ele; + }, + /* + 内置函数 + 获取元件的属性,包括x,y,width,height,alpha + */ + getElement: function(element) { + if (this.playerType == 'flashplayer') { + return this.V.getElement(element); + } + var ele = element; + if (this.varType(element) == 'string') { + ele = this.getByElement(element); + } + var coor = this.getCoor(ele); + return { + x: coor['x'], + y: coor['y'], + width: ele.offsetWidth, + height: ele.offsetHeight, + alpha: !this.isUndefined(this.css(ele, 'opacity')) ? parseFloat(this.css(ele, 'opacity')) : 1, + show: this.css(ele, 'display') == 'none' ? false: true + }; + }, + /* + 内置函数 + 控制元件显示和隐藏 + */ + elementShow: function(element, show) { + if (this.playerType == 'flashplayer') { + this.V.elementShow(element, show); + return; + } + if (this.varType(element) == 'string') { + if (element) { + this.css(ele, 'display', show == true ? 'block': 'none'); + } else { + var arr = this.elementTempArr; + for (var i = 0; i < arr.length; i++) { + this.css(arr[i], 'display', show == true ? 'block': 'none'); + } + } + } + + }, + /* + 内置函数 + 根据节点的x,y计算在播放器里的坐标 + */ + calculationCoor: function(ele) { + if (this.playerType == 'flashplayer') { + return this.V.calculationCoor(ele); + } + if(this.isUndefined(ele)){ + return; + } + if (ele == []) { + return; + } + var x, y, position = []; + var w = this.PD.offsetWidth, + h = this.PD.offsetHeight; + var ew = ele.offsetWidth, + eh = ele.offsetHeight; + if (!this.isUndefined(this.getDataset(ele, 'x'))) { + x = this.getDataset(ele, 'x'); + } + if (!this.isUndefined(this.getDataset(ele, 'y'))) { + y = this.getDataset(ele, 'y'); + } + if (!this.isUndefined(this.getDataset(ele, 'position'))) { + try { + position = this.getDataset(ele, 'position').toString().split(','); + } catch(event) {} + } + if (position.length > 0) { + position.push(null, null, null, null); + var i = 0; + for (i = 0; i < position.length; i++) { + if (this.isUndefined(position[i]) || position[i] == null || position[i] == 'null' || position[i] == '') { + position[i] = null; + } else { + position[i] = parseFloat(position[i]); + } + } + + if (position[2] == null) { + switch (position[0]) { + case 0: + x = 0; + break; + case 1: + x = parseInt((w - ew) * 0.5); + break; + default: + x = w - ew; + break; + } + } else { + switch (position[0]) { + case 0: + x = position[2]; + break; + case 1: + x = parseInt(w * 0.5) + position[2]; + break; + default: + x = w + position[2]; + break; + } + } + if (position[3] == null) { + switch (position[1]) { + case 0: + y = 0; + break; + case 1: + y = parseInt((h - eh) * 0.5); + break; + default: + y = h - eh; + break; + } + } else { + switch (position[1]) { + case 0: + y = position[3]; + break; + case 1: + y = parseInt(h * 0.5) + position[3]; + break; + default: + y = h + position[3]; + break; + } + } + } else { + if (x.substring(x.length - 1, x.length) == '%') { + x = Math.floor(parseInt(x.substring(0, x.length - 1)) * w * 0.01); + } + if (y.substring(y.length - 1, y.length) == '%') { + y = Math.floor(parseInt(y.substring(0, y.length - 1)) * h * 0.01); + } + } + return { + x: x, + y: y + } + + }, + /* + 内置函数 + 修改新增元件的坐标 + */ + changeElementCoor: function() { + for (var i = 0; i < this.elementArr.length; i++) { + if(!this.isUndefined(this.getByElement(this.elementArr[i]))){ + if (this.getByElement(this.elementArr[i]) != []) { + var c = this.calculationCoor(this.getByElement(this.elementArr[i])); + if (c['x'] && c['y']) { + this.css(this.elementArr[i], { + top: c['y'] + 'px', + left: c['x'] + 'px' + }); + } + } + } + } + }, + /* + 内置函数 + 缓动效果集 + */ + tween: function() { + var Tween = { + None: { //均速运动 + easeIn: function(t, b, c, d) { + return c * t / d + b; + }, + easeOut: function(t, b, c, d) { + return c * t / d + b; + }, + easeInOut: function(t, b, c, d) { + return c * t / d + b; + } + }, + Quadratic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t + b; + }, + easeOut: function(t, b, c, d) { + return - c * (t /= d) * (t - 2) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t + b; + return - c / 2 * ((--t) * (t - 2) - 1) + b; + } + }, + Cubic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t + b; + }, + easeOut: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; + return c / 2 * ((t -= 2) * t * t + 2) + b; + } + }, + Quartic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t * t + b; + }, + easeOut: function(t, b, c, d) { + return - c * ((t = t / d - 1) * t * t * t - 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; + return - c / 2 * ((t -= 2) * t * t * t - 2) + b; + } + }, + Quintic: { + easeIn: function(t, b, c, d) { + return c * (t /= d) * t * t * t * t + b; + }, + easeOut: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t * t * t + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; + return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; + } + }, + Sine: { + easeIn: function(t, b, c, d) { + return - c * Math.cos(t / d * (Math.PI / 2)) + c + b; + }, + easeOut: function(t, b, c, d) { + return c * Math.sin(t / d * (Math.PI / 2)) + b; + }, + easeInOut: function(t, b, c, d) { + return - c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; + } + }, + Exponential: { + easeIn: function(t, b, c, d) { + return (t == 0) ? b: c * Math.pow(2, 10 * (t / d - 1)) + b; + }, + easeOut: function(t, b, c, d) { + return (t == d) ? b + c: c * ( - Math.pow(2, -10 * t / d) + 1) + b; + }, + easeInOut: function(t, b, c, d) { + if (t == 0) return b; + if (t == d) return b + c; + if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; + return c / 2 * ( - Math.pow(2, -10 * --t) + 2) + b; + } + }, + Circular: { + easeIn: function(t, b, c, d) { + return - c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; + }, + easeOut: function(t, b, c, d) { + return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; + }, + easeInOut: function(t, b, c, d) { + if ((t /= d / 2) < 1) return - c / 2 * (Math.sqrt(1 - t * t) - 1) + b; + return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; + } + }, + Elastic: { + easeIn: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + return - (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + }, + easeOut: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d) == 1) return b + c; + if (!p) p = d * .3; + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + return (a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b); + }, + easeInOut: function(t, b, c, d, a, p) { + if (t == 0) return b; + if ((t /= d / 2) == 2) return b + c; + if (!p) p = d * (.3 * 1.5); + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } else var s = p / (2 * Math.PI) * Math.asin(c / a); + if (t < 1) return - .5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; + } + }, + Back: { + easeIn: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * (t /= d) * t * ((s + 1) * t - s) + b; + }, + easeOut: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; + }, + easeInOut: function(t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; + return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; + } + }, + Bounce: { + easeIn: function(t, b, c, d) { + return c - Tween.Bounce.easeOut(d - t, 0, c, d) + b; + }, + easeOut: function(t, b, c, d) { + if ((t /= d) < (1 / 2.75)) { + return c * (7.5625 * t * t) + b; + } else if (t < (2 / 2.75)) { + return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; + } else if (t < (2.5 / 2.75)) { + return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; + } else { + return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; + } + }, + easeInOut: function(t, b, c, d) { + if (t < d / 2) return Tween.Bounce.easeIn(t * 2, 0, c, d) * .5 + b; + else return Tween.Bounce.easeOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b; + } + } + }; + return Tween; + }, + /* + 接口函数 + 缓动效果 + ele:Object=需要缓动的对象, + parameter:String=需要改变的属性:x,y,width,height,alpha, + effect:String=效果名称, + start:Int=起始值, + end:Int=结束值, + speed:Number=运动的总秒数,支持小数 + */ + animate: function(attribute) { + if (this.playerType == 'flashplayer') { + return this.V.animate(attribute); + } + var thisTemp = this; + var animateId = 'animate_' + this.randomString(); + var obj = { + element: null, + parameter: 'x', + static: false, + effect: 'None.easeIn', + start: null, + end: null, + speed: 0, + overStop: false, + pauseStop: false, + //暂停播放时缓动是否暂停 + callBack: null + }; + obj = this.standardization(obj, attribute); + if (obj['element'] == null || obj['speed'] == 0) { + return false; + } + var w = this.PD.offsetWidth, + h = this.PD.offsetHeight; + var effArr = (obj['effect'] + '.').split('.'); + var tweenFun = this.tween()[effArr[0]][effArr[1]]; + var eleCoor = { + x: 0, + y: 0 + }; + if (this.isUndefined(tweenFun)) { + return false; + } + //先将该元件从元件数组里删除,让其不再跟随播放器的尺寸改变而改变位置 + var def = this.arrIndexOf(this.elementArr, obj['element'].className); + if (def > -1) { + this.elementTempArr.push(obj['element'].className); + this.elementArr.splice(def, 1); + } + //var run = true; + var css = {}; + //对传递的参数进行转化,x和y转化成left,top + var pm = this.getElement(obj['element']); //包含x,y,width,height,alpha属性 + var t = 0; //当前时间 + var b = 0; //初始值 + var c = 0; //变化量 + var d = obj['speed'] * 1000; //持续时间 + var timerTween = null; + var tweenObj = null; + var start = obj['start'] == null ? '': obj['start'].toString(); + var end = obj['end'] == null ? '': obj['end'].toString(); + switch (obj['parameter']) { + case 'x': + if (obj['start'] == null) { + b = pm['x']; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(start) * w * 0.01; + } else { + b = parseInt(start); + } + + } + if (obj['end'] == null) { + c = pm['x'] - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) * w * 0.01 - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) - b; + } else { + c = parseInt(end); + } + + } else { + c = parseInt(end) - b; + } + } + break; + case 'y': + if (obj['start'] == null) { + b = pm['y']; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(start) * h * 0.01; + } else { + b = parseInt(start); + } + + } + if (obj['end'] == null) { + c = pm['y'] - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) * h * 0.01 - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) - b; + } else { + c = parseInt(end); + } + } else { + c = parseInt(end) - b; + } + } + break; + case 'alpha': + if (obj['start'] == null) { + b = pm['alpha'] * 100; + } else { + if (start.substring(start.length - 1, start.length) == '%') { + b = parseInt(obj['start']); + } else { + b = parseInt(obj['start'] * 100); + } + + } + if (obj['end'] == null) { + c = pm['alpha'] * 100 - b; + } else { + if (end.substring(end.length - 1, end.length) == '%') { + c = parseInt(end) - b; + } else if (end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { + if (this.varType(obj['end']) == 'number') { + c = parseInt(obj['end']) * 100 - b; + } else { + c = parseInt(obj['end']) * 100; + } + } else { + c = parseInt(obj['end']) * 100 - b; + } + } + break; + } + var callBack = function() { + var index = thisTemp.arrIndexOf(thisTemp.animateElementArray, animateId); + if (index > -1) { + thisTemp.animateArray.splice(index, 1); + thisTemp.animateElementArray.splice(index, 1); + } + index = thisTemp.arrIndexOf(thisTemp.animatePauseArray, animateId); + if (index > -1) { + thisTemp.animatePauseArray.splice(index, 1); + } + if (obj['callBack'] != null && obj['element'] && obj['callBack'] != 'callBack' && obj['callBack'] != 'tweenX' && obj['tweenY'] != 'callBack' && obj['callBack'] != 'tweenAlpha') { + var cb = eval(obj['callBack']); + cb(obj['element']); + obj['callBack'] = null; + } + }; + var stopTween = function() { + if (timerTween != null) { + if (timerTween.runing) { + timerTween.stop(); + } + timerTween = null; + } + }; + var tweenX = function() { + if (t < d) { + t += 10; + css = { + left: Math.ceil(tweenFun(t, b, c, d)) + 'px' + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['top'] = eleCoor['y'] + 'px'; + } + thisTemp.css(obj['element'], css); + + } else { + stopTween(); + try { + var defX = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defX > -1) { + this.elementTempArr.splice(defX, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + var tweenY = function() { + if (t < d) { + t += 10; + css = { + top: Math.ceil(tweenFun(t, b, c, d)) + 'px' + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['left'] = eleCoor['x'] + 'px'; + } + thisTemp.css(obj['element'], css); + } else { + stopTween(); + try { + var defY = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defY > -1) { + this.elementTempArr.splice(defY, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + var tweenAlpha = function() { + if (t < d) { + t += 10; + eleCoor = thisTemp.calculationCoor(obj['element']); + var ap = Math.ceil(tweenFun(t, b, c, d)) * 0.01; + css = { + filter: 'alpha(opacity:' + ap + ')', + opacity: ap.toString() + }; + if (obj['static']) { + eleCoor = thisTemp.calculationCoor(obj['element']); + css['top'] = eleCoor['y'] + 'px'; + css['left'] = eleCoor['x'] + 'px'; + } + thisTemp.css(obj['element'], css); + } else { + stopTween(); + try { + var defA = this.arrIndexOf(this.elementTempArr, obj['element'].className); + if (defA > -1) { + this.elementTempArr.splice(defA, 1); + } + } catch(event) {} + thisTemp.elementArr.push(obj['element'].className); + callBack(); + } + }; + switch (obj['parameter']) { + case 'x': + tweenObj = tweenX; + break; + case 'y': + tweenObj = tweenY; + break; + case 'alpha': + tweenObj = tweenAlpha; + break; + default: + break; + } + timerTween = new thisTemp.timer(10, tweenObj); + timerTween.callBackFunction = callBack; + if (obj['overStop']) { + var mouseOver = function() { + if (timerTween != null && timerTween.runing) { + timerTween.stop(); + } + }; + this.addListenerInside('mouseover', mouseOver, obj['element']); + var mouseOut = function() { + var start = true; + if (obj['pauseStop'] && thisTemp.getMetaDate()['paused']) { + start = false; + } + if (timerTween != null && !timerTween.runing && start) { + timerTween.start(); + } + }; + this.addListenerInside('mouseout', mouseOut, obj['element']); + } + + this.animateArray.push(timerTween); + this.animateElementArray.push(animateId); + if (obj['pauseStop']) { + this.animatePauseArray.push(animateId); + } + return animateId; + }, + /* + 接口函数函数 + 继续运行animate + */ + animateResume: function(id) { + if (this.playerType == 'flashplayer') { + this.V.animateResume(this.isUndefined(id) ? '': id); + return; + } + var arr = []; + if (id != '' && !this.isUndefined(id) && id != 'pause') { + arr.push(id); + } else { + if (id === 'pause') { + arr = this.animatePauseArray; + } else { + arr = this.animateElementArray; + } + } + for (var i = 0; i < arr.length; i++) { + var index = this.arrIndexOf(this.animateElementArray, arr[i]); + if (index > -1) { + this.animateArray[index].start(); + } + } + + }, + /* + 接口函数 + 暂停运行animate + */ + animatePause: function(id) { + if (this.playerType == 'flashplayer') { + this.V.animatePause(this.isUndefined(id) ? '': id); + return; + } + var arr = []; + if (id != '' && !this.isUndefined(id) && id != 'pause') { + arr.push(id); + } else { + if (id === 'pause') { + arr = this.animatePauseArray; + } else { + arr = this.animateElementArray; + } + } + for (var i = 0; i < arr.length; i++) { + var index = this.arrIndexOf(this.animateElementArray, arr[i]); + if (index > -1) { + this.animateArray[index].stop(); + } + } + }, + /* + 内置函数 + 根据ID删除数组里对应的内容 + */ + deleteAnimate: function(id) { + if (this.playerType == 'flashplayer' && this.V) { + try { + this.V.deleteAnimate(id); + } catch(event) { + this.log(event); + } + return; + } + var index = this.arrIndexOf(this.animateElementArray, id); + if (index > -1) { + this.animateArray[index].callBackFunction(); + this.animateArray.splice(index, 1); + this.animateElementArray.splice(index, 1); + } + }, + /* + 内置函数 + 删除外部新建的元件 + */ + deleteElement: function(ele) { + if (this.playerType == 'flashplayer' && this.V) { + try { + this.V.deleteElement(ele); + } catch(event) {} + return; + } + //先将该元件从元件数组里删除,让其不再跟随播放器的尺寸改变而改变位置 + var def = this.arrIndexOf(this.elementArr, ele.className); + if (def > -1) { + this.elementArr.splice(def, 1); + } + try { + def = this.arrIndexOf(this.elementTempArr, ele.className); + if (def > -1) { + this.elementTempArr.splice(def, 1); + } + } catch(event) {} + this.deleteAnimate(ele.className); + this.deleteChild(ele); + }, + /* + -------------------------------------------------------------- + 共用函数部分 + 以下函数并非只能在本程序中使用,也可以在页面其它项目中使用 + 根据ID或className获取元素对象 + */ + getByElement: function(obj, parent) { + if (this.isUndefined(parent)) { + parent = document; + } + var num = obj.substr(0, 1); + var res = []; + if (num != '#') { + if (num == '.') { + obj = obj.substr(1, obj.length); + } + if (parent.getElementsByClassName) { + res = parent.getElementsByClassName(obj); + if(!res.length){ + return null; + } + } else { + var reg = new RegExp(' ' + obj + ' ', 'i'); + var ele = parent.getElementsByTagName('*'); + for (var i = 0; i < ele.length; i++) { + if (reg.test(' ' + ele[i].className + ' ')) { + res.push(ele[i]); + } + } + } + if (res.length > 0) { + res=res[0]; + } + else{ + res=null; + } + } else { + if (num == '#') { + obj = obj.substr(1, obj.length); + } + try{ + res=document.getElementById(obj); + } + catch(event){ + res=null; + } + } + return res; + }, + /* + 共用函数 + 功能:修改样式或获取指定样式的值, + elem:ID对象或ID对应的字符,如果多个对象一起设置,则可以使用数组 + attribute:样式名称或对象,如果是对象,则省略掉value值 + value:attribute为样式名称时,定义的样式值 + 示例一: + this.css(ID,'width','100px'); + 示例二: + this.css('id','width','100px'); + 示例三: + this.css([ID1,ID2,ID3],'width','100px'); + 示例四: + this.css(ID,{ + width:'100px', + height:'100px' + }); + 示例五(获取宽度): + var width=this.css(ID,'width'); + */ + css: function(elem, attribute, value) { + var i = 0; + var k = ''; + if (this.varType(elem) == 'array') { //数组 + for (i = 0; i < elem.length; i++) { + var el; + if (typeof(elem[i]) == 'string') { + el = this.getByElement(elem[i]) + } else { + el = elem[i]; + } + if (typeof(attribute) != 'object') { + if (!this.isUndefined(value)) { + el.style[attribute] = value; + } + } else { + for (k in attribute) { + if (!this.isUndefined(attribute[k])) { + try { + el.style[k] = attribute[k]; + } catch(event) { + this.log(event); + } + } + } + } + } + return; + + } + if (this.varType(elem) == 'string') { + elem = this.getByElement(elem); + } + if (this.varType(attribute) != 'object') { + if (!this.isUndefined(value)) { + elem.style[attribute] = value; + } else { + if (!this.isUndefined(this.getStyle(elem, attribute))) { + return this.getStyle(elem, attribute); + } else { + return false; + } + } + } else { + for (k in attribute) { + if (!this.isUndefined(attribute[k])) { + elem.style[k] = attribute[k]; + } + } + } + + }, + /* + 内置函数 + 兼容型获取style + */ + getStyle: function(obj, attr) { + if (!this.isUndefined(obj.style[attr])) { + return obj.style[attr]; + } else { + if (obj.currentStyle) { + return obj.currentStyle[attr]; + } else { + return getComputedStyle(obj, false)[attr]; + } + } + }, + /* + 共用函数 + 判断变量是否存在或值是否为undefined + */ + isUndefined: function(value) { + try { + if (value === 'undefined' || value === undefined || value === null || value === 'NaN' || value === NaN) { + return true; + } + } catch(event) { + this.log(event); + return true; + } + return false; + }, + /* + 共用函数 + 外部监听函数 + */ + addListener: function(name, funName) { + if (name && funName) { + if (this.playerType == 'flashplayer') { + var ff = ''; //定义用来向flashplayer传递的函数字符 + if (this.varType(funName) == 'function') { + ff = this.getParameterNames(funName); + } + this.V.addListener(name, ff); + return; + } + var have = false; + for (var i = 0; i < this.listenerJsArr.length; i++) { + var arr = this.listenerJsArr[i]; + if (arr[0] == name && arr[1] == funName) { + have = true; + break; + } + } + if (!have) { + this.listenerJsArr.push([name, funName]); + } + } + }, + /* + 共用函数 + 外部删除监听函数 + */ + removeListener: function(name, funName) { + if (name && funName) { + if (this.playerType == 'flashplayer') { + var ff = ''; //定义用来向flashplayer传递的函数字符 + if (this.varType(funName) == 'function') { + ff = this.getParameterNames(funName); + } + this.V.removeListener(name, ff); + return; + } + for (var i = 0; i < this.listenerJsArr.length; i++) { + var arr = this.listenerJsArr[i]; + if (arr[0] == name && arr[1] == funName) { + this.listenerJsArr.splice(i, 1); + break; + } + } + } + }, + /* + 内部监听函数,调用方式: + this.addListenerInside('click',function(event){},[ID]); + d值为空时,则表示监听当前的视频播放器 + */ + addListenerInside: function(e, f, d, t) { + if (this.isUndefined(t)) { + t = false; + } + var o = this.V; + if (!this.isUndefined(d)) { + o = d; + } + if (o.addEventListener) { + try { + o.addEventListener(e, f, t); + } catch(event) {this.log(event)} + } else if (o.attachEvent) { + try { + o.attachEvent('on' + e, f); + } catch(event) {this.log(event)} + } else { + o['on' + e] = f; + } + }, + /* + 删除内部监听函数,调用方式: + this.removeListenerInside('click',function(event){}[,ID]); + d值为空时,则表示监听当前的视频播放器 + */ + removeListenerInside: function(e, f, d, t) { + /*if(this.playerType=='flashplayer' && this.getParameterNames(f) && this.isUndefined(d)) { + return; + }*/ + if (this.isUndefined(t)) { + t = false; + } + var o = this.V; + if (!this.isUndefined(d)) { + o = d; + } + if (o.removeEventListener) { + try { + this.addNum--; + o.removeEventListener(e, f, t); + } catch(e) {} + } else if (o.detachEvent) { + try { + o.detachEvent('on' + e, f); + } catch(e) {} + } else { + o['on' + e] = null; + } + }, + /* + 共用函数 + 统一分配监听,以达到跟as3同样效果 + */ + sendJS: function(name, val) { + if (this.adPlayerPlay && name.substr( - 2) != 'Ad') { + return; + } + if(this.isUndefined(name)){ + return; + } + var list = this.listenerJsArr; + var obj = this.vars['variable']; + if(this.vars['debug']){ + this.log(name+':'+val); + } + for (var i = 0; i < list.length; i++) { + var arr = list[i]; + if (arr[0] == name) { + if (!this.isUndefined(val)) { + switch (arr[1].length) { + case 1: + arr[1](val); + break; + case 2: + arr[1](val, obj); + break; + default: + arr[1](); + break; + } + + } else { + arr[1](obj); + } + } + } + }, + /* + 共用函数 + 获取函数名称,如 function ckplayer(){} var fun=ckplayer,则getParameterNames(fun)=ckplayer + */ + getParameterNames: function(fn) { + if (this.varType(fn) !== 'function') { + return false; + } + var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + var code = fn.toString().replace(COMMENTS, ''); + var result = code.slice(code.indexOf(' ') + 1, code.indexOf('(')); + return result === null ? false: result; + }, + /* + 共用函数 + 时间替换 + */ + replaceTime:function(str,obj){ + //var timeStrArr = ['[$timeh]', '[$timei]', '[$timeI]', '[$times]', '[$timeS]', '[$durationh]', '[$durationi]', '[$durationI]', '[$durations]', '[$durationS]','[$liveTimey]', '[$liveTimeY]', '[$liveTimem]', '[$liveTimed]', '[$liveTimeh]', '[$liveTimei]', '[$liveTimes]', '[$liveLanguage]']; + for(var k in obj){ + str=str.replace('[$'+k+']',obj[k]) + } + return str; + }, + /* + 共用函数 + 格式化时分秒 + t:Int:秒数,dt:总时间的秒数 + */ + formatTime: function(t,dt,str) { + if (this.isUndefined(t) || isNaN(t)) { + seconds = 0; + } + if (this.isUndefined(dt) || isNaN(dt)) { + dt = 0; + } + var minuteS=Math.floor(t/60);//将秒数直接转化成分钟取整,这个可以得到如80分钟 + var minute=minuteS;//获取准确的分钟 + var hourS=Math.floor(t/360);//将秒数直接转化成小时取整,这个可以得到100小时 + var second=t %60; + if(minuteS>=60){ + minute=Math.floor(minuteS%60); + } + //总时间 + var hminuteS=Math.floor(dt/60);//将秒数直接转化成分钟取整,这个可以得到如80分钟 + var hminute=hminuteS;//获取准确的分钟 + var hhourS=Math.floor(dt/360);//将秒数直接转化成小时取整,这个可以得到100小时 + var hsecond=dt %60; + if(hminuteS>=60){ + hminute=Math.floor(hminuteS%60); + } + //当前时间 + var nowDate = new Date(); + var obj={ + timeh:hourS,//时 + timei:minute,//分 + timeI:minuteS,//只有分 + times:second,//秒 + timeS:t,//只有秒 + durationh:hhourS,//时 + durationi:hminute,//分 + durationI:hminuteS,//只有分 + durations:hsecond,//秒 + durationS:dt,//只有秒 + liveTimey:nowDate.getYear(),//获取当前年份(2位) + liveTimeY:nowDate.getFullYear(),//获取完整的年份(4位,1970-????) + liveTimem:nowDate.getMonth()+1,//获取当前月份(0-11,0代表1月) + liveTimed:nowDate.getDate(),// 获取当前日(1-31) + liveTimeh:nowDate.getHours(), // 获取当前小时数(0-23) + liveTimei:nowDate.getMinutes(),// 获取当前分钟数(0-59) + liveTimes:nowDate.getSeconds()// 获取当前秒数(0-59) + }; + for(var k in obj){ + if(obj[k]<10){ + obj[k]='0'+Math.floor(obj[k]); + } + else{ + obj[k]=Math.floor(obj[k]).toString(); + } + } + return this.replaceTime(str,obj); + }, + /* + 共用函数 + 获取一个随机字符 + len:随机字符长度 + */ + randomString: function(len) { + len = len || 16; + var chars = 'abcdefghijklmnopqrstuvwxyz'; + var maxPos = chars.length; + var val = ''; + for (i = 0; i < len; i++) { + val += chars.charAt(Math.floor(Math.random() * maxPos)); + } + return 'ch' + val; + }, + /* + 共用函数 + 获取字符串长度,中文算两,英文数字算1 + */ + getStringLen: function(str) { + if(this.isUndefined(str)){ + return 0; + } + var len = 0; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) { + len += 2; + } else { + len++; + } + } + return len; + }, + /* + 内部函数 + 用来为ajax提供支持 + */ + createXHR: function() { + if (window.XMLHttpRequest) { + //IE7+、Firefox、Opera、Chrome 和Safari + return new XMLHttpRequest(); + } else if (window.ActiveXObject) { + //IE6 及以下 + try { + return new ActiveXObject('Microsoft.XMLHTTP'); + } catch(event) { + try { + return new ActiveXObject('Msxml2.XMLHTTP'); + } catch(event) { + this.eject(this.errorList[7]); + } + } + } else { + this.eject(this.errorList[8]); + } + }, + /* + 共用函数 + ajax调用 + */ + ajax: function(cObj) { + var thisTemp = this; + var callback = null; + var obj = { + method: 'get',//请求类型 + dataType: 'json',//请求的数据类型 + charset: 'utf-8', + async: false,//true表示异步,false表示同步 + url: '', + data: null, + success: null, + error:null + }; + if (this.varType(cObj) != 'object') { + this.eject(this.errorList[9]); + return; + } + obj = this.standardization(obj, cObj); + if (obj.dataType === 'json' || obj.dataType === 'text' || obj.dataType === 'html' || obj.dataType === 'xml') { + var xhr = this.createXHR(); + callback = function() { + //判断http的交互是否成功 + if (xhr.status == 200) { + if (thisTemp.isUndefined(obj.success)) { + return; + } + if (obj.dataType === 'json') { + try { + obj.success(eval('(' + xhr.responseText + ')')); //回调传递参数 + } catch(event) { + if(!thisTemp.isUndefined(obj['error'])){ + obj.error(event); + } + } + } else { + obj.success(xhr.responseText); //回调传递参数 + } + } + else { + obj.success(null); + thisTemp.eject(thisTemp.errorList[10], 'Ajax.status:' + xhr.status); + } + }; + obj.url = obj.url.indexOf('?') == -1 ? obj.url + '?rand=' + this.randomString(6) : obj.url; + obj.data = this.formatParams(obj.data); //通过params()将名值对转换成字符串 + if (obj.method === 'get' && !this.isUndefined(obj.data)) { + if (obj.data != '') { + if (obj.url.indexOf('?') == -1) { + obj.url += '?' + obj.data + } else { + obj.url += '&' + obj.data; + } + } + } + if (obj.async === true) { //true表示异步,false表示同步 + xhr.onreadystatechange = function() { + if (xhr.readyState == 4 && callback != null) { //判断对象的状态是否交互完成 + callback(); //回调 + } + }; + } + xhr.open(obj.method, obj.url, obj.async); + if (obj.method === 'post') { + try{ + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('charset', obj['charset']); + xhr.send(obj.data); + } + catch(event){ + callback(); + } + } + else { + try{ + xhr.send(null); //get方式则填null + } + catch(event){ + callback(); + } + } + if (obj.async === false) { //同步 + callback(); + } + + } + else if (obj.dataType === 'jsonp') { + var oHead = document.getElementsByTagName('head')[0]; + var oScript = document.createElement('script'); + var callbackName = 'callback' + new Date().getTime(); + var params = this.formatParams(obj.data) + '&callback=' + callbackName; //按时间戳拼接字符串 + callback = obj.success; + //拼接好src + oScript.src = obj.url.split('?') + '?' + params; + //插入script标签 + oHead.insertBefore(oScript, oHead.firstChild); + //jsonp的回调函数 + window[callbackName] = function(json) { + callback(json); + oHead.removeChild(oScript); + }; + } + }, + /* + 内置函数 + 动态加载js + */ + loadJs: function(path, success) { + var oHead = document.getElementsByTagName('HEAD').item(0); + var oScript = document.createElement('script'); + oScript.type = 'text/javascript'; + oScript.src = this.getNewUrl(path); + oHead.appendChild(oScript); + oScript.onload = function() { + success(); + } + }, + /* + 共用函数 + 排除IE6-9 + */ + isMsie: function() { + var browser = navigator.appName; + var b_version = navigator.appVersion; + var version = b_version.split(';'); + var trim_Version = ''; + if (version.length > 1) { + trim_Version = version[1].replace(/[ ]/g, ''); + } + if (browser == 'Microsoft Internet Explorer' && (trim_Version == 'MSIE6.0' || trim_Version == 'MSIE7.0' || trim_Version == 'MSIE8.0' || trim_Version == 'MSIE9.0' || trim_Version == 'MSIE10.0')) { + return false; + } + return true; + }, + /* + 共用函数 + 判断是否安装了flashplayer + */ + uploadFlash: function() { + var swf; + if (navigator.userAgent.indexOf('MSIE') > 0) { + try { + var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + return true; + } catch(e) { + return false; + } + } + if (navigator.userAgent.indexOf('Firefox') > 0) { + swf = navigator.plugins['Shockwave Flash']; + if (swf) { + return true + } else { + return false; + } + } + return true; + }, + /* + 共用函数 + 检测浏览器是否支持HTML5-Video + */ + supportVideo: function() { + if (!this.isMsie()) { + return false; + } + if ( !! document.createElement('video').canPlayType) { + var vidTest = document.createElement('video'); + var oggTest; + try { + oggTest = vidTest.canPlayType('video/ogg; codecs="theora, vorbis"'); + } catch(error) { + oggTest = false; + } + if (!oggTest) { + var h264Test; + try { + h264Test = vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); + } catch(error) { + h264Test = false; + } + if (!h264Test) { + return false; + } else { + if (h264Test == "probably") { + return true; + } else { + return false; + } + } + } else { + if (oggTest == "probably") { + return true; + } else { + return false; + } + } + } else { + return false; + } + }, + /* + 共用函数 + 获取属性值 + */ + getDataset: function(ele, z) { + try { + return ele.dataset[z]; + } catch(error) { + try { + return ele.getAttribute('data-' + z) + } catch(error) { + return false; + } + } + }, + /* + 共用函数 + 返回flashplayer的对象 + */ + getObjectById: function(id) { + var x = null; + var y = this.getByElement('#' + id); + var r = 'embed'; + if (y && y.nodeName == 'OBJECT') { + if (this.varType(y.SetVariable) != 'undefined') { + x = y; + } else { + var z = y.getElementsByTagName(r)[0]; + if (z) { + x = z; + } + } + } + return x; + }, + /* + 共用函数 + 对象转地址字符串 + */ + formatParams: function(data) { + var arr = []; + for (var i in data) { + arr.push(encodeURIComponent(i) + '=' + encodeURIComponent(data[i])); + } + return arr.join('&'); + }, + /* + 内置函数 + 对地址进行冒泡排序 + */ + arrSort: function(arr) { + var temp = []; + for (var i = 0; i < arr.length; i++) { + for (var j = 0; j < arr.length - i; j++) { + if (!this.isUndefined(arr[j + 1]) && arr[j][3] < arr[j + 1][3]) { + temp = arr[j + 1]; + arr[j + 1] = arr[j]; + arr[j] = temp; + } + } + } + return arr; + }, + /* + 共用函数 + 获取文件名称 + */ + getFileName: function(filepath) { + if(!filepath) return ''; + return filepath.replace(/(.*\/)*([^.]+).*/ig,'$2'); + }, + /* + 内置函数 + 判断文件后缀 + */ + getFileExt: function(filepath) { + if (filepath != '' && !this.isUndefined(filepath)) { + if (filepath.indexOf('?') > -1) { + filepath = filepath.split('?')[0]; + } + var pos = '.' + filepath.replace(/.+\./, ''); + return pos.toLowerCase(); + } + return ''; + }, + /* + 内置函数 + 判断是否是移动端 + */ + isMobile: function() { + if (navigator.userAgent.toLowerCase().match(/(iphone|ipad|ipod|android|ios|midp|windows mobile|windows ce|rv:1.2.3.4|ucweb)/i)) { + return true; + } + return false; + }, + /* + 内置函数 + 搜索字符串str是否包含key + */ + isContains: function(str, key) { + return str.indexOf(key) > -1; + }, + /* + 内置函数 + 给地址添加随机数 + */ + getNewUrl: function(url) { + if (this.isContains(url, '?')) { + return url += '&' + this.randomString(8) + '=' + this.randomString(8); + } else { + return url += '?' + this.randomString(8) + '=' + this.randomString(8); + } + }, + /* + 共用函数 + 获取clientX和clientY + */ + client: function(event) { + var eve = event || window.event; + if (this.isUndefined(eve)) { + eve = { + clientX: 0, + clientY: 0 + }; + } + return { + x: eve.clientX + (document.documentElement.scrollLeft || this.body.scrollLeft) - this.pdCoor['x'], + y: eve.clientY + (document.documentElement.scrollTop || this.body.scrollTop) - this.pdCoor['y'] + } + }, + /* + 内置函数 + 获取节点的绝对坐标 + */ + getCoor: function(obj) { + var coor = this.getXY(obj); + return { + x: coor['x'] - this.pdCoor['x'], + y: coor['y'] - this.pdCoor['y'] + }; + }, + getXY: function(obj) { + var parObj = obj; + var left = obj.offsetLeft; + var top = obj.offsetTop; + + while (parObj = parObj.offsetParent) { + left += parObj.offsetLeft; + top += parObj.offsetTop; + } + return { + x: left, + y: top + }; + }, + /* + 内置函数 + 删除本对象的所有属性 + */ + removeChild: function() { + if (this.playerType == 'html5video') { + //删除计时器 + var i = 0; + var timerArr = [this.timerError, this.timerFull, this.timerTime, this.timerBuffer, this.timerClick, this.timerCBar, this.timerVCanvas]; + for (i = 0; i < timerArr.length; i++) { + if (timerArr[i] != null) { + if (timerArr[i].runing) { + timerArr[i].stop(); + } + timerArr[i] = null; + } + } + //删除事件监听 + var ltArr = this.listenerJsArr; + for (i = 0; i < ltArr.length; i++) { + this.removeListener(ltArr[i][0], ltArr[i][1]); + } + } + this.playerType == ''; + this.V = null; + if (this.conBarShow) { + this.deleteChild(this.CB['menu']); + } + this.deleteChild(this.PD); + this.CD.innerHTML = ''; + }, + /* + 内置函数 + 画封闭的图形 + */ + canvasFill: function(name, path) { + name.beginPath(); + for (var i = 0; i < path.length; i++) { + var d = path[i]; + if (i > 0) { + name.lineTo(d[0], d[1]); + } else { + name.moveTo(d[0], d[1]); + } + } + name.closePath(); + name.fill(); + }, + /* + 内置函数 + 画矩形 + */ + canvasFillRect: function(name, path) { + for (var i = 0; i < path.length; i++) { + var d = path[i]; + name.fillRect(d[0], d[1], d[2], d[3]); + } + }, + /* + 共用函数 + 删除容器节点 + */ + deleteChild: function(f) { + var def = this.arrIndexOf(this.elementArr, f.className); + if (def > -1) { + this.elementArr.splice(def, 1); + } + var childs = f.childNodes; + for (var i = childs.length - 1; i >= 0; i--) { + f.removeChild(childs[i]); + } + + if (f && f != null && f.parentNode) { + try { + if (f.parentNode) { + f.parentNode.removeChild(f); + + } + + } catch(event) {} + } + }, + /* + 内置函数 + 根据容器的宽高,内部节点的宽高计算出内部节点的宽高及坐标 + */ + getProportionCoor: function(stageW, stageH, vw, vh) { + var w = 0, + h = 0, + x = 0, + y = 0; + if (stageW / stageH < vw / vh) { + w = stageW; + h = w * vh / vw; + } else { + h = stageH; + w = h * vw / vh; + } + x = (stageW - w) * 0.5; + y = (stageH - h) * 0.5; + return { + width: parseInt(w), + height: parseInt(h), + x: parseInt(x), + y: parseInt(y) + }; + }, + /* + 共用函数 + 将字幕文件内容转换成数组 + */ + parseSrtSubtitles: function(srt) { + var subtitlesArr = []; + var textSubtitles = []; + var i = 0; + var arrs = srt.split('\n'); + var arr = []; + var delHtmlTag = function(str) { + return str.replace(/<[^>]+>/g, ''); //去掉所有的html标记 + }; + for (i = 0; i < arrs.length; i++) { + if (arrs[i].replace(/\s/g, '').length > 0) { + arr.push(arrs[i]); + } else { + if (arr.length > 0) { + textSubtitles.push(arr); + } + arr = []; + } + } + for (i = 0; i < textSubtitles.length; ++i) { + var textSubtitle = textSubtitles[i]; + if (textSubtitle.length >= 2) { + var sn = textSubtitle[0]; // 字幕的序号 + var startTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[0])); // 字幕的开始时间 + var endTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[1])); // 字幕的结束时间 + var content = [delHtmlTag(textSubtitle[2])]; // 字幕的内容 + var cktrackdelay=this.vars['cktrackdelay']; + if(cktrackdelay!=0){ + startTime+=cktrackdelay; + endTime+=cktrackdelay; + } + // 字幕可能有多行 + if (textSubtitle.length > 2) { + for (var j = 3; j < textSubtitle.length; j++) { + content.push(delHtmlTag(textSubtitle[j])); + } + } + // 字幕对象 + var subtitle = { + sn: sn, + startTime: startTime, + endTime: endTime, + content: content + }; + subtitlesArr.push(subtitle); + } + } + return subtitlesArr; + }, + /* + 共用函数 + 计时器,该函数模拟as3中的timer原理 + time:计时时间,单位:毫秒 + fun:接受函数 + number:运行次数,不设置则无限运行 + */ + timer: function(time, fun, number) { + var thisTemp = this; + this.time = 10; //运行间隔 + this.fun = null; //监听函数 + this.timeObj = null; //setInterval对象 + this.number = 0; //已运行次数 + this.numberTotal = null; //总至需要次数 + this.runing = false; //当前状态 + this.startFun = function() { + thisTemp.number++; + thisTemp.fun(); + if (thisTemp.numberTotal != null && thisTemp.number >= thisTemp.numberTotal) { + thisTemp.stop(); + } + }; + this.start = function() { + if (!thisTemp.runing) { + thisTemp.runing = true; + thisTemp.timeObj = window.setInterval(thisTemp.startFun, time); + } + }; + this.stop = function() { + if (thisTemp.runing) { + thisTemp.runing = false; + window.clearInterval(thisTemp.timeObj); + thisTemp.timeObj = null; + } + }; + if (time) { + this.time = time; + } + if (fun) { + this.fun = fun; + } + if (number) { + this.numberTotal = number; + } + this.start(); + }, + /* + 共用函数 + 将时分秒转换成秒 + */ + toSeconds: function(t) { + var s = 0.0; + if (t) { + var p = t.split(':'); + for (i = 0; i < p.length; i++) { + s = s * 60 + parseFloat(p[i].replace(',', '.')); + } + } + return s; + }, + /*将字符变成数字形式的数组*/ + arrayInt: function(str) { + var a = str.split(','); + var b = []; + for (var i = 0; i < a.length; i++) { + if (this.isUndefined(a[i])) { + a[i] = 0; + } + if (a[i].substr( - 1) != '%') { + a[i] = parseInt(a[i]); + } + b.push(a[i]); + } + return b; + }, + /* + 共用函数 + 将对象Object标准化 + */ + standardization: function(o, n) { //n替换进o + var h = {}; + var k; + for (k in o) { + h[k] = o[k]; + } + for (k in n) { + var type =''; + if(h[k]){ + type = this.varType(h[k]); + } + switch (type) { + case 'number': + h[k] = parseFloat(n[k]); + break; + default: + h[k] = n[k]; + break; + } + } + return h; + }, + objectAssign:function(o,n) { + if(this.varType(o)!='object' || this.varType(n)!='object'){ + return null; + } + var obj1=this.newObj(o),obj2=this.newObj(n); + for(var k in obj2){ + if(this.varType(obj2[k])=='object'){ + if(this.varType(obj1[k])!='object'){ + obj1[k]={}; + } + obj1[k]=this.objectAssign(obj1[k],obj2[k]); + } + else{ + obj1[k]=obj2[k]; + } + } + return obj1; + }, + /* + 共用函数 + 搜索数组 + */ + arrIndexOf: function(arr, key) { + if(this.isUndefined(arr) || this.isUndefined(key)){ + return -1; + } + var re = new RegExp(key, ['']); + return (arr.toString().replace(re, '┢').replace(/[^,┢]/g, '')).indexOf('┢'); + }, + /* + 共用函数 + 去掉空格 + */ + trim: function(str) { + if (str != '') { + return str.replace(/(^\s*)|(\s*$)/g, ''); + } + return ''; + }, + /* + 共用函数 + 输出内容到控制台 + */ + log: function(val) { + try { + console.log(val); + } catch(e) {} + }, + /* + 共用函数 + 弹出提示 + */ + eject: function(er, val) { + if (!this.vars['debug']) { + return; + } + var errorVal = er[1]; + if (!this.isUndefined(val)) { + errorVal = errorVal.replace('[error]', val); + } + var value = 'error ' + er[0] + ':' + errorVal; + try { + this.log(value); + } catch(e) {} + }, + /* + 共用函数 + 系统错误 + */ + sysError: function(er, val) { + var ele= this.getByElement(this.vars['container']); + var errorVal = er[1]; + if (!this.isUndefined(val)) { + errorVal = errorVal.replace('[error]', val); + } + var value = 'error ' + er[0] + ':' + errorVal; + ele.innerHTML=value; + this.css(ele,{ + backgroundColor: '#000', + color:'#FFF', + textAlign:'center', + lineHeight:ele.offsetHeight+'px' + }); + }, + /* + 共用函数 + 判断变量类型 + */ + varType:function(val){ + if(val===null){ + return 'string'; + } + var type = typeof(val); + switch(type) { + case 'string': + return 'string'; + break; + case 'number': + return 'number'; + break; + case 'boolean': + return 'boolean'; + break; + case 'function': + return 'function'; + break; + case 'symbol': + return 'symbol'; + break; + case 'object': + if(!this.isUndefined(typeof(val.length))) { + return 'array'; + } + return 'object'; + break; + case 'undefined': + return 'undefined'; + break; + default: + return typeof(val); + break; + } + }, + getConfigObject:function(){ + return this.jsonConfig; + }, + getStyleObject:function(){ + return this.jsonStyle; + }, + getLanguageObject:function(){ + return this.jsongLanguage; + } + }; + window.ckplayer = ckplayer; +})(); \ No newline at end of file diff --git a/source/ckplayer.json b/source/ckplayer.json new file mode 100644 index 0000000..2c928c1 --- /dev/null +++ b/source/ckplayer.json @@ -0,0 +1,105 @@ +{ + "config": { + "fullInteractive": true, + "delay": 30, + "timeFrequency": 100, + "autoLoad": true, + "loadNext": 0, + "definition": true, + "subtitle": true, + "playbackRate": true, + "smartRemove": true, + "bufferTime": 200, + "rtmpBufferTime": 0, + "click": true, + "doubleClick": true, + "doubleClickInterval": 200, + "keyDown": { + "space": true, + "left": true, + "right": true, + "up": true, + "down": true + }, + "timeJump": 10, + "volumeJump": 0.1, + "timeScheduleAdjust": "1", + "previewDefaultLoad": true, + "promptSpotTime": true, + "buttonMode": { + "player": false, + "controlBar": false, + "timeSchedule": true, + "volumeSchedule": true + }, + "liveAndVod": { + "open": false, + "vodTime": 2, + "start": "start" + }, + "usehardwareeecoder": false, + "errorNum": 1, + "playCorrect": false, + "timeCorrect": true, + "m3u8Definition": {}, + "m3u8MaxBufferLength": 30, + "split": ",", + "timeStamp": "", + "videoDrawImage": false, + "errorTime": 10, + "addCallback": "adPlay,adPause,playOrPause,videoPlay,videoPause,videoMute,videoEscMute,videoClear,changeVolume,fastBack,fastNext,videoSeek,newVideo,getMetaDate,videoRotation,videoBrightness,videoContrast,videoSaturation,videoHue,videoZoom,videoProportion,videoError,addListener,removeListener,addElement,getElement,deleteElement,elementShow,animate,animateResume,animatePause,deleteAnimate,changeConfig,getConfig,openUrl,fullScreen,quitFullScreen,switchFull,screenshot,custom,changeControlBarShow,getCurrentSrc,changeDefinition,changeSubtitles,changeSubtitlesSize" + }, + "menu": { + "ckkey": "97b6a7181e0bdbe69e692383e1071ba1", + "name": "ckplayer", + "link": "http://www.ckplayer.com", + "domain": "", + "version": "version:X2", + "more":[] + }, + "languagePath": "", + "stylePath": "", + "style": { + "loading": { + "file": "data:image/gif;base64,R0lGODlhPAAeALMIAPRqMPRmK/RqMfNkKPRyPPV+TPRpL/NfIf///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFN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TN6qJ941Gj6mauVveh7Btvfcd3iBEn1lg3xzeoeFgH9ph4h7jI+OgpWWbZhxipeEiZ6SdYadkZBgORenAJugi58orKWksVivrE9QR7G0R5SZFDU2vRy8wyDFxh4mJ8nNzs/QHREAIfkECQoACAAsAAAAADwAHgAABKEQyUmrvTjrzbv/YCiOZGmeaKCuaLqqRyy3p2zfdGbs/HX/B4xgSCz9fEAb5khiVpJKZLQCqFqXOAt0JuU+s1owZRvDTsdi9HlCDnbL4TU7LWmbvWp8Hv7d3vl7bnF6dWR/goGHb0CKg4CJjoyLk5R9UI1UVlWYgU6WjyCec36VIqKFpBZERU10CHY5FwWztIsvKrEktwG5vb6/wMHCw8QTEQAh+QQFCgAIACwAAAAAPAAeAAAErBDJSau9OOvNu/9gKI5kOQ1oaq7Z4b5sXL2w7NHuhR824f+YnQ4nKBpLwiFNuauNkhYopYnDAK5YZk7Li1Kds6p3yeVKp+IweQyefNvuNHqthiPeW3Z+br/L429BfxJngHZ4XXqJfHuMi4ZUgnSQj5Rmg4SYhZmTnF9WWFdlo3WRJJt+namfp5irjZ4uRketqq+Vtz0/PpKHrjaKpMAam6jDIcbHHykqys7PKxEAOw==", + "align": "center", + "vAlign": "middle", + "width": 60, + "height": 30, + "offsetX": -30, + "offsetY": -15 + }, + "logo": { + "file": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAUCAYAAAD4BKGuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAVTSURBVHja1Fl/aJVVGP4cw/mH5tUWi3I53cA0WbeIzMgaq6lQoVawm0S6glHhIKM/TELICotqCxMSGWQRdFfRLEhc9mMxqA0rbdS2wsV0GkZXuaKUWlHvgeeNh7f3u1du3Ft74eGcnXu+c873vD/Pt0nZbDZyZL2gWZAQTBH8IjggeEjgPZASPIB+g/P7EsGT6J/BfHfjHFIv2Jpjj/+dlDskvCm42Jk7X3C7YJOgw/z2oOBG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s3OLEG2/xdZSh10JBeiB1zQU0HuQdSib60rOdm9kFToIL8hmFiRHzm1YM0ylet5k579OFpcUk4I0oD0/QuJ7tcBy5ERY6ixdrh5uNwN3bUV7pd4E+J958HmPxbRRydqK/in6vxj5aH9din/udEPKtuU1GqBL24xJwBInQWiHLcbQVKBXTzkVpHP0tWHsIpZUqPeWcrScXuX2ImRkqlufBhdQl15ig3WLKH0/SeAmtD+uprBqGx1ThhlWN5LKG4lcNKbDblFDjVDU0wWK7yLLqnPNk6cKzKsfXt1GQmQQXSuwymhd3tr9lkvPJMUV152kc2PsmUEMxtzdPRk2SNX2DQ3Vhr02Is18LXjHVAz/bG0NEK8johus3UBiwyfkYlDkQUyLaWrwZBrbHMaB8Z3PJLaYk8IIVKKPSJdxbv3ecynNzLNr33GKLV1YVW4IyfycXfq0UxP4X5HJdXCqX4Wv0AKqYkkipw4LG6WxMNi+GhAtH+M/K8wVe7wuWvwQYAFT+UsGCXmX3AAAAAElFTkSuQmCC", + "align": "right", + "vAlign": "top", + "width": 87, + "height": 30, + "offsetX": -100, + "offsetY": 10 + }, + "advertisement": { + "time": 5, + "method": "get", + "videoForce": false, + "videoVolume": 0.8, + "skipButtonShow": true, + "linkButtonShow": true, + "muteButtonShow": true, + "closeButtonShow": true, + "closeOtherButtonShow": true, + "frontSkipButtonDelay": 2, + "insertSkipButtonDelay": 0, + "endSkipButtonDelay": 0, + "frontStretched": 1, + "insertStretched": 2, + "pauseStretched": 2, + "endStretched": 2 + }, + "videoDefault": { + "defaultWidth": 4, + "defaultHeight": 3 + } + } +} \ No newline at end of file diff --git a/source/ckplayer.min.js b/source/ckplayer.min.js new file mode 100644 index 0000000..94d6e06 --- /dev/null +++ b/source/ckplayer.min.js @@ -0,0 +1,16 @@ +/* + 软件名称:ckplayer + 软件版本:X2 + 软件作者:niandeng + 软件网站:http://www.ckplayer.com + -------------------------------------------------------------------------------------------------------------------- + 开发说明: + 使用的主要程序语言:javascript(js)及actionscript3.0(as3.0)(as3.0主要用于flashplayer部分的开发,不在该页面呈现) + 功能:播放视频 + 特点:兼容HTML5-VIDEO(优先)以及FlashPlayer + -------------------------------------------------------------------------------------------------------------------- + 使用开源代码部分: + 1:flashls-http://flashls.org/ + ===================================================================================================================== +*/ +!(function(){var ckplayerPath='';!function(){var scriptList=document.scripts,thisPath=scriptList[scriptList.length-1].src;for(var i=0;i1){if(videoStringTemp[0][0].substr(0,3)=='CK:'||videoStringTemp[0][0].substr(0,3)=='CE:'||videoStringTemp[0][0].substr(8,3)=='CK:'||videoStringTemp[0][0].substr(8,3)=='CE:'){this.vars['flashplayer']=true}}}this.videoString=videoStringTemp;this.checkUpConfig()},checkUpConfig:function(){var thisTemp=this;var configPath='';var jsTemp=null;if(this.vars['config']){if(this.vars['config'].substr(0,8)!='website:'){jsTemp=eval(this.vars['config']+'()');if(!this.isUndefined(jsTemp)){this.ckConfig=this.newObj(jsTemp);this.jsonConfig=this.newObj(jsTemp);this.loadConfig(null)}else{this.loadConfig(ckplayerPath+this.vars['config'])}}else{this.loadConfig(ckplayerPath+this.vars['config'].substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerConfig)==='function'){isFun=true}}catch(e){}if(isFun){jsTemp=ckplayerConfig();if(jsTemp){this.ckConfig=this.newObj(jsTemp);this.jsonConfig=this.newObj(jsTemp);this.loadConfig(null)}else{this.loadConfig(ckplayerPath+'ckplayer.json')}}else{this.loadConfig(ckplayerPath+'ckplayer.json')}}catch(e){thisTemp.sysError(thisTemp.errorList[12],e)}}},loadConfig:function(file){var thisTemp=this;if(file){this.ajax({url:file,success:function(data){if(data){thisTemp.ckConfig=data;thisTemp.jsonConfig=thisTemp.newObj(data);if(!thisTemp.isUndefined(data['flashvars'])){thisTemp.vars=thisTemp.objectAssign(data['flashvars'],thisTemp.vars)}thisTemp.checkUpLanguage()}else{thisTemp.sysError(thisTemp.errorList[11],'Config')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.checkUpLanguage()}},checkUpLanguage:function(){var thisTemp=this;var languagePath='';var jsTemp=null;if(this.vars['language']){languagePath=this.vars['language']}else{if(this.ckConfig['languagePath']){languagePath=this.ckConfig['languagePath']}}if(languagePath){if(languagePath.substr(0,8)!='website:'){jsTemp=eval(languagePath+'()');if(jsTemp){this.ckLanguage=this.newObj(jsTemp);this.jsonLanguage=this.newObj(jsTemp);this.loadLanguage(null)}else{this.loadLanguage(ckplayerPath+languagePath)}}else{this.loadLanguage(ckplayerPath+languagePath.substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerLanguage)==='function'){isFun=true}}catch(e){}if(isFun){jsTemp=ckplayerLanguage();if(jsTemp){this.ckLanguage=this.newObj(jsTemp);this.jsonLanguage=this.newObj(jsTemp);this.loadLanguage(null)}else{this.loadLanguage(ckplayerPath+'language.json')}}else{this.loadLanguage(ckplayerPath+'language.json')}}catch(e){thisTemp.sysError(thisTemp.errorList[12],e)}}},loadLanguage:function(file){var thisTemp=this;if(file){this.ajax({url:file,success:function(data){if(data){thisTemp.ckLanguage=data;thisTemp.jsonLanguage=thisTemp.newObj(data);thisTemp.checkUpStyle()}else{thisTemp.sysError(thisTemp.errorList[11],'language.json')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.checkUpStyle()}},checkUpStyle:function(){var thisTemp=this;var stylePath='';var jsTemp=null;var configJs=this.newObj(this.ckConfig);if(this.vars['style']){stylePath=this.vars['style']}else{if(this.ckConfig['stylePath']){stylePath=''+this.ckConfig['stylePath']}}if(stylePath){if(stylePath.substr(0,8)!='website:'){jsTemp=eval(stylePath+'()');if(!this.isUndefined(jsTemp)){this.jsonStyle=this.newObj(jsTemp);this.ckStyle=this.newObj(jsTemp);this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']);this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle);this.loadStyle(null)}else{this.loadStyle(ckplayerPath+stylePath)}}else{this.loadStyle(ckplayerPath+stylePath.substr(8))}}else{try{var isFun=false;try{if(typeof(ckplayerStyle)==='function'){isFun=true}}catch(e){isFun=false}if(isFun){jsTemp=ckplayerStyle();if(!this.isUndefined(jsTemp)){this.jsonStyle=this.newObj(jsTemp);this.ckStyle=this.newObj(jsTemp);this.ckStyle['advertisement']=this.objectAssign(configJs['style']['advertisement'],this.ckStyle['advertisement']);this.ckStyle=this.objectAssign(configJs['style'],this.ckStyle);this.loadStyle(null)}else{this.loadStyle(ckplayerPath+'style.json')}}else{this.loadStyle(ckplayerPath+'style.json')}}catch(e){}}},loadStyle:function(file){var thisTemp=this;if(file){var configJs=this.newObj(this.ckConfig);this.ajax({url:file,success:function(data){if(data){thisTemp.jsonStyle=thisTemp.newObj(data);thisTemp.ckStyle=thisTemp.newObj(data);thisTemp.ckStyle['advertisement']=thisTemp.objectAssign(configJs['style']['advertisement'],thisTemp.ckStyle['advertisement']);thisTemp.ckStyle=thisTemp.objectAssign(configJs['style'],thisTemp.ckStyle);thisTemp.loadConfigHandler()}else{thisTemp.sysError(thisTemp.errorList[11],'Style')}},error:function(data){thisTemp.sysError(thisTemp.errorList[12],data)}})}else{this.loadConfigHandler()}},loadConfigHandler:function(){if((!this.supportVideo()&&this.vars['flashplayer']!='')||(this.vars['flashplayer']&&this.uploadFlash())||!this.isMsie()){this.html5Video=false;this.getVideo()}else if(this.videoString){this.analysedVideoUrl(this.videoString)}else{this.eject(this.errorList[2])}},analysedVideoUrl:function(video){var i=0,y=0;var thisTemp=this;this.VA=[];if(this.varType(video)=='string'){if(video.substr(0,8)!='website:'){this.VA=[[video,'','',0]];var fileExt=this.getFileExt(video);switch(fileExt){case'.mp4':this.VA[0][1]='video/mp4';break;case'.ogg':this.VA[0][1]='video/ogg';break;case'.webm':this.VA[0][1]='video/webm';break;default:break}this.getVideo()}else{if(this.html5Video){var ajaxObj={url:video.substr(8),success:function(data){if(data){thisTemp.analysedUrl(data)}else{thisTemp.eject(thisTemp.errorList[5]);this.VA=video;thisTemp.getVideo()}},error:function(data){thisTemp.eject(thisTemp.errorList[12],data)}};this.ajax(ajaxObj)}else{this.VA=video;this.getVideo()}}}else if(this.varType(video)=='array'){if(this.varType(video[0])=='array'){this.VA=video}this.getVideo()}else if(this.varType(video)=='object'){if(!this.isUndefined(video['type'])){this.VA.push([video['file'],video['type'],'',0]);this.getVideo()}else{this.eject(this.errorList[5])}}else{this.eject(this.errorList[4])}},analysedUrl:function(data){this.vars=this.standardization(this.vars,data);if(!this.isUndefined(data['video'])){this.vars['video']=data['video']}this.analysedVideoUrl(this.vars['video'])},getHtml5Video:function(){var va=this.VA;var nva=[];var mobile=this.isMobile();var video=document.createElement('video');var codecs=function(type){var cod='';switch(type){case'video/mp4':cod='avc1.4D401E, mp4a.40.2';break;case'video/ogg':cod='theora, vorbis';break;case'video/webm':cod='vp8.0, vorbis';break;default:break}return cod};var supportType=function(vidType,codType){if(!video.canPlayType){this.html5Video=false;return}var isSupp=video.canPlayType(vidType+';codecs="'+codType+'"');if(isSupp==''){return false}return true};if(this.vars['flashplayer']||!this.isMsie()){this.html5Video=false;return}for(var i=0;i0){this.VA=nva}else{if(!mobile){this.html5Video=false}}},getVideo:function(){var thisTemp=this;var v=this.vars;if(!this.adAnalysisEnd&&(v['adfront']!=''||v['adpause']!=''||v['adinsert']!=''||v['adend']!=''||v['advertisements']!='')){this.adAnalysisEnd=true;this.adAnalysis();return}if(this.V){this.changeVideo();return}if(this.vars['cktrack']){this.loadTrack()}if(this.supportVideo()&&!this.vars['flashplayer']){this.getHtml5Video()}var src='',source='',poster='',loop='',autoplay='',track='',crossorigin='';var video=v['video'];var i=0;var vBg=this.ckStyle['background']['backgroundColor'].replace('0x','#');this.CD=this.getByElement(v['container']);volume=v['volume'];if(this.isUndefined(this.CD)){this.eject(this.errorList[6],v['container']);return false}this.V=undefined;var thisPd=null;if(v['h5container']!=''){thisPd=this.getByElement(v['h5container']);if(this.isUndefined(thisPd)){thisPd=null}}var isVideoH5=null;if(v['playerID']!=''){isVideoH5=this.getByElement('#'+v['playerID']);if(this.isUndefined(isVideoH5)){isVideoH5=null}}if(thisPd!=null&&isVideoH5!=null){this.PD=thisPd}else{var playerID='ckplayer-'+this.randomString();var playerDiv=document.createElement('div');playerDiv.className=playerID;this.CD.innerHTML='';this.CD.appendChild(playerDiv);this.PD=playerDiv}this.css(this.CD,{backgroundColor:vBg,overflow:'hidden',position:'relative'});this.css(this.PD,{backgroundColor:vBg,width:'100%',height:'100%',fontFamily:this.fontFamily});if(this.html5Video){this.PD.onselectstart=this.PD.ondrag=function(){return false};if(this.VA.length==1){this.videoTemp['src']=decodeURIComponent(this.VA[0][0]);src=' src="'+this.videoTemp['src']+'"'}else{var videoArr=this.VA.slice(0);videoArr=this.arrSort(videoArr);for(i=0;i'}this.videoTemp['source']=source}if(v['autoplay']){autoplay=' autoplay="autoplay"'}if(v['poster']){poster=' poster="'+v['poster']+'"'}if(v['loop']){loop=' loop="loop"'}if(v['seek']>0){this.needSeek=v['seek']}if(v['track']!=null&&v['cktrack']==null){var trackArr=v['track'];var trackDefault='';var defaultHave=false;for(i=0;i'}}if(v['crossorigin']){crossorigin=' crossorigin="'+v['crossorigin']+'"'}var autoLoad=this.ckConfig['config']['autoLoad'];var preload='';if(!autoLoad){preload=' preload="meta"'}var vid=this.randomString();var controls='';var mobileAutoFull=v['mobileAutoFull'];var mobileautofull='';if(!mobileAutoFull){mobileautofull=' x-webkit-airplay="true" playsinline webkit-playsinline="true" x5-video-player-type="h5"'}if(this.isMobile()){controls=' controls="controls"'}if(isVideoH5!=null&&thisPd!=null){this.V=isVideoH5;if(v['poster']){this.V.poster=v['poster']}}else{var html='';if(!this.isM3u8){html=''}else{html=''}this.PD.innerHTML=html;this.V=this.getByElement('#'+vid)}try{this.V.volume=volume;if(this.playbackRateArr&&this.vars['playbackrate']>-1){if(this.vars['playbackrate']-1){this.playbackRate()}if(v['autoplay']){this.loadingStart(true)}this.subtitleSwitch()}this.playerLoad()}else{this.embedSWF()}},adAnalysis:function(){var thisTemp=this;var v=this.vars;var isAdvShow=[];var i=0;if(v['advertisements']!=''&&v['advertisements'].substr(0,8)=='website:'){var ajaxObj={url:v['advertisements'].substr(8),success:function(data){if(data){var newData={};var val=null;try{if(!thisTemp.isUndefined(data['front'])||!thisTemp.isUndefined(data['pause'])||!thisTemp.isUndefined(data['end'])||!thisTemp.isUndefined(data['insert'])||!thisTemp.isUndefined(data['other'])){val=thisTemp.arrayDel(data['front']);if(!thisTemp.isUndefined(val)){newData['front']=val}val=thisTemp.arrayDel(data['pause']);if(!thisTemp.isUndefined(val)){newData['pause']=val}val=thisTemp.arrayDel(data['insert']);if(!thisTemp.isUndefined(val)){newData['insert']=val;if(!thisTemp.isUndefined(data['inserttime'])){newData['inserttime']=thisTemp.arrayInt(data['inserttime']);isAdvShow=[];for(i=0;i0){return newArr}return null},adAnalysisOne:function(adType,adName,adTime,adLink,adStype){var v=this.vars;if(this.isUndefined(v[adName])){v[adName]=''}if(this.isUndefined(v[adTime])){v[adTime]=''}if(this.isUndefined(v[adLink])){v[adLink]=''}if(this.isUndefined(v[adStype])){v[adStype]=''}if(v[adName]!=''){var adList=[];var ad=v[adName].split(',');var adtime=v[adTime].split(',');var adlink=v[adLink].split(',');var adstype=v[adStype].split(',');var i=0;if(ad.length>0){var adLinkLen=adlink.length,adTimeLen=adtime.length;if(v[adLink]==''){adLinkLen=0;adlink=[]}if(v[adTime]==''){adTimeLen=0;adtime=[]}if(adLinkLen0?parseInt(adtime[i]):this.ckStyle['advertisement']['time'],link:adlink[i]};adList.push(obj)}}if(this.isUndefined(this.advertisements)){this.advertisements={}}if(adList.length>0){this.advertisements[adType]=adList}}}},playerLoad:function(){var thisTemp=this;if(this.isFirst){this.isFirst=false;setTimeout(function(){thisTemp.loadedHandler()},1)}},addVEvent:function(){var thisTemp=this;var duration=0;var eventVideoClick=function(event){thisTemp.videoClickXy={x:event.clientX,y:event.clientY};thisTemp.videoClick()};this.addListenerInside('click',eventVideoClick);this.addListenerInside('click',eventVideoClick,this.MDC);this.timerErrorFun();var eventJudgeIsLive=function(event){thisTemp.sendJS('loadedmetadata');if(thisTemp.varType(thisTemp.V.duration)=='number'&&thisTemp.V.duration>1){duration=thisTemp.V.duration;if(!duration){if(thisTemp.vars['duration']>0){duration=thisTemp.vars['duration']}}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}thisTemp.sendJS('duration',duration);thisTemp.formatInserttime(duration);if(thisTemp.adPlayerPlay){thisTemp.advertisementsTime(duration+1)}thisTemp.durationSendJS=true}if(thisTemp.conBarShow){thisTemp.V.controls=null;thisTemp.videoCss()}thisTemp.judgeIsLive()};var eventPlaying=function(event){thisTemp.playingHandler();thisTemp.sendJS('play');thisTemp.sendJS('paused',false);if(!thisTemp.durationSendJS&&thisTemp.varType(thisTemp.V.duration)=='number'&&thisTemp.V.duration>0){duration=thisTemp.V.duration;if(!duration){if(thisTemp.vars['duration']>0){duration=thisTemp.vars['duration']}}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}thisTemp.durationSendJS=true;thisTemp.sendJS('duration',duration);thisTemp.formatInserttime(duration)}};this.addListenerInside('playing',eventPlaying);var eventPause=function(event){thisTemp.pauseHandler();thisTemp.sendJS('pause');thisTemp.sendJS('paused',true)};this.addListenerInside('pause',eventPause);var eventEnded=function(event){thisTemp.endedHandler()};this.addListenerInside('ended',eventEnded);var eventTimeupdate=function(event){if(thisTemp.loadingShow){thisTemp.loadingStart(false)}if(thisTemp.time){if(!thisTemp.adPlayerPlay){thisTemp.sendJS('time',thisTemp.time);if(!thisTemp.isUndefined(thisTemp.advertisements['insert'])){thisTemp.checkAdInsert(thisTemp.time)}if(!thisTemp.isUndefined(thisTemp.advertisements['other'])){thisTemp.checkAdOther(thisTemp.time)}if(thisTemp.time<3&&thisTemp.adReset){thisTemp.adReset=false;thisTemp.endedAdReset()}}else{thisTemp.adPlayerTimeHandler(thisTemp.time)}}};this.addListenerInside('timeupdate',eventTimeupdate);var eventWaiting=function(event){thisTemp.loadingStart(true)};this.addListenerInside('waiting',eventWaiting);var eventSeeking=function(event){thisTemp.sendJS('seek','start')};this.addListenerInside('seeking',eventSeeking);var eventSeeked=function(event){thisTemp.seekedHandler();thisTemp.sendJS('seek','ended')};this.addListenerInside('seeked',eventSeeked);var eventVolumeChange=function(event){try{thisTemp.volumechangeHandler();thisTemp.sendJS('volume',thisTemp.volume||thisTemp.V.volume)}catch(event){}};this.addListenerInside('volumechange',eventVolumeChange);var eventFullChange=function(event){var fullState=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen;thisTemp.sendJS('full',fullState)};this.addListenerInside('fullscreenchange',eventFullChange);this.addListenerInside('webkitfullscreenchange',eventFullChange);this.addListenerInside('mozfullscreenchange',eventFullChange);if(this.conBarShow){this.interFace()}this.addListenerInside('loadedmetadata',eventJudgeIsLive)},resetPlayer:function(){this.timeTextHandler();if(this.conBarShow){this.timeProgress(0,1);this.changeLoad(0);this.initPlayPause();this.definition();this.deletePrompt();this.deletePreview();this.trackHide();this.resetTrack();this.trackElement=[];this.track=[]}},interFace:function(){this.conBarShow=true;var thisTemp=this;var html='';var i=0;var thisStyle=this.ckStyle;var styleC=thisStyle['controlBar'];var styleCB=styleC['button'];var styleAS=thisStyle['advertisement'];var styleDF=styleC['definition'];var bWidth=38;var timeInto=this.formatTime(0,this.vars['duration'],this.ckLanguage['vod']);this.CB={menu:null};var divEle={controlBarBg:null,controlBar:null,pauseCenter:null,errorText:null,promptBg:null,prompt:null,promptTriangle:null,definitionP:null,playbackrateP:null,subtitlesP:null,loading:null,logo:null,adBackground:null,adElement:null,adLink:null,adPauseClose:null,adTime:null,adTimeText:null,adMute:null,adEscMute:null,adSkip:null,adSkipText:null,adSkipButton:null};var k='';for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.PD.appendChild(this.CB[k])}this.CB['menu']=document.createElement('div');this.body.appendChild(this.CB['menu']);if(this.vars['live']){timeInto=this.formatTime(0,0,this.ckLanguage['live'])}divEle={play:null,pause:null,mute:null,escMute:null,full:null,escFull:null,definition:null,playbackrate:null,subtitles:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){this.CB[k].dataset.title=this.ckLanguage['buttonOver'][k]}this.CB['controlBar'].appendChild(this.CB[k])}divEle={timeProgressBg:null,timeBoBg:null,volume:null,timeText:null};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['controlBar'].appendChild(this.CB[k])}this.CB['timeText'].innerHTML=timeInto;divEle={loadProgress:null,timeProgress:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['timeProgressBg'].appendChild(this.CB[k])}this.CB['timeButton']=document.createElement('div');this.CB['timeBoBg'].appendChild(this.CB['timeButton']);divEle={volumeBg:null,volumeBO:null,};for(k in divEle){this.CB[k]=divEle[k];this.CB[k]=document.createElement('div');this.CB['volume'].appendChild(this.CB[k])}this.CB['volumeUp']=document.createElement('div');this.CB['volumeBg'].appendChild(this.CB['volumeUp']);var imgTemp=null;var imgFile='';var imgFile=thisStyle['loading']['file'];if(!this.isUndefined(thisStyle['loading']['fileH5'])){imgFile=thisStyle['loading']['fileH5']}if(imgFile){imgTemp=document.createElement('img');imgTemp.src=imgFile;imgTemp.border=0;this.CB['loading'].appendChild(imgTemp)}imgFile=thisStyle['logo']['file'];if(!this.isUndefined(thisStyle['logo']['fileH5'])){imgFile=thisStyle['logo']['fileH5']}if(imgFile){imgTemp=document.createElement('img');imgTemp.src=imgFile;imgTemp.border=0;this.CB['logo'].appendChild(imgTemp)}if(this.ckConfig['config']['buttonMode']['player']){this.css(this.PD,{cursor:'pointer'})}this.controlBar();var cssTemp=null;var promptCss=thisStyle['prompt'];cssTemp=this.getEleCss(promptCss,{overflow:'hidden',zIndex:900,display:'none'});this.css(this.CB['promptBg'],cssTemp);this.css(this.CB['promptBg'],'padding','0px');cssTemp['backgroundColor']='';cssTemp['border']='';cssTemp['borderRadius']='';cssTemp['whiteSpace']='nowrap';this.css(this.CB['prompt'],cssTemp);cssTemp={width:0,height:0,borderLeft:promptCss['triangleWidth']*0.5+'px solid transparent',borderRight:promptCss['triangleWidth']*0.5+'px solid transparent',borderTop:promptCss['triangleHeight']+'px solid '+promptCss['triangleBackgroundColor'].replace('0x','#'),overflow:'hidden',opacity:promptCss['triangleAlpha'],filter:'alpha(opacity:'+promptCss['triangleAlpha']+')',position:'absolute',left:'0px',top:'0px',zIndex:900,display:'none'};this.css(this.CB['promptTriangle'],cssTemp);this.elementCoordinate();this.css([this.CB['pauseCenter'],this.CB['loading'],this.CB['errorText']],'display','none');this.carbarButton();this.playerCustom();this.carbarCustom();this.timeProgressDefault();this.videoCss();this.initPlayPause();if(this.vars['volume']>0){this.css(this.CB['escMute'],'display','none')}else{this.css(this.CB['mute'],'display','none')}if(!this.ckConfig['config']['mobileVolumeBarShow']&&this.isMobile()){this.css([this.CB['mute'],this.CB['escMute'],this.CB['volume']],{display:'none'})}this.css(this.CB['escFull'],'display','none');var cssObj={align:'top',vAlign:'left',width:'100%',height:'100%',offsetX:0,offsetY:0,zIndex:910,display:'none'};cssTemp=this.getEleCss(styleAS['background'],cssObj);this.css(this.CB['adBackground'],cssTemp);this.css(this.CB['adElement'],{position:'absolute',overflow:'hidden',top:'0px',zIndex:911,float:'center',display:'none'});this.advertisementStyle();this.css([this.CB['adTime'],this.CB['adTimeText'],this.CB['adMute'],this.CB['adEscMute'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink'],this.CB['adPauseClose']],'display','none');var timeProgressOut=function(event){thisTemp.timeProgressMouseOut()};this.addListenerInside('mouseout',timeProgressOut,this.CB['timeBoBg']);var timeProgressOver=function(event){thisTemp.timeProgressDefault()};this.addListenerInside('mouseover',timeProgressOver,this.CB['controlBar']);this.buttonEventFun(this.CB['play'],styleCB['play']);this.buttonEventFun(this.CB['pause'],styleCB['pause']);this.buttonEventFun(this.CB['mute'],styleCB['mute']);this.buttonEventFun(this.CB['escMute'],styleCB['escMute']);this.buttonEventFun(this.CB['full'],styleCB['full']);this.buttonEventFun(this.CB['escFull'],styleCB['escFull']);this.buttonEventFun(this.CB['adMute'],styleAS['muteButton']);this.buttonEventFun(this.CB['adEscMute'],styleAS['escMuteButton']);this.buttonEventFun(this.CB['adSkipButton'],styleAS['skipAdButton']);this.buttonEventFun(this.CB['adLink'],styleAS['adLinkButton']);this.buttonEventFun(this.CB['adPauseClose'],styleAS['closeButton']);this.buttonEventFun(this.CB['pauseCenter'],thisStyle['centerPlay']);this.buttonEventFun(this.CB['volumeBO'],styleC['volumeSchedule']['button']);this.buttonEventFun(this.CB['timeButton'],styleC['timeSchedule']['button']);this.addButtonEvent();this.controlBarHide();this.newMenu();this.keypress();this.changeVolume(this.vars['volume']);setTimeout(function(){thisTemp.elementCoordinate()},100);this.checkBarWidth();var resize=function(){thisTemp.log('window.resize');thisTemp.playerResize()};var MutationObserver=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;var observer=new MutationObserver(function(){thisTemp.log('video.resize');var cdW=parseInt(thisTemp.css(thisTemp.CD,'width')),cdH=parseInt(thisTemp.css(thisTemp.CD,'height'));if(cdW!=thisTemp.cdWH['w']||cdH!=thisTemp.cdWH['h']){thisTemp.cdWH={w:cdW,h:cdH};thisTemp.changeSize(cdW,cdH)}});observer.observe(this.CD,{attributes:true,attributeFilter:['style'],attributeOldValue:true});this.addListenerInside('resize',resize,window)},timeProgressDefault:function(){var styleCT=this.ckStyle['controlBar']['timeSchedule'];var cssObj=this.newObj(styleCT['default']);var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg'];var cssTemp=null;this.css(this.CB['timeBoBg'],'display','block');cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:2},this.CB['controlBarBg']);this.css(this.CB['timeProgressBg'],cssTemp);cssObj={align:'left',vAlign:'top',width:1,height:cssObj['height'],backgroundImg:loadBackImg};if(this.CB['loadProgress'].offsetWidth>1){cssObj['width']=this.CB['loadProgress'].offsetWidth}cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']);this.css(this.CB['loadProgress'],cssTemp);cssObj['width']=0;if(this.CB['timeProgress'].offsetWidth>1&&parseInt(this.css(this.CB['timeButton'],'left'))>0){cssObj['width']=this.CB['timeProgress'].offsetWidth}cssObj['backgroundImg']=playBackImg;cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2});this.css(this.CB['timeProgress'],cssTemp);cssTemp=this.getEleCss(styleCT['buttonContainer'],{position:'absolute',overflow:'hidden',zIndex:3},this.CB['controlBar']);if(this.ckConfig['config']['buttonMode']['timeSchedule']){cssTemp['cursor']='pointer'}this.css(this.CB['timeBoBg'],cssTemp);cssTemp=this.getEleCss(styleCT['button'],{cursor:'pointer',overflow:'hidden',zIndex:4},this.CB['timeBoBg']);this.css(this.CB['timeButton'],cssTemp)},timeProgressMouseOut:function(){var styleCT=this.ckStyle['controlBar']['timeSchedule'];var cssObj=this.newObj(styleCT['mouseOut']);var loadBackImg=cssObj['loadProgressImg'],playBackImg=cssObj['playProgressImg'];var cssTemp=null;this.css(this.CB['timeBoBg'],'display','block');cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:2},this.CB['controlBarBg']);this.css(this.CB['timeProgressBg'],cssTemp);cssObj={align:'left',vAlign:'top',width:1,height:cssObj['height'],backgroundImg:loadBackImg};if(this.CB['loadProgress'].offsetWidth>1){cssObj['width']=this.CB['loadProgress'].offsetWidth}cssTemp=this.getEleCss(this.newObj(cssObj),{overflow:'hidden',zIndex:1},this.CB['timeProgressBg']);this.css(this.CB['loadProgress'],cssTemp);cssObj['width']=1;if(this.CB['timeProgress'].offsetWidth>1&&parseInt(this.css(this.CB['timeButton'],'left'))>0){cssObj['width']=this.CB['timeProgress'].offsetWidth;cssObj['backgroundImg']=playBackImg}cssTemp=this.getEleCss(cssObj,{overflow:'hidden',zIndex:2});this.css(this.CB['timeProgress'],cssTemp);this.css(this.CB['timeBoBg'],'display','none')},buttonEventFun:function(ele,cssEle){var thisTemp=this;var overFun=function(event){thisTemp.css(ele,{backgroundImage:'url('+cssEle['mouseOver']+')'});thisTemp.promptShow(ele)};var outFun=function(event){thisTemp.css(ele,{backgroundImage:'url('+cssEle['mouseOut']+')'});thisTemp.promptShow(false)};outFun();this.addListenerInside('mouseover',overFun,ele);this.addListenerInside('mouseout',outFun,ele);if(!this.isUndefined(cssEle['clickEvent'])){var clickFun=function(event){thisTemp.runFunction(cssEle['clickEvent'])};this.addListenerInside('click',clickFun,ele)}},formatNumPx:function(str,z){if(!str){return 0}if(str.toString().indexOf('%')>-1){if(!this.isUndefined(z)){return parseInt(str)*z*0.01+'px'}return str}else{return str+'px'}},formatZToNum:function(str,z){if(!str){return 0}if(str.toString().indexOf('%')>-1){if(!this.isUndefined(z)){return parseInt(str)*z*0.01}return str}else{return str}},newObj:function(obj){if(this.isUndefined(obj)){return obj}var str,newobj={};if(this.varType(obj)!='object'){return obj}else{for(var k in obj){if(this.isUndefined(obj[k])){newobj[k]=obj[k]}else{if(this.varType(obj[k])=='object'){newobj[k]=this.newObj(obj[k])}else{newobj[k]=obj[k]}}}}return newobj},loadImgBg:function(eleid,obj){this.css(this.getByElement(eleid),{backgroundImage:'url('+obj+')'})},getEleCss:function(eleObj,supplement,rrEle){var eleName=null;var pdW=this.PD.offsetWidth,pdH=this.PD.offsetHeight;if(rrEle){pdW=rrEle.offsetWidth;pdH=rrEle.offsetHeight}if(this.isUndefined(eleObj)){return null}eleName=this.newObj(eleObj);var cssObject={};if(!this.isUndefined(eleName['width'])){cssObject['width']=this.formatZToNum(eleName['width'],pdW)+'px'}if(!this.isUndefined(eleName['height'])){cssObject['height']=this.formatZToNum(eleName['height'],pdH)+'px'}if(!this.isUndefined(eleName['background'])){var bg=eleName['background'];if(!this.isUndefined(bg['backgroundColor'])){cssObject['backgroundColor']=bg['backgroundColor'].replace('0x','#')}if(!this.isUndefined(bg['backgroundImg'])){cssObject['backgroundImage']='url('+bg['backgroundImg']+')'}if(!this.isUndefined(bg['alpha'])){cssObject['filter']='alpha(opacity:'+bg['alpha']+')';cssObject['opacity']=bg['alpha']}}if(!this.isUndefined(eleName['backgroundColor'])){cssObject['backgroundColor']=eleName['backgroundColor'].replace('0x','#')}if(!this.isUndefined(eleName['backgroundImg'])){cssObject['backgroundImage']='url('+eleName['backgroundImg']+')'}if(!this.isUndefined(eleName['color'])){cssObject['color']=eleName['color'].replace('0x','#')}if(!this.isUndefined(eleName['font'])){cssObject['fontFamily']=eleName['font']}if(!this.isUndefined(eleName['size'])){cssObject['fontSize']=eleName['size']+'px'}if(!this.isUndefined(eleName['alpha'])){cssObject['filter']='alpha(opacity:'+eleName['alpha']+')';cssObject['opacity']=eleName['alpha']}if(!this.isUndefined(eleName['lineHeight'])){cssObject['lineHeight']=eleName['lineHeight']+'px'}if(!this.isUndefined(eleName['textAlign'])){cssObject['textAlign']=eleName['textAlign']}if(!this.isUndefined(eleName['borderRadius'])){cssObject['borderRadius']=eleName['borderRadius']+'px'}if(!this.isUndefined(eleName['radius'])){cssObject['borderRadius']=eleName['radius']+'px'}if(!this.isUndefined(eleName['padding'])){cssObject['padding']=eleName['padding']+'px'}if(!this.isUndefined(eleName['paddingLeft'])){cssObject['paddingLeft']=eleName['paddingLeft']+'px'}if(!this.isUndefined(eleName['paddingRight'])){cssObject['paddingRight']=eleName['paddingRight']+'px'}if(!this.isUndefined(eleName['paddingTop'])){cssObject['paddingTop']=eleName['paddingTop']+'px'}if(!this.isUndefined(eleName['paddingBottom'])){cssObject['paddingBottom']=eleName['paddingBottom']+'px'}if(!this.isUndefined(eleName['margin'])){cssObject['margin']=eleName['margin']+'px'}if(!this.isUndefined(eleName['marginLeft'])){cssObject['marginLeft']=eleName['marginLeft']+'px'}if(!this.isUndefined(eleName['marginRight'])){cssObject['marginRight']=eleName['marginRight']+'px'}if(!this.isUndefined(eleName['marginTop'])){cssObject['marginTop']=eleName['marginTop']+'px'}if(!this.isUndefined(eleName['marginBottom'])){cssObject['marginBottom']=eleName['marginBottom']+'px'}if(!this.isUndefined(eleName['border'])&&!this.isUndefined(eleName['borderColor'])){cssObject['border']=eleName['border']+'px solid '+eleName['borderColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderLeft'])&&!this.isUndefined(eleName['borderLeftColor'])){cssObject['borderLeft']=eleName['borderLeft']+'px solid '+eleName['borderLeftColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderRight'])&&!this.isUndefined(eleName['borderRightColor'])){cssObject['borderRight']=eleName['borderRight']+'px solid '+eleName['borderRightColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderTop'])&&!this.isUndefined(eleName['borderTopColor'])){cssObject['borderTop']=eleName['borderTop']+'px solid '+eleName['borderTopColor'].replace('0x','#')}if(!this.isUndefined(eleName['borderBottom'])&&!this.isUndefined(eleName['borderBottomColor'])){cssObject['borderBottom']=eleName['borderBottom']+'px solid '+eleName['borderBottomColor'].replace('0x','#')}if(!this.isUndefined(supplement)){for(var k in supplement){cssObject[k]=supplement[k]}}cssObject['position']='absolute';var left=-10000,top=-10000,right=-10000,bottom=-10000;var offsetX=0,offsetY=0;if(!this.isUndefined(eleName['offsetX'])){offsetX=eleName['offsetX']}if(!this.isUndefined(eleName['marginX'])){offsetX=eleName['marginX']}if(!this.isUndefined(eleName['offsetY'])){offsetY=eleName['offsetY']}if(!this.isUndefined(eleName['marginY'])){offsetY=eleName['marginY']}offsetX=this.formatZToNum(offsetX,pdW);offsetY=this.formatZToNum(offsetY,pdH);if(!this.isUndefined(eleName['align'])){left=0;switch(eleName['align']){case'left':left=offsetX;break;case'center':left=pdW*0.5+offsetX;break;case'right':left=pdW+offsetX;break;case'right2':left=-10000;right=offsetX;break}}if(!this.isUndefined(eleName['vAlign'])){top=0;switch(eleName['vAlign']){case'top':top=offsetY;break;case'middle':top=pdH*0.5+offsetY;break;case'bottom':top=pdH+offsetY;break;case'bottom2':top=-10000;bottom=offsetY;break}}if(left>-10000){cssObject['left']=left+'px'}if(right>-10000){cssObject['right']=right+'px'}if(top>-10000){cssObject['top']=top+'px'}if(bottom>-10000){cssObject['bottom']=bottom+'px'}return cssObject},newCanvas:function(id,width,height){return''},addButtonEvent:function(){var thisTemp=this;var promptHide=function(event){thisTemp.promptShow(false)};var definitionOver=function(event){thisTemp.promptShow(thisTemp.CB['definition'])};this.addListenerInside('mouseover',definitionOver,this.CB['definition']);this.addListenerInside('mouseout',promptHide,this.CB['definition']);var playbackrateOver=function(event){thisTemp.promptShow(thisTemp.CB['playbackrate'])};this.addListenerInside('mouseover',playbackrateOver,this.CB['playbackrate']);this.addListenerInside('mouseout',promptHide,this.CB['playbackrate']);var subtitlesOver=function(event){thisTemp.promptShow(thisTemp.CB['subtitles'])};this.addListenerInside('mouseover',subtitlesOver,this.CB['subtitles']);this.addListenerInside('mouseout',promptHide,this.CB['subtitles']);var volumePrompt=function(vol){var volumeBOXY=thisTemp.getCoor(thisTemp.CB['volumeBO']);var promptObj={title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',vol),x:volumeBOXY['x']+thisTemp.CB['volumeBO'].offsetWidth*0.5,y:volumeBOXY['y']};thisTemp.promptShow(false,promptObj)};var volumeObj={slider:this.CB['volumeBO'],follow:this.CB['volumeUp'],refer:this.CB['volumeBg'],grossValue:'volume',pd:true,startFun:function(vol){},monitorFun:function(vol){thisTemp.changeVolume(vol*0.01,false,false);volumePrompt(vol)},endFun:function(vol){},overFun:function(vol){volumePrompt(vol)}};this.slider(volumeObj);var volumeClickObj={refer:this.CB['volumeBg'],grossValue:'volume',fun:function(vol){thisTemp.changeVolume(vol*0.01,true,true)}};this.progressClick(volumeClickObj);this.timeButtonMouseDown();var volumeBgMove=function(event){var volumeBgXY=thisTemp.getCoor(thisTemp.CB['volumeBg']);var eventX=thisTemp.client(event)['x'];var eventVolume=parseInt((eventX-volumeBgXY['x'])*100/thisTemp.CB['volumeBg'].offsetWidth);var buttonPromptObj={title:thisTemp.ckLanguage['volumeSliderOver'].replace('[$volume]',eventVolume),x:eventX,y:volumeBgXY['y']};thisTemp.promptShow(false,buttonPromptObj)};this.addListenerInside('mousemove',volumeBgMove,this.CB['volumeBg']);this.addListenerInside('mouseout',promptHide,this.CB['volumeBg']);this.addListenerInside('mouseout',promptHide,this.CB['volumeBO']);this.addDefListener();this.addPlaybackrate();this.addSubtitles()},videoClick:function(){var thisTemp=this;var clearTimerClick=function(){if(thisTemp.timerClick!=null){if(thisTemp.timerClick.runing){thisTemp.timerClick.stop()}thisTemp.timerClick=null}};var timerClickFun=function(){clearTimerClick();thisTemp.isClick=false;thisTemp.sendJS('videoClick',thisTemp.videoClickXy);if(thisTemp.adPlayerPlay){var ad=thisTemp.getNowAdvertisements();try{if(ad['link']!=''){window.open(ad['link'])}thisTemp.ajaxSuccessNull(ad['clickMonitor'])}catch(event){}}else{if(thisTemp.ckConfig['config']['click']){thisTemp.playOrPause()}}};clearTimerClick();if(this.isClick){this.isClick=false;thisTemp.sendJS('videoDoubleClick',thisTemp.videoClickXy);if(thisTemp.ckConfig['config']['doubleClick']){if(!this.full){thisTemp.fullScreen()}else{thisTemp.quitFullScreen()}}}else{this.isClick=true;this.timerClick=new this.timer(300,timerClickFun,1)}},timeButtonMouseDown:function(){var thisTemp=this;var timePrompt=function(time){if(isNaN(time)){time=0}var timeButtonXY=thisTemp.getCoor(thisTemp.CB['timeButton']);var promptObj={title:thisTemp.formatTime(time,0,thisTemp.ckLanguage['timeSliderOver']),x:timeButtonXY['x']-thisTemp.pdCoor['x']+thisTemp.CB['timeButton'].offsetWidth*0.5,y:timeButtonXY['y']-thisTemp.pdCoor['y']};thisTemp.promptShow(false,promptObj)};var timeObj={slider:this.CB['timeButton'],follow:this.CB['timeProgress'],refer:this.CB['timeBoBg'],grossValue:'time',pd:false,startFun:function(time){thisTemp.isTimeButtonMove=false},monitorFun:function(time){},endFun:function(time){if(thisTemp.V){if(thisTemp.V.duration>0){thisTemp.needSeek=0;thisTemp.videoSeek(parseInt(time))}}},overFun:function(time){timePrompt(time)}};var timeClickObj={refer:this.CB['timeBoBg'],grossValue:'time',fun:function(time){if(thisTemp.V){if(thisTemp.V.duration>0){thisTemp.needSeek=0;thisTemp.videoSeek(parseInt(time))}}}};var timeBoBgmousemove=function(event){var timeBoBgXY=thisTemp.getCoor(thisTemp.CB['timeBoBg']);var eventX=thisTemp.client(event)['x'];var duration=thisTemp.V.duration;if(isNaN(duration)||parseInt(duration)<0.2){duration=thisTemp.vars['duration']}if(thisTemp.vars['forceduration']>0){duration=thisTemp.vars['forceduration']}var eventTime=parseInt((eventX-timeBoBgXY['x'])*duration/thisTemp.CB['timeBoBg'].offsetWidth);var buttonPromptObj={title:thisTemp.formatTime(eventTime,0,thisTemp.ckLanguage['timeSliderOver']),x:eventX,y:timeBoBgXY['y']};thisTemp.promptShow(false,buttonPromptObj);var def=false;if(!thisTemp.isUndefined(thisTemp.CB['definitionP'])){if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block'){def=true}}if(thisTemp.vars['preview']!=null&&def){buttonPromptObj['time']=eventTime;thisTemp.preview(buttonPromptObj)}};var promptHide=function(event){thisTemp.promptShow(false);if(thisTemp.previewDiv!=null){thisTemp.css([thisTemp.previewDiv,thisTemp.previewTop],'display','none')}};if(!this.vars['live']){this.isTimeButtonDown=true;this.addListenerInside('mousemove',timeBoBgmousemove,this.CB['timeBoBg']);this.addListenerInside('mouseout',promptHide,this.CB['timeBoBg'])}else{this.isTimeButtonDown=false;timeObj['removeListenerInside']=true;timeClickObj['removeListenerInside']=true}this.slider(timeObj);this.progressClick(timeClickObj)},progressClick:function(obj){var thisTemp=this;var referMouseClick=function(event){var referX=thisTemp.client(event)['x']-thisTemp.getCoor(obj['refer'])['x'];var rWidth=obj['refer'].offsetWidth;var grossValue=0;if(obj['grossValue']=='volume'){grossValue=100}else{if(thisTemp.V){grossValue=thisTemp.V.duration;if(isNaN(grossValue)||parseInt(grossValue)<0.2){grossValue=thisTemp.vars['duration']}if(thisTemp.vars['forceduration']>0){grossValue=thisTemp.vars['forceduration']}}}var nowZ=parseInt(referX*grossValue/rWidth);if(obj['fun']){if(obj['grossValue']==='time'){var sliderXY=thisTemp.getCoor(thisTemp.CB['timeButton']);sliderLeft=sliderXY['x'];if(!thisTemp.checkSlideLeft(referX,sliderLeft,rWidth)){return}var bimeButtonWB=thisTemp.CB['timeButton'].offsetWidth*0.5;thisTemp.css(thisTemp.CB['timeButton'],'left',(referX-bimeButtonWB)+'px');thisTemp.css(thisTemp.CB['timeProgress'],'width',(referX)+'px')}obj['fun'](nowZ)}};if(this.isUndefined(obj['removeListenerInside'])){this.addListenerInside('click',referMouseClick,obj['refer'])}else{this.removeListenerInside('click',referMouseClick,obj['refer'])}},slider:function(obj){var thisTemp=this;var clientX=0,criterionWidth=0,sliderLeft=0,referLeft=0;var value=0;var calculation=function(){var sLeft=parseInt(thisTemp.css(obj['slider'],'left'));var rWidth=obj['refer'].offsetWidth-obj['slider'].offsetWidth;var grossValue=0;if(thisTemp.isUndefined(sLeft)||isNaN(sLeft)){sLeft=0}if(obj['grossValue']=='volume'){grossValue=100}else{if(thisTemp.V){grossValue=thisTemp.V.duration}}return parseInt(sLeft*grossValue/rWidth)};var mDown=function(event){thisTemp.addListenerInside('mousemove',mMove,document);thisTemp.addListenerInside('mouseup',mUp,document);var referXY=thisTemp.getCoor(obj['refer']);var sliderXY=thisTemp.getCoor(obj['slider']);clientX=thisTemp.client(event)['x'];referLeft=referXY['x'];sliderLeft=sliderXY['x'];criterionWidth=clientX-sliderLeft;if(obj['startFun']){obj['startFun'](calculation())}};var mMove=function(event){clientX=thisTemp.client(event)['x'];var newX=clientX-criterionWidth-referLeft;if(newX<0){newX=0}if(newX>obj['refer'].offsetWidth-obj['slider'].offsetWidth){newX=obj['refer'].offsetWidth-obj['slider'].offsetWidth}if(obj['slider']===thisTemp.CB['timeButton']){if(!thisTemp.checkSlideLeft(newX,sliderLeft,obj['refer'].offsetWidth)){return}}thisTemp.css(obj['slider'],'left',newX+'px');thisTemp.css(obj['follow'],'width',(newX+obj['slider'].offsetWidth*0.5)+'px');var nowZ=calculation();if(obj['monitorFun']){obj['monitorFun'](nowZ)}};var mUp=function(event){thisTemp.removeListenerInside('mousemove',mMove,document);thisTemp.removeListenerInside('mouseup',mUp,document);if(obj['endFun']){obj['endFun'](calculation())}};var mOver=function(event){if(obj['overFun']){obj['overFun'](calculation())}};if(this.isUndefined(obj['removeListenerInside'])){this.addListenerInside('mousedown',mDown,obj['slider']);this.addListenerInside('mouseover',mOver,obj['slider'])}else{this.removeListenerInside('mousedown',mDown,obj['slider']);this.removeListenerInside('mouseover',mOver,obj['slider'])}},checkSlideLeft:function(newX,sliderLeft,refer){var timeSA=this.ckConfig['config']['timeScheduleAdjust'];switch(timeSA){case 0:return false;break;case 2:if(newXsliderLeft){return false}break;case 4:if(!this.timeSliderLeftTemp){this.timeSliderLeftTemp=sliderLeft/refer}if(newXthis.timeSliderLeftTemp){this.timeSliderLeftTemp=timeSliderMax}}if(newX>this.timeSliderLeftTemp*refer){return false}break;default:return true;break}return true},loadingStart:function(rot){var thisTemp=this;if(this.isUndefined(rot)){rot=true}if(this.conBarShow){this.css(thisTemp.CB['loading'],'display','none');this.loadingShow=false}var buffer=0;if(rot){if(this.conBarShow){this.css(thisTemp.CB['loading'],'display','block');this.loadingShow=true}}else{thisTemp.sendJS('buffer',100)}},promptShow:function(ele,data){if(!this.conBarShow){return}var obj={};var eleTitle='';if(!this.isUndefined(ele)){eleTitle=this.getDataset(ele,'title');if(this.isUndefined(eleTitle)){ele=null}}if(ele||data){if(!this.isUndefined(data)){obj=data}else{var offsetCoor=this.getCoor(ele);obj={title:eleTitle,x:offsetCoor['x']+ele.offsetWidth*0.5,y:offsetCoor['y']}}this.CB['prompt'].innerHTML=obj['title'];this.css(this.CB['prompt'],'display','block');var promptStye=this.ckStyle['prompt'];var promoptWidth=this.CB['prompt'].offsetWidth,promoptHeight=this.CB['prompt'].offsetHeight;this.css(this.CB['promptBg'],{width:promoptWidth+'px',height:promoptHeight+'px'});var x=obj['x']-(promoptWidth*0.5);var y=obj['y']-this.CB['prompt'].offsetHeight-promptStye['marginBottom']-promptStye['triangleHeight'];if(x<0){x=0}if(x>this.PD.offsetWidth-promoptWidth){x=this.PD.offsetWidth-promoptWidth}this.css([this.CB['promptBg'],this.CB['prompt']],{display:'block',left:x+'px',top:y+'px'});this.css(this.CB['promptTriangle'],{display:'block',left:x+(promoptWidth-promptStye['triangleWidth'])*0.5+parseInt(promptStye['triangleDeviationX'])+'px',top:y+promoptHeight+'px'})}else{this.css([this.CB['promptBg'],this.CB['prompt'],this.CB['promptTriangle']],{display:'none'})}},timerErrorFun:function(){var thisTemp=this;this.errorSend=false;var clearIntervalError=function(event){if(thisTemp.timerError!=null){if(thisTemp.timerError.runing){thisTemp.timerError.stop()}thisTemp.timerError=null}};var errorFun=function(event){clearIntervalError();thisTemp.error=true;thisTemp.errorUrl=thisTemp.getVideoUrl();if(!thisTemp.errorSend){thisTemp.errorSend=true;thisTemp.sendJS('error')}if(thisTemp.conBarShow){thisTemp.CB['errorText'].innerHTML=thisTemp.ckLanguage['error']['streamNotFound'];thisTemp.css(thisTemp.CB['errorText'],'display','block');thisTemp.css([thisTemp.CB['pauseCenter'],thisTemp.CB['loading']],'display','none')}thisTemp.V.removeAttribute('poster');thisTemp.resetPlayer()};var errorListenerFun=function(event){setTimeout(function(){if(isNaN(thisTemp.V.duration)){errorFun(event)}},500)};if(!this.errorAdd){this.errorAdd=true;this.addListenerInside('error',errorListenerFun)}clearIntervalError();var timerErrorFun=function(){if(thisTemp.V&&parseInt(thisTemp.V.networkState)==3){errorFun()}};this.timerError=new this.timer(this.ckConfig['config']['errorTime'],timerErrorFun)},judgeFullScreen:function(){var thisTemp=this;if(this.timerFull!=null){if(this.timerFull.runing){this.timerFull.stop()}this.timerFull=null}var fullFun=function(){thisTemp.isFullScreen()};this.timerFull=new this.timer(20,fullFun)},isFullScreen:function(){if(!this.conBarShow){return}var fullState=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;if(fullState&&!this.full){this.full=true;this.sendJS('full',true);this.elementCoordinate();this.carbarButton();this.customCoor();this.css(this.CB['full'],'display','none');this.css(this.CB['escFull'],'display','block');if(this.vars['live']==0){this.timeUpdateHandler()}this.PD.appendChild(this.CB['menu'])}if(!fullState&&this.full){this.full=false;this.sendJS('full',false);this.elementCoordinate();this.carbarButton();this.customCoor();this.css(this.CB['full'],'display','block');this.css(this.CB['escFull'],'display','none');if(this.timerFull!=null){if(this.timerFull.runing){this.timerFull.stop()}this.timerFull=null}if(this.vars['live']==0){this.timeUpdateHandler()}this.body.appendChild(this.CB['menu'])}},newMenu:function(){var thisTemp=this;var i=0;this.css(this.CB['menu'],{backgroundColor:'#FFFFFF',padding:'5px',position:'absolute',left:'10px',top:'20px',display:'none',zIndex:'999',color:'#A1A9BE',boxShadow:'2px 2px 3px #AAAAAA'});var mArr=this.contextMenu;var cMenu=this.ckConfig['menu'];if(cMenu['name']){if(cMenu['link']){mArr[0]=[cMenu['name'],'link',cMenu['link']]}else{mArr[0]=[cMenu['name'],'default']}}if(cMenu['version']){mArr[1]=[cMenu['version'],'default','line']}if(cMenu['more']){if(this.varType(cMenu['more'])=='array'){if(cMenu['more'].length>0){var moreArr=cMenu['more'];for(i=0;i'+me[0]+'

';break;case'link':if(me[3]){me[3]='target="'+me[3]+'"'}html+='

'+me[0]+'

';break;case'javaScript':html+='

'+me[0]+'

';break;case'actionScript':html+='

'+me[0]+'

';break;default:break}}this.CB['menu'].innerHTML=html;var pArr=this.CB['menu'].childNodes;for(i=0;icdH-2)&&cShow&&!thisTemp.getMetaDate()['paused']){controlBarShow(false)}}else{if(!cShow){controlBarShow(true)}}oldClient={x:client['x'],y:client['y']}};this.timerCBar=new this.timer(2000,cbarFun);var cdMove=function(event){var getClient=thisTemp.client(event);client['x']=getClient['x'];client['y']=getClient['y'];if(!cShow){controlBarShow(true)}thisTemp.sendJS('mouse',client)};this.addListenerInside('mousemove',cdMove,thisTemp.CD);this.addListenerInside('ended',cdMove);this.addListenerInside('resize',cdMove,window);if(hide===true){cShow=true;force=true;controlBarShow(false)}if(hide===false){cShow=false;force=true;controlBarShow(true)}},keypress:function(){var thisTemp=this;var keyDown=function(eve){var keycode=eve.keyCode||eve.which;if(thisTemp.adPlayerPlay){return}switch(keycode){case 32:thisTemp.playOrPause();break;case 37:thisTemp.fastBack();break;case 39:thisTemp.fastNext();break;case 38:now=thisTemp.volume+thisTemp.ckConfig['config']['volumeJump'];thisTemp.changeVolume(now>1?1:now);break;case 40:now=thisTemp.volume-thisTemp.ckConfig['config']['volumeJump'];thisTemp.changeVolume(now<0?0:now);break;default:break}};this.addListenerInside('keydown',keyDown,window||document)},playbackRate:function(){if(!this.conBarShow||!this.ckConfig['config']['playbackRate']){return}var styleCD=this.ckStyle['controlBar']['playbackrate'];var cssSup={overflow:'hidden',display:'none',zIndex:995};var cssSup2={overflow:'hidden',align:'top',vAlign:'left',offsetX:0,offsetY:0,zIndex:1};var thisTemp=this;var dArr=this.playbackRateArr;var html='';var nowD='';var i=0,nowI=0;nowD=dArr[this.playbackRateDefault][1];nowI=this.playbackRateDefault;this.removeChildAll(this.CB['playbackrateP']);if(dArr.length>1){this.CB['playbackratePB']=document.createElement('div'),this.CB['playbackratePC']=document.createElement('div');this.CB['playbackrateP'].appendChild(this.CB['playbackratePB']);this.CB['playbackrateP'].appendChild(this.CB['playbackratePC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['playbackratePC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['playbackrateP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['playbackratePB'],cssTemp);for(i=0;i0){this.subtitlesTemp=dArr.length-1}for(i=0;i1){this.CB['subtitlesPB']=document.createElement('div'),this.CB['subtitlesPC']=document.createElement('div');this.CB['subtitlesP'].appendChild(this.CB['subtitlesPB']);this.CB['subtitlesP'].appendChild(this.CB['subtitlesPC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['subtitlesPC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['subtitlesP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['subtitlesPB'],cssTemp);for(i=0;in){var arr=vArr[n];if(arr.length>2){var title=arr[1];if(title){this.newSubtitles(title)}}}},changeSubtitlesSize:function(n,m){if(!this.loaded||n<0){return}if(this.playerType=='flashplayer'){this.V.changeSubtitlesSize(n,m);return}this.ckStyle['cktrack']['size']=n;if(!this.isUndefined(m)){this.ckStyle['cktrack']['leading']=m}this.trackShowAgain()},newSubtitles:function(title){var vArr=this.vars['cktrack'];var i=0;for(i=0;i1){this.CB['definitionPB']=document.createElement('div'),this.CB['definitionPC']=document.createElement('div');this.CB['definitionP'].appendChild(this.CB['definitionPB']);this.CB['definitionP'].appendChild(this.CB['definitionPC']);var bgCss=this.newObj(styleCD['background']);bgCss['backgroundColor']='';cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['definitionPC'],cssTemp);bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(this.objectAssign(bgCss,styleCD['backgroundCoorH5']),cssSup);this.css(this.CB['definitionP'],cssTemp);bgCss=this.newObj(styleCD['background']);bgCss['alpha']=bgCss['backgroundAlpha'];bgCss['padding']=0;bgCss['paddingLeft']=0;bgCss['paddingTop']=0;bgCss['paddingRight']=0;bgCss['paddingBottom']=0;cssTemp=this.getEleCss(bgCss,cssSup2);this.css(this.CB['definitionPB'],cssTemp);for(i=0;i=0;i--){var childNode=ele.childNodes[i];ele.removeChild(childNode)}},addDefListener:function(){var thisTemp=this;var setTimeOutP=null;var defClick=function(event){if(thisTemp.css(thisTemp.CB['definitionP'],'display')!='block'&&!thisTemp.isUndefined(thisTemp.CB['definitionPC'])){thisTemp.css(thisTemp.CB['definitionP'],'display','block');var tbCss=thisTemp.ckStyle['controlBar']['definition']['background'];thisTemp.css(thisTemp.CB['definitionPB'],{width:thisTemp.CB['definitionPC'].offsetWidth+'px',height:thisTemp.CB['definitionPC'].offsetHeight+'px'});thisTemp.css(thisTemp.CB['definitionP'],{width:(thisTemp.CB['definitionPC'].offsetWidth+tbCss['triangleDeviationX']+tbCss['triangleWidth'])+'px',height:(thisTemp.CB['definitionPC'].offsetHeight+tbCss['triangleDeviationY']+tbCss['triangleHeight'])+'px'});thisTemp.promptShow(false);var tempELe=thisTemp.CB['definitionPB'];var tempWidth=tempELe.offsetWidth,tempHeight=tempELe.offsetHeight;var x=((tempWidth-tbCss['triangleWidth'])*0.5)+tbCss['triangleDeviationX'];var y=tempELe.offsetHeight+tbCss['triangleDeviationY'];var cssTemp={left:x+'px',top:y+'px'};thisTemp.css(thisTemp.CB['definitionTriangle'],cssTemp)}else{thisTemp.css(thisTemp.CB['definitionP'],'display','none')}};this.addListenerInside('click',defClick,this.CB['definition']);var defMouseOut=function(event){if(setTimeOutP){window.clearTimeout(setTimeOutP);setTimeOutP=null}setTimeOutP=setTimeout(function(event){thisTemp.css(thisTemp.CB['definitionP'],'display','none')},500)};this.addListenerInside('mouseout',defMouseOut,thisTemp.CB['definitionP']);var defMouseOver=function(event){thisTemp.buttonHide=false;if(setTimeOutP){window.clearTimeout(setTimeOutP);setTimeOutP=null}};this.addListenerInside('mouseover',defMouseOver,thisTemp.CB['definitionP'])},changeDefinition:function(n){if(!this.loaded||n<0){return}if(this.playerType=='flashplayer'){this.V.changeDefinition(n);return}if(this.VA.length>n){var arr=this.VA[n];if(arr.length>3){var title=arr[2];if(title){this.newDefinition(title)}}}},newDefinition:function(title){var vArr=this.VA;var nVArr=[];var i=0;for(i=0;i'}this.V.removeAttribute('src');this.V.innerHTML=source;this.V.currentSrc=nVArr[0][0]}}else{this.embedHls(vArr[0][0],this.vars['autoplay'])}this.V.autoplay='autoplay';this.V.load();if(this.playbackRateTemp!=1){this.V.playbackRate=this.playbackRateTemp}this.timerErrorFun()},embedHls:function(url,autoplay){var thisTemp=this;thisTemp.hlsAutoPlay=autoplay;if(Hls.isSupported()){var hls=new Hls();hls.loadSource(url);hls.attachMedia(this.V);hls.on(Hls.Events.MANIFEST_PARSED,function(){thisTemp.playerLoad();if(autoplay){thisTemp.videoPlay()}})}},prompt:function(){if(!this.conBarShow){return}var thisTemp=this;var prompt=this.vars['promptSpot'];if(prompt==null||this.promptArr.length>0){return}var showPrompt=function(event){if(thisTemp.promptElement==null){var random2='prompte-'+thisTemp.randomString(5);var ele2=document.createElement('div');ele2.className=random2;thisTemp.PD.appendChild(ele2);thisTemp.promptElement=thisTemp.getByElement(random2);thisTemp.css(thisTemp.promptElement,{overflowX:'hidden',lineHeight:thisTemp.ckStyle['previewPrompt']['lineHeight']+'px',fontFamily:thisTemp.ckStyle['previewPrompt']['font'],fontSize:thisTemp.ckStyle['previewPrompt']['size']+'px',color:thisTemp.ckStyle['previewPrompt']['color'].replace('0x','#'),position:'absolute',display:'block',zIndex:'90'})}var pcon=thisTemp.getPromptTest();var pW=pcon['pW'],pT=pcon['pT'],pL=parseInt(thisTemp.css(this,'left'))-parseInt(pW*0.5);if(pcon['pL']>10){pL=pcon['pL']}if(pL<0){pL=0}thisTemp.css(thisTemp.promptElement,{width:pW+'px',left:(-pW-10)+'px',display:'block'});thisTemp.promptElement.innerHTML=thisTemp.getDataset(this,'words');thisTemp.css(thisTemp.promptElement,{left:pL+'px',top:(pT-thisTemp.promptElement.offsetHeight-thisTemp.ckStyle['previewPrompt']['marginBottom'])+'px'})};var hidePrompt=function(event){if(thisTemp.promptElement!=null){thisTemp.css(thisTemp.promptElement,{display:'none'})}};var i=0;for(i=0;ithis.PD.offsetWidth-pW){pL=this.PD.offsetWidth-pW}return{pW:pW,pT:pT,pL:pL}},deletePrompt:function(){var arr=this.promptArr;if(arr.length>0){for(var i=0;ibw-parseInt(arr[i].offsetWidth*0.5)){left=bw-parseInt(arr[i].offsetWidth*0.5)}this.css(arr[i],{left:left+'px',display:'block'})}},preview:function(obj){var thisTemp=this;var preview={file:null,scale:0};preview=this.standardization(preview,this.vars['preview']);if(preview['file']==null||preview['scale']<=0){return}var srcArr=preview['file'];if(this.previewStart==0){this.previewStart=1;if(srcArr.length>0){var i=0;var imgW=0,imgH=0;var random='preview-'+thisTemp.randomString(10);var loadNum=0;var loadImg=function(i){srcArr[i]=thisTemp.getNewUrl(srcArr[i]);var n=0;var img=new Image();img.src=srcArr[i];img.className=random+i;img.onload=function(event){loadNum++;if(thisTemp.previewDiv==null){imgW=img.width;imgH=img.height;thisTemp.previewWidth=parseInt(imgW*0.1);var ele=document.createElement('div');ele.className=random;thisTemp.PD.appendChild(ele);thisTemp.previewDiv=thisTemp.getByElement(random);var eleTop=0;eleTop=thisTemp.PD.offsetHeight-thisTemp.ckStyle['preview']['bottom'];thisTemp.css(thisTemp.previewDiv,{width:srcArr.length*imgW*10+'px',height:parseInt(imgH*0.1)+'px',backgroundColor:'#000000',position:'absolute',left:'0px',top:eleTop+'px',display:'none',zIndex:'80'});ele.setAttribute('data-x','0');ele.setAttribute('data-y',eleTop);var ele2=document.createElement('div');ele2.className=random+'d2';thisTemp.PD.appendChild(ele2);thisTemp.previewTop=thisTemp.getByElement(ele2.className);thisTemp.css(thisTemp.previewTop,{width:parseInt(imgW*0.1)+'px',height:parseInt(imgH*0.1)+'px',position:'absolute',border:thisTemp.ckStyle['preview']['border']+'px solid '+thisTemp.ckStyle['preview']['borderColor'].replace('0x','#'),left:'0px',top:eleTop+'px',display:'none',zIndex:'81'});var html='';for(n=0;n=imgW){sx=0;sy+=h}thisTemp.css(cimg,'display','none')}if(loadNum==srcArr.length){thisTemp.previewStart=2}else{i++;loadImg(i)}}}}loadImg(i);return}if(this.previewStart==2){var isTween=true;var nowNum=parseInt(obj['time']/this.vars['preview']['scale']);var numTotal=parseInt(thisTemp.getMetaDate()['duration']/this.vars['preview']['scale']);if(thisTemp.css(thisTemp.previewDiv,'display')=='none'){isTween=false}thisTemp.css(thisTemp.previewDiv,'display','block');var imgWidth=thisTemp.previewDiv.offsetWidth*0.01/srcArr.length;var left=(imgWidth*nowNum)-obj['x']+parseInt(imgWidth*0.5),top=thisTemp.PD.offsetHeight-thisTemp.previewDiv.offsetHeight-thisTemp.ckStyle['preview']['bottom'];thisTemp.css(thisTemp.previewDiv,'top',top+2+'px');var topLeft=obj['x']-parseInt(imgWidth*0.5);var timepieces=0;if(topLeft<0){topLeft=0;timepieces=obj['x']-topLeft-imgWidth*0.5}if(topLeft>thisTemp.PD.offsetWidth-imgWidth){topLeft=thisTemp.PD.offsetWidth-imgWidth;timepieces=obj['x']-topLeft-imgWidth*0.5}if(left<0){left=0}if(left>numTotal*imgWidth-thisTemp.PD.offsetWidth){left=numTotal*imgWidth-thisTemp.PD.offsetWidth}thisTemp.css(thisTemp.previewTop,{left:topLeft+'px',top:top+2+'px',display:'block'});if(thisTemp.previewTop.offsetHeight>thisTemp.previewDiv.offsetHeight){thisTemp.css(thisTemp.previewTop,{height:thisTemp.previewDiv.offsetHeight-(thisTemp.previewTop.offsetHeight-thisTemp.previewDiv.offsetHeight)+'px'})}if(this.previewTween!=null){this.animatePause(this.previewTween);this.previewTween=null}var nowLeft=parseInt(thisTemp.css(thisTemp.previewDiv,'left'));var leftC=nowLeft+left;if(nowLeft==-(left+timepieces)){return}if(isTween){var obj={element:thisTemp.previewDiv,start:null,end:-(left+timepieces),speed:0.3};this.previewTween=this.animate(obj)}else{thisTemp.css(thisTemp.previewDiv,'left',-(left+timepieces)+'px')}}},deletePreview:function(){if(this.previewDiv!=null){this.deleteChild(this.previewDiv);this.previewDiv=null;this.previewStart=0}},changeVideo:function(){if(!this.html5Video){this.getVarsObject();this.V.newVideo(this.vars);return}var vArr=this.VA;var v=this.vars;var i=0;if(vArr.length<1){return}if(this.V!=null&&this.needSeek==0){this.needSeek=this.V.currentTime}if(v['poster']){this.V.poster=v['poster']}else{this.V.removeAttribute('poster')}if(v['loop']){this.V.loop='loop'}else{this.V.removeAttribute('loop')}if(v['seek']>0){this.needSeek=v['seek']}else{this.needSeek=0}if(this.getFileExt(vArr[0][0])!='.m3u8'){this.isM3u8=false}if(!this.isM3u8){if(vArr.length==1){this.V.innerHTML='';this.V.src=vArr[0][0]}else{var source='';vArr=this.arrSort(vArr);for(i=0;i'}this.V.removeAttribute('src');this.V.innerHTML=source}if(v['autoplay']){this.V.autoplay='autoplay'}else{this.V.removeAttribute('autoplay')}this.V.load()}else{this.embedHls(vArr[0][0],v['autoplay'])}if(!this.isUndefined(v['volume'])){this.changeVolume(v['volume'])}this.resetPlayer();this.timerErrorFun();if(this.vars['cktrack']){this.loadTrack()}},elementCoordinate:function(){this.pdCoor=this.getXY(this.PD);var cssTemp=null;try{cssTemp=this.getEleCss(this.ckStyle['centerPlay'],{cursor:'pointer'});this.css(this.CB['pauseCenter'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['loading']);this.css(this.CB['loading'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['error']);this.css(this.CB['errorText'],cssTemp)}catch(event){this.log(event)}try{cssTemp=this.getEleCss(this.ckStyle['logo']);this.css(this.CB['logo'],cssTemp)}catch(event){this.log(event)}this.checkBarWidth()},carbarButton:function(){var styleC=this.ckStyle['controlBar'];var styleCB=styleC['button'];var cssTemp=null;var cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};var cssSup2={overflow:'hidden',cursor:'default',zIndex:1};var cssSup4={overflow:'hidden',cursor:'pointer',display:'none',zIndex:995};cssTemp=this.getEleCss(styleCB['play'],cssSup,this.CB['controlBarBg']);this.css(this.CB['play'],cssTemp);cssTemp=this.getEleCss(styleCB['pause'],cssSup,this.CB['controlBarBg']);this.css(this.CB['pause'],cssTemp);cssTemp=this.getEleCss(styleCB['mute'],cssSup,this.CB['controlBarBg']);this.css(this.CB['mute'],cssTemp);cssTemp=this.getEleCss(styleCB['escMute'],cssSup,this.CB['controlBarBg']);this.css(this.CB['escMute'],cssTemp);cssTemp=this.getEleCss(styleCB['full'],cssSup,this.CB['controlBarBg']);this.css(this.CB['full'],cssTemp);cssTemp=this.getEleCss(styleCB['escFull'],cssSup,this.CB['controlBarBg']);this.css(this.CB['escFull'],cssTemp);cssTemp=this.getEleCss(styleC['timeText']['vod'],cssSup2,this.CB['controlBarBg']);this.css(this.CB['timeText'],cssTemp);var volumeSchedule=this.newObj(styleC['volumeSchedule']);volumeSchedule['backgroundImg']='';cssTemp=this.getEleCss(volumeSchedule,cssSup2,this.CB['controlBarBg']);this.css(this.CB['volume'],cssTemp);cssTemp={width:cssTemp['width'],height:styleC['volumeSchedule']['backgroundHeight']+'px',overflow:'hidden',backgroundRepeat:'no-repeat',backgroundPosition:'left center'};if(this.ckConfig['config']['buttonMode']['volumeSchedule']){cssTemp['cursor']='pointer'}this.css(this.CB['volumeBg'],cssTemp);this.css(this.CB['volumeBg'],{position:'absolute',});cssTemp['width']=(this.CB['volumeBO'].offsetWidth*0.5+parseInt(this.css(this.CB['volumeBO'],'left')))+'px';this.css(this.CB['volumeUp'],cssTemp);this.css(this.CB['volumeBg'],'backgroundImage','url('+styleC['volumeSchedule']['backgroundImg']+')');this.css(this.CB['volumeUp'],'backgroundImage','url('+styleC['volumeSchedule']['maskImg']+')');cssTemp=this.getEleCss(styleC['volumeSchedule']['button'],{overflow:'hidden',cursor:'pointer',backgroundRepeat:'no-repeat',backgroundPosition:'left center'});this.css(this.CB['volumeBO'],cssTemp);if(this.ckConfig['config']['playbackRate']){if(!this.CB['playbackrateButtonText']){this.textButton(this.CB['playbackrate'],styleC['playbackrate']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['playbackrate']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['playbackrate'],'playbackrateButtonText')}cssTemp=this.getEleCss(styleC['playbackrate']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['playbackrate'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['playbackrateP'],'display','none');cssTemp=this.getEleCss(styleC['playbackrate']['backgroundCoorH5'],cssSup4);this.css(this.CB['playbackrateP'],cssTemp)}if(this.ckConfig['config']['definition']){if(!this.CB['defaultButtonText']){this.textButton(this.CB['definition'],styleC['definition']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['definition']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['definition'],'defaultButtonText')}cssTemp=this.getEleCss(styleC['definition']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['definition'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['definitionP'],'display','none');cssTemp=this.getEleCss(styleC['definition']['backgroundCoorH5'],cssSup4);this.css(this.CB['definitionP'],cssTemp)}if(this.ckConfig['config']['subtitle']){if(!this.CB['subtitleButtonText']){this.textButton(this.CB['subtitles'],styleC['subtitle']['defaultButton'],this.objectAssign({overflow:'hidden',cursor:'pointer',zIndex:1},styleC['subtitle']['defaultButtonCoor']),this.CB['controlBarBg'],this.ckLanguage['subtitle'],'subtitleButtonText')}cssTemp=this.getEleCss(styleC['subtitle']['defaultButtonCoor'],cssSup,this.CB['controlBarBg']);this.css(this.CB['subtitles'],{left:cssTemp['left'],top:cssTemp['top']});this.css(this.CB['subtitlesP'],'display','none');cssTemp=this.getEleCss(styleC['subtitle']['backgroundCoorH5'],cssSup4);this.css(this.CB['subtitlesP'],cssTemp)}},textButton:function(ele,css,cssSup,upEle,text,newName){var thisTemp=this;var bgCss={width:css['width'],height:css['height']};if(cssSup){bgCss={width:css['width'],height:css['height'],align:cssSup['align'],vAlign:cssSup['vAlign'],marginX:cssSup['marginX'],marginY:cssSup['marginY'],offsetX:cssSup['offsetX'],offsetY:cssSup['offsetY'],zIndex:2}}cssTemp=this.getEleCss(bgCss,null,upEle);thisTemp.css(ele,cssTemp);var outCss=this.newObj(css);var overCss=this.newObj(css);var textOutCss=this.newObj(css);var textOverCss=this.newObj(css);var cssTemp=null;outCss['alpha']=css['backgroundAlpha'];overCss['backgroundColor']=css['overBackgroundColor'];overCss['alpha']=css['backgroundAlpha'];textOutCss['color']=css['textColor'];textOverCss['color']=css['overTextColor'];textOutCss['textAlign']=css['align'];textOverCss['textAlign']=css['align'];textOutCss['backgroundColor']=textOverCss['backgroundColor']='';var bgEle=document.createElement('div');this.removeChildAll(ele);ele.appendChild(bgEle);if(newName){this.CB[newName]=document.createElement('div');ele.appendChild(this.CB[newName]);this.CB[newName].innerHTML=text}else{var newEle=document.createElement('div');ele.appendChild(newEle);newEle.innerHTML=text}var outFun=function(){cssTemp=thisTemp.getEleCss(outCss,{cursor:'pointer',zIndex:1},bgEle);cssTemp['left']='';cssTemp['top']='';thisTemp.css(bgEle,cssTemp);cssTemp=thisTemp.getEleCss(textOutCss,{cursor:'pointer',zIndex:2},bgEle);cssTemp['left']='';cssTemp['top']='';if(newName){thisTemp.css(thisTemp.CB[newName],cssTemp,bgEle)}else{thisTemp.css(newEle,cssTemp,bgEle)}thisTemp.buttonHide=true;if(thisTemp.timeButtonOver){window.clearTimeout(thisTemp.timeButtonOver);thisTemp.timeButtonOver=null}thisTemp.timeButtonOver=window.setTimeout(function(){thisTemp.buttonListHide()},1000)};var overFun=function(){cssTemp=thisTemp.getEleCss(overCss,{zIndex:1},bgEle);cssTemp['left']='';cssTemp['top']='';thisTemp.css(bgEle,cssTemp);cssTemp=thisTemp.getEleCss(textOverCss,{zIndex:2},bgEle);cssTemp['left']='';cssTemp['top']='';if(newName){thisTemp.css(thisTemp.CB[newName],cssTemp)}else{thisTemp.css(newEle,cssTemp)}};outFun();this.addListenerInside('mouseout',outFun,ele);this.addListenerInside('mouseover',overFun,ele)},buttonListHide:function(){if(this.buttonHide){this.css([this.CB['definitionP'],this.CB['subtitlesP'],this.CB['playbackrateP']],'display','none')}if(this.timeButtonOver){window.clearTimeout(this.timeButtonOver);this.timeButtonOver=null}this.buttonHide=false},videoCss:function(){var cssTemp={};if(this.css(this.CB['controlBar'],'display')=='none'){cssTemp=this.ckStyle['video']['controlBarHideReserve']}else{cssTemp=this.ckStyle['video']['reserve']}var spacingBottom=cssTemp['spacingBottom'];if(this.V.controls&&this.isMobile()){spacingBottom-=40}var pW=this.PD.offsetWidth,pH=this.PD.offsetHeight;var vW=pW-cssTemp['spacingLeft']-cssTemp['spacingRight'];var vH=pH-cssTemp['spacingTop']-spacingBottom;if(!this.MD){this.css(this.V,{width:vW+'px',height:vH+'px',marginLeft:cssTemp['spacingLeft']+'px',marginTop:cssTemp['spacingTop']+'px'})}else{this.css([this.MD,this.MDC],{width:vW+'px',height:vH+'px',marginLeft:cssTemp['spacingLeft']+'px',marginTop:cssTemp['spacingTop']+'px'})}},playerCustom:function(){var custom=this.ckStyle['custom'];var button=custom['button'];var images=custom['images'];var cssTemp=null;var cssSup=null;var k='',tempID='';var b={};var tempDiv;var i=0;for(k in button){b=button[k];cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};cssTemp=this.getEleCss(b,cssSup);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-button',name:k});this.PD.appendChild(tempDiv);if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]}i++;this.buttonEventFun(tempDiv,b)}for(k in images){b=images[k];cssSup={overflow:'hidden',zIndex:1};cssTemp=this.getEleCss(b,cssSup);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'player-images',name:k});this.PD.appendChild(tempDiv);var img=new Image();img.src=images[k]['img'];tempDiv.appendChild(img);i++}},carbarCustom:function(){var custom=this.ckStyle['controlBar']['custom'];var button=custom['button'];var images=custom['images'];var cssTemp=null;var cssSup=null;var k='',tempID='';var b={};var tempDiv;var i=0;for(k in button){b=button[k];cssSup={overflow:'hidden',cursor:'pointer',zIndex:1};cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-button',name:k});this.CB['controlBar'].appendChild(tempDiv);if(!this.isUndefined(this.ckLanguage['buttonOver'][k])){tempDiv.dataset.title=this.ckLanguage['buttonOver'][k]}i++;this.buttonEventFun(tempDiv,b)}for(k in images){b=images[k];cssSup={overflow:'hidden',zIndex:1};cssTemp=this.getEleCss(b,cssSup,this.CB['controlBarBg']);tempDiv=document.createElement('div');this.css(tempDiv,cssTemp);this.customeElement.push({ele:tempDiv,css:b,cssSup:cssSup,type:'controlBar-images',name:k});this.CB['controlBar'].appendChild(tempDiv);var img=new Image();img.src=images[k]['img'];tempDiv.appendChild(img);i++}},customCoor:function(){var cssTemp=null;if(this.customeElement.length>0){for(var i=0;i0){for(var i=0;i0){this.videoSeek(this.needSeek);this.needSeek=0}if(this.animatePauseArray.length>0){this.animateResume('pause')}if(this.playerType=='html5video'&&this.V!=null&&this.ckConfig['config']['videoDrawImage']){this.sendVCanvas()}if(!this.isUndefined(this.advertisements['pause'])&&!this.adPlayStart){this.closePauseAd()}},adPausePlayer:function(){this.adI=0;this.adType='pause';this.adPauseShow=true;this.loadAdPause();this.sendJS('pauseAd','play')},loadAdPause:function(){var ad=this.getNowAdvertisements();var type=ad['type'];var thisTemp=this;var width=this.PD.offsetWidth,height=this.PD.offsetHeight;if(this.isStrImage(type)&&this.adPauseShow){this.css(this.CB['adElement'],'display','block');var imgClass='adimg'+this.randomString(10);var imgHtml='';if(ad['link']){imgHtml=''+imgHtml+''}this.CB['adElement'].innerHTML=imgHtml;this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css([thisTemp.getByElement(imgClass),thisTemp.CB['adElement']],{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});if(thisTemp.ckStyle['advertisement']['closeButtonShow']&&thisTemp.adPauseShow){thisTemp.css(thisTemp.CB['adPauseClose'],{display:'block'})}thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']);thisTemp.adPauseCoor()},this.getByElement(imgClass));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adElement']);var newI=this.adI;if(this.adI0){setTimeout(function(){if(thisTemp.adPauseShow){thisTemp.adI=newI;thisTemp.loadAdPause()}},ad['time']*1000)}}},adPauseCoor:function(){if(this.css(this.CB['adElement'],'display')=='block'){var w=this.CB['adElement'].offsetWidth,h=this.CB['adElement'].offsetHeight;var pw=this.PD.offsetWidth,ph=this.PD.offsetHeight;this.css(this.CB['adElement'],{top:(ph-h)*0.5+'px',left:(pw-w)*0.5+'px'});if(this.css(this.CB['adPauseClose'],'display')=='block'){var rr=this.ckStyle['advertisement']['closeButton'];var cxy=this.getPosition(rr,this.CB['adElement']);this.css(this.CB['adPauseClose'],{top:cxy['y']+'px',left:cxy['x']+'px'})}}},closePauseAd:function(){this.CB['adElement'].innerHTML='';this.css([this.CB['adElement'],this.CB['adPauseClose']],'display','none');this.adPauseShow=false;this.sendJS('pauseAd','ended')},advertisementsTime:function(nt){if(this.isUndefined(nt)){nt=0}var ad=this.advertisements[this.adType];if(nt>0){ad[this.adI]['time']=Math.ceil(nt)}this.adTimeAllTotal=0;for(var i=this.adI;i0){this.CB['adTimeText'].innerHTML=this.ckLanguage['adCountdown'].replace('[$second]',this.adTimeAllTotal).replace('[$Second]',this.adTimeAllTotal>9?this.adTimeAllTotal:'0'+this.adTimeAllTotal)}if(this.adPauseShow){this.closePauseAd()}this.adOtherCloseAll();this.adTimeTotal=-1},adSkipButtonShow:function(){var thisTemp=this;var skipConfig=this.ckStyle['advertisement'];var delayTimeTemp=skipConfig[this.adType+'SkipButtonDelay'];var timeFun=function(){if(delayTimeTemp>=0){thisTemp.CB['adSkipText'].innerHTML=thisTemp.ckLanguage['skipDelay'].replace('[$second]',delayTimeTemp).replace('[$Second]',delayTimeTemp>9?delayTimeTemp:'0'+delayTimeTemp);thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block');thisTemp.css(thisTemp.CB['adSkipButton'],'display','none');setTimeout(timeFun,1000)}else{thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none');if(thisTemp.css(thisTemp.CB['adTime'],'display')=='block'){thisTemp.css(thisTemp.CB['adSkipButton'],'display','block')}}delayTimeTemp--};if(skipConfig['skipButtonShow']){if(skipConfig[this.adType+'SkipButtonDelay']>0&&this.isUndefined(this.adSkipButtonTime)){thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','block');timeFun()}else{thisTemp.css([thisTemp.CB['adSkip'],thisTemp.CB['adSkipText']],'display','none');thisTemp.css(thisTemp.CB['adSkipButton'],'display','block')}}},advertisementsPlay:function(){this.css([this.CB['adBackground'],this.CB['adElement'],this.CB['adTime'],this.CB['adTimeText'],this.CB['adSkip'],this.CB['adSkipText'],this.CB['adSkipButton'],this.CB['adLink']],'display','none');this.adPlayerPlay=false;var ad=this.advertisements[this.adType];if(this.adI==0&&(this.adType=='front'||this.adType=='insert'||this.adType=='end')){this.sendJS('process',this.adType+' ad play');this.sendJS(this.adType+'Ad','play')}this.trackHide();if(this.adI';if(ad['link']){imgHtml=''+imgHtml+''}this.CB['adElement'].innerHTML=imgHtml;this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css(thisTemp.getByElement(imgClass),{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});thisTemp.css(thisTemp.CB['adElement'],{width:imgWH['width']+'px',height:imgWH['height']+'px',top:(height-imgWH['height'])*0.5+'px',left:(width-imgWH['width'])*0.5+'px'});thisTemp.ajaxSuccessNull(ad['exhibitionMonitor'])},this.getByElement(imgClass));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adElement']);if(!this.isUndefined(ad['time'])){this.adCountDown()}}else{this.css([this.CB['adTime'],this.CB['adTimeText']],'display','block');if(this.adVideoMute){this.css(this.CB['adEscMute'],'display','block');this.css(this.CB['adMute'],'display','none')}else{this.css(this.CB['adEscMute'],'display','none');this.css(this.CB['adMute'],'display','block')}this.CB['adElement'].innerHTML='';if(this.videoTemp['currentSrc']==''){this.videoTemp['currentSrc']=this.getCurrentSrc()}if(this.V.loop){this.videoTemp['loop']=true;this.V.loop=false}if(this.V!=null&&this.V.currentTime>0&&this.adIsVideoTime&&this.adType!='front'){this.adIsVideoTime=false;this.needSeek=this.V.currentTime}this.V.src=ad['file'];this.V.currentSrc=ad['file'];this.V.innerHTML='';this.V.play();this.adVideoPlay=true;this.ajaxSuccessNull(ad['exhibitionMonitor']);if(!this.adVideoMute){this.escAdMute()}}if(ad['link']){this.css(this.CB['adLink'],'display','block');var adLinkClick=function(event){thisTemp.sendJS('clickEvent','javaScript->adLinkClick')};this.addListenerInside('click',adLinkClick,this.CB['adLink']);this.adLinkTemp=ad['link'];var linkTemp='';this.CB['adLink'].innerHTML=linkTemp;this.css(this.getByElement('ckadmorelink'),{color:'#FFFFFF',textDecoration:'none'});this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.CB['adLink'])}else{this.css(this.CB['adLink'],'display','none')}},adCountDown:function(){var thisTemp=this;if(this.adTimeTotal>0){if(!this.adIsPause){this.adTimeTotal--;this.showAdTime();this.adCountDownObj=null;this.adCountDownObj=setTimeout(function(){thisTemp.adCountDown()},1000)}}else{this.adI++;this.advertisementsPlay()}},adPlayerTimeHandler:function(time){var ad=this.getNowAdvertisements();var type=ad['type'];if(this.isStrImage(type)){return}if(this.adTimeTotal!=parseInt(time)){this.adTimeTotal=parseInt(time);this.showAdTime()}},showAdTime:function(){this.adTimeAllTotal--;var n=this.adTimeAllTotal;if(n<0){n=0}this.CB['adTimeText'].innerHTML=this.ckLanguage['adCountdown'].replace('[$second]',n).replace('[$Second]',n<10?'0'+n:n)},checkAdOther:function(t){if(this.adPlayerPlay){return}var adTime=this.advertisements['othertime'];var adPlay=this.advertisements['otherPlay'];for(var i=0;i=adTime[i]&&!adPlay[i]){adPlay[i]=true;this.newAdOther(i)}}},newAdOther:function(i){var thisTemp=this;var ad=this.advertisements['other'][i];var randomS=this.randomString(10);var adDivID='adother'+randomS;imgClassName='adimgother'+randomS;var adDiv=document.createElement('div');adDiv.className=adDivID;this.PD.appendChild(adDiv);ad['div']=adDivID;ad['element']=imgClassName;var adHtml='';if(ad['link']){adHtml=''+adHtml+''}this.getByElement(adDivID).innerHTML=adHtml;this.css(adDivID,{position:'absolute',overflow:'hidden',zIndex:'996',top:'-600px',left:'-600px',cursor:'pointer'});if(this.ckStyle['advertisement']['closeOtherButtonShow']){var closeAdDivID='adotherclose-'+randomS;var closeAdDiv=document.createElement('div');closeAdDiv.className=closeAdDivID;this.PD.appendChild(closeAdDiv);ad['closeDiv']=closeAdDivID;ad['close']=false;var closeAdDivCss=this.getEleCss(this.ckStyle['advertisement']['closeOtherButton'],{offsetX:-10000,offsetY:-10000,cursor:'pointer',zIndex:997});this.css(closeAdDivID,closeAdDivCss);var adOtherCloseOver=function(){thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOver'])};var adOtherCloseOut=function(){thisTemp.loadImgBg(closeAdDivID,thisTemp.ckStyle['advertisement']['closeOtherButton']['mouseOut'])};adOtherCloseOut();this.addListenerInside('mouseover',adOtherCloseOver,this.getByElement(closeAdDivID));this.addListenerInside('mouseout',adOtherCloseOut,this.getByElement(closeAdDivID))}this.addListenerInside('load',function(){var imgObj=new Image();imgObj.src=this.src;var imgWH=thisTemp.adjustmentWH(imgObj.width,imgObj.height);thisTemp.css([thisTemp.getByElement(imgClassName),thisTemp.getByElement(adDivID)],{width:imgWH['width']+'px',height:imgWH['height']+'px',border:'0px'});thisTemp.advertisements['other'][i]=ad;thisTemp.ajaxSuccessNull(ad['exhibitionMonitor']);thisTemp.adOtherCoor()},this.getByElement(imgClassName));this.addListenerInside('click',function(){thisTemp.adOtherClose(i)},this.getByElement(closeAdDivID));this.addListenerInside('click',function(){thisTemp.ajaxSuccessNull(ad['clickMonitor'])},this.getByElement(imgClassName));if(ad['time']>0){setTimeout(function(){thisTemp.adOtherClose(i)},ad['time']*1000)}},adOtherClose:function(i){var ad=this.advertisements['other'][i];if(!this.isUndefined(ad['close'])){if(!ad['close']){ad['close']=true;this.PD.removeChild(this.getByElement(ad['div']));this.PD.removeChild(this.getByElement(ad['closeDiv']))}}},adOtherCloseAll:function(){if(!this.isUndefined(this.advertisements['other'])){var ad=this.advertisements['other'];for(var i=0;i-1;i--){if(t>=adTime[i]&&t1&&!adPlay[i]){this.adI=0;this.adType='insert';this.adMuteInto();this.adIsVideoTime=true;this.adPlayStart=true;this.adVideoPlay=false;this.videoPause();this.advertisementsTime();this.advertisementsPlay();this.adSkipButtonShow();adPlay[i]=true;for(var n=0;n=width||h>=height){if(width/w>height/h){nh=height-20;nw=w*nh/h}else{nw=width-20;nh=h*nw/w}}else{nw=w;nh=h}return{width:nw,height:nh}},ajaxSuccessNull:function(url){if(!this.isUndefined(url)){var ajaxObj={url:url,success:function(data){}};this.ajax(ajaxObj)}},runFunction:function(s){try{var arr=s.split('->');if(arr.length==2){switch(arr[0]){case'javaScript':if(arr[1].substr(0,11)!='[flashvars]'){eval(arr[1]+'()')}else{eval(this.vars[arr[1].substr(11)]+'()')}break;case'actionScript':eval('this.'+arr[1]+'()');break}}this.sendJS('clickEvent',s)}catch(event){}},sendVCanvas:function(){if(this.timerVCanvas==null){this.css(this.V,'display','none');this.css(this.MD,'display','block');var thisTemp=this;var videoCanvas=function(){if(thisTemp.MDCX.width!=thisTemp.MD.offsetWidth){thisTemp.MDC.width=thisTemp.MD.offsetWidth}if(thisTemp.MDCX.height!=thisTemp.MD.offsetHeight){thisTemp.MDC.height=thisTemp.MD.offsetHeight}thisTemp.MDCX.clearRect(0,0,thisTemp.MDCX.width,thisTemp.MDCX.height);var coor=thisTemp.getProportionCoor(thisTemp.PD.offsetWidth,thisTemp.PD.offsetHeight,thisTemp.V.videoWidth,thisTemp.V.videoHeight);thisTemp.MDCX.drawImage(thisTemp.V,0,0,thisTemp.V.videoWidth,thisTemp.V.videoHeight,coor['x'],coor['y'],coor['width'],coor['height'])};this.timerVCanvas=new this.timer(0,videoCanvas)}},pauseHandler:function(){var thisTemp=this;this.playShow(false);if(this.animatePauseArray.length>0){this.animatePause('pause')}if(this.playerType=='html5video'&&this.V!=null&&this.ckConfig['config']['videoDrawImage']){this.stopVCanvas()}if(!this.isUndefined(this.advertisements['pause'])&&!this.adPlayStart&&!this.adPauseShow){setTimeout(function(){if(!thisTemp.isUndefined(thisTemp.advertisements['pause'])&&!thisTemp.adPlayStart&&!thisTemp.adPauseShow&&thisTemp.time>1){thisTemp.adPausePlayer()}},300)}},stopVCanvas:function(){if(this.timerVCanvas!=null){this.css(this.V,'display','block');this.css(this.MD,'display','none');if(this.timerVCanvas.runing){this.timerVCanvas.stop()}this.timerVCanvas=null}},playShow:function(b){if(!this.conBarShow){return}if(b){this.css(this.CB['play'],'display','none');this.css(this.CB['pauseCenter'],'display','none');this.css(this.CB['pause'],'display','block')}else{this.css(this.CB['play'],'display','block');if(this.css(this.CB['errorText'],'display')=='none'){if(!this.adPlayerPlay){this.css(this.CB['pauseCenter'],'display','block')}}else{this.css(this.CB['pauseCenter'],'display','none')}this.css(this.CB['pause'],'display','none')}},seekedHandler:function(){this.resetTrack();this.isTimeButtonMove=true;if(this.V.paused){if(this.hlsAutoPlay){this.videoPlay()}else{this.hlsAutoPlay=true}}},endedHandler:function(){this.sendJS('ended');if(this.adPlayerPlay){this.adI++;this.advertisementsPlay();return}if(!this.endAdPlay&&!this.isUndefined(this.advertisements['end'])){this.endAdPlay=true;this.adI=0;this.adType='end';this.adMuteInto();this.adIsVideoTime=true;this.adPlayStart=true;this.adVideoPlay=false;this.videoPause();this.advertisementsTime();this.advertisementsPlay();this.adSkipButtonShow();this.adReset=true;return}this.endedAdReset();if(this.vars['loop']){this.videoSeek(0)}},endedAdReset:function(){var arr=[];var i=0;if(!this.isUndefined(this.advertisements['insertPlay'])){arr=this.advertisements['insertPlay'];for(i=0;i0){this.css(this.CB['mute'],'display','block');this.css(this.CB['escMute'],'display','none')}else{this.css(this.CB['mute'],'display','none');this.css(this.CB['escMute'],'display','block')}}catch(event){}}},timeUpdateHandler:function(){var duration=0;if(this.playerType=='html5video'){try{duration=this.V.duration}catch(event){}}if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}if(duration>0){this.time=this.V.currentTime;this.timeTextHandler();this.trackShowHandler();if(this.isTimeButtonMove){this.timeProgress(this.time,duration)}}},controlBar:function(){var cb=this.ckStyle['controlBar'];var cssObjTemp={align:cb['align'],vAlign:cb['vAlign'],width:cb['width'],height:cb['height'],offsetX:cb['offsetX'],offsetY:cb['offsetY']};var bgCss={backgroundColor:cb['background']['backgroundColor'],backgroundImg:cb['background']['backgroundImg'],alpha:cb['background']['alpha']};var cssTemp=this.getEleCss(this.objectAssign(cssObjTemp,bgCss),{zIndex:888});this.css(this.CB['controlBarBg'],cssTemp);cssTemp=this.getEleCss(cssObjTemp,{zIndex:889});this.css(this.CB['controlBar'],cssTemp)},timeProgress:function(time,duration){if(!this.conBarShow){return}var timeProgressBgW=this.CB['timeProgressBg'].offsetWidth;var timeBOW=parseInt((time*timeProgressBgW/duration)-(this.CB['timeButton'].offsetWidth*0.5));if(timeBOW>timeProgressBgW-this.CB['timeButton'].offsetWidth){timeBOW=timeProgressBgW-this.CB['timeButton'].offsetWidth}if(timeBOW<0){timeBOW=0}this.css(this.CB['timeProgress'],'width',timeBOW+'px');this.css(this.CB['timeButton'],'left',parseInt(timeBOW)+'px')},timeTextHandler:function(){if(!this.conBarShow){return}var duration=this.V.duration;var time=this.V.currentTime;if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}this.CB['timeText'].innerHTML=this.formatTime(time,duration,this.ckLanguage['vod'])},bufferEdHandler:function(){if(!this.conBarShow||this.playerType=='flashplayer'){return}var thisTemp=this;var clearTimerBuffer=function(){if(thisTemp.timerBuffer!=null){if(thisTemp.timerBuffer.runing){thisTemp.sendJS('buffer',100);thisTemp.timerBuffer.stop()}thisTemp.timerBuffer=null}};clearTimerBuffer();var bufferFun=function(){if(!thisTemp.isUndefined(thisTemp.V)&&thisTemp.V.buffered.length>0){var duration=thisTemp.V.duration;var len=thisTemp.V.buffered.length;var bufferStart=thisTemp.V.buffered.start(len-1);var bufferEnd=thisTemp.V.buffered.end(len-1);var loadTime=bufferStart+bufferEnd;var loadProgressBgW=thisTemp.CB['timeProgressBg'].offsetWidth;var timeButtonW=thisTemp.CB['timeButton'].offsetWidth;var loadW=parseInt((loadTime*loadProgressBgW/duration)+timeButtonW);if(loadW>=loadProgressBgW){loadW=loadProgressBgW;clearTimerBuffer()}thisTemp.changeLoad(loadTime)}};this.timerBuffer=new this.timer(200,bufferFun)},changeLoad:function(loadTime){if(this.V==null){return}if(!this.conBarShow){return}var loadProgressBgW=this.CB['timeProgressBg'].offsetWidth;var timeButtonW=this.CB['timeButton'].offsetWidth;var duration=this.V.duration;if(isNaN(duration)||parseInt(duration)<0.2){duration=this.vars['duration']}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}if(this.isUndefined(loadTime)){loadTime=this.loadTime}else{this.loadTime=loadTime}var loadW=parseInt((loadTime*loadProgressBgW/duration)+timeButtonW);this.css(this.CB['loadProgress'],'width',loadW+'px');this.sendJS('loadTime',loadTime);this.loadTimeTemp=loadTime},judgeIsLive:function(){var thisTemp=this;if(this.timerError!=null){if(this.timerError.runing){this.timerError.stop()}this.timerError=null}this.error=false;if(this.conBarShow){this.css(this.CB['errorText'],'display','none')}var timeupdate=function(event){thisTemp.timeUpdateHandler()};if(!this.vars['live']){if(this.V!=null&&this.playerType=='html5video'){this.addListenerInside('timeupdate',timeupdate);thisTemp.timeTextHandler();thisTemp.prompt();setTimeout(function(){thisTemp.bufferEdHandler()},200)}}else{this.removeListenerInside('timeupdate',timeupdate);if(this.timerTime!=null){window.clearInterval(this.timerTime);timerTime=null}if(this.timerTime!=null){if(this.timerTime.runing){this.timerTime.stop()}this.timerTime=null}var timeFun=function(){if(thisTemp.V!=null&&!thisTemp.V.paused&&thisTemp.conBarShow){thisTemp.CB['timeText'].innerHTML=thisTemp.formatTime(0,0,thisTemp.ckLanguage['live'])}};this.timerTime=new this.timer(1000,timeFun)}this.definition()},loadTrack:function(def){if(this.playerType=='flashplayer'||this.vars['flashplayer']==true){return}if(this.isUndefined(def)){def=-1}var track=this.vars['cktrack'];var loadTrackUrl='';var type=this.varType(track);var thisTemp=this;if(type=='array'){if(def==-1){var index=0;var indexN=0;for(var i=0;iindexN){indexN=li[2];index=i}}}else{index=def}loadTrackUrl=track[index][0]}else{loadTrackUrl=track}var obj={method:'get',dataType:'text',url:loadTrackUrl,charset:'utf-8',success:function(data){if(data){thisTemp.track=thisTemp.parseSrtSubtitles(data);thisTemp.trackIndex=0;thisTemp.nowTrackShow={sn:''}}}};this.ajax(obj)},resetTrack:function(){this.trackIndex=0;this.nowTrackShow={sn:''}},trackShowHandler:function(){if(!this.conBarShow||this.adPlayerPlay){return}if(this.track.length<1){return}if(this.trackIndex>=this.track.length){this.trackIndex=0}var nowTrack=this.track[this.trackIndex];if(this.time>=nowTrack['startTime']&&this.time<=nowTrack['endTime']){var nowShow=this.nowTrackShow;if(nowShow['sn']!=nowTrack['sn']){this.trackHide();this.trackShow(nowTrack);this.nowTrackTemp=nowTrack}}else{this.trackHide();this.checkTrack()}},trackShowAgain:function(){this.trackHide();this.trackShow(this.nowTrackTemp)},trackShow:function(track){this.nowTrackShow=track;var arr=track['content'];for(var i=0;i=arr[i]['startTime']&&this.time<=arr[i]['endTime']){this.trackIndex=i;break}}},playOrPause:function(){if(!this.loaded){return}if(this.V==null){return}if(this.playerType=='flashplayer'){this.V.playOrPause();return}if(this.V.paused){this.videoPlay()}else{this.videoPause()}},videoPlay:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoPlay();return}if(this.adPlayerPlay){this.eliminateAd();return}try{if(this.V.currentSrc){this.V.play()}}catch(event){}},videoPause:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoPause();return}try{this.V.pause()}catch(event){}},videoSeek:function(time){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoSeek(time);return}var duration=this.V.duration>0.2?this.V.duration:this.getMetaDate()['duration'];if(duration>0&&time>duration){if(this.vars['forceduration']>0){time=0;this.sendJS('ended')}else{time=duration-0.1}}if(time>=0){this.V.currentTime=time;this.sendJS('seekTime',time)}},changeVolume:function(vol,bg,button){if(this.loaded){if(this.playerType=='flashplayer'){this.V.changeVolume(vol);return}}if(isNaN(vol)||this.isUndefined(vol)){vol=0}if(!this.loaded){this.vars['volume']=vol}if(!this.html5Video){this.V.changeVolume(vol);return}try{if(this.isUndefined(bg)){bg=true}}catch(e){}try{if(this.isUndefined(button)){button=true}}catch(e){}if(!vol){vol=0}if(vol<0){vol=0}if(vol>1){vol=1}try{this.V.volume=vol}catch(error){}this.volume=vol;if(bg&&this.conBarShow){var bgW=vol*this.CB['volumeBg'].offsetWidth;if(bgW<0){bgW=0}if(bgW>this.CB['volumeBg'].offsetWidth){bgW=this.CB['volumeBg'].offsetWidth}this.css(this.CB['volumeUp'],'width',bgW+'px')}if(button&&this.conBarShow){var buLeft=parseInt(this.CB['volumeUp'].offsetWidth-(this.CB['volumeBO'].offsetWidth*0.5));if(buLeft>this.CB['volumeBg'].offsetWidth-this.CB['volumeBO'].offsetWidth){buLeft=this.CB['volumeBg'].offsetWidth-this.CB['volumeBO'].offsetWidth}if(buLeft<0){buLeft=0}this.css(this.CB['volumeBO'],'left',buLeft+'px')}},videoMute:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoMute();return}this.volumeTemp=this.V?(this.V.volume>0?this.V.volume:this.vars['volume']):this.vars['volume'];this.changeVolume(0)},videoEscMute:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoEscMute();return}this.changeVolume(this.volumeTemp>0?this.volumeTemp:this.vars['volume'])},adMute:function(){if(!this.loaded){return}this.changeVolume(0);this.adVideoMute=true;this.css(this.CB['adEscMute'],'display','block');this.css(this.CB['adMute'],'display','none')},escAdMute:function(){if(!this.loaded){return}var v=this.ckStyle['advertisement']['videoVolume'];this.changeVolume(v);this.adMuteInto()},adMuteInto:function(){this.adVideoMute=false;this.css(this.CB['adEscMute'],'display','none');this.css(this.CB['adMute'],'display','block')},fastBack:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.fastBack();return}var time=this.time-this.ckConfig['config']['timeJump'];if(time<0){time=0}this.videoSeek(time)},fastNext:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.fastNext();return}var time=this.time+this.ckConfig['config']['timeJump'];if(time>this.V.duration){time=this.V.duration}this.videoSeek(time)},getCurrentSrc:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){return this.V.getCurrentSrc()}return this.V.currentSrc},switchFull:function(){if(this.full){this.quitFullScreen()}else{this.fullScreen()}},fullScreen:function(){if(this.html5Video&&this.playerType=='html5video'){var element=this.PD;if(element.requestFullscreen){element.requestFullscreen()}else if(element.mozRequestFullScreen){element.mozRequestFullScreen()}else if(element.webkitRequestFullscreen){element.webkitRequestFullscreen()}else if(element.msRequestFullscreen){element.msRequestFullscreen()}else if(element.oRequestFullscreen){element.oRequestFullscreen()}this.judgeFullScreen()}else{}},quitFullScreen:function(){if(this.html5Video&&this.playerType=='html5video'){if(document.exitFullscreen){document.exitFullscreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.oRequestFullscreen){document.oCancelFullScreen()}else if(document.requestFullscreen){document.requestFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}else{this.css(document.documentElement,'cssText','');this.css(document.document.body,'cssText','');this.css(this.PD,'cssText','')}this.judgeFullScreen()}},videoRotation:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoRotation(n);return}if(this.isUndefined(n)){n=0}var tf=this.css(this.V,'transform');if(this.isUndefined(tf)&&!tf){tf='rotate(0deg)'}var reg=tf.match(/rotate\([^)]+\)/);reg=reg?reg[0].replace('rotate(','').replace('deg)',''):'';if(reg==''){reg=0}else{reg=parseInt(reg)}if(n==-1){reg-=90}else if(n==1){reg+=90}else{if(n!=90&&n!=180&&n!=270&&n!=-90&&n!=-180&&n!=-270){reg=0}else{reg=n}}n=reg;var y90=n%90,y180=n%180,y270=n%270;var ys=false;if(y90==0&&y180==90&&y270==90){ys=true}if(y90==0&&y180==90&&y270==0){ys=true}if(y90==-0&&y180==-90&&y270==-90){ys=true}if(y90==-0&&y180==-90&&y270==-0){ys=true}tf=tf.replace(/rotate\([^)]+\)/,'').replace(/scale\([^)]+\)/,'')+' rotate('+n+'deg)';var cdW=this.CD.offsetWidth,cdH=this.CD.offsetHeight,vW=this.V.videoWidth,vH=this.V.videoHeight;if(vW>0&&vH>0){if(ys){if(cdW/cdH>vH/vW){nH=cdH;nW=vH*nH/vW}else{nW=cdW;nH=vW*nW/vH}this.css(this.V,'transform','rotate(0deg)');this.css(this.V,'transform','scale('+nH/cdW+','+nW/cdH+')'+tf)}else{this.css(this.V,'transform',tf)}}else{this.css(this.V,'transform',tf)}return},videoBrightness:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoBrightness(n);return}},videoContrast:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoContrast(n);return}},videoSaturation:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoSaturation(n);return}},videoHue:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoHue(n);return}},videoZoom:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoZoom(n);return}if(this.isUndefined(n)){n=1}if(n<0){n=0}if(n>2){n=2}var tf=this.css(this.V,'transform');tf=tf.replace(/scale\([^)]+\)/,'')+' scale('+n+')';this.videoScale=n;this.css(this.V,'transform',tf);return},videoProportion:function(w,h){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoProportion(w,h);return}},adPlay:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.adPlay();return}if(this.adPlayerPlay){this.adIsPause=false;var ad=this.getNowAdvertisements();var type=ad['type'];if(this.isStrImage(type)){this.adCountDown()}else{this.V.play()}}},adPause:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.adPause();return}if(this.adPlayerPlay){this.adIsPause=true;var ad=this.getNowAdvertisements();var type=ad['type'];if(type!='jpg'&&type!='jpeg'&&type!='png'&&type!='svg'&&type!='gif'){this.videoPause()}}},videoError:function(n){if(!this.loaded){return}if(this.playerType=='flashplayer'){this.V.videoError(n);return}},changeConfig:function(){if(!this.loaded){return}if(this.playerType=='flashplayer'){var args=Array.prototype.slice.call(arguments);switch(args.length){case 1:this.V.changeConfig(args[0]);break;case 2:this.V.changeConfig(args[0],args[1]);break;case 3:this.V.changeConfig(args[0],args[1],args[2]);break;case 4:this.V.changeConfig(args[0],args[1],args[2],args[3]);break;case 5:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4]);break;case 6:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5]);break;case 7:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);break;case 8:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);break;case 8:this.V.changeConfig(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);break}return}var obj=this.ckConfig;var arg=arguments;for(var i=0;i0){this.css(this.CD,'width',w+'px')}if(h>0){this.css(this.CD,'height',h+'px')}if(this.html5Video){this.playerResize()}},playerResize:function(){this.controlBar();this.elementCoordinate();this.carbarButton();this.customCoor();this.timeProgressDefault();this.videoCss();this.timeUpdateHandler();this.changeElementCoor();this.changePrompt();this.advertisementStyle();this.adPauseCoor();this.adOtherCoor();this.changeLoad();this.sendJS('resize')},changePlaybackRate:function(n){if(this.html5Video){var arr=this.playbackRateArr;n=parseInt(n);if(n';html+=param['v'];html+='';html+='';html+='';html+='';html+='';this.PD.innerHTML=html;this.V=this.getObjectById(vid);this.playerType='flashplayer'},checkShockwaveFlash:function(){if(window.ActiveXObject){try{var s=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');if(s){return true}}catch(e){}}else{try{var s=navigator.plugins['Shockwave Flash'];if(s){return true}}catch(e){}}return false},getFlashVars:function(){this.getVarsObject();var v=this.vars;var z='';for(k in v){if(k!='flashplayer'&&k!='container'&&v[k]!=''){if(z!=''){z+='&'}var vk=v[k];if(vk==true){vk=1}if(vk==false){vk=0}z+=k+'='+vk}}if(!v.hasOwnProperty('volume')||!v['volume']){if(z!=''){z+='&'}z+='volume=0'}return z},isStrImage:function(s){if(s=='jpg'||s=='jpeg'||s=='png'||s=='svg'||s=='gif'){return true}return false},getVarsObject:function(){var v=this.vars;var f='',d='',w='';var arr=this.VA;var prompt=v['promptSpot'];var i=0;var video=this.vars['video'];if(this.varType(video)=='array'){var arr=video;for(i=0;i'}w=w.replace('movie=','src=');return{w:w,v:v}},getMetaDate:function(){if(!this.loaded||this.V==null){return false}if(this.playerType=='html5video'){var duration=0;try{duration=!isNaN(this.V.duration)?this.V.duration:0;if(isNaN(duration)||parseInt(duration)<0.2){if(this.vars['duration']>0){duration=this.vars['duration']}}if(this.vars['forceduration']>0){duration=this.vars['forceduration']}}catch(event){this.log(event)}var data={duration:duration,volume:this.V.volume,playbackRate:this.V.playbackRate,width:this.PD.offsetWidth||this.V.offsetWidth||this.V.width,height:this.PD.offsetHeight||this.V.offsetHeight||this.V.height,streamWidth:this.V.videoWidth,streamHeight:this.V.videoHeight,videoWidth:this.V.offsetWidth,videoHeight:this.V.offsetHeight,paused:this.V.paused,loadTime:this.loadTimeTemp};return data}else{try{return this.V.getMetaDate()}catch(event){this.log(event)}}return false},getVideoUrl:function(){if(this.playerType=='flashplayer'){return this.V.getVideoUrl()}var arr=[];if(this.V.src){arr.push(this.V.src)}else{var uArr=this.V.childNodes;for(var i=0;i');var type='',fun='',link='',target='';if(callArr.length==2){var callM=callArr[0];var callE=callArr[1];if(!callE){return{type:'none'}}var val='';var eArr=[];type=callM;switch(callM){case'actionScript':if(callE.indexOf('(')>-1){eArr=callE.split('(');callE=eArr[0];val=eArr[1].replace(')','')}if(val==''){fun='thisTemp.'+callE+'()'}else{fun='thisTemp.'+callE+'('+val+')'}break;case'javaScript':if(callE.substr(0,11)=='[flashvars]'){callE=callE.substr(11);if(this.vars.hasOwnProperty(callE)){callE=this.vars[callE]}else{break}}if(callE.indexOf('(')>-1){eArr=callE.split('(');callE=eArr[0];val=eArr[1].replace(')','')}if(val==''){fun=callE+'()'}else{fun=callE+'('+val+')'}break;case"link":var callLink=(callE+',').split(',');if(callLink[0].substr(0,11)=='[flashvars]'){var fl=callLink[0].replace('[flashvars]','');if(this.vars.hasOwnProperty(fl)){callLink[0]=this.vars[fl]}else{break}}if(!callLink[1]){callLink[1]='_blank'}link=callLink[0];target=callLink[1];break}}return{type:type,fun:fun,link:link,target:target}},getPosition:function(obj,rEle){var pw=this.PD.offsetWidth,ph=this.PD.offsetHeight;var x=0,y=0;var left=0,top=0,rw=0,rh=0;if(!this.isUndefined(rEle)){left=parseInt(this.css(rEle,'left')),top=parseInt(this.css(rEle,'top')),rw=rEle.offsetWidth,rh=rEle.offsetHeight}switch(obj['align']){case'left':x=obj['offsetX']+left;break;case'center':x=pw*0.5+obj['offsetX'];if(left){x-=(pw*0.5-rw*0.5-left)}break;case'right':x=pw+obj['offsetX'];if(left){x-=(pw-left-rw)}break}switch(obj['vAlign']){case'top':y=obj['offsetY']+top;break;case'middle':y=ph*0.5+obj['offsetY']-top-(rh*0.5);if(top){x-=(ph*0.5-rh*0.5-top)}break;case'bottom':y=ph+obj['offsetY'];if(top){y-=(ph-top-rh)}break}return{x:x,y:y}},addElement:function(attribute){var thisTemp=this;if(this.playerType=='flashplayer'){return this.V.addElement(attribute)}var i=0;var obj={list:null,x:'100%',y:"50%",position:null,alpha:1,backgroundColor:'',backAlpha:1,backRadius:0,clickEvent:''};obj=this.standardization(obj,attribute);var list=obj['list'];if(list==null){return''}var id='element-'+this.randomString(10);var ele=document.createElement('div');ele.className=id;if(obj['x']){ele.setAttribute('data-x',obj['x'])}if(obj['y']){ele.setAttribute('data-y',obj['y'])}if(obj['position']!=null){ele.setAttribute('data-position',obj['position'].join(','))}this.PD.appendChild(ele);this.css(ele,{position:'absolute',filter:'alpha(opacity:'+obj['alpha']+')',opacity:obj['alpha'].toString(),width:'800px',zIndex:'20'});var bgid='elementbg'+this.randomString(10);var bgAlpha=obj['alpha'].toString();var bgColor=obj['backgroundColor'].replace('0x','#');var html='';var idArr=[];var clickArr=[];if(!this.isUndefined(list)&&list.length>0){var textObj,returnObj,clickEvent;for(i=0;i'}else{html+='
'}break;case'text':textObj={type:'text',text:'',color:'0xFFFFFF',size:14,fontFamily:this.fontFamily,leading:0,alpha:1,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,marginLeft:0,marginRight:0,marginTop:0,marginBottom:0,backgroundColor:'',backAlpha:1,backRadius:0,clickEvent:''};list[i]=this.standardization(textObj,list[i]);clickEvent=this.clickEvent(list[i]['clickEvent']);clickArr.push(clickEvent);if(clickEvent['type']=='link'){html+=''}else{html+='
'+list[i]['text']+'
'}break;default:break}idArr.push(newEleid)}}var objClickEvent=this.clickEvent(obj['clickEvent']);ele.innerHTML='
'+html+'
';if(objClickEvent['type']=='javaScript'||objClickEvent['type']=='actionScript'){var objClickHandler=function(){eval(objClickEvent['fun']);thisTemp.sendJS('clickEvent',clk['type']+'->'+clk['fun'].replace('thisTemp.','').replace('()',''))};this.addListenerInside('click',objClickHandler,this.getByElement(bgid+'_c'))}this.css(bgid+'_c',{position:'absolute',zIndex:'2'});for(i=0;i'+clk['fun'].replace('thisTemp.','').replace('()',''))};this.addListenerInside('click',clickHandler,this.getByElement(idArr[i]))}switch(list[i]['type']){case'image':case'png':case'jpg':case'jpeg':case'gif':this.css(idArr[i],{float:'left',width:list[i]['width']+'px',height:list[i]['height']+'px',filter:'alpha(opacity:'+list[i]['alpha']+')',opacity:list[i]['alpha'].toString(),marginLeft:list[i]['marginLeft']+'px',marginRight:list[i]['marginRight']+'px',marginTop:list[i]['marginTop']+'px',marginBottom:list[i]['marginBottom']+'px',borderRadius:list[i]['radius']+'px',cursor:'pointer'});this.css(idArr[i]+'_image',{width:list[i]['width']+'px',height:list[i]['height']+'px',borderRadius:list[i]['radius']+'px'});break;case'text':this.css(idArr[i]+'_text',{filter:'alpha(opacity:'+list[i]['alpha']+')',opacity:list[i]['alpha'].toString(),borderRadius:list[i]['radius']+'px',fontFamily:list[i]['font'],fontSize:list[i]['size']+'px',color:list[i]['color'].replace('0x','#'),lineHeight:list[i]['leading']>0?list[i]['leading']+'px':'',paddingLeft:list[i]['paddingLeft']+'px',paddingRight:list[i]['paddingRight']+'px',paddingTop:list[i]['paddingTop']+'px',paddingBottom:list[i]['paddingBottom']+'px',whiteSpace:'nowrap',position:'absolute',zIndex:'3',cursor:'pointer'});this.css(idArr[i],{float:'left',width:this.getByElement(idArr[i]+'_text').offsetWidth+'px',height:this.getByElement(idArr[i]+'_text').offsetHeight+'px',marginLeft:list[i]['marginLeft']+'px',marginRight:list[i]['marginRight']+'px',marginTop:list[i]['marginTop']+'px',marginBottom:list[i]['marginBottom']+'px'});this.css(idArr[i]+'_bg',{width:this.getByElement(idArr[i]+'_text').offsetWidth+'px',height:this.getByElement(idArr[i]+'_text').offsetHeight+'px',filter:'alpha(opacity:'+list[i]['backAlpha']+')',opacity:list[i]['backAlpha'].toString(),borderRadius:list[i]['backRadius']+'px',backgroundColor:list[i]['backgroundColor'].replace('0x','#'),position:'absolute',zIndex:'2'});break;default:break}}this.css(bgid,{width:this.getByElement(bgid+'_c').offsetWidth+'px',height:this.getByElement(bgid+'_c').offsetHeight+'px',position:'absolute',filter:'alpha(opacity:'+bgAlpha+')',opacity:bgAlpha,backgroundColor:bgColor.replace('0x','#'),borderRadius:obj['backRadius']+'px',zIndex:'1'});this.css(ele,{width:this.getByElement(bgid).offsetWidth+'px',height:this.getByElement(bgid).offsetHeight+'px'});var eidCoor=this.calculationCoor(ele);this.css(ele,{left:eidCoor['x']+'px',top:eidCoor['y']+'px'});this.elementArr.push(ele.className);return ele},getElement:function(element){if(this.playerType=='flashplayer'){return this.V.getElement(element)}var ele=element;if(this.varType(element)=='string'){ele=this.getByElement(element)}var coor=this.getCoor(ele);return{x:coor['x'],y:coor['y'],width:ele.offsetWidth,height:ele.offsetHeight,alpha:!this.isUndefined(this.css(ele,'opacity'))?parseFloat(this.css(ele,'opacity')):1,show:this.css(ele,'display')=='none'?false:true}},elementShow:function(element,show){if(this.playerType=='flashplayer'){this.V.elementShow(element,show);return}if(this.varType(element)=='string'){if(element){this.css(ele,'display',show==true?'block':'none')}else{var arr=this.elementTempArr;for(var i=0;i0){position.push(null,null,null,null);var i=0;for(i=0;i-1){this.elementTempArr.push(obj['element'].className);this.elementArr.splice(def,1)}var css={};var pm=this.getElement(obj['element']);var t=0;var b=0;var c=0;var d=obj['speed']*1000;var timerTween=null;var tweenObj=null;var start=obj['start']==null?'':obj['start'].toString();var end=obj['end']==null?'':obj['end'].toString();switch(obj['parameter']){case'x':if(obj['start']==null){b=pm['x']}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(start)*w*0.01}else{b=parseInt(start)}}if(obj['end']==null){c=pm['x']-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)*w*0.01-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])-b}else{c=parseInt(end)}}else{c=parseInt(end)-b}}break;case'y':if(obj['start']==null){b=pm['y']}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(start)*h*0.01}else{b=parseInt(start)}}if(obj['end']==null){c=pm['y']-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)*h*0.01-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])-b}else{c=parseInt(end)}}else{c=parseInt(end)-b}}break;case'alpha':if(obj['start']==null){b=pm['alpha']*100}else{if(start.substring(start.length-1,start.length)=='%'){b=parseInt(obj['start'])}else{b=parseInt(obj['start']*100)}}if(obj['end']==null){c=pm['alpha']*100-b}else{if(end.substring(end.length-1,end.length)=='%'){c=parseInt(end)-b}else if(end.substring(0,1)=='-'||end.substring(0,1)=='+'){if(this.varType(obj['end'])=='number'){c=parseInt(obj['end'])*100-b}else{c=parseInt(obj['end'])*100}}else{c=parseInt(obj['end'])*100-b}}break}var callBack=function(){var index=thisTemp.arrIndexOf(thisTemp.animateElementArray,animateId);if(index>-1){thisTemp.animateArray.splice(index,1);thisTemp.animateElementArray.splice(index,1)}index=thisTemp.arrIndexOf(thisTemp.animatePauseArray,animateId);if(index>-1){thisTemp.animatePauseArray.splice(index,1)}if(obj['callBack']!=null&&obj['element']&&obj['callBack']!='callBack'&&obj['callBack']!='tweenX'&&obj['tweenY']!='callBack'&&obj['callBack']!='tweenAlpha'){var cb=eval(obj['callBack']);cb(obj['element']);obj['callBack']=null}};var stopTween=function(){if(timerTween!=null){if(timerTween.runing){timerTween.stop()}timerTween=null}};var tweenX=function(){if(t-1){this.elementTempArr.splice(defX,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};var tweenY=function(){if(t-1){this.elementTempArr.splice(defY,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};var tweenAlpha=function(){if(t-1){this.elementTempArr.splice(defA,1)}}catch(event){}thisTemp.elementArr.push(obj['element'].className);callBack()}};switch(obj['parameter']){case'x':tweenObj=tweenX;break;case'y':tweenObj=tweenY;break;case'alpha':tweenObj=tweenAlpha;break;default:break}timerTween=new thisTemp.timer(10,tweenObj);timerTween.callBackFunction=callBack;if(obj['overStop']){var mouseOver=function(){if(timerTween!=null&&timerTween.runing){timerTween.stop()}};this.addListenerInside('mouseover',mouseOver,obj['element']);var mouseOut=function(){var start=true;if(obj['pauseStop']&&thisTemp.getMetaDate()['paused']){start=false}if(timerTween!=null&&!timerTween.runing&&start){timerTween.start()}};this.addListenerInside('mouseout',mouseOut,obj['element'])}this.animateArray.push(timerTween);this.animateElementArray.push(animateId);if(obj['pauseStop']){this.animatePauseArray.push(animateId)}return animateId},animateResume:function(id){if(this.playerType=='flashplayer'){this.V.animateResume(this.isUndefined(id)?'':id);return}var arr=[];if(id!=''&&!this.isUndefined(id)&&id!='pause'){arr.push(id)}else{if(id==='pause'){arr=this.animatePauseArray}else{arr=this.animateElementArray}}for(var i=0;i-1){this.animateArray[index].start()}}},animatePause:function(id){if(this.playerType=='flashplayer'){this.V.animatePause(this.isUndefined(id)?'':id);return}var arr=[];if(id!=''&&!this.isUndefined(id)&&id!='pause'){arr.push(id)}else{if(id==='pause'){arr=this.animatePauseArray}else{arr=this.animateElementArray}}for(var i=0;i-1){this.animateArray[index].stop()}}},deleteAnimate:function(id){if(this.playerType=='flashplayer'&&this.V){try{this.V.deleteAnimate(id)}catch(event){this.log(event)}return}var index=this.arrIndexOf(this.animateElementArray,id);if(index>-1){this.animateArray[index].callBackFunction();this.animateArray.splice(index,1);this.animateElementArray.splice(index,1)}},deleteElement:function(ele){if(this.playerType=='flashplayer'&&this.V){try{this.V.deleteElement(ele)}catch(event){}return}var def=this.arrIndexOf(this.elementArr,ele.className);if(def>-1){this.elementArr.splice(def,1)}try{def=this.arrIndexOf(this.elementTempArr,ele.className);if(def>-1){this.elementTempArr.splice(def,1)}}catch(event){}this.deleteAnimate(ele.className);this.deleteChild(ele)},getByElement:function(obj,parent){if(this.isUndefined(parent)){parent=document}var num=obj.substr(0,1);var res=[];if(num!='#'){if(num=='.'){obj=obj.substr(1,obj.length)}if(parent.getElementsByClassName){res=parent.getElementsByClassName(obj);if(!res.length){return null}}else{var reg=new RegExp(' '+obj+' ','i');var ele=parent.getElementsByTagName('*');for(var i=0;i0){res=res[0]}else{res=null}}else{if(num=='#'){obj=obj.substr(1,obj.length)}try{res=document.getElementById(obj)}catch(event){res=null}}return res},css:function(elem,attribute,value){var i=0;var k='';if(this.varType(elem)=='array'){for(i=0;i=60){minute=Math.floor(minuteS%60)}var hminuteS=Math.floor(dt/60);var hminute=hminuteS;var hhourS=Math.floor(dt/360);var hsecond=dt%60;if(hminuteS>=60){hminute=Math.floor(hminuteS%60)}var nowDate=new Date();var obj={timeh:hourS,timei:minute,timeI:minuteS,times:second,timeS:t,durationh:hhourS,durationi:hminute,durationI:hminuteS,durations:hsecond,durationS:dt,liveTimey:nowDate.getYear(),liveTimeY:nowDate.getFullYear(),liveTimem:nowDate.getMonth()+1,liveTimed:nowDate.getDate(),liveTimeh:nowDate.getHours(),liveTimei:nowDate.getMinutes(),liveTimes:nowDate.getSeconds()};for(var k in obj){if(obj[k]<10){obj[k]='0'+Math.floor(obj[k])}else{obj[k]=Math.floor(obj[k]).toString()}}return this.replaceTime(str,obj)},randomString:function(len){len=len||16;var chars='abcdefghijklmnopqrstuvwxyz';var maxPos=chars.length;var val='';for(i=0;i127||str.charCodeAt(i)==94){len+=2}else{len++}}return len},createXHR:function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else if(window.ActiveXObject){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(event){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(event){this.eject(this.errorList[7])}}}else{this.eject(this.errorList[8])}},ajax:function(cObj){var thisTemp=this;var callback=null;var obj={method:'get',dataType:'json',charset:'utf-8',async:false,url:'',data:null,success:null,error:null};if(this.varType(cObj)!='object'){this.eject(this.errorList[9]);return}obj=this.standardization(obj,cObj);if(obj.dataType==='json'||obj.dataType==='text'||obj.dataType==='html'||obj.dataType==='xml'){var xhr=this.createXHR();callback=function(){if(xhr.status==200){if(thisTemp.isUndefined(obj.success)){return}if(obj.dataType==='json'){try{obj.success(eval('('+xhr.responseText+')'))}catch(event){if(!thisTemp.isUndefined(obj['error'])){obj.error(event)}}}else{obj.success(xhr.responseText)}}else{obj.success(null);thisTemp.eject(thisTemp.errorList[10],'Ajax.status:'+xhr.status)}};obj.url=obj.url.indexOf('?')==-1?obj.url+'?rand='+this.randomString(6):obj.url;obj.data=this.formatParams(obj.data);if(obj.method==='get'&&!this.isUndefined(obj.data)){if(obj.data!=''){if(obj.url.indexOf('?')==-1){obj.url+='?'+obj.data}else{obj.url+='&'+obj.data}}}if(obj.async===true){xhr.onreadystatechange=function(){if(xhr.readyState==4&&callback!=null){callback()}}}xhr.open(obj.method,obj.url,obj.async);if(obj.method==='post'){try{xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.setRequestHeader('charset',obj['charset']);xhr.send(obj.data)}catch(event){callback()}}else{try{xhr.send(null)}catch(event){callback()}}if(obj.async===false){callback()}}else if(obj.dataType==='jsonp'){var oHead=document.getElementsByTagName('head')[0];var oScript=document.createElement('script');var callbackName='callback'+new Date().getTime();var params=this.formatParams(obj.data)+'&callback='+callbackName;callback=obj.success;oScript.src=obj.url.split('?')+'?'+params;oHead.insertBefore(oScript,oHead.firstChild);window[callbackName]=function(json){callback(json);oHead.removeChild(oScript)}}},loadJs:function(path,success){var oHead=document.getElementsByTagName('HEAD').item(0);var oScript=document.createElement('script');oScript.type='text/javascript';oScript.src=this.getNewUrl(path);oHead.appendChild(oScript);oScript.onload=function(){success()}},isMsie:function(){var browser=navigator.appName;var b_version=navigator.appVersion;var version=b_version.split(';');var trim_Version='';if(version.length>1){trim_Version=version[1].replace(/[ ]/g,'')}if(browser=='Microsoft Internet Explorer'&&(trim_Version=='MSIE6.0'||trim_Version=='MSIE7.0'||trim_Version=='MSIE8.0'||trim_Version=='MSIE9.0'||trim_Version=='MSIE10.0')){return false}return true},uploadFlash:function(){var swf;if(navigator.userAgent.indexOf('MSIE')>0){try{var swf=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');return true}catch(e){return false}}if(navigator.userAgent.indexOf('Firefox')>0){swf=navigator.plugins['Shockwave Flash'];if(swf){return true}else{return false}}return true},supportVideo:function(){if(!this.isMsie()){return false}if(!!document.createElement('video').canPlayType){var vidTest=document.createElement('video');var oggTest;try{oggTest=vidTest.canPlayType('video/ogg; codecs="theora, vorbis"')}catch(error){oggTest=false}if(!oggTest){var h264Test;try{h264Test=vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}catch(error){h264Test=false}if(!h264Test){return false}else{if(h264Test=="probably"){return true}else{return false}}}else{if(oggTest=="probably"){return true}else{return false}}}else{return false}},getDataset:function(ele,z){try{return ele.dataset[z]}catch(error){try{return ele.getAttribute('data-'+z)}catch(error){return false}}},getObjectById:function(id){var x=null;var y=this.getByElement('#'+id);var r='embed';if(y&&y.nodeName=='OBJECT'){if(this.varType(y.SetVariable)!='undefined'){x=y}else{var z=y.getElementsByTagName(r)[0];if(z){x=z}}}return x},formatParams:function(data){var arr=[];for(var i in data){arr.push(encodeURIComponent(i)+'='+encodeURIComponent(data[i]))}return arr.join('&')},arrSort:function(arr){var temp=[];for(var i=0;i-1){filepath=filepath.split('?')[0]}var pos='.'+filepath.replace(/.+\./,'');return pos.toLowerCase()}return''},isMobile:function(){if(navigator.userAgent.toLowerCase().match(/(iphone|ipad|ipod|android|ios|midp|windows mobile|windows ce|rv:1.2.3.4|ucweb)/i)){return true}return false},isContains:function(str,key){return str.indexOf(key)>-1},getNewUrl:function(url){if(this.isContains(url,'?')){return url+='&'+this.randomString(8)+'='+this.randomString(8)}else{return url+='?'+this.randomString(8)+'='+this.randomString(8)}},client:function(event){var eve=event||window.event;if(this.isUndefined(eve)){eve={clientX:0,clientY:0}}return{x:eve.clientX+(document.documentElement.scrollLeft||this.body.scrollLeft)-this.pdCoor['x'],y:eve.clientY+(document.documentElement.scrollTop||this.body.scrollTop)-this.pdCoor['y']}},getCoor:function(obj){var coor=this.getXY(obj);return{x:coor['x']-this.pdCoor['x'],y:coor['y']-this.pdCoor['y']}},getXY:function(obj){var parObj=obj;var left=obj.offsetLeft;var top=obj.offsetTop;while(parObj=parObj.offsetParent){left+=parObj.offsetLeft;top+=parObj.offsetTop}return{x:left,y:top}},removeChild:function(){if(this.playerType=='html5video'){var i=0;var timerArr=[this.timerError,this.timerFull,this.timerTime,this.timerBuffer,this.timerClick,this.timerCBar,this.timerVCanvas];for(i=0;i0){name.lineTo(d[0],d[1])}else{name.moveTo(d[0],d[1])}}name.closePath();name.fill()},canvasFillRect:function(name,path){for(var i=0;i-1){this.elementArr.splice(def,1)}var childs=f.childNodes;for(var i=childs.length-1;i>=0;i--){f.removeChild(childs[i])}if(f&&f!=null&&f.parentNode){try{if(f.parentNode){f.parentNode.removeChild(f)}}catch(event){}}},getProportionCoor:function(stageW,stageH,vw,vh){var w=0,h=0,x=0,y=0;if(stageW/stageH]+>/g,'')};for(i=0;i0){arr.push(arrs[i])}else{if(arr.length>0){textSubtitles.push(arr)}arr=[]}}for(i=0;i=2){var sn=textSubtitle[0];var startTime=this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[0]));var endTime=this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[1]));var content=[delHtmlTag(textSubtitle[2])];var cktrackdelay=this.vars['cktrackdelay'];if(cktrackdelay!=0){startTime+=cktrackdelay;endTime+=cktrackdelay}if(textSubtitle.length>2){for(var j=3;j=thisTemp.numberTotal){thisTemp.stop()}};this.start=function(){if(!thisTemp.runing){thisTemp.runing=true;thisTemp.timeObj=window.setInterval(thisTemp.startFun,time)}};this.stop=function(){if(thisTemp.runing){thisTemp.runing=false;window.clearInterval(thisTemp.timeObj);thisTemp.timeObj=null}};if(time){this.time=time}if(fun){this.fun=fun}if(number){this.numberTotal=number}this.start()},toSeconds:function(t){var s=0.0;if(t){var p=t.split(':');for(i=0;i 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( len % 32 ); + blocks[ ( ( ( len + 64 ) >>> 9 ) << 4 ) + 14 ] = len; + return blocks; + } + + } +} \ No newline at end of file diff --git a/source/com/adobe/crypto/SHA1.as b/source/com/adobe/crypto/SHA1.as new file mode 100644 index 0000000..823ea5d --- /dev/null +++ b/source/com/adobe/crypto/SHA1.as @@ -0,0 +1,268 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + import mx.utils.Base64Encoder; + + /** + * US Secure Hash Algorithm 1 (SHA1) + * + * Implementation based on algorithm description at + * http://www.faqs.org/rfcs/rfc3174.html + */ + public class SHA1 + { + /** + * Performs the SHA1 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hash( s:String ):String + { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks( blocks ); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA1 hash algorithm on a ByteArray. + * + * @param data The ByteArray data to hash + * @return A string containing the hash value of data + * @langversion ActionScript 3.0 + * @playerversion 9.0 + */ + public static function hashBytes( data:ByteArray ):String + { + var blocks:Array = SHA1.createBlocksFromByteArray( data ); + var byteArray:ByteArray = hashBlocks(blocks); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA1 hash algorithm on a string, then does + * Base64 encoding on the result. + * + * @param s The string to hash + * @return The base64 encoded hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hashToBase64( s:String ):String + { + var blocks:Array = SHA1.createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks(blocks); + + // ByteArray.toString() returns the contents as a UTF-8 string, + // which we can't use because certain byte sequences might trigger + // a UTF-8 conversion. Instead, we convert the bytes to characters + // one by one. + var charsInByteArray:String = ""; + byteArray.position = 0; + for (var j:int = 0; j < byteArray.length; j++) + { + var byte:uint = byteArray.readUnsignedByte(); + charsInByteArray += String.fromCharCode(byte); + } + + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(charsInByteArray); + return encoder.flush(); + } + + private static function hashBlocks( blocks:Array ):ByteArray + { + // initialize the h's + var h0:int = 0x67452301; + var h1:int = 0xefcdab89; + var h2:int = 0x98badcfe; + var h3:int = 0x10325476; + var h4:int = 0xc3d2e1f0; + + var len:int = blocks.length; + var w:Array = new Array( 80 ); + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16 ) { + + // 6.1.c + var a:int = h0; + var b:int = h1; + var c:int = h2; + var d:int = h3; + var e:int = h4; + + // 80 steps to process each block + // TODO: unroll for faster execution, or 4 loops of + // 20 each to avoid the k and f function calls + for ( var t:int = 0; t < 80; t++ ) { + + if ( t < 16 ) { + // 6.1.a + w[ t ] = blocks[ i + t ]; + } else { + // 6.1.b + w[ t ] = IntUtil.rol( w[ t - 3 ] ^ w[ t - 8 ] ^ w[ t - 14 ] ^ w[ t - 16 ], 1 ); + } + + // 6.1.d + var temp:int = IntUtil.rol( a, 5 ) + f( t, b, c, d ) + e + int( w[ t ] ) + k( t ); + + e = d; + d = c; + c = IntUtil.rol( b, 30 ); + b = a; + a = temp; + } + + // 6.1.e + h0 += a; + h1 += b; + h2 += c; + h3 += d; + h4 += e; + } + + var byteArray:ByteArray = new ByteArray(); + byteArray.writeInt(h0); + byteArray.writeInt(h1); + byteArray.writeInt(h2); + byteArray.writeInt(h3); + byteArray.writeInt(h4); + byteArray.position = 0; + return byteArray; + } + + /** + * Performs the logical function based on t + */ + private static function f( t:int, b:int, c:int, d:int ):int { + if ( t < 20 ) { + return ( b & c ) | ( ~b & d ); + } else if ( t < 40 ) { + return b ^ c ^ d; + } else if ( t < 60 ) { + return ( b & c ) | ( b & d ) | ( c & d ); + } + return b ^ c ^ d; + } + + /** + * Determines the constant value based on t + */ + private static function k( t:int ):int { + if ( t < 20 ) { + return 0x5a827999; + } else if ( t < 40 ) { + return 0x6ed9eba1; + } else if ( t < 60 ) { + return 0x8f1bbcdc; + } + return 0xca62c1d6; + } + + /** + * Converts a ByteArray to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param data The data to split into blocks + * @return An array containing the blocks into which data was split + */ + private static function createBlocksFromByteArray( data:ByteArray ):Array + { + var oldPosition:int = data.position; + data.position = 0; + + var blocks:Array = new Array(); + var len:int = data.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) + { + blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + + data.position = oldPosition; + + return blocks; + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was split into. + */ + private static function createBlocksFromString( s:String ):Array + { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + return blocks; + } + + } +} \ No newline at end of file diff --git a/source/com/adobe/crypto/SHA224.as b/source/com/adobe/crypto/SHA224.as new file mode 100644 index 0000000..d1c46d0 --- /dev/null +++ b/source/com/adobe/crypto/SHA224.as @@ -0,0 +1,255 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + import mx.utils.Base64Encoder; + + /** + * The SHA-224 algorithm + * + * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf + */ + public class SHA224 + { + + /** + * Performs the SHA224 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hash( s:String ):String { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks( blocks ); + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA224 hash algorithm on a ByteArray. + * + * @param data The ByteArray data to hash + * @return A string containing the hash value of data + * @langversion ActionScript 3.0 + * @playerversion 9.0 + */ + public static function hashBytes( data:ByteArray ):String + { + var blocks:Array = createBlocksFromByteArray( data ); + var byteArray:ByteArray = hashBlocks(blocks); + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA224 hash algorithm on a string, then does + * Base64 encoding on the result. + * + * @param s The string to hash + * @return The base64 encoded hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hashToBase64( s:String ):String + { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks(blocks); + + // ByteArray.toString() returns the contents as a UTF-8 string, + // which we can't use because certain byte sequences might trigger + // a UTF-8 conversion. Instead, we convert the bytes to characters + // one by one. + var charsInByteArray:String = ""; + byteArray.position = 0; + for (var j:int = 0; j < byteArray.length; j++) + { + var byte:uint = byteArray.readUnsignedByte(); + charsInByteArray += String.fromCharCode(byte); + } + + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(charsInByteArray); + return encoder.flush(); + } + + private static function hashBlocks( blocks:Array ):ByteArray { + var h0:int = 0xc1059ed8; + var h1:int = 0x367cd507; + var h2:int = 0x3070dd17; + var h3:int = 0xf70e5939; + var h4:int = 0xffc00b31; + var h5:int = 0x68581511; + var h6:int = 0x64f98fa7; + var h7:int = 0xbefa4fa4; + + var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2); + + var len:int = blocks.length; + var w:Array = new Array(); + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16 ) { + + var a:int = h0; + var b:int = h1; + var c:int = h2; + var d:int = h3; + var e:int = h4; + var f:int = h5; + var g:int = h6; + var h:int = h7; + + for(var t:int = 0; t < 64; t++) { + + if ( t < 16 ) { + w[t] = blocks[ i + t ]; + if(isNaN(w[t])) { w[t] = 0; } + } else { + var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3); + var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10); + w[t] = w[t-16] + ws0 + w[t-7] + ws1; + } + + var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22); + var maj:int = (a & b) ^ (a & c) ^ (b & c); + var t2:int = s0 + maj; + var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25); + var ch:int = (e & f) ^ ((~e) & g); + var t1:int = h + s1 + ch + k[t] + w[t]; + + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + //Add this chunk's hash to result so far: + h0 += a; + h1 += b; + h2 += c; + h3 += d; + h4 += e; + h5 += f; + h6 += g; + h7 += h; + } + + var byteArray:ByteArray = new ByteArray(); + byteArray.writeInt(h0); + byteArray.writeInt(h1); + byteArray.writeInt(h2); + byteArray.writeInt(h3); + byteArray.writeInt(h4); + byteArray.writeInt(h5); + byteArray.writeInt(h6); + byteArray.position = 0; + return byteArray; + } + + /** + * Converts a ByteArray to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param data The data to split into blocks + * @return An array containing the blocks into which data was split + */ + private static function createBlocksFromByteArray( data:ByteArray ):Array + { + var oldPosition:int = data.position; + data.position = 0; + + var blocks:Array = new Array(); + var len:int = data.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) + { + blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + + data.position = oldPosition; + + return blocks; + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was split into. + */ + private static function createBlocksFromString( s:String ):Array + { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + return blocks; + } + } +} \ No newline at end of file diff --git a/source/com/adobe/crypto/SHA256.as b/source/com/adobe/crypto/SHA256.as new file mode 100644 index 0000000..00108b6 --- /dev/null +++ b/source/com/adobe/crypto/SHA256.as @@ -0,0 +1,260 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import com.adobe.utils.IntUtil; + import flash.utils.ByteArray; + import mx.utils.Base64Encoder; + + /** + * The SHA-256 algorithm + * + * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf + */ + public class SHA256 + { + + /** + * Performs the SHA256 hash algorithm on a string. + * + * @param s The string to hash + * @return A string containing the hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hash( s:String ):String { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks( blocks ); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA256 hash algorithm on a ByteArray. + * + * @param data The ByteArray data to hash + * @return A string containing the hash value of data + * @langversion ActionScript 3.0 + * @playerversion 9.0 + */ + public static function hashBytes( data:ByteArray ):String + { + var blocks:Array = createBlocksFromByteArray( data ); + var byteArray:ByteArray = hashBlocks(blocks); + + return IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ) + + IntUtil.toHex( byteArray.readInt(), true ); + } + + /** + * Performs the SHA256 hash algorithm on a string, then does + * Base64 encoding on the result. + * + * @param s The string to hash + * @return The base64 encoded hash value of s + * @langversion ActionScript 3.0 + * @playerversion 9.0 + * @tiptext + */ + public static function hashToBase64( s:String ):String + { + var blocks:Array = createBlocksFromString( s ); + var byteArray:ByteArray = hashBlocks(blocks); + + // ByteArray.toString() returns the contents as a UTF-8 string, + // which we can't use because certain byte sequences might trigger + // a UTF-8 conversion. Instead, we convert the bytes to characters + // one by one. + var charsInByteArray:String = ""; + byteArray.position = 0; + for (var j:int = 0; j < byteArray.length; j++) + { + var byte:uint = byteArray.readUnsignedByte(); + charsInByteArray += String.fromCharCode(byte); + } + + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(charsInByteArray); + return encoder.flush(); + } + + private static function hashBlocks( blocks:Array ):ByteArray { + var h0:int = 0x6a09e667; + var h1:int = 0xbb67ae85; + var h2:int = 0x3c6ef372; + var h3:int = 0xa54ff53a; + var h4:int = 0x510e527f; + var h5:int = 0x9b05688c; + var h6:int = 0x1f83d9ab; + var h7:int = 0x5be0cd19; + + var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2); + + var len:int = blocks.length; + var w:Array = new Array( 64 ); + + // loop over all of the blocks + for ( var i:int = 0; i < len; i += 16 ) { + + var a:int = h0; + var b:int = h1; + var c:int = h2; + var d:int = h3; + var e:int = h4; + var f:int = h5; + var g:int = h6; + var h:int = h7; + + for(var t:int = 0; t < 64; t++) { + + if ( t < 16 ) { + w[t] = blocks[ i + t ]; + if(isNaN(w[t])) { w[t] = 0; } + } else { + var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3); + var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10); + w[t] = w[t-16] + ws0 + w[t-7] + ws1; + } + + var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22); + var maj:int = (a & b) ^ (a & c) ^ (b & c); + var t2:int = s0 + maj; + var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25); + var ch:int = (e & f) ^ ((~e) & g); + var t1:int = h + s1 + ch + k[t] + w[t]; + + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + //Add this chunk's hash to result so far: + h0 += a; + h1 += b; + h2 += c; + h3 += d; + h4 += e; + h5 += f; + h6 += g; + h7 += h; + } + + var byteArray:ByteArray = new ByteArray(); + byteArray.writeInt(h0); + byteArray.writeInt(h1); + byteArray.writeInt(h2); + byteArray.writeInt(h3); + byteArray.writeInt(h4); + byteArray.writeInt(h5); + byteArray.writeInt(h6); + byteArray.writeInt(h7); + byteArray.position = 0; + return byteArray; + } + + /** + * Converts a ByteArray to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param data The data to split into blocks + * @return An array containing the blocks into which data was split + */ + private static function createBlocksFromByteArray( data:ByteArray ):Array + { + var oldPosition:int = data.position; + data.position = 0; + + var blocks:Array = new Array(); + var len:int = data.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) + { + blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + + data.position = oldPosition; + + return blocks; + } + + /** + * Converts a string to a sequence of 16-word blocks + * that we'll do the processing on. Appends padding + * and length in the process. + * + * @param s The string to split into blocks + * @return An array containing the blocks that s was split into. + */ + private static function createBlocksFromString( s:String ):Array + { + var blocks:Array = new Array(); + var len:int = s.length * 8; + var mask:int = 0xFF; // ignore hi byte of characters > 0xFF + for( var i:int = 0; i < len; i += 8 ) { + blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 ); + } + + // append padding and length + blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 ); + blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len; + return blocks; + } + } +} \ No newline at end of file diff --git a/source/com/adobe/crypto/WSSEUsernameToken.as b/source/com/adobe/crypto/WSSEUsernameToken.as new file mode 100644 index 0000000..b0c40f9 --- /dev/null +++ b/source/com/adobe/crypto/WSSEUsernameToken.as @@ -0,0 +1,117 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.crypto +{ + import mx.formatters.DateFormatter; + import mx.utils.Base64Encoder; + + /** + * Web Services Security Username Token + * + * Implementation based on algorithm description at + * http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf + */ + public class WSSEUsernameToken + { + /** + * Generates a WSSE Username Token. + * + * @param username The username + * @param password The password + * @param nonce A cryptographically random nonce (if null, the nonce + * will be generated) + * @param timestamp The time at which the token is generated (if null, + * the time will be set to the moment of execution) + * @return The generated token + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getUsernameToken(username:String, password:String, nonce:String=null, timestamp:Date=null):String + { + if (nonce == null) + { + nonce = generateNonce(); + } + nonce = base64Encode(nonce); + + var created:String = generateTimestamp(timestamp); + + var password64:String = getBase64Digest(nonce, + created, + password); + + var token:String = new String("UsernameToken Username=\""); + token += username + "\", " + + "PasswordDigest=\"" + password64 + "\", " + + "Nonce=\"" + nonce + "\", " + + "Created=\"" + created + "\""; + return token; + } + + private static function generateNonce():String + { + // Math.random returns a Number between 0 and 1. We don't want our + // nonce to contain invalid characters (e.g. the period) so we + // strip them out before returning the result. + var s:String = Math.random().toString(); + return s.replace(".", ""); + } + + internal static function base64Encode(s:String):String + { + var encoder:Base64Encoder = new Base64Encoder(); + encoder.encode(s); + return encoder.flush(); + } + + internal static function generateTimestamp(timestamp:Date):String + { + if (timestamp == null) + { + timestamp = new Date(); + } + var dateFormatter:DateFormatter = new DateFormatter(); + dateFormatter.formatString = "YYYY-MM-DDTJJ:NN:SS" + return dateFormatter.format(timestamp) + "Z"; + } + + internal static function getBase64Digest(nonce:String, created:String, password:String):String + { + return SHA1.hashToBase64(nonce + created + password); + } + } +} \ No newline at end of file diff --git a/source/com/adobe/errors/IllegalStateError.as b/source/com/adobe/errors/IllegalStateError.as new file mode 100644 index 0000000..681cf91 --- /dev/null +++ b/source/com/adobe/errors/IllegalStateError.as @@ -0,0 +1,66 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.errors +{ + /** + * This class represents an Error that is thrown when a method is called when + * the receiving instance is in an invalid state. + * + * For example, this may occur if a method has been called, and other properties + * in the instance have not been initialized properly. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + */ + public class IllegalStateError extends Error + { + /** + * Constructor + * + * @param message A message describing the error in detail. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function IllegalStateError(message:String) + { + super(message); + } + } +} \ No newline at end of file diff --git a/source/com/adobe/images/BitString.as b/source/com/adobe/images/BitString.as new file mode 100644 index 0000000..7e1ff14 --- /dev/null +++ b/source/com/adobe/images/BitString.as @@ -0,0 +1,42 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.images +{ + public class BitString + { + public var len:int = 0; + public var val:int = 0; + } +} \ No newline at end of file diff --git a/source/com/adobe/images/JPGEncoder.as b/source/com/adobe/images/JPGEncoder.as new file mode 100644 index 0000000..4c6ad63 --- /dev/null +++ b/source/com/adobe/images/JPGEncoder.as @@ -0,0 +1,651 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.images +{ + import flash.geom.*; + import flash.display.*; + import flash.utils.*; + + /** + * Class that converts BitmapData into a valid JPEG + */ + public class JPGEncoder + { + + // Static table initialization + + private var ZigZag:Array = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + private var YTable:Array = new Array(64); + private var UVTable:Array = new Array(64); + private var fdtbl_Y:Array = new Array(64); + private var fdtbl_UV:Array = new Array(64); + + private function initQuantTables(sf:int):void + { + var i:int; + var t:Number; + var YQT:Array = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + for (i = 0; i < 64; i++) { + t = Math.floor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT:Array = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (i = 0; i < 64; i++) { + t = Math.floor((UVQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + UVTable[ZigZag[i]] = t; + } + var aasf:Array = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + i = 0; + for (var row:int = 0; row < 8; row++) + { + for (var col:int = 0; col < 8; col++) + { + fdtbl_Y[i] = (1.0 / (YTable [ZigZag[i]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[i] = (1.0 / (UVTable[ZigZag[i]] * aasf[row] * aasf[col] * 8.0)); + i++; + } + } + } + + private var YDC_HT:Array; + private var UVDC_HT:Array; + private var YAC_HT:Array; + private var UVAC_HT:Array; + + private function computeHuffmanTbl(nrcodes:Array, std_table:Array):Array + { + var codevalue:int = 0; + var pos_in_table:int = 0; + var HT:Array = new Array(); + for (var k:int=1; k<=16; k++) { + for (var j:int=1; j<=nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = new BitString(); + HT[std_table[pos_in_table]].val = codevalue; + HT[std_table[pos_in_table]].len = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + private var std_dc_luminance_nrcodes:Array = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + private var std_dc_luminance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11]; + private var std_ac_luminance_nrcodes:Array = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + private var std_ac_luminance_values:Array = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + private var std_dc_chrominance_nrcodes:Array = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + private var std_dc_chrominance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11]; + private var std_ac_chrominance_nrcodes:Array = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + private var std_ac_chrominance_values:Array = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + private function initHuffmanTbl():void + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + private var bitcode:Array = new Array(65535); + private var category:Array = new Array(65535); + + private function initCategoryNumber():void + { + var nrlower:int = 1; + var nrupper:int = 2; + var nr:int; + for (var cat:int=1; cat<=15; cat++) { + //Positive numbers + for (nr=nrlower; nr= 0 ) { + if (value & uint(1 << posval) ) { + bytenew |= uint(1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + private function writeByte(value:int):void + { + byteout.writeByte(value); + } + + private function writeWord(value:int):void + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + + private function fDCTQuant(data:Array, fdtbl:Array):Array + { + var tmp0:Number, tmp1:Number, tmp2:Number, tmp3:Number, tmp4:Number, tmp5:Number, tmp6:Number, tmp7:Number; + var tmp10:Number, tmp11:Number, tmp12:Number, tmp13:Number; + var z1:Number, z2:Number, z3:Number, z4:Number, z5:Number, z11:Number, z13:Number; + var i:int; + /* Pass 1: process rows. */ + var dataOff:int=0; + for (i=0; i<8; i++) { + tmp0 = data[dataOff+0] + data[dataOff+7]; + tmp7 = data[dataOff+0] - data[dataOff+7]; + tmp1 = data[dataOff+1] + data[dataOff+6]; + tmp6 = data[dataOff+1] - data[dataOff+6]; + tmp2 = data[dataOff+2] + data[dataOff+5]; + tmp5 = data[dataOff+2] - data[dataOff+5]; + tmp3 = data[dataOff+3] + data[dataOff+4]; + tmp4 = data[dataOff+3] - data[dataOff+4]; + + /* Even part */ + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + data[dataOff+0] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+4] = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+2] = tmp13 + z1; /* phase 5 */ + data[dataOff+6] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + z3 = tmp11 * 0.707106781; /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + data[dataOff+5] = z13 + z2; /* phase 6 */ + data[dataOff+3] = z13 - z2; + data[dataOff+1] = z11 + z4; + data[dataOff+7] = z11 - z4; + + dataOff += 8; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + dataOff = 0; + for (i=0; i<8; i++) { + tmp0 = data[dataOff+ 0] + data[dataOff+56]; + tmp7 = data[dataOff+ 0] - data[dataOff+56]; + tmp1 = data[dataOff+ 8] + data[dataOff+48]; + tmp6 = data[dataOff+ 8] - data[dataOff+48]; + tmp2 = data[dataOff+16] + data[dataOff+40]; + tmp5 = data[dataOff+16] - data[dataOff+40]; + tmp3 = data[dataOff+24] + data[dataOff+32]; + tmp4 = data[dataOff+24] - data[dataOff+32]; + + /* Even part */ + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + data[dataOff+ 0] = tmp10 + tmp11; /* phase 3 */ + data[dataOff+32] = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ + data[dataOff+16] = tmp13 + z1; /* phase 5 */ + data[dataOff+48] = tmp13 - z1; + + /* Odd part */ + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ + z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ + z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ + z3 = tmp11 * 0.707106781; /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + data[dataOff+40] = z13 + z2; /* phase 6 */ + data[dataOff+24] = z13 - z2; + data[dataOff+ 8] = z11 + z4; + data[dataOff+56] = z11 - z4; + + dataOff++; /* advance pointer to next column */ + } + + // Quantize/descale the coefficients + for (i=0; i<64; i++) { + // Apply the quantization and scaling factor & Round to nearest integer + data[i] = Math.round((data[i]*fdtbl[i])); + } + return data; + } + + // Chunk writing + + private function writeAPP0():void + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + private function writeSOF0(width:int, height:int):void + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + private function writeDQT():void + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + var i:int; + for (i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (i=0; i<64; i++) { + writeByte(UVTable[i]); + } + } + + private function writeDHT():void + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + var i:int; + + writeByte(0); // HTYDCinfo + for (i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (i=0; i<=11; i++) { + writeByte(std_dc_luminance_values[i]); + } + + writeByte(0x10); // HTYACinfo + for (i=0; i<16; i++) { + writeByte(std_ac_luminance_nrcodes[i+1]); + } + for (i=0; i<=161; i++) { + writeByte(std_ac_luminance_values[i]); + } + + writeByte(1); // HTUDCinfo + for (i=0; i<16; i++) { + writeByte(std_dc_chrominance_nrcodes[i+1]); + } + for (i=0; i<=11; i++) { + writeByte(std_dc_chrominance_values[i]); + } + + writeByte(0x11); // HTUACinfo + for (i=0; i<16; i++) { + writeByte(std_ac_chrominance_nrcodes[i+1]); + } + for (i=0; i<=161; i++) { + writeByte(std_ac_chrominance_values[i]); + } + } + + private function writeSOS():void + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + // Core processing + private var DU:Array = new Array(64); + + private function processDU(CDU:Array, fdtbl:Array, DC:Number, HTDC:Array, HTAC:Array):Number + { + var EOB:BitString = HTAC[0x00]; + var M16zeroes:BitString = HTAC[0xF0]; + var i:int; + + var DU_DCT:Array = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (i=0;i<64;i++) { + DU[ZigZag[i]]=DU_DCT[i]; + } + var Diff:int = DU[0] - DC; DC = DU[0]; + //Encode DC + if (Diff==0) { + writeBits(HTDC[0]); // Diff might be 0 + } else { + writeBits(HTDC[category[32767+Diff]]); + writeBits(bitcode[32767+Diff]); + } + //Encode ACs + var end0pos:int = 63; + for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) { + }; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + i = 1; + while ( i <= end0pos ) { + var startpos:int = i; + for (; (DU[i]==0) && (i<=end0pos); i++) { + } + var nrzeroes:int = i-startpos; + if ( nrzeroes >= 16 ) { + for (var nrmarker:int=1; nrmarker <= nrzeroes/16; nrmarker++) { + writeBits(M16zeroes); + } + nrzeroes = int(nrzeroes&0xF); + } + writeBits(HTAC[nrzeroes*16+category[32767+DU[i]]]); + writeBits(bitcode[32767+DU[i]]); + i++; + } + if ( end0pos != 63 ) { + writeBits(EOB); + } + return DC; + } + + private var YDU:Array = new Array(64); + private var UDU:Array = new Array(64); + private var VDU:Array = new Array(64); + + private function RGB2YUV(img:BitmapData, xpos:int, ypos:int):void + { + var pos:int=0; + for (var y:int=0; y<8; y++) { + for (var x:int=0; x<8; x++) { + var P:uint = img.getPixel32(xpos+x,ypos+y); + var R:Number = Number((P>>16)&0xFF); + var G:Number = Number((P>> 8)&0xFF); + var B:Number = Number((P )&0xFF); + YDU[pos]=((( 0.29900)*R+( 0.58700)*G+( 0.11400)*B))-128; + UDU[pos]=(((-0.16874)*R+(-0.33126)*G+( 0.50000)*B)); + VDU[pos]=((( 0.50000)*R+(-0.41869)*G+(-0.08131)*B)); + pos++; + } + } + } + + /** + * Constructor for JPEGEncoder class + * + * @param quality The quality level between 1 and 100 that detrmines the + * level of compression used in the generated JPEG + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function JPGEncoder(quality:Number = 50) + { + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + var sf:int = 0; + if (quality < 50) { + sf = int(5000 / quality); + } else { + sf = int(200 - quality*2); + } + // Create tables + initHuffmanTbl(); + initCategoryNumber(); + initQuantTables(sf); + } + + /** + * Created a JPEG image from the specified BitmapData + * + * @param image The BitmapData that will be converted into the JPEG format. + * @return a ByteArray representing the JPEG encoded image data. + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function encode(image:BitmapData):ByteArray + { + // Initialize bit writer + byteout = new ByteArray(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY:Number=0; + var DCU:Number=0; + var DCV:Number=0; + bytenew=0; + bytepos=7; + for (var ypos:int=0; ypos= 0 ) { + var fillbits:BitString = new BitString(); + fillbits.len = bytepos+1; + fillbits.val = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + return byteout; + } + } +} diff --git a/source/com/adobe/images/PNGEncoder.as b/source/com/adobe/images/PNGEncoder.as new file mode 100644 index 0000000..f40e575 --- /dev/null +++ b/source/com/adobe/images/PNGEncoder.as @@ -0,0 +1,144 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.images +{ + import flash.geom.*; + import flash.display.Bitmap; + import flash.display.BitmapData; + import flash.utils.ByteArray; + + /** + * Class that converts BitmapData into a valid PNG + */ + public class PNGEncoder + { + /** + * Created a PNG image from the specified BitmapData + * + * @param image The BitmapData that will be converted into the PNG format. + * @return a ByteArray representing the PNG encoded image data. + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function encode(img:BitmapData):ByteArray { + // Create output byte array + var png:ByteArray = new ByteArray(); + // Write PNG signature + png.writeUnsignedInt(0x89504e47); + png.writeUnsignedInt(0x0D0A1A0A); + // Build IHDR chunk + var IHDR:ByteArray = new ByteArray(); + IHDR.writeInt(img.width); + IHDR.writeInt(img.height); + IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA + IHDR.writeByte(0); + writeChunk(png,0x49484452,IHDR); + // Build IDAT chunk + var IDAT:ByteArray= new ByteArray(); + for(var i:int=0;i < img.height;i++) { + // no filter + IDAT.writeByte(0); + var p:uint; + var j:int; + if ( !img.transparent ) { + for(j=0;j < img.width;j++) { + p = img.getPixel(j,i); + IDAT.writeUnsignedInt( + uint(((p&0xFFFFFF) << 8)|0xFF)); + } + } else { + for(j=0;j < img.width;j++) { + p = img.getPixel32(j,i); + IDAT.writeUnsignedInt( + uint(((p&0xFFFFFF) << 8)| + (p>>>24))); + } + } + } + IDAT.compress(); + writeChunk(png,0x49444154,IDAT); + // Build IEND chunk + writeChunk(png,0x49454E44,null); + // return PNG + return png; + } + + private static var crcTable:Array; + private static var crcTableComputed:Boolean = false; + + private static function writeChunk(png:ByteArray, + type:uint, data:ByteArray):void { + if (!crcTableComputed) { + crcTableComputed = true; + crcTable = []; + var c:uint; + for (var n:uint = 0; n < 256; n++) { + c = n; + for (var k:uint = 0; k < 8; k++) { + if (c & 1) { + c = uint(uint(0xedb88320) ^ + uint(c >>> 1)); + } else { + c = uint(c >>> 1); + } + } + crcTable[n] = c; + } + } + var len:uint = 0; + if (data != null) { + len = data.length; + } + png.writeUnsignedInt(len); + var p:uint = png.position; + png.writeUnsignedInt(type); + if ( data != null ) { + png.writeBytes(data); + } + var e:uint = png.position; + png.position = p; + c = 0xffffffff; + for (var i:int = 0; i < (e-p); i++) { + c = uint(crcTable[ + (c ^ png.readUnsignedByte()) & + uint(0xff)] ^ uint(c >>> 8)); + } + c = uint(c^uint(0xffffffff)); + png.position = e; + png.writeUnsignedInt(c); + } + } +} \ No newline at end of file diff --git a/source/com/adobe/net/DynamicURLLoader.as b/source/com/adobe/net/DynamicURLLoader.as new file mode 100644 index 0000000..ae69f22 --- /dev/null +++ b/source/com/adobe/net/DynamicURLLoader.as @@ -0,0 +1,58 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.net +{ + import flash.net.URLLoader; + + /** + * Class that provides a dynamic implimentation of the URLLoader class. + * + * This class provides no API implimentations. However, since the class is + * declared as dynamic, it can be used in place of URLLoader, and allow + * you to dynamically attach properties to it (which URLLoader does not allow). + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public dynamic class DynamicURLLoader extends URLLoader + { + public function DynamicURLLoader() + { + super(); + } + } +} \ No newline at end of file diff --git a/source/com/adobe/net/IURIResolver.as b/source/com/adobe/net/IURIResolver.as new file mode 100644 index 0000000..ed8acd8 --- /dev/null +++ b/source/com/adobe/net/IURIResolver.as @@ -0,0 +1,79 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.net +{ + /** + * The URI class cannot know about DNS aliases, virtual hosts, or + * symbolic links that may be involved. The application can provide + * an implementation of this interface to resolve the URI before the + * URI class makes any comparisons. For example, a web host has + * two aliases: + * + *

+ * http://www.site.com/ + * http://www.site.net/ + *

+ * + *

The application can provide an implementation that automatically + * resolves site.net to site.com before URI compares two URI objects. + * Only the application can know and understand the context in which + * the URI's are being used.

+ * + *

Use the URI.resolver accessor to assign a custom resolver to + * the URI class. Any resolver specified is global to all instances + * of URI.

+ * + *

URI will call this before performing URI comparisons in the + * URI.getRelation() and URI.getCommonParent() functions. + * + * @see URI.getRelation + * @see URI.getCommonParent + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public interface IURIResolver + { + /** + * Implement this method to provide custom URI resolution for + * your application. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + function resolve(uri:URI) : URI; + } +} \ No newline at end of file diff --git a/source/com/adobe/net/URI.as b/source/com/adobe/net/URI.as new file mode 100644 index 0000000..8ec9acd --- /dev/null +++ b/source/com/adobe/net/URI.as @@ -0,0 +1,2469 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.net +{ + import flash.utils.ByteArray; + + /** + * This class implements functions and utilities for working with URI's + * (Universal Resource Identifiers). For technical description of the + * URI syntax, please see RFC 3986 at http://www.ietf.org/rfc/rfc3986.txt + * or do a web search for "rfc 3986". + * + *

The most important aspect of URI's to understand is that URI's + * and URL's are not strings. URI's are complex data structures that + * encapsulate many pieces of information. The string version of a + * URI is the serialized representation of that data structure. This + * string serialization is used to provide a human readable + * representation and a means to transport the data over the network + * where it can then be parsed back into its' component parts.

+ * + *

URI's fall into one of three categories: + *

    + *
  • <scheme>:<scheme-specific-part>#<fragment> (non-hierarchical)
  • + *
  • <scheme>: + *
  • <path>?<query>#<fragment> (relative hierarchical)
  • + *

+ * + *

The query and fragment parts are optional.

+ * + *

This class supports both non-hierarchical and hierarchical URI's

+ * + *

This class is intended to be used "as-is" for the vast majority + * of common URI's. However, if your application requires a custom + * URI syntax (e.g. custom query syntax or special handling of + * non-hierarchical URI's), this class can be fully subclassed. If you + * intended to subclass URI, please see the source code for complete + * documation on protected members and protected fuctions.

+ * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public class URI + { + // Here we define which characters must be escaped for each + // URI part. The characters that must be escaped for each + // part differ depending on what would cause ambiguous parsing. + // RFC 3986 sec. 2.4 states that characters should only be + // encoded when they would conflict with subcomponent delimiters. + // We don't want to over-do the escaping. We only want to escape + // the minimum needed to prevent parsing problems. + + // space and % must be escaped in all cases. '%' is the delimiter + // for escaped characters. + public static const URImustEscape:String = " %"; + + // Baseline of what characters must be escaped + public static const URIbaselineEscape:String = URImustEscape + ":?#/@"; + + // Characters that must be escaped in the part part. + public static const URIpathEscape:String = URImustEscape + "?#"; + + // Characters that must be escaped in the query part, if setting + // the query as a whole string. If the query is set by + // name/value, URIqueryPartEscape is used instead. + public static const URIqueryEscape:String = URImustEscape + "#"; + + // This is what each name/value pair must escape "&=" as well + // so they don't conflict with the "param=value¶m2=value2" + // syntax. + public static const URIqueryPartEscape:String = URImustEscape + "#&="; + + // Non-hierarchical URI's can have query and fragment parts, but + // we also want to prevent '/' otherwise it might end up looking + // like a hierarchical URI to the parser. + public static const URInonHierEscape:String = URImustEscape + "?#/"; + + // Baseline uninitialized setting for the URI scheme. + public static const UNKNOWN_SCHEME:String = "unknown"; + + // The following bitmaps are used for performance enhanced + // character escaping. + + // Baseline characters that need to be escaped. Many parts use + // this. + protected static const URIbaselineExcludedBitmap:URIEncodingBitmap = + new URIEncodingBitmap(URIbaselineEscape); + + // Scheme escaping bitmap + protected static const URIschemeExcludedBitmap:URIEncodingBitmap = + URIbaselineExcludedBitmap; + + // User/pass escaping bitmap + protected static const URIuserpassExcludedBitmap:URIEncodingBitmap = + URIbaselineExcludedBitmap; + + // Authority escaping bitmap + protected static const URIauthorityExcludedBitmap:URIEncodingBitmap = + URIbaselineExcludedBitmap; + + // Port escaping bitmap + protected static const URIportExludedBitmap:URIEncodingBitmap = + URIbaselineExcludedBitmap; + + // Path escaping bitmap + protected static const URIpathExcludedBitmap:URIEncodingBitmap = + new URIEncodingBitmap(URIpathEscape); + + // Query (whole) escaping bitmap + protected static const URIqueryExcludedBitmap:URIEncodingBitmap = + new URIEncodingBitmap(URIqueryEscape); + + // Query (individual parts) escaping bitmap + protected static const URIqueryPartExcludedBitmap:URIEncodingBitmap = + new URIEncodingBitmap(URIqueryPartEscape); + + // Fragments are the last part in the URI. They only need to + // escape space, '#', and '%'. Turns out that is what query + // uses too. + protected static const URIfragmentExcludedBitmap:URIEncodingBitmap = + URIqueryExcludedBitmap; + + // Characters that need to be escaped in the non-hierarchical part + protected static const URInonHierexcludedBitmap:URIEncodingBitmap = + new URIEncodingBitmap(URInonHierEscape); + + // Values used by getRelation() + public static const NOT_RELATED:int = 0; + public static const CHILD:int = 1; + public static const EQUAL:int = 2; + public static const PARENT:int = 3; + + //------------------------------------------------------------------- + // protected class members + //------------------------------------------------------------------- + protected var _valid:Boolean = false; + protected var _relative:Boolean = false; + protected var _scheme:String = ""; + protected var _authority:String = ""; + protected var _username:String = ""; + protected var _password:String = ""; + protected var _port:String = ""; + protected var _path:String = ""; + protected var _query:String = ""; + protected var _fragment:String = ""; + protected var _nonHierarchical:String = ""; + protected static var _resolver:IURIResolver = null; + + + /** + * URI Constructor. If no string is given, this will initialize + * this URI object to a blank URI. + */ + public function URI(uri:String = null) : void + { + if (uri == null) + initialize(); + else + constructURI(uri); + } + + + /** + * @private + * Method that loads the URI from the given string. + */ + protected function constructURI(uri:String) : Boolean + { + if (!parseURI(uri)) + _valid = false; + + return isValid(); + } + + + /** + * @private Private initializiation. + */ + protected function initialize() : void + { + _valid = false; + _relative = false; + + _scheme = UNKNOWN_SCHEME; + _authority = ""; + _username = ""; + _password = ""; + _port = ""; + _path = ""; + _query = ""; + _fragment = ""; + + _nonHierarchical = ""; + } + + /** + * @private Accessor to explicitly set/get the hierarchical + * state of the URI. + */ + protected function set hierState(state:Boolean) : void + { + if (state) + { + // Clear the non-hierarchical data + _nonHierarchical = ""; + + // Also set the state vars while we are at it + if (_scheme == "" || _scheme == UNKNOWN_SCHEME) + _relative = true; + else + _relative = false; + + if (_authority.length == 0 && _path.length == 0) + _valid = false; + else + _valid = true; + } + else + { + // Clear the hierarchical data + _authority = ""; + _username = ""; + _password = ""; + _port = ""; + _path = ""; + + _relative = false; + + if (_scheme == "" || _scheme == UNKNOWN_SCHEME) + _valid = false; + else + _valid = true; + } + } + protected function get hierState() : Boolean + { + return (_nonHierarchical.length == 0); + } + + + /** + * @private Functions that performs some basic consistency validation. + */ + protected function validateURI() : Boolean + { + // Check the scheme + if (isAbsolute()) + { + if (_scheme.length <= 1 || _scheme == UNKNOWN_SCHEME) + { + // we probably parsed a C:\ type path or no scheme + return false; + } + else if (verifyAlpha(_scheme) == false) + return false; // Scheme contains bad characters + } + + if (hierState) + { + if (_path.search('\\') != -1) + return false; // local path + else if (isRelative() == false && _scheme == UNKNOWN_SCHEME) + return false; // It's an absolute URI, but it has a bad scheme + } + else + { + if (_nonHierarchical.search('\\') != -1) + return false; // some kind of local path + } + + // Looks like it's ok. + return true; + } + + + /** + * @private + * + * Given a URI in string format, parse that sucker into its basic + * components and assign them to this object. A URI is of the form: + * :?# + * + * For simplicity, we parse the URI in the following order: + * + * 1. Fragment (anchors) + * 2. Query (CGI stuff) + * 3. Scheme ("http") + * 4. Authority (host name) + * 5. Username/Password (if any) + * 6. Port (server port if any) + * 7. Path (/homepages/mypage.html) + * + * The reason for this order is to minimize any parsing ambiguities. + * Fragments and queries can contain almost anything (they are parts + * that can contain custom data with their own syntax). Parsing + * them out first removes a large chance of parsing errors. This + * method expects well formed URI's, but performing the parse in + * this order makes us a little more tolerant of user error. + * + * REGEXP + * Why doesn't this use regular expressions to parse the URI? We + * have found that in a real world scenario, URI's are not always + * well formed. Sometimes characters that should have been escaped + * are not, and those situations would break a regexp pattern. This + * function attempts to be smart about what it is parsing based on + * location of characters relative to eachother. This function has + * been proven through real-world use to parse the vast majority + * of URI's correctly. + * + * NOTE + * It is assumed that the string in URI form is escaped. This function + * does not escape anything. If you constructed the URI string by + * hand, and used this to parse in the URI and still need it escaped, + * call forceEscape() on your URI object. + * + * Parsing Assumptions + * This routine assumes that the URI being passed is well formed. + * Passing things like local paths, malformed URI's, and the such + * will result in parsing errors. This function can handle + * - absolute hierarchical (e.g. "http://something.com/index.html), + * - relative hierarchical (e.g. "../images/flower.gif"), or + * - non-hierarchical URIs (e.g. "mailto:jsmith@fungoo.com"). + * + * Anything else will probably result in a parsing error, or a bogus + * URI object. + * + * Note that non-hierarchical URIs *MUST* have a scheme, otherwise + * they will be mistaken for relative URI's. + * + * If you are not sure what is being passed to you (like manually + * entered text from UI), you can construct a blank URI object and + * call unknownToURI() passing in the unknown string. + * + * @return true if successful, false if there was some kind of + * parsing error + */ + protected function parseURI(uri:String) : Boolean + { + var baseURI:String = uri; + var index:int, index2:int; + + // Make sure this object is clean before we start. If it was used + // before and we are now parsing a new URI, we don't want any stale + // info lying around. + initialize(); + + // Remove any fragments (anchors) from the URI + index = baseURI.indexOf("#"); + if (index != -1) + { + // Store the fragment piece if any + if (baseURI.length > (index + 1)) // +1 is to skip the '#' + _fragment = baseURI.substr(index + 1, baseURI.length - (index + 1)); + + // Trim off the fragment + baseURI = baseURI.substr(0, index); + } + + // We need to strip off any CGI parameters (eg '?param=bob') + index = baseURI.indexOf("?"); + if (index != -1) + { + if (baseURI.length > (index + 1)) + _query = baseURI.substr(index + 1, baseURI.length - (index + 1)); // +1 is to skip the '?' + + // Trim off the query + baseURI = baseURI.substr(0, index); + } + + // Now try to find the scheme part + index = baseURI.search(':'); + index2 = baseURI.search('/'); + + var containsColon:Boolean = (index != -1); + var containsSlash:Boolean = (index2 != -1); + + // This value is indeterminate if "containsColon" is false. + // (if there is no colon, does the slash come before or + // after said non-existing colon?) + var colonBeforeSlash:Boolean = (!containsSlash || index < index2); + + // If it has a colon and it's before the first slash, we will treat + // it as a scheme. If a slash is before a colon, there must be a + // stray colon in a path or something. In which case, the colon is + // not the separator for the scheme. Technically, we could consider + // this an error, but since this is not an ambiguous state (we know + // 100% that this has no scheme), we will keep going. + if (containsColon && colonBeforeSlash) + { + // We found a scheme + _scheme = baseURI.substr(0, index); + + // Normalize the scheme + _scheme = _scheme.toLowerCase(); + + baseURI = baseURI.substr(index + 1); + + if (baseURI.substr(0, 2) == "//") + { + // This is a hierarchical URI + _nonHierarchical = ""; + + // Trim off the "//" + baseURI = baseURI.substr(2, baseURI.length - 2); + } + else + { + // This is a non-hierarchical URI like "mailto:bob@mail.com" + _nonHierarchical = baseURI; + + if ((_valid = validateURI()) == false) + initialize(); // Bad URI. Clear it. + + // No more parsing to do for this case + return isValid(); + } + } + else + { + // No scheme. We will consider this a relative URI + _scheme = ""; + _relative = true; + _nonHierarchical = ""; + } + + // Ok, what we have left is everything after the :// + + // Now that we have stripped off any query and fragment parts, we + // need to split the authority from the path + + if (isRelative()) + { + // Don't bother looking for the authority. It's a relative URI + _authority = ""; + _port = ""; + _path = baseURI; + } + else + { + // Check for malformed UNC style file://///server/type/path/ + // By the time we get here, we have already trimmed the "file://" + // so baseURI will be ///server/type/path. If baseURI only + // has one slash, we leave it alone because that is valid (that + // is the case of "file:///path/to/file.txt" where there is no + // server - implicit "localhost"). + if (baseURI.substr(0, 2) == "//") + { + // Trim all leading slashes + while(baseURI.charAt(0) == "/") + baseURI = baseURI.substr(1, baseURI.length - 1); + } + + index = baseURI.search('/'); + if (index == -1) + { + // No path. We must have passed something like "http://something.com" + _authority = baseURI; + _path = ""; + } + else + { + _authority = baseURI.substr(0, index); + _path = baseURI.substr(index, baseURI.length - index); + } + + // Check to see if the URI has any username or password information. + // For example: ftp://username:password@server.com + index = _authority.search('@'); + if (index != -1) + { + // We have a username and possibly a password + _username = _authority.substr(0, index); + + // Remove the username/password from the authority + _authority = _authority.substr(index + 1); // Skip the '@' + + // Now check to see if the username also has a password + index = _username.search(':'); + if (index != -1) + { + _password = _username.substring(index + 1, _username.length); + _username = _username.substr(0, index); + } + else + _password = ""; + } + else + { + _username = ""; + _password = ""; + } + + // Lastly, check to see if the authorty has a port number. + // This is parsed after the username/password to avoid conflicting + // with the ':' in the 'username:password' if one exists. + index = _authority.search(':'); + if (index != -1) + { + _port = _authority.substring(index + 1, _authority.length); // skip the ':' + _authority = _authority.substr(0, index); + } + else + { + _port = ""; + } + + // Lastly, normalize the authority. Domain names + // are case insensitive. + _authority = _authority.toLowerCase(); + } + + if ((_valid = validateURI()) == false) + initialize(); // Bad URI. Clear it + + return isValid(); + } + + + /******************************************************************** + * Copy function. + */ + public function copyURI(uri:URI) : void + { + this._scheme = uri._scheme; + this._authority = uri._authority; + this._username = uri._username; + this._password = uri._password; + this._port = uri._port; + this._path = uri._path; + this._query = uri._query; + this._fragment = uri._fragment; + this._nonHierarchical = uri._nonHierarchical; + + this._valid = uri._valid; + this._relative = uri._relative; + } + + + /** + * @private + * Checks if the given string only contains a-z or A-Z. + */ + protected function verifyAlpha(str:String) : Boolean + { + var pattern:RegExp = /[^a-z]/; + var index:int; + + str = str.toLowerCase(); + index = str.search(pattern); + + if (index == -1) + return true; + else + return false; + } + + /** + * Is this a valid URI? + * + * @return true if this object represents a valid URI, false + * otherwise. + */ + public function isValid() : Boolean + { + return this._valid; + } + + + /** + * Is this URI an absolute URI? An absolute URI is a complete, fully + * qualified reference to a resource. e.g. http://site.com/index.htm + * Non-hierarchical URI's are always absolute. + */ + public function isAbsolute() : Boolean + { + return !this._relative; + } + + + /** + * Is this URI a relative URI? Relative URI's do not have a scheme + * and only contain a relative path with optional anchor and query + * parts. e.g. "../reports/index.htm". Non-hierarchical URI's + * will never be relative. + */ + public function isRelative() : Boolean + { + return this._relative; + } + + + /** + * Does this URI point to a resource that is a directory/folder? + * The URI specification dictates that any path that ends in a slash + * is a directory. This is needed to be able to perform correct path + * logic when combining relative URI's with absolute URI's to + * obtain the correct absolute URI to a resource. + * + * @see URI.chdir + * + * @return true if this URI represents a directory resource, false + * if this URI represents a file resource. + */ + public function isDirectory() : Boolean + { + if (_path.length == 0) + return false; + + return (_path.charAt(path.length - 1) == '/'); + } + + + /** + * Is this URI a hierarchical URI? URI's can be + */ + public function isHierarchical() : Boolean + { + return hierState; + } + + + /** + * The scheme of the URI. + */ + public function get scheme() : String + { + return URI.unescapeChars(_scheme); + } + public function set scheme(schemeStr:String) : void + { + // Normalize the scheme + var normalized:String = schemeStr.toLowerCase(); + _scheme = URI.fastEscapeChars(normalized, URI.URIschemeExcludedBitmap); + } + + + /** + * The authority (host) of the URI. Only valid for + * hierarchical URI's. If the URI is relative, this will + * be an empty string. When setting this value, the string + * given is assumed to be unescaped. When retrieving this + * value, the resulting string is unescaped. + */ + public function get authority() : String + { + return URI.unescapeChars(_authority); + } + public function set authority(authorityStr:String) : void + { + // Normalize the authority + authorityStr = authorityStr.toLowerCase(); + + _authority = URI.fastEscapeChars(authorityStr, + URI.URIauthorityExcludedBitmap); + + // Only hierarchical URI's can have an authority, make + // sure this URI is of the proper format. + this.hierState = true; + } + + + /** + * The username of the URI. Only valid for hierarchical + * URI's. If the URI is relative, this will be an empty + * string. + * + *

The URI specification allows for authentication + * credentials to be embedded in the URI as such:

+ * + *

http://user:passwd@host/path/to/file.htm

+ * + *

When setting this value, the string + * given is assumed to be unescaped. When retrieving this + * value, the resulting string is unescaped.

+ */ + public function get username() : String + { + return URI.unescapeChars(_username); + } + public function set username(usernameStr:String) : void + { + _username = URI.fastEscapeChars(usernameStr, URI.URIuserpassExcludedBitmap); + + // Only hierarchical URI's can have a username. + this.hierState = true; + } + + + /** + * The password of the URI. Similar to username. + * @see URI.username + */ + public function get password() : String + { + return URI.unescapeChars(_password); + } + public function set password(passwordStr:String) : void + { + _password = URI.fastEscapeChars(passwordStr, + URI.URIuserpassExcludedBitmap); + + // Only hierarchical URI's can have a password. + this.hierState = true; + } + + + /** + * The host port number. Only valid for hierarchical URI's. If + * the URI is relative, this will be an empty string. URI's can + * contain the port number of the remote host: + * + *

http://site.com:8080/index.htm

+ */ + public function get port() : String + { + return URI.unescapeChars(_port); + } + public function set port(portStr:String) : void + { + _port = URI.escapeChars(portStr); + + // Only hierarchical URI's can have a port. + this.hierState = true; + } + + + /** + * The path portion of the URI. Only valid for hierarchical + * URI's. When setting this value, the string + * given is assumed to be unescaped. When retrieving this + * value, the resulting string is unescaped. + * + *

The path portion can be in one of two formats. 1) an absolute + * path, or 2) a relative path. An absolute path starts with a + * slash ('/'), a relative path does not.

+ * + *

An absolute path may look like:

+ * /full/path/to/my/file.htm + * + *

A relative path may look like:

+ * + * path/to/my/file.htm + * ../images/logo.gif + * ../../reports/index.htm + * + * + *

Paths can be absolute or relative. Note that this not the same as + * an absolute or relative URI. An absolute URI can only have absolute + * paths. For example:

+ * + * http:/site.com/path/to/file.htm + * + *

This absolute URI has an absolute path of "/path/to/file.htm".

+ * + *

Relative URI's can have either absolute paths or relative paths. + * All of the following relative URI's are valid:

+ * + * + * /absolute/path/to/file.htm + * path/to/file.htm + * ../path/to/file.htm + * + */ + public function get path() : String + { + return URI.unescapeChars(_path); + } + public function set path(pathStr:String) : void + { + this._path = URI.fastEscapeChars(pathStr, URI.URIpathExcludedBitmap); + + if (this._scheme == UNKNOWN_SCHEME) + { + // We set the path. This is a valid URI now. + this._scheme = ""; + } + + // Only hierarchical URI's can have a path. + hierState = true; + } + + + /** + * The query (CGI) portion of the URI. This part is valid for + * both hierarchical and non-hierarchical URI's. + * + *

This accessor should only be used if a custom query syntax + * is used. This URI class supports the common "param=value" + * style query syntax via the get/setQueryValue() and + * get/setQueryByMap() functions. Those functions should be used + * instead if the common syntax is being used. + * + *

The URI RFC does not specify any particular + * syntax for the query part of a URI. It is intended to allow + * any format that can be agreed upon by the two communicating hosts. + * However, most systems have standardized on the typical CGI + * format:

+ * + * http://site.com/script.php?param1=value1¶m2=value2 + * + *

This class has specific support for this query syntax

+ * + *

This common query format is an array of name/value + * pairs with its own syntax that is different from the overall URI + * syntax. The query has its own escaping logic. For a query part + * to be properly escaped and unescaped, it must be split into its + * component parts. This accessor escapes/unescapes the entire query + * part without regard for it's component parts. This has the + * possibliity of leaving the query string in an ambiguious state in + * regards to its syntax. If the contents of the query part are + * important, it is recommended that get/setQueryValue() or + * get/setQueryByMap() are used instead.

+ * + * If a different query syntax is being used, a subclass of URI + * can be created to handle that specific syntax. + * + * @see URI.getQueryValue, URI.getQueryByMap + */ + public function get query() : String + { + return URI.unescapeChars(_query); + } + public function set query(queryStr:String) : void + { + _query = URI.fastEscapeChars(queryStr, URI.URIqueryExcludedBitmap); + + // both hierarchical and non-hierarchical URI's can + // have a query. Do not set the hierState. + } + + /** + * Accessor to the raw query data. If you are using a custom query + * syntax, this accessor can be used to get and set the query part + * directly with no escaping/unescaping. This should ONLY be used + * if your application logic is handling custom query logic and + * handling the proper escaping of the query part. + */ + public function get queryRaw() : String + { + return _query; + } + public function set queryRaw(queryStr:String) : void + { + _query = queryStr; + } + + + /** + * The fragment (anchor) portion of the URI. This is valid for + * both hierarchical and non-hierarchical URI's. + */ + public function get fragment() : String + { + return URI.unescapeChars(_fragment); + } + public function set fragment(fragmentStr:String) : void + { + _fragment = URI.fastEscapeChars(fragmentStr, URIfragmentExcludedBitmap); + + // both hierarchical and non-hierarchical URI's can + // have a fragment. Do not set the hierState. + } + + + /** + * The non-hierarchical part of the URI. For example, if + * this URI object represents "mailto:somebody@company.com", + * this will contain "somebody@company.com". This is valid only + * for non-hierarchical URI's. + */ + public function get nonHierarchical() : String + { + return URI.unescapeChars(_nonHierarchical); + } + public function set nonHierarchical(nonHier:String) : void + { + _nonHierarchical = URI.fastEscapeChars(nonHier, URInonHierexcludedBitmap); + + // This is a non-hierarchical URI. + this.hierState = false; + } + + + /** + * Quick shorthand accessor to set the parts of this URI. + * The given parts are assumed to be in unescaped form. If + * the URI is non-hierarchical (e.g. mailto:) you will need + * to call SetScheme() and SetNonHierarchical(). + */ + public function setParts(schemeStr:String, authorityStr:String, + portStr:String, pathStr:String, queryStr:String, + fragmentStr:String) : void + { + this.scheme = schemeStr; + this.authority = authorityStr; + this.port = portStr; + this.path = pathStr; + this.query = queryStr; + this.fragment = fragmentStr; + + hierState = true; + } + + + /** + * URI escapes the given character string. This is similar in function + * to the global encodeURIComponent() function in ActionScript, but is + * slightly different in regards to which characters get escaped. This + * escapes the characters specified in the URIbaselineExluded set (see class + * static members). This is needed for this class to work properly. + * + *

If a different set of characters need to be used for the escaping, + * you may use fastEscapeChars() and specify a custom URIEncodingBitmap + * that contains the characters your application needs escaped.

+ * + *

Never pass a full URI to this function. A URI can only be properly + * escaped/unescaped when split into its component parts (see RFC 3986 + * section 2.4). This is due to the fact that the URI component separators + * could be characters that would normally need to be escaped.

+ * + * @param unescaped character string to be escaped. + * + * @return escaped character string + * + * @see encodeURIComponent + * @see fastEscapeChars + */ + static public function escapeChars(unescaped:String) : String + { + // This uses the excluded set by default. + return fastEscapeChars(unescaped, URI.URIbaselineExcludedBitmap); + } + + + /** + * Unescape any URI escaped characters in the given character + * string. + * + *

Never pass a full URI to this function. A URI can only be properly + * escaped/unescaped when split into its component parts (see RFC 3986 + * section 2.4). This is due to the fact that the URI component separators + * could be characters that would normally need to be escaped.

+ * + * @param escaped the escaped string to be unescaped. + * + * @return unescaped string. + */ + static public function unescapeChars(escaped:String /*, onlyHighASCII:Boolean = false*/) : String + { + // We can just use the default AS function. It seems to + // decode everything correctly + var unescaped:String; + unescaped = decodeURIComponent(escaped); + return unescaped; + } + + /** + * Performance focused function that escapes the given character + * string using the given URIEncodingBitmap as the rule for what + * characters need to be escaped. This function is used by this + * class and can be used externally to this class to perform + * escaping on custom character sets. + * + *

Never pass a full URI to this function. A URI can only be properly + * escaped/unescaped when split into its component parts (see RFC 3986 + * section 2.4). This is due to the fact that the URI component separators + * could be characters that would normally need to be escaped.

+ * + * @param unescaped the unescaped string to be escaped + * @param bitmap the set of characters that need to be escaped + * + * @return the escaped string. + */ + static public function fastEscapeChars(unescaped:String, bitmap:URIEncodingBitmap) : String + { + var escaped:String = ""; + var c:String; + var x:int, i:int; + + for (i = 0; i < unescaped.length; i++) + { + c = unescaped.charAt(i); + + x = bitmap.ShouldEscape(c); + if (x) + { + c = x.toString(16); + if (c.length == 1) + c = "0" + c; + + c = "%" + c; + c = c.toUpperCase(); + } + + escaped += c; + } + + return escaped; + } + + + /** + * Is this URI of a particular scheme type? For example, + * passing "http" to a URI object that represents the URI + * "http://site.com/" would return true. + * + * @param scheme scheme to check for + * + * @return true if this URI object is of the given type, false + * otherwise. + */ + public function isOfType(scheme:String) : Boolean + { + // Schemes are never case sensitive. Ignore case. + scheme = scheme.toLowerCase(); + return (this._scheme == scheme); + } + + + /** + * Get the value for the specified named in the query part. This + * assumes the query part of the URI is in the common + * "name1=value1&name2=value2" syntax. Do not call this function + * if you are using a custom query syntax. + * + * @param name name of the query value to get. + * + * @return the value of the query name, empty string if the + * query name does not exist. + */ + public function getQueryValue(name:String) : String + { + var map:Object; + var item:String; + var value:String; + + map = getQueryByMap(); + + for (item in map) + { + if (item == name) + { + value = map[item]; + return value; + } + } + + // Didn't find the specified key + return new String(""); + } + + + /** + * Set the given value on the given query name. If the given name + * does not exist, it will automatically add this name/value pair + * to the query. If null is passed as the value, it will remove + * the given item from the query. + * + *

This automatically escapes any characters that may conflict with + * the query syntax so that they are "safe" within the query. The + * strings passed are assumed to be literal unescaped name and value.

+ * + * @param name name of the query value to set + * @param value value of the query item to set. If null, this will + * force the removal of this item from the query. + */ + public function setQueryValue(name:String, value:String) : void + { + var map:Object; + + map = getQueryByMap(); + + // If the key doesn't exist yet, this will create a new pair in + // the map. If it does exist, this will overwrite the previous + // value, which is what we want. + map[name] = value; + + setQueryByMap(map); + } + + + /** + * Get the query of the URI in an Object class that allows for easy + * access to the query data via Object accessors. For example: + * + * + * var query:Object = uri.getQueryByMap(); + * var value:String = query["param"]; // get a value + * query["param2"] = "foo"; // set a new value + * + * + * @return Object that contains the name/value pairs of the query. + * + * @see #setQueryByMap + * @see #getQueryValue + * @see #setQueryValue + */ + public function getQueryByMap() : Object + { + var queryStr:String; + var pair:String; + var pairs:Array; + var item:Array; + var name:String, value:String; + var index:int; + var map:Object = new Object(); + + + // We need the raw query string, no unescaping. + queryStr = this._query; + + pairs = queryStr.split('&'); + for each (pair in pairs) + { + if (pair.length == 0) + continue; + + item = pair.split('='); + + if (item.length > 0) + name = item[0]; + else + continue; // empty array + + if (item.length > 1) + value = item[1]; + else + value = ""; + + name = queryPartUnescape(name); + value = queryPartUnescape(value); + + map[name] = value; + } + + return map; + } + + + /** + * Set the query part of this URI using the given object as the + * content source. Any member of the object that has a value of + * null will not be in the resulting query. + * + * @param map object that contains the name/value pairs as + * members of that object. + * + * @see #getQueryByMap + * @see #getQueryValue + * @see #setQueryValue + */ + public function setQueryByMap(map:Object) : void + { + var item:String; + var name:String, value:String; + var queryStr:String = ""; + var tmpPair:String; + var foo:String; + + for (item in map) + { + name = item; + value = map[item]; + + if (value == null) + value = ""; + + // Need to escape the name/value pair so that they + // don't conflict with the query syntax (specifically + // '=', '&', and ). + name = queryPartEscape(name); + value = queryPartEscape(value); + + tmpPair = name; + + if (value.length > 0) + { + tmpPair += "="; + tmpPair += value; + } + + if (queryStr.length != 0) + queryStr += '&'; // Add the separator + + queryStr += tmpPair; + } + + // We don't want to escape. We already escaped the + // individual name/value pairs. If we escaped the + // query string again by assigning it to "query", + // we would have double escaping. + _query = queryStr; + } + + + /** + * Similar to Escape(), except this also escapes characters that + * would conflict with the name/value pair query syntax. This is + * intended to be called on each individual "name" and "value" + * in the query making sure that nothing in the name or value + * strings contain characters that would conflict with the query + * syntax (e.g. '=' and '&'). + * + * @param unescaped unescaped string that is to be escaped. + * + * @return escaped string. + * + * @see #queryUnescape + */ + static public function queryPartEscape(unescaped:String) : String + { + var escaped:String = unescaped; + escaped = URI.fastEscapeChars(unescaped, URI.URIqueryPartExcludedBitmap); + return escaped; + } + + + /** + * Unescape the individual name/value string pairs. + * + * @param escaped escaped string to be unescaped + * + * @return unescaped string + * + * @see #queryEscape + */ + static public function queryPartUnescape(escaped:String) : String + { + var unescaped:String = escaped; + unescaped = unescapeChars(unescaped); + return unescaped; + } + + /** + * Output this URI as a string. The resulting string is properly + * escaped and well formed for machine processing. + */ + public function toString() : String + { + if (this == null) + return ""; + else + return toStringInternal(false); + } + + /** + * Output the URI as a string that is easily readable by a human. + * This outputs the URI with all escape sequences unescaped to + * their character representation. This makes the URI easier for + * a human to read, but the URI could be completely invalid + * because some unescaped characters may now cause ambiguous parsing. + * This function should only be used if you want to display a URI to + * a user. This function should never be used outside that specific + * case. + * + * @return the URI in string format with all escape sequences + * unescaped. + * + * @see #toString + */ + public function toDisplayString() : String + { + return toStringInternal(true); + } + + + /** + * @private + * + * The guts of toString() + */ + protected function toStringInternal(forDisplay:Boolean) : String + { + var uri:String = ""; + var part:String = ""; + + if (isHierarchical() == false) + { + // non-hierarchical URI + + uri += (forDisplay ? this.scheme : _scheme); + uri += ":"; + uri += (forDisplay ? this.nonHierarchical : _nonHierarchical); + } + else + { + // Hierarchical URI + + if (isRelative() == false) + { + // If it is not a relative URI, then we want the scheme and + // authority parts in the string. If it is relative, we + // do NOT want this stuff. + + if (_scheme.length != 0) + { + part = (forDisplay ? this.scheme : _scheme); + uri += part + ":"; + } + + if (_authority.length != 0 || isOfType("file")) + { + uri += "//"; + + // Add on any username/password associated with this + // authority + if (_username.length != 0) + { + part = (forDisplay ? this.username : _username); + uri += part; + + if (_password.length != 0) + { + part = (forDisplay ? this.password : _password); + uri += ":" + part; + } + + uri += "@"; + } + + // add the authority + part = (forDisplay ? this.authority : _authority); + uri += part; + + // Tack on the port number, if any + if (port.length != 0) + uri += ":" + port; + } + } + + // Tack on the path + part = (forDisplay ? this.path : _path); + uri += part; + + } // end hierarchical part + + // Both non-hier and hierarchical have query and fragment parts + + // Add on the query and fragment parts + if (_query.length != 0) + { + part = (forDisplay ? this.query : _query); + uri += "?" + part; + } + + if (fragment.length != 0) + { + part = (forDisplay ? this.fragment : _fragment); + uri += "#" + part; + } + + return uri; + } + + /** + * Forcefully ensure that this URI is properly escaped. + * + *

Sometimes URI's are constructed by hand using strings outside + * this class. In those cases, it is unlikely the URI has been + * properly escaped. This function forcefully escapes this URI + * by unescaping each part and then re-escaping it. If the URI + * did not have any escaping, the first unescape will do nothing + * and then the re-escape will properly escape everything. If + * the URI was already escaped, the unescape and re-escape will + * essentally be a no-op. This provides a safe way to make sure + * a URI is in the proper escaped form.

+ */ + public function forceEscape() : void + { + // The accessors for each of the members will unescape + // and then re-escape as we get and assign them. + + // Handle the parts that are common for both hierarchical + // and non-hierarchical URI's + this.scheme = this.scheme; + this.setQueryByMap(this.getQueryByMap()); + this.fragment = this.fragment; + + if (isHierarchical()) + { + this.authority = this.authority; + this.path = this.path; + this.port = this.port; + this.username = this.username; + this.password = this.password; + } + else + { + this.nonHierarchical = this.nonHierarchical; + } + } + + + /** + * Does this URI point to a resource of the given file type? + * Given a file extension (or just a file name, this will strip the + * extension), check to see if this URI points to a file of that + * type. + * + * @param extension string that contains a file extension with or + * without a dot ("html" and ".html" are both valid), or a file + * name with an extension (e.g. "index.html"). + * + * @return true if this URI points to a resource with the same file + * file extension as the extension provided, false otherwise. + */ + public function isOfFileType(extension:String) : Boolean + { + var thisExtension:String; + var index:int; + + index = extension.lastIndexOf("."); + if (index != -1) + { + // Strip the extension + extension = extension.substr(index + 1); + } + else + { + // The caller passed something without a dot in it. We + // will assume that it is just a plain extension (e.g. "html"). + // What they passed is exactly what we want + } + + thisExtension = getExtension(true); + + if (thisExtension == "") + return false; + + // Compare the extensions ignoring case + if (compareStr(thisExtension, extension, false) == 0) + return true; + else + return false; + } + + + /** + * Get the ".xyz" file extension from the filename in the URI. + * For example, if we have the following URI: + * + * http://something.com/path/to/my/page.html?form=yes&name=bob#anchor + * + *

This will return ".html".

+ * + * @param minusDot If true, this will strip the dot from the extension. + * If true, the above example would have returned "html". + * + * @return the file extension + */ + public function getExtension(minusDot:Boolean = false) : String + { + var filename:String = getFilename(); + var extension:String; + var index:int; + + if (filename == "") + return String(""); + + index = filename.lastIndexOf("."); + + // If it doesn't have an extension, or if it is a "hidden" file, + // it doesn't have an extension. Hidden files on unix start with + // a dot (e.g. ".login"). + if (index == -1 || index == 0) + return String(""); + + extension = filename.substr(index); + + // If the caller does not want the dot, remove it. + if (minusDot && extension.charAt(0) == ".") + extension = extension.substr(1); + + return extension; + } + + /** + * Quick function to retrieve the file name off the end of a URI. + * + *

For example, if the URI is:

+ * http://something.com/some/path/to/my/file.html + *

this function will return "file.html".

+ * + * @param minusExtension true if the file extension should be stripped + * + * @return the file name. If this URI is a directory, the return + * value will be empty string. + */ + public function getFilename(minusExtension:Boolean = false) : String + { + if (isDirectory()) + return String(""); + + var pathStr:String = this.path; + var filename:String; + var index:int; + + // Find the last path separator. + index = pathStr.lastIndexOf("/"); + + if (index != -1) + filename = pathStr.substr(index + 1); + else + filename = pathStr; + + if (minusExtension) + { + // The caller has requested that the extension be removed + index = filename.lastIndexOf("."); + + if (index != -1) + filename = filename.substr(0, index); + } + + return filename; + } + + + /** + * @private + * Helper function to compare strings. + * + * @return true if the two strings are identical, false otherwise. + */ + static protected function compareStr(str1:String, str2:String, + sensitive:Boolean = true) : Boolean + { + if (sensitive == false) + { + str1 = str1.toLowerCase(); + str2 = str2.toLowerCase(); + } + + return (str1 == str2) + } + + /** + * Based on the type of this URI (http, ftp, etc.) get + * the default port used for that protocol. This is + * just intended to be a helper function for the most + * common cases. + */ + public function getDefaultPort() : String + { + if (_scheme == "http") + return String("80"); + else if (_scheme == "ftp") + return String("21"); + else if (_scheme == "file") + return String(""); + else if (_scheme == "sftp") + return String("22"); // ssh standard port + else + { + // Don't know the port for this URI type + return String(""); + } + } + + /** + * @private + * + * This resolves the given URI if the application has a + * resolver interface defined. This function does not + * modify the passed in URI and returns a new URI. + */ + static protected function resolve(uri:URI) : URI + { + var copy:URI = new URI(); + copy.copyURI(uri); + + if (_resolver != null) + { + // A resolver class has been registered. Call it. + return _resolver.resolve(copy); + } + else + { + // No resolver. Nothing to do, but we don't + // want to reuse the one passed in. + return copy; + } + } + + /** + * Accessor to set and get the resolver object used by all URI + * objects to dynamically resolve URI's before comparison. + */ + static public function set resolver(resolver:IURIResolver) : void + { + _resolver = resolver; + } + static public function get resolver() : IURIResolver + { + return _resolver; + } + + /** + * Given another URI, return this URI object's relation to the one given. + * URI's can have 1 of 4 possible relationships. They can be unrelated, + * equal, parent, or a child of the given URI. + * + * @param uri URI to compare this URI object to. + * @param caseSensitive true if the URI comparison should be done + * taking case into account, false if the comparison should be + * performed case insensitive. + * + * @return URI.NOT_RELATED, URI.CHILD, URI.PARENT, or URI.EQUAL + */ + public function getRelation(uri:URI, caseSensitive:Boolean = true) : int + { + // Give the app a chance to resolve these URI's before we compare them. + var thisURI:URI = URI.resolve(this); + var thatURI:URI = URI.resolve(uri); + + if (thisURI.isRelative() || thatURI.isRelative()) + { + // You cannot compare relative URI's due to their lack of context. + // You could have two relative URI's that look like: + // ../../images/ + // ../../images/marketing/logo.gif + // These may appear related, but you have no overall context + // from which to make the comparison. The first URI could be + // from one site and the other URI could be from another site. + return URI.NOT_RELATED; + } + else if (thisURI.isHierarchical() == false || thatURI.isHierarchical() == false) + { + // One or both of the URI's are non-hierarchical. + if (((thisURI.isHierarchical() == false) && (thatURI.isHierarchical() == true)) || + ((thisURI.isHierarchical() == true) && (thatURI.isHierarchical() == false))) + { + // XOR. One is hierarchical and the other is + // non-hierarchical. They cannot be compared. + return URI.NOT_RELATED; + } + else + { + // They are both non-hierarchical + if (thisURI.scheme != thatURI.scheme) + return URI.NOT_RELATED; + + if (thisURI.nonHierarchical != thatURI.nonHierarchical) + return URI.NOT_RELATED; + + // The two non-hierarcical URI's are equal. + return URI.EQUAL; + } + } + + // Ok, this URI and the one we are being compared to are both + // absolute hierarchical URI's. + + if (thisURI.scheme != thatURI.scheme) + return URI.NOT_RELATED; + + if (thisURI.authority != thatURI.authority) + return URI.NOT_RELATED; + + var thisPort:String = thisURI.port; + var thatPort:String = thatURI.port; + + // Different ports are considered completely different servers. + if (thisPort == "") + thisPort = thisURI.getDefaultPort(); + if (thatPort == "") + thatPort = thatURI.getDefaultPort(); + + // Check to see if the port is the default port. + if (thisPort != thatPort) + return URI.NOT_RELATED; + + if (compareStr(thisURI.path, thatURI.path, caseSensitive)) + return URI.EQUAL; + + // Special case check. If we are here, the scheme, authority, + // and port match, and it is not a relative path, but the + // paths did not match. There is a special case where we + // could have: + // http://something.com/ + // http://something.com + // Technically, these are equal. So lets, check for this case. + var thisPath:String = thisURI.path; + var thatPath:String = thatURI.path; + + if ( (thisPath == "/" || thatPath == "/") && + (thisPath == "" || thatPath == "") ) + { + // We hit the special case. These two are equal. + return URI.EQUAL; + } + + // Ok, the paths do not match, but one path may be a parent/child + // of the other. For example, we may have: + // http://something.com/path/to/homepage/ + // http://something.com/path/to/homepage/images/logo.gif + // In this case, the first is a parent of the second (or the second + // is a child of the first, depending on which you compare to the + // other). To make this comparison, we must split the path into + // its component parts (split the string on the '/' path delimiter). + // We then compare the + var thisParts:Array, thatParts:Array; + var thisPart:String, thatPart:String; + var i:int; + + thisParts = thisPath.split("/"); + thatParts = thatPath.split("/"); + + if (thisParts.length > thatParts.length) + { + thatPart = thatParts[thatParts.length - 1]; + if (thatPart.length > 0) + { + // if the last part is not empty, the passed URI is + // not a directory. There is no way the passed URI + // can be a parent. + return URI.NOT_RELATED; + } + else + { + // Remove the empty trailing part + thatParts.pop(); + } + + // This may be a child of the one passed in + for (i = 0; i < thatParts.length; i++) + { + thisPart = thisParts[i]; + thatPart = thatParts[i]; + + if (compareStr(thisPart, thatPart, caseSensitive) == false) + return URI.NOT_RELATED; + } + + return URI.CHILD; + } + else if (thisParts.length < thatParts.length) + { + thisPart = thisParts[thisParts.length - 1]; + if (thisPart.length > 0) + { + // if the last part is not empty, this URI is not a + // directory. There is no way this object can be + // a parent. + return URI.NOT_RELATED; + } + else + { + // Remove the empty trailing part + thisParts.pop(); + } + + // This may be the parent of the one passed in + for (i = 0; i < thisParts.length; i++) + { + thisPart = thisParts[i]; + thatPart = thatParts[i]; + + if (compareStr(thisPart, thatPart, caseSensitive) == false) + return URI.NOT_RELATED; + } + + return URI.PARENT; + } + else + { + // Both URI's have the same number of path components, but + // it failed the equivelence check above. This means that + // the two URI's are not related. + return URI.NOT_RELATED; + } + + // If we got here, the scheme and authority are the same, + // but the paths pointed to two different locations that + // were in different parts of the file system tree + return URI.NOT_RELATED; + } + + /** + * Given another URI, return the common parent between this one + * and the provided URI. + * + * @param uri the other URI from which to find a common parent + * @para caseSensitive true if this operation should be done + * with case sensitive comparisons. + * + * @return the parent URI if successful, null otherwise. + */ + public function getCommonParent(uri:URI, caseSensitive:Boolean = true) : URI + { + var thisURI:URI = URI.resolve(this); + var thatURI:URI = URI.resolve(uri); + + if(!thisURI.isAbsolute() || !thatURI.isAbsolute() || + thisURI.isHierarchical() == false || + thatURI.isHierarchical() == false) + { + // Both URI's must be absolute hierarchical for this to + // make sense. + return null; + } + + var relation:int = thisURI.getRelation(thatURI); + if (relation == URI.NOT_RELATED) + { + // The given URI is not related to this one. No + // common parent. + return null; + } + + thisURI.chdir("."); + thatURI.chdir("."); + + var strBefore:String, strAfter:String; + do + { + relation = thisURI.getRelation(thatURI, caseSensitive); + if(relation == URI.EQUAL || relation == URI.PARENT) + break; + + // If strBefore and strAfter end up being the same, + // we know we are at the root of the path because + // chdir("..") is doing nothing. + strBefore = thisURI.toString(); + thisURI.chdir(".."); + strAfter = thisURI.toString(); + } + while(strBefore != strAfter); + + return thisURI; + } + + + /** + * This function is used to move around in a URI in a way similar + * to the 'cd' or 'chdir' commands on Unix. These operations are + * completely string based, using the context of the URI to + * determine the position within the path. The heuristics used + * to determine the action are based off Appendix C in RFC 2396. + * + *

URI paths that end in '/' are considered paths that point to + * directories, while paths that do not end in '/' are files. For + * example, if you execute chdir("d") on the following URI's:
+ * 1. http://something.com/a/b/c/ (directory)
+ * 2. http://something.com/a/b/c (not directory)
+ * you will get:
+ * 1. http://something.com/a/b/c/d
+ * 2. http://something.com/a/b/d

+ * + *

See RFC 2396, Appendix C for more info.

+ * + * @param reference the URI or path to "cd" to. + * @param escape true if the passed reference string should be URI + * escaped before using it. + * + * @return true if the chdir was successful, false otherwise. + */ + public function chdir(reference:String, escape:Boolean = false) : Boolean + { + var uriReference:URI; + var ref:String = reference; + + if (escape) + ref = URI.escapeChars(reference); + + if (ref == "") + { + // NOOP + return true; + } + else if (ref.substr(0, 2) == "//") + { + // Special case. This is an absolute URI but without the scheme. + // Take the scheme from this URI and tack it on. This is + // intended to make working with chdir() a little more + // tolerant. + var final:String = this.scheme + ":" + ref; + + return constructURI(final); + } + else if (ref.charAt(0) == "?") + { + // A relative URI that is just a query part is essentially + // a "./?query". We tack on the "./" here to make the rest + // of our logic work. + ref = "./" + ref; + } + + // Parse the reference passed in as a URI. This way we + // get any query and fragments parsed out as well. + uriReference = new URI(ref); + + if (uriReference.isAbsolute() || + uriReference.isHierarchical() == false) + { + // If the URI given is a full URI, it replaces this one. + copyURI(uriReference); + return true; + } + + + var thisPath:String, thatPath:String; + var thisParts:Array, thatParts:Array; + var thisIsDir:Boolean = false, thatIsDir:Boolean = false; + var thisIsAbs:Boolean = false, thatIsAbs:Boolean = false; + var lastIsDotOperation:Boolean = false; + var curDir:String; + var i:int; + + thisPath = this.path; + thatPath = uriReference.path; + + if (thisPath.length > 0) + thisParts = thisPath.split("/"); + else + thisParts = new Array(); + + if (thatPath.length > 0) + thatParts = thatPath.split("/"); + else + thatParts = new Array(); + + if (thisParts.length > 0 && thisParts[0] == "") + { + thisIsAbs = true; + thisParts.shift(); // pop the first one off the array + } + if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "") + { + thisIsDir = true; + thisParts.pop(); // pop the last one off the array + } + + if (thatParts.length > 0 && thatParts[0] == "") + { + thatIsAbs = true; + thatParts.shift(); // pop the first one off the array + } + if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "") + { + thatIsDir = true; + thatParts.pop(); // pop the last one off the array + } + + if (thatIsAbs) + { + // The reference is an absolute path (starts with a slash). + // It replaces this path wholesale. + this.path = uriReference.path; + + // And it inherits the query and fragment + this.queryRaw = uriReference.queryRaw; + this.fragment = uriReference.fragment; + + return true; + } + else if (thatParts.length == 0 && uriReference.query == "") + { + // The reference must have only been a fragment. Fragments just + // get appended to whatever the current path is. We don't want + // to overwrite any query that may already exist, so this case + // only takes on the new fragment. + this.fragment = uriReference.fragment; + return true; + } + else if (thisIsDir == false && thisParts.length > 0) + { + // This path ends in a file. It goes away no matter what. + thisParts.pop(); + } + + // By default, this assumes the query and fragment of the reference + this.queryRaw = uriReference.queryRaw; + this.fragment = uriReference.fragment; + + // Append the parts of the path from the passed in reference + // to this object's path. + thisParts = thisParts.concat(thatParts); + + for(i = 0; i < thisParts.length; i++) + { + curDir = thisParts[i]; + lastIsDotOperation = false; + + if (curDir == ".") + { + thisParts.splice(i, 1); + i = i - 1; // account for removing this item + lastIsDotOperation = true; + } + else if (curDir == "..") + { + if (i >= 1) + { + if (thisParts[i - 1] == "..") + { + // If the previous is a "..", we must have skipped + // it due to this URI being relative. We can't + // collapse leading ".."s in a relative URI, so + // do nothing. + } + else + { + thisParts.splice(i - 1, 2); + i = i - 2; // move back to account for the 2 we removed + } + } + else + { + // This is the first thing in the path. + + if (isRelative()) + { + // We can't collapse leading ".."s in a relative + // path. Do noting. + } + else + { + // This is an abnormal case. We have dot-dotted up + // past the base of our "file system". This is a + // case where we had a /path/like/this.htm and were + // given a path to chdir to like this: + // ../../../../../../mydir + // Obviously, it has too many ".." and will take us + // up beyond the top of the URI. However, according + // RFC 2396 Appendix C.2, we should try to handle + // these abnormal cases appropriately. In this case, + // we will do what UNIX command lines do if you are + // at the root (/) of the filesystem and execute: + // # cd ../../../../../bin + // Which will put you in /bin. Essentially, the extra + // ".."'s will just get eaten. + + thisParts.splice(i, 1); + i = i - 1; // account for the ".." we just removed + } + } + + lastIsDotOperation = true; + } + } + + var finalPath:String = ""; + + // If the last thing in the path was a "." or "..", then this thing is a + // directory. If the last thing isn't a dot-op, then we don't want to + // blow away any information about the directory (hence the "|=" binary + // assignment). + thatIsDir = thatIsDir || lastIsDotOperation; + + // Reconstruct the path with the abs/dir info we have + finalPath = joinPath(thisParts, thisIsAbs, thatIsDir); + + // Set the path (automatically escaping it) + this.path = finalPath; + + return true; + } + + /** + * @private + * Join an array of path parts back into a URI style path string. + * This is used by the various path logic functions to recombine + * a path. This is different than the standard Array.join() + * function because we need to take into account the starting and + * ending path delimiters if this is an absolute path or a + * directory. + * + * @param parts the Array that contains strings of each path part. + * @param isAbs true if the given path is absolute + * @param isDir true if the given path is a directory + * + * @return the combined path string. + */ + protected function joinPath(parts:Array, isAbs:Boolean, isDir:Boolean) : String + { + var pathStr:String = ""; + var i:int; + + for (i = 0; i < parts.length; i++) + { + if (pathStr.length > 0) + pathStr += "/"; + + pathStr += parts[i]; + } + + // If this path is a directory, tack on the directory delimiter, + // but only if the path contains something. Adding this to an + // empty path would make it "/", which is an absolute path that + // starts at the root. + if (isDir && pathStr.length > 0) + pathStr += "/"; + + if (isAbs) + pathStr = "/" + pathStr; + + return pathStr; + } + + /** + * Given an absolute URI, make this relative URI absolute using + * the given URI as a base. This URI instance must be relative + * and the base_uri must be absolute. + * + * @param base_uri URI to use as the base from which to make + * this relative URI into an absolute URI. + * + * @return true if successful, false otherwise. + */ + public function makeAbsoluteURI(base_uri:URI) : Boolean + { + if (isAbsolute() || base_uri.isRelative()) + { + // This URI needs to be relative, and the base needs to be + // absolute otherwise we won't know what to do! + return false; + } + + // Make a copy of the base URI. We don't want to modify + // the passed URI. + var base:URI = new URI(); + base.copyURI(base_uri); + + // ChDir on the base URI. This will preserve any query + // and fragment we have. + if (base.chdir(toString()) == false) + return false; + + // It worked, so copy the base into this one + copyURI(base); + + return true; + } + + + /** + * Given a URI to use as a base from which this object should be + * relative to, convert this object into a relative URI. For example, + * if you have: + * + * + * var uri1:URI = new URI("http://something.com/path/to/some/file.html"); + * var uri2:URI = new URI("http://something.com/path/to/another/file.html"); + * + * uri1.MakeRelativePath(uri2); + * + *

uri1 will have a final value of "../some/file.html"

+ * + *

Note! This function is brute force. If you have two URI's + * that are completely unrelated, this will still attempt to make + * the relative URI. In that case, you will most likely get a + * relative path that looks something like:

+ * + *

../../../../../../some/path/to/my/file.html

+ * + * @param base_uri the URI from which to make this URI relative + * + * @return true if successful, false if the base_uri and this URI + * are not related, of if error. + */ + public function makeRelativeURI(base_uri:URI, caseSensitive:Boolean = true) : Boolean + { + var base:URI = new URI(); + base.copyURI(base_uri); + + var thisParts:Array, thatParts:Array; + var finalParts:Array = new Array(); + var thisPart:String, thatPart:String, finalPath:String; + var pathStr:String = this.path; + var queryStr:String = this.queryRaw; + var fragmentStr:String = this.fragment; + var i:int; + var diff:Boolean = false; + var isDir:Boolean = false; + + if (isRelative()) + { + // We're already relative. + return true; + } + + if (base.isRelative()) + { + // The base is relative. A relative base doesn't make sense. + return false; + } + + + if ( (isOfType(base_uri.scheme) == false) || + (this.authority != base_uri.authority) ) + { + // The schemes and/or authorities are different. We can't + // make a relative path to something that is completely + // unrelated. + return false; + } + + // Record the state of this URI + isDir = isDirectory(); + + // We are based of the directory of the given URI. We need to + // make sure the URI is pointing to a directory. Changing + // directory to "." will remove any file name if the base is + // not a directory. + base.chdir("."); + + thisParts = pathStr.split("/"); + thatParts = base.path.split("/"); + + if (thisParts.length > 0 && thisParts[0] == "") + thisParts.shift(); + + if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "") + { + isDir = true; + thisParts.pop(); + } + + if (thatParts.length > 0 && thatParts[0] == "") + thatParts.shift(); + if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "") + thatParts.pop(); + + + // Now that we have the paths split into an array of directories, + // we can compare the two paths. We start from the left of side + // of the path and start comparing. When we either run out of + // directories (one path is longer than the other), or we find + // a directory that is different, we stop. The remaining parts + // of each path is then used to determine the relative path. For + // example, lets say we have: + // path we want to make relative: /a/b/c/d/e.txt + // path to use as base for relative: /a/b/f/ + // + // This loop will start at the left, and remove directories + // until we get a mismatch or run off the end of one of them. + // In this example, the result will be: + // c/d/e.txt + // f + // + // For every part left over in the base path, we prepend a ".." + // to the relative to get the final path: + // ../c/d/e.txt + while(thatParts.length > 0) + { + if (thisParts.length == 0) + { + // we matched all there is to match, we are done. + // This is the case where "this" object is a parent + // path of the given URI. eg: + // this.path = /a/b/ (thisParts) + // base.path = /a/b/c/d/e/ (thatParts) + break; + } + + thisPart = thisParts[0]; + thatPart = thatParts[0]; + + if (compareStr(thisPart, thatPart, caseSensitive)) + { + thisParts.shift(); + thatParts.shift(); + } + else + break; + } + + // If there are any path info left from the base URI, that means + // **this** object is above the given URI in the file tree. For + // each part left over in the given URI, we need to move up one + // directory to get where we are. + var dotdot:String = ".."; + for (i = 0; i < thatParts.length; i++) + { + finalParts.push(dotdot); + } + + // Append the parts of this URI to any dot-dot's we have + finalParts = finalParts.concat(thisParts); + + // Join the parts back into a path + finalPath = joinPath(finalParts, false /* not absolute */, isDir); + + if (finalPath.length == 0) + { + // The two URI's are exactly the same. The proper relative + // path is: + finalPath = "./"; + } + + // Set the parts of the URI, preserving the original query and + // fragment parts. + setParts("", "", "", finalPath, queryStr, fragmentStr); + + return true; + } + + /** + * Given a string, convert it to a URI. The string could be a + * full URI that is improperly escaped, a malformed URI (e.g. + * missing a protocol like "www.something.com"), a relative URI, + * or any variation there of. + * + *

The intention of this function is to take anything that a + * user might manually enter as a URI/URL and try to determine what + * they mean. This function differs from the URI constructor in + * that it makes some assumptions to make it easy to import user + * entered URI data.

+ * + *

This function is intended to be a helper function. + * It is not all-knowning and will probably make mistakes + * when attempting to parse a string of unknown origin. If + * your applicaiton is receiving input from the user, your + * application should already have a good idea what the user + * should be entering, and your application should be + * pre-processing the user's input to make sure it is well formed + * before passing it to this function.

+ * + *

It is assumed that the string given to this function is + * something the user may have manually entered. Given this, + * the URI string is probably unescaped or improperly escaped. + * This function will attempt to properly escape the URI by + * using forceEscape(). The result is that a toString() call + * on a URI that was created from unknownToURI() may not match + * the input string due to the difference in escaping.

+ * + * @param unknown a potental URI string that should be parsed + * and loaded into this object. + * @param defaultScheme if it is determined that the passed string + * looks like a URI, but it is missing the scheme part, this + * string will be used as the missing scheme. + * + * @return true if the given string was successfully parsed into + * a valid URI object, false otherwise. + */ + public function unknownToURI(unknown:String, defaultScheme:String = "http") : Boolean + { + var temp:String; + + if (unknown.length == 0) + { + this.initialize(); + return false; + } + + // Some users love the backslash key. Fix it. + unknown = unknown.replace(/\\/g, "/"); + + // Check for any obviously missing scheme. + if (unknown.length >= 2) + { + temp = unknown.substr(0, 2); + if (temp == "//") + unknown = defaultScheme + ":" + unknown; + } + + if (unknown.length >= 3) + { + temp = unknown.substr(0, 3); + if (temp == "://") + unknown = defaultScheme + unknown; + } + + // Try parsing it as a normal URI + var uri:URI = new URI(unknown); + + if (uri.isHierarchical() == false) + { + if (uri.scheme == UNKNOWN_SCHEME) + { + this.initialize(); + return false; + } + + // It's a non-hierarchical URI + copyURI(uri); + forceEscape(); + return true; + } + else if ((uri.scheme != UNKNOWN_SCHEME) && + (uri.scheme.length > 0)) + { + if ( (uri.authority.length > 0) || + (uri.scheme == "file") ) + { + // file://... URI + copyURI(uri); + forceEscape(); // ensure proper escaping + return true; + } + else if (uri.authority.length == 0 && uri.path.length == 0) + { + // It's is an incomplete URI (eg "http://") + + setParts(uri.scheme, "", "", "", "", ""); + return false; + } + } + else + { + // Possible relative URI. We can only detect relative URI's + // that start with "." or "..". If it starts with something + // else, the parsing is ambiguous. + var path:String = uri.path; + + if (path == ".." || path == "." || + (path.length >= 3 && path.substr(0, 3) == "../") || + (path.length >= 2 && path.substr(0, 2) == "./") ) + { + // This is a relative URI. + copyURI(uri); + forceEscape(); + return true; + } + } + + // Ok, it looks like we are just a normal URI missing the scheme. Tack + // on the scheme. + uri = new URI(defaultScheme + "://" + unknown); + + // Check to see if we are good now + if (uri.scheme.length > 0 && uri.authority.length > 0) + { + // It was just missing the scheme. + copyURI(uri); + forceEscape(); // Make sure we are properly encoded. + return true; + } + + // don't know what this is + this.initialize(); + return false; + } + + } // end URI class +} // end package \ No newline at end of file diff --git a/source/com/adobe/net/URIEncodingBitmap.as b/source/com/adobe/net/URIEncodingBitmap.as new file mode 100644 index 0000000..e85ac55 --- /dev/null +++ b/source/com/adobe/net/URIEncodingBitmap.as @@ -0,0 +1,142 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.net +{ + import flash.utils.ByteArray; + + /** + * This class implements an efficient lookup table for URI + * character escaping. This class is only needed if you + * create a derived class of URI to handle custom URI + * syntax. This class is used internally by URI. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0* + */ + public class URIEncodingBitmap extends ByteArray + { + /** + * Constructor. Creates an encoding bitmap using the given + * string of characters as the set of characters that need + * to be URI escaped. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public function URIEncodingBitmap(charsToEscape:String) : void + { + var i:int; + var data:ByteArray = new ByteArray(); + + // Initialize our 128 bits (16 bytes) to zero + for (i = 0; i < 16; i++) + this.writeByte(0); + + data.writeUTFBytes(charsToEscape); + data.position = 0; + + while (data.bytesAvailable) + { + var c:int = data.readByte(); + + if (c > 0x7f) + continue; // only escape low bytes + + var enc:int; + this.position = (c >> 3); + enc = this.readByte(); + enc |= 1 << (c & 0x7); + this.position = (c >> 3); + this.writeByte(enc); + } + } + + /** + * Based on the data table contained in this object, check + * if the given character should be escaped. + * + * @param char the character to be escaped. Only the first + * character in the string is used. Any other characters + * are ignored. + * + * @return the integer value of the raw UTF8 character. For + * example, if '%' is given, the return value is 37 (0x25). + * If the character given does not need to be escaped, the + * return value is zero. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public function ShouldEscape(char:String) : int + { + var data:ByteArray = new ByteArray(); + var c:int, mask:int; + + // write the character into a ByteArray so + // we can pull it out as a raw byte value. + data.writeUTFBytes(char); + data.position = 0; + c = data.readByte(); + + if (c & 0x80) + { + // don't escape high byte characters. It can make international + // URI's unreadable. We just want to escape characters that would + // make URI syntax ambiguous. + return 0; + } + else if ((c < 0x1f) || (c == 0x7f)) + { + // control characters must be escaped. + return c; + } + + this.position = (c >> 3); + mask = this.readByte(); + + if (mask & (1 << (c & 0x7))) + { + // we need to escape this, return the numeric value + // of the character + return c; + } + else + { + return 0; + } + } + } +} \ No newline at end of file diff --git a/source/com/adobe/net/proxies/RFC2817Socket.as b/source/com/adobe/net/proxies/RFC2817Socket.as new file mode 100644 index 0000000..3657da4 --- /dev/null +++ b/source/com/adobe/net/proxies/RFC2817Socket.as @@ -0,0 +1,204 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package com.adobe.net.proxies +{ + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.events.ProgressEvent; + import flash.net.Socket; + + /** + * This class allows TCP socket connections through HTTP proxies in accordance with + * RFC 2817: + * + * ftp://ftp.rfc-editor.org/in-notes/rfc2817.txt + * + * It can also be used to make direct connections to a destination, as well. If you + * pass the host and port into the constructor, no proxy will be used. You can also + * call connect, passing in the host and the port, and if you didn't set the proxy + * info, a direct connection will be made. A proxy is only used after you have called + * the setProxyInfo function. + * + * The connection to and negotiation with the proxy is completely hidden. All the + * same events are thrown whether you are using a proxy or not, and the data you + * receive from the target server will look exact as it would if you were connected + * to it directly rather than through a proxy. + * + * @author Christian Cantrell + * + **/ + public class RFC2817Socket + extends Socket + { + private var proxyHost:String = null; + private var host:String = null; + private var proxyPort:int = 0; + private var port:int = 0; + private var deferredEventHandlers:Object = new Object(); + private var buffer:String = new String(); + + /** + * Construct a new RFC2817Socket object. If you pass in the host and the port, + * no proxy will be used. If you want to use a proxy, instantiate with no + * arguments, call setProxyInfo, then call connect. + **/ + public function RFC2817Socket(host:String = null, port:int = 0) + { + if (host != null && port != 0) + { + super(host, port); + } + } + + /** + * Set the proxy host and port number. Your connection will only proxied if + * this function has been called. + **/ + public function setProxyInfo(host:String, port:int):void + { + this.proxyHost = host; + this.proxyPort = port; + + var deferredSocketDataHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA]; + var deferredConnectHandler:Object = this.deferredEventHandlers[Event.CONNECT]; + + if (deferredSocketDataHandler != null) + { + super.removeEventListener(ProgressEvent.SOCKET_DATA, deferredSocketDataHandler.listener, deferredSocketDataHandler.useCapture); + } + + if (deferredConnectHandler != null) + { + super.removeEventListener(Event.CONNECT, deferredConnectHandler.listener, deferredConnectHandler.useCapture); + } + } + + /** + * Connect to the specified host over the specified port. If you want your + * connection proxied, call the setProxyInfo function first. + **/ + public override function connect(host:String, port:int):void + { + if (this.proxyHost == null) + { + this.redirectConnectEvent(); + this.redirectSocketDataEvent(); + super.connect(host, port); + } + else + { + this.host = host; + this.port = port; + super.addEventListener(Event.CONNECT, this.onConnect); + super.addEventListener(ProgressEvent.SOCKET_DATA, this.onSocketData); + super.connect(this.proxyHost, this.proxyPort); + } + } + + private function onConnect(event:Event):void + { + this.writeUTFBytes("CONNECT "+this.host+":"+this.port+" HTTP/1.1\n\n"); + this.flush(); + this.redirectConnectEvent(); + } + + private function onSocketData(event:ProgressEvent):void + { + while (this.bytesAvailable != 0) + { + this.buffer += this.readUTFBytes(1); + if (this.buffer.search(/\r?\n\r?\n$/) != -1) + { + this.checkResponse(event); + break; + } + } + } + + private function checkResponse(event:ProgressEvent):void + { + var responseCode:String = this.buffer.substr(this.buffer.indexOf(" ")+1, 3); + + if (responseCode.search(/^2/) == -1) + { + var ioError:IOErrorEvent = new IOErrorEvent(IOErrorEvent.IO_ERROR); + ioError.text = "Error connecting to the proxy ["+this.proxyHost+"] on port ["+this.proxyPort+"]: " + this.buffer; + this.dispatchEvent(ioError); + } + else + { + this.redirectSocketDataEvent(); + this.dispatchEvent(new Event(Event.CONNECT)); + if (this.bytesAvailable > 0) + { + this.dispatchEvent(event); + } + } + this.buffer = null; + } + + private function redirectConnectEvent():void + { + super.removeEventListener(Event.CONNECT, onConnect); + var deferredEventHandler:Object = this.deferredEventHandlers[Event.CONNECT]; + if (deferredEventHandler != null) + { + super.addEventListener(Event.CONNECT, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference); + } + } + + private function redirectSocketDataEvent():void + { + super.removeEventListener(ProgressEvent.SOCKET_DATA, onSocketData); + var deferredEventHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA]; + if (deferredEventHandler != null) + { + super.addEventListener(ProgressEvent.SOCKET_DATA, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference); + } + } + + public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int=0.0, useWeakReference:Boolean=false):void + { + if (type == Event.CONNECT || type == ProgressEvent.SOCKET_DATA) + { + this.deferredEventHandlers[type] = {listener:listener,useCapture:useCapture, priority:priority, useWeakReference:useWeakReference}; + } + else + { + super.addEventListener(type, listener, useCapture, priority, useWeakReference); + } + } + } +} \ No newline at end of file diff --git a/source/com/adobe/serialization/json/JSON.as b/source/com/adobe/serialization/json/JSON.as new file mode 100644 index 0000000..d43c420 --- /dev/null +++ b/source/com/adobe/serialization/json/JSON.as @@ -0,0 +1,88 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + /** + * This class provides encoding and decoding of the JSON format. + * + * Example usage: + * + * // create a JSON string from an internal object + * JSON.encode( myObject ); + * + * // read a JSON string into an internal object + * var myObject:Object = JSON.decode( jsonString ); + * + */ + public class JSON { + + + /** + * Encodes a object into a JSON string. + * + * @param o The object to create a JSON string for + * @return the JSON string representing o + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function encode( o:Object ):String { + + var encoder:JSONEncoder = new JSONEncoder( o ); + return encoder.getString(); + + } + + /** + * Decodes a JSON string into a native object. + * + * @param s The JSON string representing the object + * @return A native object as specified by s + * @throw JSONParseError + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function decode( s:String ):* { + + var decoder:JSONDecoder = new JSONDecoder( s ) + return decoder.getValue(); + + } + + } + +} \ No newline at end of file diff --git a/source/com/adobe/serialization/json/JSONDecoder.as b/source/com/adobe/serialization/json/JSONDecoder.as new file mode 100644 index 0000000..be06317 --- /dev/null +++ b/source/com/adobe/serialization/json/JSONDecoder.as @@ -0,0 +1,218 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + public class JSONDecoder { + + /** The value that will get parsed from the JSON string */ + private var value:*; + + /** The tokenizer designated to read the JSON string */ + private var tokenizer:JSONTokenizer; + + /** The current token from the tokenizer */ + private var token:JSONToken; + + /** + * Constructs a new JSONDecoder to parse a JSON string + * into a native object. + * + * @param s The JSON string to be converted + * into a native object + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function JSONDecoder( s:String ) { + + tokenizer = new JSONTokenizer( s ); + + nextToken(); + value = parseValue(); + } + + /** + * Gets the internal object that was created by parsing + * the JSON string passed to the constructor. + * + * @return The internal object representation of the JSON + * string that was passed to the constructor + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function getValue():* { + return value; + } + + /** + * Returns the next token from the tokenzier reading + * the JSON string + */ + private function nextToken():JSONToken { + return token = tokenizer.getNextToken(); + } + + /** + * Attempt to parse an array + */ + private function parseArray():Array { + // create an array internally that we're going to attempt + // to parse from the tokenizer + var a:Array = new Array(); + + // grab the next token from the tokenizer to move + // past the opening [ + nextToken(); + + // check to see if we have an empty array + if ( token.type == JSONTokenType.RIGHT_BRACKET ) { + // we're done reading the array, so return it + return a; + } + + // deal with elements of the array, and use an "infinite" + // loop because we could have any amount of elements + while ( true ) { + // read in the value and add it to the array + a.push ( parseValue() ); + + // after the value there should be a ] or a , + nextToken(); + + if ( token.type == JSONTokenType.RIGHT_BRACKET ) { + // we're done reading the array, so return it + return a; + } else if ( token.type == JSONTokenType.COMMA ) { + // move past the comma and read another value + nextToken(); + } else { + tokenizer.parseError( "Expecting ] or , but found " + token.value ); + } + } + return null; + } + + /** + * Attempt to parse an object + */ + private function parseObject():Object { + // create the object internally that we're going to + // attempt to parse from the tokenizer + var o:Object = new Object(); + + // store the string part of an object member so + // that we can assign it a value in the object + var key:String + + // grab the next token from the tokenizer + nextToken(); + + // check to see if we have an empty object + if ( token.type == JSONTokenType.RIGHT_BRACE ) { + // we're done reading the object, so return it + return o; + } + + // deal with members of the object, and use an "infinite" + // loop because we could have any amount of members + while ( true ) { + + if ( token.type == JSONTokenType.STRING ) { + // the string value we read is the key for the object + key = String( token.value ); + + // move past the string to see what's next + nextToken(); + + // after the string there should be a : + if ( token.type == JSONTokenType.COLON ) { + + // move past the : and read/assign a value for the key + nextToken(); + o[key] = parseValue(); + + // move past the value to see what's next + nextToken(); + + // after the value there's either a } or a , + if ( token.type == JSONTokenType.RIGHT_BRACE ) { + // // we're done reading the object, so return it + return o; + + } else if ( token.type == JSONTokenType.COMMA ) { + // skip past the comma and read another member + nextToken(); + } else { + tokenizer.parseError( "Expecting } or , but found " + token.value ); + } + } else { + tokenizer.parseError( "Expecting : but found " + token.value ); + } + } else { + tokenizer.parseError( "Expecting string but found " + token.value ); + } + } + return null; + } + + /** + * Attempt to parse a value + */ + private function parseValue():Object { + + switch ( token.type ) { + case JSONTokenType.LEFT_BRACE: + return parseObject(); + + case JSONTokenType.LEFT_BRACKET: + return parseArray(); + + case JSONTokenType.STRING: + case JSONTokenType.NUMBER: + case JSONTokenType.TRUE: + case JSONTokenType.FALSE: + case JSONTokenType.NULL: + return token.value; + + default: + tokenizer.parseError( "Unexpected " + token.value ); + + } + return null; + } + } +} diff --git a/source/com/adobe/serialization/json/JSONEncoder.as b/source/com/adobe/serialization/json/JSONEncoder.as new file mode 100644 index 0000000..f8b195c --- /dev/null +++ b/source/com/adobe/serialization/json/JSONEncoder.as @@ -0,0 +1,302 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json +{ + + import flash.utils.describeType; + + public class JSONEncoder { + + /** The string that is going to represent the object we're encoding */ + private var jsonString:String; + + /** + * Creates a new JSONEncoder. + * + * @param o The object to encode as a JSON string + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function JSONEncoder( value:* ) { + jsonString = convertToString( value ); + + } + + /** + * Gets the JSON string from the encoder. + * + * @return The JSON string representation of the object + * that was passed to the constructor + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function getString():String { + return jsonString; + } + + /** + * Converts a value to it's JSON string equivalent. + * + * @param value The value to convert. Could be any + * type (object, number, array, etc) + */ + private function convertToString( value:* ):String { + + // determine what value is and convert it based on it's type + if ( value is String ) { + + // escape the string so it's formatted correctly + return escapeString( value as String ); + + } else if ( value is Number ) { + + // only encode numbers that finate + return isFinite( value as Number) ? value.toString() : "null"; + + } else if ( value is Boolean ) { + + // convert boolean to string easily + return value ? "true" : "false"; + + } else if ( value is Array ) { + + // call the helper method to convert an array + return arrayToString( value as Array ); + + } else if ( value is Object && value != null ) { + + // call the helper method to convert an object + return objectToString( value ); + } + return "null"; + } + + /** + * Escapes a string accoding to the JSON specification. + * + * @param str The string to be escaped + * @return The string with escaped special characters + * according to the JSON specification + */ + private function escapeString( str:String ):String { + // create a string to store the string's jsonstring value + var s:String = ""; + // current character in the string we're processing + var ch:String; + // store the length in a local variable to reduce lookups + var len:Number = str.length; + + // loop over all of the characters in the string + for ( var i:int = 0; i < len; i++ ) { + + // examine the character to determine if we have to escape it + ch = str.charAt( i ); + switch ( ch ) { + + case '"': // quotation mark + s += "\\\""; + break; + + //case '/': // solidus + // s += "\\/"; + // break; + + case '\\': // reverse solidus + s += "\\\\"; + break; + + case '\b': // bell + s += "\\b"; + break; + + case '\f': // form feed + s += "\\f"; + break; + + case '\n': // newline + s += "\\n"; + break; + + case '\r': // carriage return + s += "\\r"; + break; + + case '\t': // horizontal tab + s += "\\t"; + break; + + default: // everything else + + // check for a control character and escape as unicode + if ( ch < ' ' ) { + // get the hex digit(s) of the character (either 1 or 2 digits) + var hexCode:String = ch.charCodeAt( 0 ).toString( 16 ); + + // ensure that there are 4 digits by adjusting + // the # of zeros accordingly. + var zeroPad:String = hexCode.length == 2 ? "00" : "000"; + + // create the unicode escape sequence with 4 hex digits + s += "\\u" + zeroPad + hexCode; + } else { + + // no need to do any special encoding, just pass-through + s += ch; + + } + } // end switch + + } // end for loop + + return "\"" + s + "\""; + } + + /** + * Converts an array to it's JSON string equivalent + * + * @param a The array to convert + * @return The JSON string representation of a + */ + private function arrayToString( a:Array ):String { + // create a string to store the array's jsonstring value + var s:String = ""; + + // loop over the elements in the array and add their converted + // values to the string + for ( var i:int = 0; i < a.length; i++ ) { + // when the length is 0 we're adding the first element so + // no comma is necessary + if ( s.length > 0 ) { + // we've already added an element, so add the comma separator + s += "," + } + + // convert the value to a string + s += convertToString( a[i] ); + } + + // KNOWN ISSUE: In ActionScript, Arrays can also be associative + // objects and you can put anything in them, ie: + // myArray["foo"] = "bar"; + // + // These properties aren't picked up in the for loop above because + // the properties don't correspond to indexes. However, we're + // sort of out luck because the JSON specification doesn't allow + // these types of array properties. + // + // So, if the array was also used as an associative object, there + // may be some values in the array that don't get properly encoded. + // + // A possible solution is to instead encode the Array as an Object + // but then it won't get decoded correctly (and won't be an + // Array instance) + + // close the array and return it's string value + return "[" + s + "]"; + } + + /** + * Converts an object to it's JSON string equivalent + * + * @param o The object to convert + * @return The JSON string representation of o + */ + private function objectToString( o:Object ):String + { + // create a string to store the object's jsonstring value + var s:String = ""; + + // determine if o is a class instance or a plain object + var classInfo:XML = describeType( o ); + if ( classInfo.@name.toString() == "Object" ) + { + // the value of o[key] in the loop below - store this + // as a variable so we don't have to keep looking up o[key] + // when testing for valid values to convert + var value:Object; + + // loop over the keys in the object and add their converted + // values to the string + for ( var key:String in o ) + { + // assign value to a variable for quick lookup + value = o[key]; + + // don't add function's to the JSON string + if ( value is Function ) + { + // skip this key and try another + continue; + } + + // when the length is 0 we're adding the first item so + // no comma is necessary + if ( s.length > 0 ) { + // we've already added an item, so add the comma separator + s += "," + } + + s += escapeString( key ) + ":" + convertToString( value ); + } + } + else // o is a class instance + { + // Loop over all of the variables and accessors in the class and + // serialize them along with their values. + for each ( var v:XML in classInfo..*.( name() == "variable" || name() == "accessor" ) ) + { + // When the length is 0 we're adding the first item so + // no comma is necessary + if ( s.length > 0 ) { + // We've already added an item, so add the comma separator + s += "," + } + + s += escapeString( v.@name.toString() ) + ":" + + convertToString( o[ v.@name ] ); + } + + } + + return "{" + s + "}"; + } + + + } + +} diff --git a/source/com/adobe/serialization/json/JSONParseError.as b/source/com/adobe/serialization/json/JSONParseError.as new file mode 100644 index 0000000..5042b35 --- /dev/null +++ b/source/com/adobe/serialization/json/JSONParseError.as @@ -0,0 +1,90 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + /** + * + * + */ + public class JSONParseError extends Error { + + /** The location in the string where the error occurred */ + private var _location:int; + + /** The string in which the parse error occurred */ + private var _text:String; + + /** + * Constructs a new JSONParseError. + * + * @param message The error message that occured during parsing + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function JSONParseError( message:String = "", location:int = 0, text:String = "") { + super( message ); + //name = "JSONParseError"; + _location = location; + _text = text; + } + + /** + * Provides read-only access to the location variable. + * + * @return The location in the string where the error occurred + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function get location():int { + return _location; + } + + /** + * Provides read-only access to the text variable. + * + * @return The string in which the error occurred + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function get text():String { + return _text; + } + } + +} \ No newline at end of file diff --git a/source/com/adobe/serialization/json/JSONToken.as b/source/com/adobe/serialization/json/JSONToken.as new file mode 100644 index 0000000..54b1332 --- /dev/null +++ b/source/com/adobe/serialization/json/JSONToken.as @@ -0,0 +1,107 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + public class JSONToken { + + private var _type:int; + private var _value:Object; + + /** + * Creates a new JSONToken with a specific token type and value. + * + * @param type The JSONTokenType of the token + * @param value The value of the token + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) { + _type = type; + _value = value; + } + + /** + * Returns the type of the token. + * + * @see com.adobe.serialization.json.JSONTokenType + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function get type():int { + return _type; + } + + /** + * Sets the type of the token. + * + * @see com.adobe.serialization.json.JSONTokenType + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function set type( value:int ):void { + _type = value; + } + + /** + * Gets the value of the token + * + * @see com.adobe.serialization.json.JSONTokenType + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function get value():Object { + return _value; + } + + /** + * Sets the value of the token + * + * @see com.adobe.serialization.json.JSONTokenType + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public function set value ( v:Object ):void { + _value = v; + } + + } + +} \ No newline at end of file diff --git a/source/com/adobe/serialization/json/JSONTokenType.as b/source/com/adobe/serialization/json/JSONTokenType.as new file mode 100644 index 0000000..e78173e --- /dev/null +++ b/source/com/adobe/serialization/json/JSONTokenType.as @@ -0,0 +1,70 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + /** + * Class containing constant values for the different types + * of tokens in a JSON encoded string. + */ + public class JSONTokenType { + + public static const UNKNOWN:int = -1; + + public static const COMMA:int = 0; + + public static const LEFT_BRACE:int = 1; + + public static const RIGHT_BRACE:int = 2; + + public static const LEFT_BRACKET:int = 3; + + public static const RIGHT_BRACKET:int = 4; + + public static const COLON:int = 6; + + public static const TRUE:int = 7; + + public static const FALSE:int = 8; + + public static const NULL:int = 9; + + public static const STRING:int = 10; + + public static const NUMBER:int = 11; + + } + +} \ No newline at end of file diff --git a/source/com/adobe/serialization/json/JSONTokenizer.as b/source/com/adobe/serialization/json/JSONTokenizer.as new file mode 100644 index 0000000..2516446 --- /dev/null +++ b/source/com/adobe/serialization/json/JSONTokenizer.as @@ -0,0 +1,550 @@ +/* +Adobe Systems Incorporated(r) Source Code License Agreement +Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + +Please read this Source Code License Agreement carefully before using +the source code. + +Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable copyright license, to reproduce, +prepare derivative works of, publicly display, publicly perform, and +distribute this source code and such derivative works in source or +object code form without any attribution requirements. + +The name "Adobe Systems Incorporated" must not be used to endorse or promote products +derived from the source code without prior written permission. + +You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and +against any loss, damage, claims or lawsuits, including attorney's +fees that arise or result from your use or distribution of the source +code. + +THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT +ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF +NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.serialization.json { + + public class JSONTokenizer { + + /** The object that will get parsed from the JSON string */ + private var obj:Object; + + /** The JSON string to be parsed */ + private var jsonString:String; + + /** The current parsing location in the JSON string */ + private var loc:int; + + /** The current character in the JSON string during parsing */ + private var ch:String; + + /** + * Constructs a new JSONDecoder to parse a JSON string + * into a native object. + * + * @param s The JSON string to be converted + * into a native object + */ + public function JSONTokenizer( s:String ) { + jsonString = s; + loc = 0; + + // prime the pump by getting the first character + nextChar(); + } + + /** + * Gets the next token in the input sting and advances + * the character to the next character after the token + */ + public function getNextToken():JSONToken { + var token:JSONToken = new JSONToken(); + + // skip any whitespace / comments since the last + // token was read + skipIgnored(); + + // examine the new character and see what we have... + switch ( ch ) { + + case '{': + token.type = JSONTokenType.LEFT_BRACE; + token.value = '{'; + nextChar(); + break + + case '}': + token.type = JSONTokenType.RIGHT_BRACE; + token.value = '}'; + nextChar(); + break + + case '[': + token.type = JSONTokenType.LEFT_BRACKET; + token.value = '['; + nextChar(); + break + + case ']': + token.type = JSONTokenType.RIGHT_BRACKET; + token.value = ']'; + nextChar(); + break + + case ',': + token.type = JSONTokenType.COMMA; + token.value = ','; + nextChar(); + break + + case ':': + token.type = JSONTokenType.COLON; + token.value = ':'; + nextChar(); + break; + + case 't': // attempt to read true + var possibleTrue:String = "t" + nextChar() + nextChar() + nextChar(); + + if ( possibleTrue == "true" ) { + token.type = JSONTokenType.TRUE; + token.value = true; + nextChar(); + } else { + parseError( "Expecting 'true' but found " + possibleTrue ); + } + + break; + + case 'f': // attempt to read false + var possibleFalse:String = "f" + nextChar() + nextChar() + nextChar() + nextChar(); + + if ( possibleFalse == "false" ) { + token.type = JSONTokenType.FALSE; + token.value = false; + nextChar(); + } else { + parseError( "Expecting 'false' but found " + possibleFalse ); + } + + break; + + case 'n': // attempt to read null + + var possibleNull:String = "n" + nextChar() + nextChar() + nextChar(); + + if ( possibleNull == "null" ) { + token.type = JSONTokenType.NULL; + token.value = null; + nextChar(); + } else { + parseError( "Expecting 'null' but found " + possibleNull ); + } + + break; + + case '"': // the start of a string + token = readString(); + break; + + default: + // see if we can read a number + if ( isDigit( ch ) || ch == '-' ) { + token = readNumber(); + } else if ( ch == '' ) { + // check for reading past the end of the string + return null; + } else { + // not sure what was in the input string - it's not + // anything we expected + parseError( "Unexpected " + ch + " encountered" ); + } + } + + return token; + } + + /** + * Attempts to read a string from the input string. Places + * the character location at the first character after the + * string. It is assumed that ch is " before this method is called. + * + * @return the JSONToken with the string value if a string could + * be read. Throws an error otherwise. + */ + private function readString():JSONToken { + // the token for the string we'll try to read + var token:JSONToken = new JSONToken(); + token.type = JSONTokenType.STRING; + + // the string to store the string we'll try to read + var string:String = ""; + + // advance past the first " + nextChar(); + + while ( ch != '"' && ch != '' ) { + + // unescape the escape sequences in the string + if ( ch == '\\' ) { + + // get the next character so we know what + // to unescape + nextChar(); + + switch ( ch ) { + + case '"': // quotation mark + string += '"'; + break; + + case '/': // solidus + string += "/"; + break; + + case '\\': // reverse solidus + string += '\\'; + break; + + case 'b': // bell + string += '\b'; + break; + + case 'f': // form feed + string += '\f'; + break; + + case 'n': // newline + string += '\n'; + break; + + case 'r': // carriage return + string += '\r'; + break; + + case 't': // horizontal tab + string += '\t' + break; + + case 'u': + // convert a unicode escape sequence + // to it's character value - expecting + // 4 hex digits + + // save the characters as a string we'll convert to an int + var hexValue:String = ""; + + // try to find 4 hex characters + for ( var i:int = 0; i < 4; i++ ) { + // get the next character and determine + // if it's a valid hex digit or not + if ( !isHexDigit( nextChar() ) ) { + parseError( " Excepted a hex digit, but found: " + ch ); + } + // valid, add it to the value + hexValue += ch; + } + + // convert hexValue to an integer, and use that + // integrer value to create a character to add + // to our string. + string += String.fromCharCode( parseInt( hexValue, 16 ) ); + + break; + + default: + // couldn't unescape the sequence, so just + // pass it through + string += '\\' + ch; + + } + + } else { + // didn't have to unescape, so add the character to the string + string += ch; + + } + + // move to the next character + nextChar(); + + } + + // we read past the end of the string without closing it, which + // is a parse error + if ( ch == '' ) { + parseError( "Unterminated string literal" ); + } + + // move past the closing " in the input string + nextChar(); + + // attach to the string to the token so we can return it + token.value = string; + + return token; + } + + /** + * Attempts to read a number from the input string. Places + * the character location at the first character after the + * number. + * + * @return The JSONToken with the number value if a number could + * be read. Throws an error otherwise. + */ + private function readNumber():JSONToken { + // the token for the number we'll try to read + var token:JSONToken = new JSONToken(); + token.type = JSONTokenType.NUMBER; + + // the string to accumulate the number characters + // into that we'll convert to a number at the end + var input:String = ""; + + // check for a negative number + if ( ch == '-' ) { + input += '-'; + nextChar(); + } + + // the number must start with a digit + if ( !isDigit( ch ) ) + { + parseError( "Expecting a digit" ); + } + + // 0 can only be the first digit if it + // is followed by a decimal point + if ( ch == '0' ) + { + input += ch; + nextChar(); + + // make sure no other digits come after 0 + if ( isDigit( ch ) ) + { + parseError( "A digit cannot immediately follow 0" ); + } + } + else + { + // read numbers while we can + while ( isDigit( ch ) ) { + input += ch; + nextChar(); + } + } + + // check for a decimal value + if ( ch == '.' ) { + input += '.'; + nextChar(); + + // after the decimal there has to be a digit + if ( !isDigit( ch ) ) + { + parseError( "Expecting a digit" ); + } + + // read more numbers to get the decimal value + while ( isDigit( ch ) ) { + input += ch; + nextChar(); + } + } + + // check for scientific notation + if ( ch == 'e' || ch == 'E' ) + { + input += "e" + nextChar(); + // check for sign + if ( ch == '+' || ch == '-' ) + { + input += ch; + nextChar(); + } + + // require at least one number for the exponent + // in this case + if ( !isDigit( ch ) ) + { + parseError( "Scientific notation number needs exponent value" ); + } + + // read in the exponent + while ( isDigit( ch ) ) + { + input += ch; + nextChar(); + } + } + + // convert the string to a number value + var num:Number = Number( input ); + + if ( isFinite( num ) && !isNaN( num ) ) { + token.value = num; + return token; + } else { + parseError( "Number " + num + " is not valid!" ); + } + return null; + } + + /** + * Reads the next character in the input + * string and advances the character location. + * + * @return The next character in the input string, or + * null if we've read past the end. + */ + private function nextChar():String { + return ch = jsonString.charAt( loc++ ); + } + + /** + * Advances the character location past any + * sort of white space and comments + */ + private function skipIgnored():void { + skipWhite(); + skipComments(); + skipWhite(); + } + + /** + * Skips comments in the input string, either + * single-line or multi-line. Advances the character + * to the first position after the end of the comment. + */ + private function skipComments():void { + if ( ch == '/' ) { + // Advance past the first / to find out what type of comment + nextChar(); + switch ( ch ) { + case '/': // single-line comment, read through end of line + + // Loop over the characters until we find + // a newline or until there's no more characters left + do { + nextChar(); + } while ( ch != '\n' && ch != '' ) + + // move past the \n + nextChar(); + + break; + + case '*': // multi-line comment, read until closing */ + + // move past the opening * + nextChar(); + + // try to find a trailing */ + while ( true ) { + if ( ch == '*' ) { + // check to see if we have a closing / + nextChar(); + if ( ch == '/') { + // move past the end of the closing */ + nextChar(); + break; + } + } else { + // move along, looking if the next character is a * + nextChar(); + } + + // when we're here we've read past the end of + // the string without finding a closing */, so error + if ( ch == '' ) { + parseError( "Multi-line comment not closed" ); + } + } + + break; + + // Can't match a comment after a /, so it's a parsing error + default: + parseError( "Unexpected " + ch + " encountered (expecting '/' or '*' )" ); + } + } + + } + + + /** + * Skip any whitespace in the input string and advances + * the character to the first character after any possible + * whitespace. + */ + private function skipWhite():void { + + // As long as there are spaces in the input + // stream, advance the current location pointer + // past them + while ( isWhiteSpace( ch ) ) { + nextChar(); + } + + } + + /** + * Determines if a character is whitespace or not. + * + * @return True if the character passed in is a whitespace + * character + */ + private function isWhiteSpace( ch:String ):Boolean { + return ( ch == ' ' || ch == '\t' || ch == '\n' ); + } + + /** + * Determines if a character is a digit [0-9]. + * + * @return True if the character passed in is a digit + */ + private function isDigit( ch:String ):Boolean { + return ( ch >= '0' && ch <= '9' ); + } + + /** + * Determines if a character is a digit [0-9]. + * + * @return True if the character passed in is a digit + */ + private function isHexDigit( ch:String ):Boolean { + // get the uppercase value of ch so we only have + // to compare the value between 'A' and 'F' + var uc:String = ch.toUpperCase(); + + // a hex digit is a digit of A-F, inclusive ( using + // our uppercase constraint ) + return ( isDigit( ch ) || ( uc >= 'A' && uc <= 'F' ) ); + } + + /** + * Raises a parsing error with a specified message, tacking + * on the error location and the original string. + * + * @param message The message indicating why the error occurred + */ + public function parseError( message:String ):void { + throw new JSONParseError( message, loc, jsonString ); + } + } + +} diff --git a/source/com/adobe/utils/ArrayUtil.as b/source/com/adobe/utils/ArrayUtil.as new file mode 100644 index 0000000..79f499b --- /dev/null +++ b/source/com/adobe/utils/ArrayUtil.as @@ -0,0 +1,190 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + + /** + * Class that contains static utility methods for manipulating and working + * with Arrays. + * + * Note that all APIs assume that they are working with well formed arrays. + * i.e. they will only manipulate indexed values. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public class ArrayUtil + { + + /** + * Determines whether the specified array contains the specified value. + * + * @param arr The array that will be checked for the specified value. + * + * @param value The object which will be searched for within the array + * + * @return True if the array contains the value, False if it does not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function arrayContainsValue(arr:Array, value:Object):Boolean + { + return (arr.indexOf(value) != -1); + } + + /** + * Remove all instances of the specified value from the array, + * + * @param arr The array from which the value will be removed + * + * @param value The object that will be removed from the array. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function removeValueFromArray(arr:Array, value:Object):void + { + var len:uint = arr.length; + + for(var i:Number = len; i > -1; i--) + { + if(arr[i] === value) + { + arr.splice(i, 1); + } + } + } + + /** + * Create a new array that only contains unique instances of objects + * in the specified array. + * + * Basically, this can be used to remove duplication object instances + * from an array + * + * @param arr The array which contains the values that will be used to + * create the new array that contains no duplicate values. + * + * @return A new array which only contains unique items from the specified + * array. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function createUniqueCopy(a:Array):Array + { + var newArray:Array = new Array(); + + var len:Number = a.length; + var item:Object; + + for (var i:uint = 0; i < len; ++i) + { + item = a[i]; + + if(ArrayUtil.arrayContainsValue(newArray, item)) + { + continue; + } + + newArray.push(item); + } + + return newArray; + } + + /** + * Creates a copy of the specified array. + * + * Note that the array returned is a new array but the items within the + * array are not copies of the items in the original array (but rather + * references to the same items) + * + * @param arr The array that will be copies + * + * @return A new array which contains the same items as the array passed + * in. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function copyArray(arr:Array):Array + { + return arr.slice(); + } + + /** + * Compares two arrays and returns a boolean indicating whether the arrays + * contain the same values at the same indexes. + * + * @param arr1 The first array that will be compared to the second. + * + * @param arr2 The second array that will be compared to the first. + * + * @return True if the arrays contains the same values at the same indexes. + False if they do not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean + { + if(arr1.length != arr2.length) + { + return false; + } + + var len:Number = arr1.length; + + for(var i:Number = 0; i < len; i++) + { + if(arr1[i] !== arr2[i]) + { + return false; + } + } + + return true; + } + } +} diff --git a/source/com/adobe/utils/DateUtil.as b/source/com/adobe/utils/DateUtil.as new file mode 100644 index 0000000..eaa68c7 --- /dev/null +++ b/source/com/adobe/utils/DateUtil.as @@ -0,0 +1,666 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + import com.adobe.utils.ArrayUtil; + import mx.formatters.DateBase; + + /** + * Class that contains static utility methods for manipulating and working + * with Dates. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public class DateUtil + { + + /** + * Returns the English Short Month name (3 letters) for the Month that + * the Date represents. + * + * @param d The Date instance whose month will be used to retrieve the + * short month name. + * + * @return An English 3 Letter Month abbreviation. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_MONTH + */ + public static function getShortMonthName(d:Date):String + { + return DateBase.monthNamesShort[d.getMonth()]; + } + + /** + * Returns the index of the month that the short month name string + * represents. + * + * @param m The 3 letter abbreviation representing a short month name. + * + * @param Optional parameter indicating whether the search should be case + * sensitive + * + * @return A int that represents that month represented by the specifed + * short name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_MONTH + */ + public static function getShortMonthIndex(m:String):int + { + return DateBase.monthNamesShort.indexOf(m); + } + + /** + * Returns the English full Month name for the Month that + * the Date represents. + * + * @param d The Date instance whose month will be used to retrieve the + * full month name. + * + * @return An English full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_MONTH + */ + public static function getFullMonthName(d:Date):String + { + return DateBase.monthNamesLong[d.getMonth()]; + } + + /** + * Returns the index of the month that the full month name string + * represents. + * + * @param m A full month name. + * + * @return A int that represents that month represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_MONTH + */ + public static function getFullMonthIndex(m:String):int + { + return DateBase.monthNamesLong.indexOf(m); + } + + /** + * Returns the English Short Day name (3 letters) for the day that + * the Date represents. + * + * @param d The Date instance whose day will be used to retrieve the + * short day name. + * + * @return An English 3 Letter day abbreviation. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_DAY + */ + public static function getShortDayName(d:Date):String + { + return DateBase.dayNamesShort[d.getDay()]; + } + + /** + * Returns the index of the day that the short day name string + * represents. + * + * @param m A short day name. + * + * @return A int that represents that short day represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see SHORT_DAY + */ + public static function getShortDayIndex(d:String):int + { + return DateBase.dayNamesShort.indexOf(d); + } + + /** + * Returns the English full day name for the day that + * the Date represents. + * + * @param d The Date instance whose day will be used to retrieve the + * full day name. + * + * @return An English full day name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_DAY + */ + public static function getFullDayName(d:Date):String + { + return DateBase.dayNamesLong[d.getDay()]; + } + + /** + * Returns the index of the day that the full day name string + * represents. + * + * @param m A full day name. + * + * @return A int that represents that full day represented by the specifed + * full month name. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see FULL_DAY + */ + public static function getFullDayIndex(d:String):int + { + return DateBase.dayNamesLong.indexOf(d); + } + + /** + * Returns a two digit representation of the year represented by the + * specified date. + * + * @param d The Date instance whose year will be used to generate a two + * digit string representation of the year. + * + * @return A string that contains a 2 digit representation of the year. + * Single digits will be padded with 0. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getShortYear(d:Date):String + { + var dStr:String = String(d.getFullYear()); + + if(dStr.length < 3) + { + return dStr; + } + + return (dStr.substr(dStr.length - 2)); + } + + /** + * Compares two dates and returns an integer depending on their relationship. + * + * Returns -1 if d1 is greater than d2. + * Returns 1 if d2 is greater than d1. + * Returns 0 if both dates are equal. + * + * @param d1 The date that will be compared to the second date. + * @param d2 The date that will be compared to the first date. + * + * @return An int indicating how the two dates compare. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function compareDates(d1:Date, d2:Date):int + { + var d1ms:Number = d1.getTime(); + var d2ms:Number = d2.getTime(); + + if(d1ms > d2ms) + { + return -1; + } + else if(d1ms < d2ms) + { + return 1; + } + else + { + return 0; + } + } + + /** + * Returns a short hour (0 - 12) represented by the specified date. + * + * If the hour is less than 12 (0 - 11 AM) then the hour will be returned. + * + * If the hour is greater than 12 (12 - 23 PM) then the hour minus 12 + * will be returned. + * + * @param d1 The Date from which to generate the short hour + * + * @return An int between 0 and 13 ( 1 - 12 ) representing the short hour. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getShortHour(d:Date):int + { + var h:int = d.hours; + + if(h == 0 || h == 12) + { + return 12; + } + else if(h > 12) + { + return h - 12; + } + else + { + return h; + } + } + + /** + * Returns a string indicating whether the date represents a time in the + * ante meridiem (AM) or post meridiem (PM). + * + * If the hour is less than 12 then "AM" will be returned. + * + * If the hour is greater than 12 then "PM" will be returned. + * + * @param d1 The Date from which to generate the 12 hour clock indicator. + * + * @return A String ("AM" or "PM") indicating which half of the day the + * hour represents. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getAMPM(d:Date):String + { + return (d.hours > 11)? "PM" : "AM"; + } + + /** + * Parses dates that conform to RFC822 into Date objects. This method also + * supports four-digit years (not supported in RFC822), but two-digit years + * (referring to the 20th century) are fine, too. + * + * This function is useful for parsing RSS .91, .92, and 2.0 dates. + * + * @param str + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://asg.web.cmu.edu/rfc/rfc822.html + */ + public static function parseRFC822(str:String):Date + { + var finalDate:Date; + try + { + var dateParts:Array = str.split(" "); + var day:String = null; + + if (dateParts[0].search(/\d/) == -1) + { + day = dateParts.shift().replace(/\W/, ""); + } + + var date:Number = Number(dateParts.shift()); + var month:Number = Number(DateUtil.getShortMonthIndex(dateParts.shift())); + var year:Number = Number(dateParts.shift()); + var timeParts:Array = dateParts.shift().split(":"); + var hour:Number = int(timeParts.shift()); + var minute:Number = int(timeParts.shift()); + var second:Number = (timeParts.length > 0) ? int(timeParts.shift()): 0; + + var milliseconds:Number = Date.UTC(year, month, date, hour, minute, second, 0); + + var timezone:String = dateParts.shift(); + var offset:Number = 0; + + if (timezone.search(/\d/) == -1) + { + switch(timezone) + { + case "UT": + offset = 0; + break; + case "UTC": + offset = 0; + break; + case "GMT": + offset = 0; + break; + case "EST": + offset = (-5 * 3600000); + break; + case "EDT": + offset = (-4 * 3600000); + break; + case "CST": + offset = (-6 * 3600000); + break; + case "CDT": + offset = (-5 * 3600000); + break; + case "MST": + offset = (-7 * 3600000); + break; + case "MDT": + offset = (-6 * 3600000); + break; + case "PST": + offset = (-8 * 3600000); + break; + case "PDT": + offset = (-7 * 3600000); + break; + case "Z": + offset = 0; + break; + case "A": + offset = (-1 * 3600000); + break; + case "M": + offset = (-12 * 3600000); + break; + case "N": + offset = (1 * 3600000); + break; + case "Y": + offset = (12 * 3600000); + break; + default: + offset = 0; + } + } + else + { + var multiplier:Number = 1; + var oHours:Number = 0; + var oMinutes:Number = 0; + if (timezone.length != 4) + { + if (timezone.charAt(0) == "-") + { + multiplier = -1; + } + timezone = timezone.substr(1, 4); + } + oHours = Number(timezone.substr(0, 2)); + oMinutes = Number(timezone.substr(2, 2)); + offset = (((oHours * 3600000) + (oMinutes * 60000)) * multiplier); + } + + finalDate = new Date(milliseconds - offset); + + if (finalDate.toString() == "Invalid Date") + { + throw new Error("This date does not conform to RFC822."); + } + } + catch (e:Error) + { + var eStr:String = "Unable to parse the string [" +str+ "] into a date. "; + eStr += "The internal error was: " + e.toString(); + throw new Error(eStr); + } + return finalDate; + } + + /** + * Returns a date string formatted according to RFC822. + * + * @param d + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://asg.web.cmu.edu/rfc/rfc822.html + */ + public static function toRFC822(d:Date):String + { + var date:Number = d.getUTCDate(); + var hours:Number = d.getUTCHours(); + var minutes:Number = d.getUTCMinutes(); + var seconds:Number = d.getUTCSeconds(); + var sb:String = new String(); + sb += DateBase.dayNamesShort[d.getUTCDay()]; + sb += ", "; + + if (date < 10) + { + sb += "0"; + } + sb += date; + sb += " "; + //sb += DateUtil.SHORT_MONTH[d.getUTCMonth()]; + sb += DateBase.monthNamesShort[d.getUTCMonth()]; + sb += " "; + sb += d.getUTCFullYear(); + sb += " "; + if (hours < 10) + { + sb += "0"; + } + sb += hours; + sb += ":"; + if (minutes < 10) + { + sb += "0"; + } + sb += minutes; + sb += ":"; + if (seconds < 10) + { + sb += "0"; + } + sb += seconds; + sb += " GMT"; + return sb; + } + + /** + * Parses dates that conform to the W3C Date-time Format into Date objects. + * + * This function is useful for parsing RSS 1.0 and Atom 1.0 dates. + * + * @param str + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://www.w3.org/TR/NOTE-datetime + */ + public static function parseW3CDTF(str:String):Date + { + var finalDate:Date; + try + { + var dateStr:String = str.substring(0, str.indexOf("T")); + var timeStr:String = str.substring(str.indexOf("T")+1, str.length); + var dateArr:Array = dateStr.split("-"); + var year:Number = Number(dateArr.shift()); + var month:Number = Number(dateArr.shift()); + var date:Number = Number(dateArr.shift()); + + var multiplier:Number; + var offsetHours:Number; + var offsetMinutes:Number; + var offsetStr:String; + + if (timeStr.indexOf("Z") != -1) + { + multiplier = 1; + offsetHours = 0; + offsetMinutes = 0; + timeStr = timeStr.replace("Z", ""); + } + else if (timeStr.indexOf("+") != -1) + { + multiplier = 1; + offsetStr = timeStr.substring(timeStr.indexOf("+")+1, timeStr.length); + offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":"))); + offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length)); + timeStr = timeStr.substring(0, timeStr.indexOf("+")); + } + else // offset is - + { + multiplier = -1; + offsetStr = timeStr.substring(timeStr.indexOf("-")+1, timeStr.length); + offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":"))); + offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length)); + timeStr = timeStr.substring(0, timeStr.indexOf("-")); + } + var timeArr:Array = timeStr.split(":"); + var hour:Number = Number(timeArr.shift()); + var minutes:Number = Number(timeArr.shift()); + var secondsArr:Array = (timeArr.length > 0) ? String(timeArr.shift()).split(".") : null; + var seconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0; + var milliseconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0; + var utc:Number = Date.UTC(year, month-1, date, hour, minutes, seconds, milliseconds); + var offset:Number = (((offsetHours * 3600000) + (offsetMinutes * 60000)) * multiplier); + finalDate = new Date(utc - offset); + + if (finalDate.toString() == "Invalid Date") + { + throw new Error("This date does not conform to W3CDTF."); + } + } + catch (e:Error) + { + var eStr:String = "Unable to parse the string [" +str+ "] into a date. "; + eStr += "The internal error was: " + e.toString(); + throw new Error(eStr); + } + return finalDate; + } + + /** + * Returns a date string formatted according to W3CDTF. + * + * @param d + * @param includeMilliseconds Determines whether to include the + * milliseconds value (if any) in the formatted string. + * + * @returns + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see http://www.w3.org/TR/NOTE-datetime + */ + public static function toW3CDTF(d:Date,includeMilliseconds:Boolean=false):String + { + var date:Number = d.getUTCDate(); + var month:Number = d.getUTCMonth(); + var hours:Number = d.getUTCHours(); + var minutes:Number = d.getUTCMinutes(); + var seconds:Number = d.getUTCSeconds(); + var milliseconds:Number = d.getUTCMilliseconds(); + var sb:String = new String(); + + sb += d.getUTCFullYear(); + sb += "-"; + + //thanks to "dom" who sent in a fix for the line below + if (month + 1 < 10) + { + sb += "0"; + } + sb += month + 1; + sb += "-"; + if (date < 10) + { + sb += "0"; + } + sb += date; + sb += "T"; + if (hours < 10) + { + sb += "0"; + } + sb += hours; + sb += ":"; + if (minutes < 10) + { + sb += "0"; + } + sb += minutes; + sb += ":"; + if (seconds < 10) + { + sb += "0"; + } + sb += seconds; + if (includeMilliseconds && milliseconds > 0) + { + sb += "."; + sb += milliseconds; + } + sb += "-00:00"; + return sb; + } + } +} diff --git a/source/com/adobe/utils/DictionaryUtil.as b/source/com/adobe/utils/DictionaryUtil.as new file mode 100644 index 0000000..4c71c06 --- /dev/null +++ b/source/com/adobe/utils/DictionaryUtil.as @@ -0,0 +1,90 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + import flash.utils.Dictionary; + + public class DictionaryUtil + { + + /** + * Returns an Array of all keys within the specified dictionary. + * + * @param d The Dictionary instance whose keys will be returned. + * + * @return Array of keys contained within the Dictionary + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getKeys(d:Dictionary):Array + { + var a:Array = new Array(); + + for (var key:Object in d) + { + a.push(key); + } + + return a; + } + + /** + * Returns an Array of all values within the specified dictionary. + * + * @param d The Dictionary instance whose values will be returned. + * + * @return Array of values contained within the Dictionary + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function getValues(d:Dictionary):Array + { + var a:Array = new Array(); + + for each (var value:Object in d) + { + a.push(value); + } + + return a; + } + + } +} \ No newline at end of file diff --git a/source/com/adobe/utils/IntUtil.as b/source/com/adobe/utils/IntUtil.as new file mode 100644 index 0000000..6b677ef --- /dev/null +++ b/source/com/adobe/utils/IntUtil.as @@ -0,0 +1,69 @@ + +package com.adobe.utils { + + import flash.utils.Endian; + + /** + * Contains reusable methods for operations pertaining + * to int values. + */ + public class IntUtil { + + /** + * Rotates x left n bits + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function rol ( x:int, n:int ):int { + return ( x << n ) | ( x >>> ( 32 - n ) ); + } + + /** + * Rotates x right n bits + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function ror ( x:int, n:int ):uint { + var nn:int = 32 - n; + return ( x << nn ) | ( x >>> ( 32 - nn ) ); + } + + /** String for quick lookup of a hex character based on index */ + private static var hexChars:String = "0123456789abcdef"; + + /** + * Outputs the hex value of a int, allowing the developer to specify + * the endinaness in the process. Hex output is lowercase. + * + * @param n The int value to output as hex + * @param bigEndian Flag to output the int as big or little endian + * @return A string of length 8 corresponding to the + * hex representation of n ( minus the leading "0x" ) + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function toHex( n:int, bigEndian:Boolean = false ):String { + var s:String = ""; + + if ( bigEndian ) { + for ( var i:int = 0; i < 4; i++ ) { + s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF ) + + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF ); + } + } else { + for ( var x:int = 0; x < 4; x++ ) { + s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF ) + + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF ); + } + } + + return s; + } + } + +} \ No newline at end of file diff --git a/source/com/adobe/utils/NumberFormatter.as b/source/com/adobe/utils/NumberFormatter.as new file mode 100644 index 0000000..60b9667 --- /dev/null +++ b/source/com/adobe/utils/NumberFormatter.as @@ -0,0 +1,77 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + + /** + * Class that contains static utility methods for formatting Numbers + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + * + * @see #mx.formatters.NumberFormatter + */ + public class NumberFormatter + { + + /** + * Formats a number to include a leading zero if it is a single digit + * between -1 and 10. + * + * @param n The number that will be formatted + * + * @return A string with single digits between -1 and 10 padded with a + * leading zero. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function addLeadingZero(n:Number):String + { + var out:String = String(n); + + if(n < 10 && n > -1) + { + out = "0" + out; + } + + return out; + } + + } +} \ No newline at end of file diff --git a/source/com/adobe/utils/StringUtil.as b/source/com/adobe/utils/StringUtil.as new file mode 100644 index 0000000..493fbd0 --- /dev/null +++ b/source/com/adobe/utils/StringUtil.as @@ -0,0 +1,257 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + + /** + * Class that contains static utility methods for manipulating Strings. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public class StringUtil + { + + + /** + * Does a case insensitive compare or two strings and returns true if + * they are equal. + * + * @param s1 The first string to compare. + * + * @param s2 The second string to compare. + * + * @returns A boolean value indicating whether the strings' values are + * equal in a case sensitive compare. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function stringsAreEqual(s1:String, s2:String, + caseSensitive:Boolean):Boolean + { + if(caseSensitive) + { + return (s1 == s2); + } + else + { + return (s1.toUpperCase() == s2.toUpperCase()); + } + } + + /** + * Removes whitespace from the front and the end of the specified + * string. + * + * @param input The String whose beginning and ending whitespace will + * will be removed. + * + * @returns A String with whitespace removed from the begining and end + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function trim(input:String):String + { + return StringUtil.ltrim(StringUtil.rtrim(input)); + } + + /** + * Removes whitespace from the front of the specified string. + * + * @param input The String whose beginning whitespace will will be removed. + * + * @returns A String with whitespace removed from the begining + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function ltrim(input:String):String + { + var size:Number = input.length; + for(var i:Number = 0; i < size; i++) + { + if(input.charCodeAt(i) > 32) + { + return input.substring(i); + } + } + return ""; + } + + /** + * Removes whitespace from the end of the specified string. + * + * @param input The String whose ending whitespace will will be removed. + * + * @returns A String with whitespace removed from the end + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function rtrim(input:String):String + { + var size:Number = input.length; + for(var i:Number = size; i > 0; i--) + { + if(input.charCodeAt(i - 1) > 32) + { + return input.substring(0, i); + } + } + + return ""; + } + + /** + * Determines whether the specified string begins with the spcified prefix. + * + * @param input The string that the prefix will be checked against. + * + * @param prefix The prefix that will be tested against the string. + * + * @returns True if the string starts with the prefix, false if it does not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function beginsWith(input:String, prefix:String):Boolean + { + return (prefix == input.substring(0, prefix.length)); + } + + /** + * Determines whether the specified string ends with the spcified suffix. + * + * @param input The string that the suffic will be checked against. + * + * @param prefix The suffic that will be tested against the string. + * + * @returns True if the string ends with the suffix, false if it does not. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function endsWith(input:String, suffix:String):Boolean + { + return (suffix == input.substring(input.length - suffix.length)); + } + + /** + * Removes all instances of the remove string in the input string. + * + * @param input The string that will be checked for instances of remove + * string + * + * @param remove The string that will be removed from the input string. + * + * @returns A String with the remove string removed. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function remove(input:String, remove:String):String + { + return StringUtil.replace(input, remove, ""); + } + + /** + * Replaces all instances of the replace string in the input string + * with the replaceWith string. + * + * @param input The string that instances of replace string will be + * replaces with removeWith string. + * + * @param replace The string that will be replaced by instances of + * the replaceWith string. + * + * @param replaceWith The string that will replace instances of replace + * string. + * + * @returns A new String with the replace string replaced with the + * replaceWith string. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + * @tiptext + */ + public static function replace(input:String, replace:String, replaceWith:String):String + { + //change to StringBuilder + var sb:String = new String(); + var found:Boolean = false; + + var sLen:Number = input.length; + var rLen:Number = replace.length; + + for (var i:Number = 0; i < sLen; i++) + { + if(input.charAt(i) == replace.charAt(0)) + { + found = true; + for(var j:Number = 0; j < rLen; j++) + { + if(!(input.charAt(i + j) == replace.charAt(j))) + { + found = false; + break; + } + } + + if(found) + { + sb += replaceWith; + i = i + (rLen - 1); + continue; + } + } + sb += input.charAt(i); + } + //TODO : if the string is not found, should we return the original + //string? + return sb; + } + } +} \ No newline at end of file diff --git a/source/com/adobe/utils/XMLUtil.as b/source/com/adobe/utils/XMLUtil.as new file mode 100644 index 0000000..1a902ef --- /dev/null +++ b/source/com/adobe/utils/XMLUtil.as @@ -0,0 +1,171 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.utils +{ + + public class XMLUtil + { + /** + * Constant representing a text node type returned from XML.nodeKind. + * + * @see XML.nodeKind() + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static const TEXT:String = "text"; + + /** + * Constant representing a comment node type returned from XML.nodeKind. + * + * @see XML.nodeKind() + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static const COMMENT:String = "comment"; + + /** + * Constant representing a processing instruction type returned from XML.nodeKind. + * + * @see XML.nodeKind() + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static const PROCESSING_INSTRUCTION:String = "processing-instruction"; + + /** + * Constant representing an attribute type returned from XML.nodeKind. + * + * @see XML.nodeKind() + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static const ATTRIBUTE:String = "attribute"; + + /** + * Constant representing a element type returned from XML.nodeKind. + * + * @see XML.nodeKind() + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static const ELEMENT:String = "element"; + + /** + * Checks whether the specified string is valid and well formed XML. + * + * @param data The string that is being checked to see if it is valid XML. + * + * @return A Boolean value indicating whether the specified string is + * valid XML. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static function isValidXML(data:String):Boolean + { + var xml:XML; + + try + { + xml = new XML(data); + } + catch(e:Error) + { + return false; + } + + if(xml.nodeKind() != XMLUtil.ELEMENT) + { + return false; + } + + return true; + } + + /** + * Returns the next sibling of the specified node relative to the node's parent. + * + * @param x The node whose next sibling will be returned. + * + * @return The next sibling of the node. null if the node does not have + * a sibling after it, or if the node has no parent. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static function getNextSibling(x:XML):XML + { + return XMLUtil.getSiblingByIndex(x, 1); + } + + /** + * Returns the sibling before the specified node relative to the node's parent. + * + * @param x The node whose sibling before it will be returned. + * + * @return The sibling before the node. null if the node does not have + * a sibling before it, or if the node has no parent. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public static function getPreviousSibling(x:XML):XML + { + return XMLUtil.getSiblingByIndex(x, -1); + } + + protected static function getSiblingByIndex(x:XML, count:int):XML + { + var out:XML; + + try + { + out = x.parent().children()[x.childIndex() + count]; + } + catch(e:Error) + { + return null; + } + + return out; + } + } +} \ No newline at end of file diff --git a/source/com/adobe/webapis/ServiceBase.as b/source/com/adobe/webapis/ServiceBase.as new file mode 100644 index 0000000..cbd7ac8 --- /dev/null +++ b/source/com/adobe/webapis/ServiceBase.as @@ -0,0 +1,51 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +package com.adobe.webapis +{ + import flash.events.EventDispatcher; + + /** + * Base class for remote service classes. + */ + public class ServiceBase extends EventDispatcher + { + public function ServiceBase() + { + } + + } +} \ No newline at end of file diff --git a/source/com/adobe/webapis/URLLoaderBase.as b/source/com/adobe/webapis/URLLoaderBase.as new file mode 100644 index 0000000..dad2b2c --- /dev/null +++ b/source/com/adobe/webapis/URLLoaderBase.as @@ -0,0 +1,111 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.adobe.webapis +{ + import flash.events.IOErrorEvent; + import flash.events.SecurityErrorEvent; + import flash.events.ProgressEvent; + + import com.adobe.net.DynamicURLLoader; + + /** + * Dispatched when data is + * received as the download operation progresses. + * + * @eventType flash.events.ProgressEvent.PROGRESS + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + [Event(name="progress", type="flash.events.ProgressEvent")] + + /** + * Dispatched if a call to the server results in a fatal + * error that terminates the download. + * + * @eventType flash.events.IOErrorEvent.IO_ERROR + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + [Event(name="ioError", type="flash.events.IOErrorEvent")] + + /** + * A securityError event occurs if a call attempts to + * load data from a server outside the security sandbox. + * + * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + [Event(name="securityError", type="flash.events.SecurityErrorEvent")] + + /** + * Base class for services that utilize URLLoader + * to communicate with remote APIs / Services. + * + * @langversion ActionScript 3.0 + * @playerversion Flash 9.0 + */ + public class URLLoaderBase extends ServiceBase + { + protected function getURLLoader():DynamicURLLoader + { + var loader:DynamicURLLoader = new DynamicURLLoader(); + loader.addEventListener("progress", onProgress); + loader.addEventListener("ioError", onIOError); + loader.addEventListener("securityError", onSecurityError); + + return loader; + } + + private function onIOError(event:IOErrorEvent):void + { + dispatchEvent(event); + } + + private function onSecurityError(event:SecurityErrorEvent):void + { + dispatchEvent(event); + } + + private function onProgress(event:ProgressEvent):void + { + dispatchEvent(event); + } + } +} \ No newline at end of file diff --git a/source/com/adobe/webapis/events/ServiceEvent.as b/source/com/adobe/webapis/events/ServiceEvent.as new file mode 100644 index 0000000..d83ab25 --- /dev/null +++ b/source/com/adobe/webapis/events/ServiceEvent.as @@ -0,0 +1,78 @@ +/* + Adobe Systems Incorporated(r) Source Code License Agreement + Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. + + Please read this Source Code License Agreement carefully before using + the source code. + + Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license, to reproduce, + prepare derivative works of, publicly display, publicly perform, and + distribute this source code and such derivative works in source or + object code form without any attribution requirements. + + The name "Adobe Systems Incorporated" must not be used to endorse or promote products + derived from the source code without prior written permission. + + You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and + against any loss, damage, claims or lawsuits, including attorney's + fees that arise or result from your use or distribution of the source + code. + + THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT + ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF + NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA + OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +package com.adobe.webapis.events +{ + + import flash.events.Event; + + /** + * Event class that contains data loaded from remote services. + * + * @author Mike Chambers + */ + public class ServiceEvent extends Event + { + private var _data:Object = new Object();; + + /** + * Constructor for ServiceEvent class. + * + * @param type The type of event that the instance represents. + */ + public function ServiceEvent(type:String, bubbles:Boolean = false, + cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + /** + * This object contains data loaded in response + * to remote service calls, and properties associated with that call. + */ + public function get data():Object + { + return _data; + } + + public function set data(d:Object):void + { + _data = d; + } + + + } +} \ No newline at end of file diff --git a/source/com/dynamicflash/util/Base64.as b/source/com/dynamicflash/util/Base64.as new file mode 100644 index 0000000..ca155e2 --- /dev/null +++ b/source/com/dynamicflash/util/Base64.as @@ -0,0 +1,135 @@ +/* +Base64 - 1.1.0 + +Copyright (c) 2006 Steve Webster + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +package com.dynamicflash.util { + + import flash.utils.ByteArray; + + public class Base64 { + + private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + public static const version:String = "1.0.0"; + + public static function encode(data:String):String { + // Convert string to ByteArray + var bytes:ByteArray = new ByteArray(); + bytes.writeUTFBytes(data); + + // Return encoded ByteArray + return encodeByteArray(bytes); + } + + public static function encodeByteArray(data:ByteArray):String { + // Initialise output + var output:String = ""; + + // Create data and output buffers + var dataBuffer:Array; + var outputBuffer:Array = new Array(4); + + // Rewind ByteArray + data.position = 0; + + // while there are still bytes to be processed + while (data.bytesAvailable > 0) { + // Create new data buffer and populate next 3 bytes from data + dataBuffer = new Array(); + for (var i:uint = 0; i < 3 && data.bytesAvailable > 0; i++) { + dataBuffer[i] = data.readUnsignedByte(); + } + + // Convert to data buffer Base64 character positions and + // store in output buffer + outputBuffer[0] = (dataBuffer[0] & 0xfc) >> 2; + outputBuffer[1] = ((dataBuffer[0] & 0x03) << 4) | ((dataBuffer[1]) >> 4); + outputBuffer[2] = ((dataBuffer[1] & 0x0f) << 2) | ((dataBuffer[2]) >> 6); + outputBuffer[3] = dataBuffer[2] & 0x3f; + + // If data buffer was short (i.e not 3 characters) then set + // end character indexes in data buffer to index of '=' symbol. + // This is necessary because Base64 data is always a multiple of + // 4 bytes and is basses with '=' symbols. + for (var j:uint = dataBuffer.length; j < 3; j++) { + outputBuffer[j + 1] = 64; + } + + // Loop through output buffer and add Base64 characters to + // encoded data string for each character. + for (var k:uint = 0; k < outputBuffer.length; k++) { + output += BASE64_CHARS.charAt(outputBuffer[k]); + } + } + + // Return encoded data + return output; + } + + public static function decode(data:String):String { + // Decode data to ByteArray + var bytes:ByteArray = decodeToByteArray(data); + + // Convert to string and return + return bytes.readUTFBytes(bytes.length); + } + + public static function decodeToByteArray(data:String):ByteArray { + // Initialise output ByteArray for decoded data + var output:ByteArray = new ByteArray(); + + // Create data and output buffers + var dataBuffer:Array = new Array(4); + var outputBuffer:Array = new Array(3); + + // While there are data bytes left to be processed + for (var i:uint = 0; i < data.length; i += 4) { + // Populate data buffer with position of Base64 characters for + // next 4 bytes from encoded data + for (var j:uint = 0; j < 4 && i + j < data.length; j++) { + dataBuffer[j] = BASE64_CHARS.indexOf(data.charAt(i + j)); + } + + // Decode data buffer back into bytes + outputBuffer[0] = (dataBuffer[0] << 2) + ((dataBuffer[1] & 0x30) >> 4); + outputBuffer[1] = ((dataBuffer[1] & 0x0f) << 4) + ((dataBuffer[2] & 0x3c) >> 2); + outputBuffer[2] = ((dataBuffer[2] & 0x03) << 6) + dataBuffer[3]; + + // Add all non-padded bytes in output buffer to decoded data + for (var k:uint = 0; k < outputBuffer.length; k++) { + if (dataBuffer[k+1] == 64) break; + output.writeByte(outputBuffer[k]); + } + } + + // Rewind decoded data ByteArray + output.position = 0; + + // Return decoded data + return output; + } + + public function Base64() { + throw new Error("Base64 class is static container only"); + } + } +} \ No newline at end of file diff --git a/source/com/dynamicflash/util/tests/Base64Test.as b/source/com/dynamicflash/util/tests/Base64Test.as new file mode 100644 index 0000000..9077039 --- /dev/null +++ b/source/com/dynamicflash/util/tests/Base64Test.as @@ -0,0 +1,60 @@ +/* +Copyright (c) 2006 Steve Webster + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +package com.dynamicflash.util.tests { + + import flexunit.framework.TestCase; + import flexunit.framework.TestSuite; + import flash.utils.ByteArray; + + import com.dynamicflash.util.Base64; + + public class Base64Test extends TestCase { + + public function Base64Test(methodName:String = null) { + super(methodName); + } + + public function testEncode():void { + assertEquals("VGhpcyBpcyBhIHRlc3Q=",Base64.encode("This is a test")); + } + + public function testEncodeDecodeBytes():void { + var obj:Object = {name:"Dynamic Flash", url:"http://dynamicflash.com"}; + var source:ByteArray = new ByteArray(); + source.writeObject(obj); + var encoded:String = Base64.encodeByteArray(source); + var decoded:ByteArray = Base64.decodeToByteArray(encoded); + var obj2:Object = decoded.readObject(); + assertEquals(obj.name, obj2.name); + assertEquals(obj.url, obj2.url); + } + + public function testDecode():void { + assertEquals("This is a test",Base64.decode("VGhpcyBpcyBhIHRlc3Q=")); + } + + public function testEncodeDecode():void { + var string:String = "The quick brown fox jumped over the lazy dogs"; + assertEquals(string, Base64.decode(Base64.encode(string))); + } + } +} \ No newline at end of file diff --git a/source/com/hangge/util/no.txt b/source/com/hangge/util/no.txt new file mode 100644 index 0000000..e69de29 diff --git a/source/com/hurlant/crypto/Crypto.as b/source/com/hurlant/crypto/Crypto.as new file mode 100644 index 0000000..e914239 --- /dev/null +++ b/source/com/hurlant/crypto/Crypto.as @@ -0,0 +1,273 @@ +/** + * Crypto + * + * An abstraction layer to instanciate our crypto algorithms + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto +{ + import com.hurlant.crypto.hash.HMAC; + import com.hurlant.crypto.hash.IHash; + import com.hurlant.crypto.hash.MD2; + import com.hurlant.crypto.hash.MD5; + import com.hurlant.crypto.hash.SHA1; + import com.hurlant.crypto.hash.SHA224; + import com.hurlant.crypto.hash.SHA256; + import com.hurlant.crypto.prng.ARC4; + import com.hurlant.crypto.rsa.RSAKey; + import com.hurlant.crypto.symmetric.AESKey; + import com.hurlant.crypto.symmetric.BlowFishKey; + import com.hurlant.crypto.symmetric.CBCMode; + import com.hurlant.crypto.symmetric.CFB8Mode; + import com.hurlant.crypto.symmetric.CFBMode; + import com.hurlant.crypto.symmetric.CTRMode; + import com.hurlant.crypto.symmetric.DESKey; + import com.hurlant.crypto.symmetric.ECBMode; + import com.hurlant.crypto.symmetric.ICipher; + import com.hurlant.crypto.symmetric.IMode; + import com.hurlant.crypto.symmetric.IPad; + import com.hurlant.crypto.symmetric.ISymmetricKey; + import com.hurlant.crypto.symmetric.IVMode; + import com.hurlant.crypto.symmetric.NullPad; + import com.hurlant.crypto.symmetric.OFBMode; + import com.hurlant.crypto.symmetric.PKCS5; + import com.hurlant.crypto.symmetric.SimpleIVMode; + import com.hurlant.crypto.symmetric.TripleDESKey; + import com.hurlant.crypto.symmetric.XTeaKey; + import com.hurlant.util.Base64; + + import flash.utils.ByteArray; + + /** + * A class to make it easy to use the rest of the framework. + * As a side-effect, using this class will cause most of the framework + * to be linked into your application, which is not always what you want. + * + * If you want to optimize your download size, don't use this class. + * (But feel free to read it to get ideas on how to get the algorithm you want.) + */ + public class Crypto + { + private var b64:Base64; // we don't use it, but we want the swc to include it, so cheap trick. + + public function Crypto(){ + } + + /** + * Things that should work, among others: + * "aes" + * "aes-128-ecb" + * "aes-128-cbc" + * "aes-128-cfb" + * "aes-128-cfb8" + * "aes-128-ofb" + * "aes-192-cfb" + * "aes-256-ofb" + * "blowfish-cbc" + * "des-ecb" + * "xtea" + * "xtea-ecb" + * "xtea-cbc" + * "xtea-cfb" + * "xtea-cfb8" + * "xtea-ofb" + * "rc4" + * "simple-aes-cbc" + */ + public static function getCipher(name:String, key:ByteArray, pad:IPad=null):ICipher { + // split name into an array. + var keys:Array = name.split("-"); + switch (keys[0]) { + /** + * "simple" is a special case. It means: + * "If using an IV mode, prepend the IV to the ciphertext" + */ + case "simple": + keys.shift(); + name = keys.join("-"); + var cipher:ICipher = getCipher(name, key, pad); + if (cipher is IVMode) { + return new SimpleIVMode(cipher as IVMode); + } else { + return cipher; + } + /** + * we support both "aes-128" and "aes128" + * Technically, you could use "aes192-128", but you'd + * only be hurting yourself. + */ + case "aes": + case "aes128": + case "aes192": + case "aes256": + keys.shift(); + if (key.length*8==keys[0]) { + // support for "aes-128-..." and such. + keys.shift(); + } + return getMode(keys[0], new AESKey(key), pad); + break; + case "bf": + case "blowfish": + keys.shift(); + return getMode(keys[0], new BlowFishKey(key), pad); + /** + * des-ede and des-ede3 are both equivalent to des3. + * the choice between 2tdes and 3tdes is made based + * on the length of the key provided. + */ + case "des": + keys.shift(); + if (keys[0]!="ede" && keys[0]!="ede3") { + return getMode(keys[0], new DESKey(key), pad); + } + if (keys.length==1) { + keys.push("ecb"); // default mode for 2tdes and 3tdes with openssl enc + } + // fall-through to triple des + case "3des": + case "des3": + keys.shift(); + return getMode(keys[0], new TripleDESKey(key), pad); + case "xtea": + keys.shift(); + return getMode(keys[0], new XTeaKey(key), pad); + break; + /** + * Technically, you could say "rc4-128" or whatever, + * but really, the length of the key is what counts here. + */ + case "rc4": + keys.shift(); + return new ARC4(key); + break; + } + return null; + } + + /** + * Returns the size of a key for a given cipher identifier. + */ + public static function getKeySize(name:String):uint { + var keys:Array = name.split("-"); + switch (keys[0]) { + case "simple": + keys.shift(); + return getKeySize(keys.join("-")); + case "aes128": + return 16; + case "aes192": + return 24; + case "aes256": + return 32; + case "aes": + keys.shift(); + return parseInt(keys[0])/8; + case "bf": + case "blowfish": + return 16; + case "des": + keys.shift(); + switch (keys[0]) { + case "ede": + return 16; + case "ede3": + return 24; + default: + return 8; + } + case "3des": + case "des3": + return 24; + case "xtea": + return 8; + case "rc4": + if (parseInt(keys[1])>0) { + return parseInt(keys[1])/8; + } + return 16; // why not. + } + return 0; // unknown; + } + + private static function getMode(name:String, alg:ISymmetricKey, padding:IPad=null):IMode { + switch (name) { + case "ecb": + return new ECBMode(alg, padding); + case "cfb": + return new CFBMode(alg, padding); + case "cfb8": + return new CFB8Mode(alg, padding); + case "ofb": + return new OFBMode(alg, padding); + case "ctr": + return new CTRMode(alg, padding); + case "cbc": + default: + return new CBCMode(alg, padding); + } + } + + /** + * Things that should work: + * "md5" + * "sha" + * "sha1" + * "sha224" + * "sha256" + */ + public static function getHash(name:String):IHash { + switch(name) { + case "md2": + return new MD2; + case "md5": + return new MD5; + case "sha": // let's hope you didn't mean sha-0 + case "sha1": + return new SHA1; + case "sha224": + return new SHA224; + case "sha256": + return new SHA256; + } + return null; + } + + /** + * Things that should work: + * "sha1" + * "md5-64" + * "hmac-md5-96" + * "hmac-sha1-128" + * "hmac-sha256-192" + * etc. + */ + public static function getHMAC(name:String):HMAC { + var keys:Array = name.split("-"); + if (keys[0]=="hmac") keys.shift(); + var bits:uint = 0; + if (keys.length>1) { + bits = parseInt(keys[1]); + } + return new HMAC(getHash(keys[0]), bits); + } + + public static function getPad(name:String):IPad { + switch(name) { + case "null": + return new NullPad; + case "pkcs5": + default: + return new PKCS5; + } + } + + /** mostly useless. + */ + public static function getRSA(E:String, M:String):RSAKey { + return RSAKey.parsePublicKey(M,E); + } + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/HMAC.as b/source/com/hurlant/crypto/hash/HMAC.as new file mode 100644 index 0000000..bad10f9 --- /dev/null +++ b/source/com/hurlant/crypto/hash/HMAC.as @@ -0,0 +1,73 @@ +/** + * HMAC + * + * An ActionScript 3 implementation of HMAC, Keyed-Hashing for Message + * Authentication, as defined by RFC-2104 + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + import com.hurlant.util.Hex; + + public class HMAC + { + private var hash:IHash; + private var bits:uint; + + /** + * Create a HMAC object, using a Hash function, and + * optionally a number of bits to return. + * The HMAC will be truncated to that size if needed. + */ + public function HMAC(hash:IHash, bits:uint=0) { + this.hash = hash; + this.bits = bits; + } + + /** + * Compute a HMAC using a key and some data. + * It doesn't modify either, and returns a new ByteArray with the HMAC value. + */ + public function compute(key:ByteArray, data:ByteArray):ByteArray { + var hashKey:ByteArray; + if (key.length>hash.getInputSize()) { + hashKey = hash.hash(key); + } else { + hashKey = new ByteArray; + hashKey.writeBytes(key); + } + while (hashKey.length0 && bits<8*outerHash.length) { + outerHash.length = bits/8; + } + return outerHash; + } + public function dispose():void { + hash = null; + bits = 0; + } + public function toString():String { + return "hmac-"+(bits>0?bits+"-":"")+hash.toString(); + } + + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/IHash.as b/source/com/hurlant/crypto/hash/IHash.as new file mode 100644 index 0000000..e5d9111 --- /dev/null +++ b/source/com/hurlant/crypto/hash/IHash.as @@ -0,0 +1,20 @@ +/** + * IHash + * + * An interface for each hash function to implement + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + + public interface IHash + { + function getInputSize():uint; + function getHashSize():uint; + function hash(src:ByteArray):ByteArray; + function toString():String; + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/MD2.as b/source/com/hurlant/crypto/hash/MD2.as new file mode 100644 index 0000000..63ae6ac --- /dev/null +++ b/source/com/hurlant/crypto/hash/MD2.as @@ -0,0 +1,112 @@ +/** + * MD2 + * + * An ActionScript 3 implementation of the RSA Data Security, Inc MD2 Message + * Digest Algorithm, as defined in RFC 1319 + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + * + * Excerpt from http://en.wikipedia.org/wiki/MD2: + * > + * > Rogier and Chauvaud (1997) described collisions of MD2's compression function, + * > although they were unable to extend the attack to the full MD2. + * > + * > In 2004, MD2 was shown to be vulnerable to a preimage attack with time + * > complexity equivalent to 2104 applications of the compression function + * > (Muller, 2004). + * > The author concludes, "MD2 can no longer be considered a secure one-way + * > hash function". + * + * also, this implementaton is quite slow. + */ + +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + + public class MD2 implements IHash + { + public static const HASH_SIZE:int = 16; + + private static const S:Array = [ // PI Digits + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, + 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, + 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, +190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, +169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, +128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, +255, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, + 79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, + 69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, + 27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, + 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, +106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, +120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, +242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, + 49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 ]; + + public function getInputSize():uint + { + return 16; + } + + public function getHashSize():uint + { + return HASH_SIZE; + } + + public function hash(src:ByteArray):ByteArray + { + // 3.1 Step 1. Padding + var i:uint = (16-src.length%16) || 16; + do { + src[src.length]=i; + } while (src.length%16!=0); + + // 3.2 Step 2. Checksum + var len:uint = src.length; + var checksum:ByteArray = new ByteArray; + var L:uint = 0; + for (i = 0;i> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a:uint = 0x67452301; // 1732584193; + var b:uint = 0xEFCDAB89; //-271733879; + var c:uint = 0x98BADCFE; //-1732584194; + var d:uint = 0x10325476; // 271733878; + + for(var i:uint = 0; i < x.length; i += 16) + { + x[i]||=0; x[i+1]||=0; x[i+2]||=0; x[i+3]||=0; + x[i+4]||=0; x[i+5]||=0; x[i+6]||=0; x[i+7]||=0; + x[i+8]||=0; x[i+9]||=0; x[i+10]||=0; x[i+11]||=0; + x[i+12]||=0; x[i+13]||=0; x[i+14]||=0; x[i+15]||=0; + + var olda:uint = a; + var oldb:uint = b; + var oldc:uint = c; + var oldd:uint = d; + + a = ff(a, b, c, d, x[i+ 0], 7 , 0xD76AA478); + d = ff(d, a, b, c, x[i+ 1], 12, 0xE8C7B756); + c = ff(c, d, a, b, x[i+ 2], 17, 0x242070DB); + b = ff(b, c, d, a, x[i+ 3], 22, 0xC1BDCEEE); + a = ff(a, b, c, d, x[i+ 4], 7 , 0xF57C0FAF); + d = ff(d, a, b, c, x[i+ 5], 12, 0x4787C62A); + c = ff(c, d, a, b, x[i+ 6], 17, 0xA8304613); + b = ff(b, c, d, a, x[i+ 7], 22, 0xFD469501); + a = ff(a, b, c, d, x[i+ 8], 7 , 0x698098D8); + d = ff(d, a, b, c, x[i+ 9], 12, 0x8B44F7AF); + c = ff(c, d, a, b, x[i+10], 17, 0xFFFF5BB1); + b = ff(b, c, d, a, x[i+11], 22, 0x895CD7BE); + a = ff(a, b, c, d, x[i+12], 7 , 0x6B901122); + d = ff(d, a, b, c, x[i+13], 12, 0xFD987193); + c = ff(c, d, a, b, x[i+14], 17, 0xA679438E); + b = ff(b, c, d, a, x[i+15], 22, 0x49B40821); + + a = gg(a, b, c, d, x[i+ 1], 5 , 0xf61e2562); + d = gg(d, a, b, c, x[i+ 6], 9 , 0xc040b340); + c = gg(c, d, a, b, x[i+11], 14, 0x265e5a51); + b = gg(b, c, d, a, x[i+ 0], 20, 0xe9b6c7aa); + a = gg(a, b, c, d, x[i+ 5], 5 , 0xd62f105d); + d = gg(d, a, b, c, x[i+10], 9 , 0x2441453); + c = gg(c, d, a, b, x[i+15], 14, 0xd8a1e681); + b = gg(b, c, d, a, x[i+ 4], 20, 0xe7d3fbc8); + a = gg(a, b, c, d, x[i+ 9], 5 , 0x21e1cde6); + d = gg(d, a, b, c, x[i+14], 9 , 0xc33707d6); + c = gg(c, d, a, b, x[i+ 3], 14, 0xf4d50d87); + b = gg(b, c, d, a, x[i+ 8], 20, 0x455a14ed); + a = gg(a, b, c, d, x[i+13], 5 , 0xa9e3e905); + d = gg(d, a, b, c, x[i+ 2], 9 , 0xfcefa3f8); + c = gg(c, d, a, b, x[i+ 7], 14, 0x676f02d9); + b = gg(b, c, d, a, x[i+12], 20, 0x8d2a4c8a); + + a = hh(a, b, c, d, x[i+ 5], 4 , 0xfffa3942); + d = hh(d, a, b, c, x[i+ 8], 11, 0x8771f681); + c = hh(c, d, a, b, x[i+11], 16, 0x6d9d6122); + b = hh(b, c, d, a, x[i+14], 23, 0xfde5380c); + a = hh(a, b, c, d, x[i+ 1], 4 , 0xa4beea44); + d = hh(d, a, b, c, x[i+ 4], 11, 0x4bdecfa9); + c = hh(c, d, a, b, x[i+ 7], 16, 0xf6bb4b60); + b = hh(b, c, d, a, x[i+10], 23, 0xbebfbc70); + a = hh(a, b, c, d, x[i+13], 4 , 0x289b7ec6); + d = hh(d, a, b, c, x[i+ 0], 11, 0xeaa127fa); + c = hh(c, d, a, b, x[i+ 3], 16, 0xd4ef3085); + b = hh(b, c, d, a, x[i+ 6], 23, 0x4881d05); + a = hh(a, b, c, d, x[i+ 9], 4 , 0xd9d4d039); + d = hh(d, a, b, c, x[i+12], 11, 0xe6db99e5); + c = hh(c, d, a, b, x[i+15], 16, 0x1fa27cf8); + b = hh(b, c, d, a, x[i+ 2], 23, 0xc4ac5665); + + a = ii(a, b, c, d, x[i+ 0], 6 , 0xf4292244); + d = ii(d, a, b, c, x[i+ 7], 10, 0x432aff97); + c = ii(c, d, a, b, x[i+14], 15, 0xab9423a7); + b = ii(b, c, d, a, x[i+ 5], 21, 0xfc93a039); + a = ii(a, b, c, d, x[i+12], 6 , 0x655b59c3); + d = ii(d, a, b, c, x[i+ 3], 10, 0x8f0ccc92); + c = ii(c, d, a, b, x[i+10], 15, 0xffeff47d); + b = ii(b, c, d, a, x[i+ 1], 21, 0x85845dd1); + a = ii(a, b, c, d, x[i+ 8], 6 , 0x6fa87e4f); + d = ii(d, a, b, c, x[i+15], 10, 0xfe2ce6e0); + c = ii(c, d, a, b, x[i+ 6], 15, 0xa3014314); + b = ii(b, c, d, a, x[i+13], 21, 0x4e0811a1); + a = ii(a, b, c, d, x[i+ 4], 6 , 0xf7537e82); + d = ii(d, a, b, c, x[i+11], 10, 0xbd3af235); + c = ii(c, d, a, b, x[i+ 2], 15, 0x2ad7d2bb); + b = ii(b, c, d, a, x[i+ 9], 21, 0xeb86d391); + + a += olda; + b += oldb; + c += oldc; + d += oldd; + + } + return [ a, b, c, d ]; + } + + /* + * Bitwise rotate a 32-bit number to the left. + */ + private function rol(num:uint, cnt:uint):uint + { + return (num << cnt) | (num >>> (32 - cnt)); + } + + /* + * These functions implement the four basic operations the algorithm uses. + */ + private function cmn(q:uint, a:uint, b:uint, x:uint, s:uint, t:uint):uint { + return rol(a + q + x + t, s) + b; + } + private function ff(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + } + private function gg(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + } + private function hh(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint { + return cmn(b ^ c ^ d, a, b, x, s, t); + } + private function ii(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + } + + public function toString():String { + return "md5"; + } + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/SHA1.as b/source/com/hurlant/crypto/hash/SHA1.as new file mode 100644 index 0000000..d5ce996 --- /dev/null +++ b/source/com/hurlant/crypto/hash/SHA1.as @@ -0,0 +1,106 @@ +/** + * SHA1 + * + * An ActionScript 3 implementation of Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Copyright (c) 2007 Henri Torgemane + * + * Derived from: + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + + public class SHA1 extends SHABase implements IHash + { + public static const HASH_SIZE:int = 20; + + public override function getHashSize():uint { + return HASH_SIZE; + } + + protected override function core(x:Array, len:uint):Array + { + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w:Array = []; + var a:uint = 0x67452301; //1732584193; + var b:uint = 0xEFCDAB89; //-271733879; + var c:uint = 0x98BADCFE; //-1732584194; + var d:uint = 0x10325476; //271733878; + var e:uint = 0xC3D2E1F0; //-1009589776; + + for(var i:uint = 0; i < x.length; i += 16) + { + + var olda:uint = a; + var oldb:uint = b; + var oldc:uint = c; + var oldd:uint = d; + var olde:uint = e; + + for(var j:uint = 0; j < 80; j++) + { + if (j < 16) { + w[j] = x[i + j] || 0; + } else { + w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + } + var t:uint = rol(a,5) + ft(j,b,c,d) + e + w[j] + kt(j); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + a += olda; + b += oldb; + c += oldc; + d += oldd; + e += olde; + } + return [ a, b, c, d, e ]; + + } + + /* + * Bitwise rotate a 32-bit number to the left. + */ + private function rol(num:uint, cnt:uint):uint + { + return (num << cnt) | (num >>> (32 - cnt)); + } + + /* + * Perform the appropriate triplet combination function for the current + * iteration + */ + private function ft(t:uint, b:uint, c:uint, d:uint):uint + { + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; + } + + /* + * Determine the appropriate additive constant for the current iteration + */ + private function kt(t:uint):uint + { + return (t < 20) ? 0x5A827999 : (t < 40) ? 0x6ED9EBA1 : + (t < 60) ? 0x8F1BBCDC : 0xCA62C1D6; + } + public override function toString():String { + return "sha1"; + } + } +} diff --git a/source/com/hurlant/crypto/hash/SHA224.as b/source/com/hurlant/crypto/hash/SHA224.as new file mode 100644 index 0000000..345aa3d --- /dev/null +++ b/source/com/hurlant/crypto/hash/SHA224.as @@ -0,0 +1,28 @@ +/** + * SHA224 + * + * An ActionScript 3 implementation of Secure Hash Algorithm, SHA-224, as defined + * in FIPS PUB 180-2 + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + public class SHA224 extends SHA256 + { + function SHA224() { + h = [ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]; + } + + public override function getHashSize():uint { + return 28; + } + public override function toString():String { + return "sha224"; + } + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/SHA256.as b/source/com/hurlant/crypto/hash/SHA256.as new file mode 100644 index 0000000..fdcae2d --- /dev/null +++ b/source/com/hurlant/crypto/hash/SHA256.as @@ -0,0 +1,114 @@ +/** + * SHA256 + * + * An ActionScript 3 implementation of Secure Hash Algorithm, SHA-256, as defined + * in FIPS PUB 180-2 + * Copyright (c) 2007 Henri Torgemane + * + * Derived from: + * A JavaScript implementation of the Secure Hash Standard + * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/ + * Derived from: + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + + public class SHA256 extends SHABase implements IHash + { + protected static const k:Array = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; + protected var h:Array = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]; + + public function SHA256(){ + } + + public override function getHashSize():uint + { + return 32; + } + + protected override function core(x:Array, len:uint):Array { + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w:Array = []; + var a:uint = h[0]; + var b:uint = h[1]; + var c:uint = h[2]; + var d:uint = h[3]; + var e:uint = h[4]; + var f:uint = h[5]; + var g:uint = h[6]; + var h:uint = h[7]; + + for (var i:uint=0; i>>3); + var s1:uint = rrol(w[j-2], 17)^rrol(w[j-2],19)^(w[j-2]>>>10); + w[j] = w[j-16] + s0 + w[j-7] + s1; + } + var t2:uint = (rrol(a,2) ^ rrol(a,13) ^ rrol(a,22)) + ((a&b) ^ (a&c) ^ (b&c)); + var t1:uint = h + (rrol(e,6) ^ rrol(e,11) ^ rrol(e,25)) + ((e&f)^(g&~e)) + k[j] + w[j] + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + + } + a += olda; + b += oldb; + c += oldc; + d += oldd; + e += olde; + f += oldf; + g += oldg; + h += oldh; + } + return [ a,b,c,d,e,f,g,h ]; + } + + /* + * Bitwise rotate a 32-bit number to the right. + */ + protected function rrol(num:uint, cnt:uint):uint { + return (num << (32-cnt)) | (num >>> cnt); + } + + public override function toString():String { + return "sha256"; + } + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/hash/SHABase.as b/source/com/hurlant/crypto/hash/SHABase.as new file mode 100644 index 0000000..598a29e --- /dev/null +++ b/source/com/hurlant/crypto/hash/SHABase.as @@ -0,0 +1,57 @@ +/** + * SHABase + * + * An ActionScript 3 abstract class for the SHA family of hash functions + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + + public class SHABase implements IHash + { + public function getInputSize():uint + { + return 64; + } + + public function getHashSize():uint + { + return 0; + } + + public function hash(src:ByteArray):ByteArray + { + var savedLength:uint = src.length; + var len:uint = savedLength *8; + // pad to nearest int. + while (src.length%4!=0) { + src[src.length]=0; + } + // convert ByteArray to an array of uint + src.position=0; + var a:Array = []; + for (var i:uint=0;i>> 8; + pool[pptr++] = t&255; + } + pptr=0; + seed(); + } + + public function seed(x:int = 0):void { + if (x==0) { + x = new Date().getTime(); + } + pool[pptr++] ^= x & 255; + pool[pptr++] ^= (x>>8)&255; + pool[pptr++] ^= (x>>16)&255; + pool[pptr++] ^= (x>>24)&255; + pptr %= psize; + seeded = true; + } + + /** + * Gather anything we have that isn't entirely predictable: + * - memory used + * - system capabilities + * - timing stuff + * - installed fonts + */ + public function autoSeed():void { + var b:ByteArray = new ByteArray; + b.writeUnsignedInt(System.totalMemory); + b.writeUTF(Capabilities.serverString); + b.writeUnsignedInt(getTimer()); + b.writeUnsignedInt((new Date).getTime()); + var a:Array = Font.enumerateFonts(true); + for each (var f:Font in a) { + b.writeUTF(f.fontName); + b.writeUTF(f.fontStyle); + b.writeUTF(f.fontType); + } + b.position=0; + while (b.bytesAvailable>=4) { + seed(b.readUnsignedInt()); + } + } + + + public function nextBytes(buffer:ByteArray, length:int):void { + while (length--) { + buffer.writeByte(nextByte()); + } + } + public function nextByte():int { + if (!ready) { + if (!seeded) { + autoSeed(); + } + state.init(pool); + pool.length = 0; + pptr = 0; + ready = true; + } + return state.next(); + } + public function dispose():void { + for (var i:uint=0;i= src.length) { + src.position = 0; + } + var bl:uint = getBlockSize(); + var end:int = src.position + length; + while (src.position= src.length) { + src.position = 0; + } + var bl:uint = getBlockSize(); + var end:int = src.position + length; + while (src.position=p && n>11) { + out[--n] = src[i--]; + } + out[--n] = 0; + var rng:Random = new Random; + while (n>2) { + var x:int = 0; + while (x==0) x = rng.nextByte(); + out[--n] = x; + } + out[--n] = 2; + out[--n] = 0; + return out; + } + + private function pkcs1unpad(src:BigInteger, n:uint):ByteArray { + var b:ByteArray = src.toByteArray(); + var out:ByteArray = new ByteArray; + var i:int = 0; + while (i>1; + var key:RSAKey = new RSAKey(null,0,null); + key.e = parseInt(E, 16); + var ee:BigInteger = new BigInteger(E,16); + for (;;) { + for (;;) { + key.p = bigRandom(B-qs, rng); + if (key.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE)==0 && + key.p.isProbablePrime(10)) break; + } + for (;;) { + key.q = bigRandom(qs, rng); + if (key.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE)==0 && + key.q.isProbablePrime(10)) break; + } + if (key.p.compareTo(key.q)<=0) { + var t:BigInteger = key.p; + key.p = key.q; + key.q = t; + } + var p1:BigInteger = key.p.subtract(BigInteger.ONE); + var q1:BigInteger = key.q.subtract(BigInteger.ONE); + var phi:BigInteger = p1.multiply(q1); + if (phi.gcd(ee).compareTo(BigInteger.ONE)==0) { + key.n = key.p.multiply(key.q); + key.d = ee.modInverse(phi); + key.dmp1 = key.d.mod(p1); + key.dmq1 = key.d.mod(q1); + key.coeff = key.q.modInverse(key.p); + break; + } + } + return key; + } + + protected static function bigRandom(bits:int, rnd:Random):BigInteger { + if (bits<2) return BigInteger.nbv(1); + var x:ByteArray = new ByteArray; + rnd.nextBytes(x, (bits>>3)); + x.position = 0; + var b:BigInteger = new BigInteger(x); + b.primify(bits, 1); + return b; + } + + protected function doPublic(x:BigInteger):BigInteger { + return x.modPowInt(e, n); + } + + protected function doPrivate2(x:BigInteger):BigInteger { + if (p==null && q==null) { + return x.modPow(d,n); + } + + var xp:BigInteger = x.mod(p).modPow(dmp1, p); + var xq:BigInteger = x.mod(q).modPow(dmq1, q); + + while (xp.compareTo(xq)<0) { + xp = xp.add(p); + } + var r:BigInteger = xp.subtract(xq).multiply(coeff).mod(p).multiply(q).add(xq); + + return r; + } + + protected function doPrivate(x:BigInteger):BigInteger { + if (p==null || q==null) { + return x.modPow(d, n); + } + // TODO: re-calculate any missing CRT params + var xp:BigInteger = x.mod(p).modPow(dmp1, p); + var xq:BigInteger = x.mod(q).modPow(dmq1, q); + + while (xp.compareTo(xq)<0) { + xp = xp.add(p); + } + return xp.subtract(xq).multiply(coeff).mod(p).multiply(q).add(xq); + } + + + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/symmetric/AESKey.as b/source/com/hurlant/crypto/symmetric/AESKey.as new file mode 100644 index 0000000..be81dbc --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/AESKey.as @@ -0,0 +1,477 @@ +/** + * AESKey + * + * An ActionScript 3 implementation of the Advanced Encryption Standard, as + * defined in FIPS PUB 197 + * Copyright (c) 2007 Henri Torgemane + * + * Derived from: + * A public domain implementation from Karl Malbrain, malbrain@yahoo.com + * (http://www.geocities.com/malbrain/aestable_c.html) + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import com.hurlant.crypto.prng.Random; + import com.hurlant.util.Hex; + import com.hurlant.util.Memory; + + import flash.utils.ByteArray; + + public class AESKey implements ISymmetricKey + { + // AES only supports Nb=4 + private static const Nb:uint = 4; // number of columns in the state & expanded key + + // TODO: + // - move those tables in binary files, then + // - [Embed()] them as ByteArray directly. + // (should result in smaller .swf, and faster initialization time.) + + private static const _Sbox:Array = [ // forward s-box + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09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, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]; + private static const _InvSbox:Array = [ // inverse s-box + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; + private static const _Xtime2Sbox:Array = [ // combined Xtimes2[Sbox[]] + 0xc6, 0xf8, 0xee, 0xf6, 0xff, 0xd6, 0xde, 0x91, 0x60, 0x02, 0xce, 0x56, 0xe7, 0xb5, 0x4d, 0xec, + 0x8f, 0x1f, 0x89, 0xfa, 0xef, 0xb2, 0x8e, 0xfb, 0x41, 0xb3, 0x5f, 0x45, 0x23, 0x53, 0xe4, 0x9b, + 0x75, 0xe1, 0x3d, 0x4c, 0x6c, 0x7e, 0xf5, 0x83, 0x68, 0x51, 0xd1, 0xf9, 0xe2, 0xab, 0x62, 0x2a, + 0x08, 0x95, 0x46, 0x9d, 0x30, 0x37, 0x0a, 0x2f, 0x0e, 0x24, 0x1b, 0xdf, 0xcd, 0x4e, 0x7f, 0xea, + 0x12, 0x1d, 0x58, 0x34, 0x36, 0xdc, 0xb4, 0x5b, 0xa4, 0x76, 0xb7, 0x7d, 0x52, 0xdd, 0x5e, 0x13, + 0xa6, 0xb9, 0x00, 0xc1, 0x40, 0xe3, 0x79, 0xb6, 0xd4, 0x8d, 0x67, 0x72, 0x94, 0x98, 0xb0, 0x85, + 0xbb, 0xc5, 0x4f, 0xed, 0x86, 0x9a, 0x66, 0x11, 0x8a, 0xe9, 0x04, 0xfe, 0xa0, 0x78, 0x25, 0x4b, + 0xa2, 0x5d, 0x80, 0x05, 0x3f, 0x21, 0x70, 0xf1, 0x63, 0x77, 0xaf, 0x42, 0x20, 0xe5, 0xfd, 0xbf, + 0x81, 0x18, 0x26, 0xc3, 0xbe, 0x35, 0x88, 0x2e, 0x93, 0x55, 0xfc, 0x7a, 0xc8, 0xba, 0x32, 0xe6, + 0xc0, 0x19, 0x9e, 0xa3, 0x44, 0x54, 0x3b, 0x0b, 0x8c, 0xc7, 0x6b, 0x28, 0xa7, 0xbc, 0x16, 0xad, + 0xdb, 0x64, 0x74, 0x14, 0x92, 0x0c, 0x48, 0xb8, 0x9f, 0xbd, 0x43, 0xc4, 0x39, 0x31, 0xd3, 0xf2, + 0xd5, 0x8b, 0x6e, 0xda, 0x01, 0xb1, 0x9c, 0x49, 0xd8, 0xac, 0xf3, 0xcf, 0xca, 0xf4, 0x47, 0x10, + 0x6f, 0xf0, 0x4a, 0x5c, 0x38, 0x57, 0x73, 0x97, 0xcb, 0xa1, 0xe8, 0x3e, 0x96, 0x61, 0x0d, 0x0f, + 0xe0, 0x7c, 0x71, 0xcc, 0x90, 0x06, 0xf7, 0x1c, 0xc2, 0x6a, 0xae, 0x69, 0x17, 0x99, 0x3a, 0x27, + 0xd9, 0xeb, 0x2b, 0x22, 0xd2, 0xa9, 0x07, 0x33, 0x2d, 0x3c, 0x15, 0xc9, 0x87, 0xaa, 0x50, 0xa5, + 0x03, 0x59, 0x09, 0x1a, 0x65, 0xd7, 0x84, 0xd0, 0x82, 0x29, 0x5a, 0x1e, 0x7b, 0xa8, 0x6d, 0x2c]; + private static const _Xtime3Sbox:Array = [ // combined Xtimes3[Sbox[]] + 0xa5, 0x84, 0x99, 0x8d, 0x0d, 0xbd, 0xb1, 0x54, 0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0xe9, 0x18, + 0xd5, 0x88, 0x6f, 0x72, 0x24, 0xf1, 0xc7, 0x51, 0x23, 0x7c, 0x9c, 0x21, 0xdd, 0xdc, 0x86, 0x85, + 0x90, 0x42, 0xc4, 0xaa, 0xd8, 0x05, 0x01, 0x12, 0xa3, 0x5f, 0xf9, 0xd0, 0x91, 0x58, 0x27, 0xb9, + 0x38, 0x13, 0xb3, 0x33, 0xbb, 0x70, 0x89, 0xa7, 0xb6, 0x22, 0x92, 0x20, 0x49, 0xff, 0x78, 0x7a, + 0x8f, 0xf8, 0x80, 0x17, 0xda, 0x31, 0xc6, 0xb8, 0xc3, 0xb0, 0x77, 0x11, 0xcb, 0xfc, 0xd6, 0x3a]; + // modular multiplication tables + // based on: + + // Xtime2[x] = (x & 0x80 ? 0x1b : 0) ^ (x + x) + // Xtime3[x] = x^Xtime2[x]; + private static const _Xtime2:Array = [ + 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, + 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, + 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, + 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, + 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, + 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, + 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, + 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, + 0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, + 0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, + 0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, + 0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, + 0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, + 0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, + 0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, + 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5]; + private static const _Xtime9:Array = [ + 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, + 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0x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xe4, 0xed, + 0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35, 0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d, + 0xa1, 0xa8, 0xb3, 0xba, 0x85, 0x8c, 0x97, 0x9e, 0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6, + 0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46]; + private static const _XtimeB:Array = [ + 0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, + 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, + 0x7b, 0x70, 0x6d, 0x66, 0x57, 0x5c, 0x41, 0x4a, 0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12, + 0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa, 0x93, 0x98, 0x85, 0x8e, 0xbf, 0xb4, 0xa9, 0xa2, + 0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7, 0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f, + 0x46, 0x4d, 0x50, 0x5b, 0x6a, 0x61, 0x7c, 0x77, 0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f, + 0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc, 0xd5, 0xde, 0xc3, 0xc8, 0xf9, 0xf2, 0xef, 0xe4, + 0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c, 0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54, + 0xf7, 0xfc, 0xe1, 0xea, 0xdb, 0xd0, 0xcd, 0xc6, 0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e, + 0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76, 0x1f, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2e, + 0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd, 0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5, + 0x3c, 0x37, 0x2a, 0x21, 0x10, 0x1b, 0x06, 0x0d, 0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55, + 0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30, 0x59, 0x52, 0x4f, 0x44, 0x75, 0x7e, 0x63, 0x68, + 0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80, 0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8, + 0x7a, 0x71, 0x6c, 0x67, 0x56, 0x5d, 0x40, 0x4b, 0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13, + 0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3]; + private static const _XtimeD:Array = [ + 0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, + 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, + 0xbb, 0xb6, 0xa1, 0xac, 0x8f, 0x82, 0x95, 0x98, 0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0, + 0x6b, 0x66, 0x71, 0x7c, 0x5f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x50, 0x5d, 0x4a, 0x47, + 0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97]; + private static const _XtimeE:Array = [ + 0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, + 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, + 0xdb, 0xd5, 0xc7, 0xc9, 0xe3, 0xed, 0xff, 0xf1, 0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81, + 0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11, 0x4b, 0x45, 0x57, 0x59, 0x73, 0x7d, 0x6f, 0x61, + 0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87, 0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7, + 0x4d, 0x43, 0x51, 0x5f, 0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17, + 0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14, 0x3e, 0x30, 0x22, 0x2c, + 0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc, 0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, + 0x41, 0x4f, 0x5d, 0x53, 0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b, + 0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3, 0xe9, 0xe7, 0xf5, 0xfb, + 0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0, 0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, + 0x7a, 0x74, 0x66, 0x68, 0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20, + 0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e, 0xa4, 0xaa, 0xb8, 0xb6, + 0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26, 0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, + 0x37, 0x39, 0x2b, 0x25, 0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d, + 0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d]; + static private var _Rcon:Array = [ + 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + static private var Sbox:ByteArray; + static private var InvSbox:ByteArray; + static private var Xtime2Sbox:ByteArray + static private var Xtime3Sbox:ByteArray + static private var Xtime2:ByteArray; + static private var Xtime9:ByteArray; + static private var XtimeB:ByteArray; + static private var XtimeD:ByteArray; + static private var XtimeE:ByteArray; + static private var Rcon:ByteArray; + // static initializer + { + static private var i:uint; + Sbox = new ByteArray; + InvSbox = new ByteArray; + Xtime2Sbox = new ByteArray; + Xtime3Sbox = new ByteArray; + Xtime2 = new ByteArray; + Xtime9 = new ByteArray; + XtimeB = new ByteArray; + XtimeD = new ByteArray; + XtimeE = new ByteArray; + for (i=0;i<256;i++) { + Sbox[i] = _Sbox[i]; + InvSbox[i] = _InvSbox[i]; + Xtime2Sbox[i] = _Xtime2Sbox[i]; + Xtime3Sbox[i] = _Xtime3Sbox[i]; + Xtime2[i] = _Xtime2[i]; + Xtime9[i] = _Xtime9[i]; + XtimeB[i] = _XtimeB[i]; + XtimeD[i] = _XtimeD[i]; + XtimeE[i] = _XtimeE[i]; + } + Rcon = new ByteArray; + for (i=0;i<_Rcon.length;i++) { + Rcon[i] = _Rcon[i]; + } + } + + private var key:ByteArray; + private var keyLength:uint; + private var Nr:uint; + private var state:ByteArray; + private var tmp:ByteArray; + + public function AESKey(key:ByteArray) { + tmp = new ByteArray; + state = new ByteArray; + keyLength = key.length; + this.key = new ByteArray; + this.key.writeBytes(key); + expandKey(); + } + + // produce Nb bytes for each round + private function expandKey():void { + var tmp0:uint, tmp1:uint, tmp2:uint, tmp3:uint, tmp4:uint; + var idx:uint; + var Nk:uint = key.length/4; + Nr = Nk+6; + + for( idx = Nk; idx < Nb * (Nr + 1); idx++ ) { + tmp0 = key[4*idx - 4]; + tmp1 = key[4*idx - 3]; + tmp2 = key[4*idx - 2]; + tmp3 = key[4*idx - 1]; + if( !(idx % Nk) ) { + tmp4 = tmp3; + tmp3 = Sbox[tmp0]; + tmp0 = Sbox[tmp1] ^ Rcon[idx/Nk]; + tmp1 = Sbox[tmp2]; + tmp2 = Sbox[tmp4]; + } else if( Nk > 6 && idx % Nk == 4 ) { + tmp0 = Sbox[tmp0]; + tmp1 = Sbox[tmp1]; + tmp2 = Sbox[tmp2]; + tmp3 = Sbox[tmp3]; + } + + key[4*idx+0] = key[4*idx - 4*Nk + 0] ^ tmp0; + key[4*idx+1] = key[4*idx - 4*Nk + 1] ^ tmp1; + key[4*idx+2] = key[4*idx - 4*Nk + 2] ^ tmp2; + key[4*idx+3] = key[4*idx - 4*Nk + 3] ^ tmp3; + } + } + + + public function getBlockSize():uint + { + return 16; + } + + // encrypt one 128 bit block + public function encrypt(block:ByteArray, index:uint=0):void + { + var round:uint; + state.position=0; + state.writeBytes(block, index, Nb*4); + + addRoundKey(key, 0); + for ( round = 1; round < Nr + 1; round++ ) { + if (round < Nr) { + mixSubColumns(); + } else { + shiftRows(); + } + addRoundKey(key, round * Nb * 4); + } + + block.position=index; + block.writeBytes(state); + } + + public function decrypt(block:ByteArray, index:uint=0):void + { + var round:uint; + state.position=0; + state.writeBytes(block, index, Nb*4); + + addRoundKey(key, Nr*Nb*4); + invShiftRows(); + for( round = Nr; round--; ) + { + addRoundKey( key, round*Nb*4); + if (round) { + invMixSubColumns(); + } + } + + block.position=index; + block.writeBytes(state); + } + + public function dispose():void { + var i:uint; + var r:Random = new Random; + for (i=0;i>> 24)] + S1[(x >>> 16) & 0xff]) ^ S2[(x >>> 8) & 0xff]) + S3[x & 0xff]); + } + + /** + * apply the encryption cycle to each value pair in the table. + */ + private function processTable(xl:uint, xr:uint, table:Array):void + { + var size:uint = table.length; + + for (var s:uint = 0; s < size; s += 2) + { + xl ^= P[0]; + + for (var i:uint = 1; i < ROUNDS; i += 2) + { + xr ^= F(xl) ^ P[i]; + xl ^= F(xr) ^ P[i + 1]; + } + + xr ^= P[ROUNDS + 1]; + + table[s] = xr; + table[s + 1] = xl; + + xr = xl; // end of cycle swap + xl = table[s]; + } + } + + private function setKey(key:ByteArray):void + { + /* + * - comments are from _Applied Crypto_, Schneier, p338 please be + * careful comparing the two, AC numbers the arrays from 1, the enclosed + * code from 0. + * + * (1) Initialise the S-boxes and the P-array, with a fixed string This + * string contains the hexadecimal digits of pi (3.141...) + */ + S0 = KS0.concat(); + S1 = KS1.concat(); + S2 = KS2.concat(); + S3 = KS3.concat(); + P = KP.concat(); + + /* + * (2) Now, XOR P[0] with the first 32 bits of the key, XOR P[1] with + * the second 32-bits of the key, and so on for all bits of the key (up + * to P[17]). Repeatedly cycle through the key bits until the entire + * P-array has been XOR-ed with the key bits + */ + var keyLength:uint= key.length; + var keyIndex:uint = 0; + + for (var i:uint = 0; i < P_SZ; i++) + { + // get the 32 bits of the key, in 4 * 8 bit chunks + var data:uint = 0x0000000; + for (var j:uint = 0; j < 4; j++) + { + // create a 32 bit block + data = (data << 8) | (key[keyIndex++] & 0xff); + + // wrap when we get to the end of the key + if (keyIndex >= keyLength) + { + keyIndex = 0; + } + } + // XOR the newly created 32 bit chunk onto the P-array + P[i] ^= data; + } + + /* + * (3) Encrypt the all-zero string with the Blowfish algorithm, using + * the subkeys described in (1) and (2) + * + * (4) Replace P1 and P2 with the output of step (3) + * + * (5) Encrypt the output of step(3) using the Blowfish algorithm, with + * the modified subkeys. + * + * (6) Replace P3 and P4 with the output of step (5) + * + * (7) Continue the process, replacing all elements of the P-array and + * then all four S-boxes in order, with the output of the continuously + * changing Blowfish algorithm + */ + + processTable(0, 0, P); + processTable(P[P_SZ - 2], P[P_SZ - 1], S0); + processTable(S0[SBOX_SK - 2], S0[SBOX_SK - 1], S1); + processTable(S1[SBOX_SK - 2], S1[SBOX_SK - 1], S2); + processTable(S2[SBOX_SK - 2], S2[SBOX_SK - 1], S3); + } + + /** + * Encrypt the given input starting at the given offset and place the result + * in the provided buffer starting at the given offset. The input will be an + * exact multiple of our blocksize. + */ + private function encryptBlock(src:ByteArray, srcIndex:uint, dst:ByteArray, dstIndex:uint):void + { + var xl:uint = BytesTo32bits(src, srcIndex); + var xr:uint = BytesTo32bits(src, srcIndex + 4); + + xl ^= P[0]; + + for (var i:uint = 1; i < ROUNDS; i += 2) + { + xr ^= F(xl) ^ P[i]; + xl ^= F(xr) ^ P[i + 1]; + } + + xr ^= P[ROUNDS + 1]; + + Bits32ToBytes(xr, dst, dstIndex); + Bits32ToBytes(xl, dst, dstIndex + 4); + } + + /** + * Decrypt the given input starting at the given offset and place the result + * in the provided buffer starting at the given offset. The input will be an + * exact multiple of our blocksize. + */ + private function decryptBlock(src:ByteArray, srcIndex:uint, dst:ByteArray, dstIndex:uint):void + { + var xl:uint = BytesTo32bits(src, srcIndex); + var xr:uint = BytesTo32bits(src, srcIndex + 4); + + xl ^= P[ROUNDS + 1]; + + for (var i:uint = ROUNDS; i > 0; i -= 2) + { + xr ^= F(xl) ^ P[i]; + xl ^= F(xr) ^ P[i - 1]; + } + + xr ^= P[0]; + + Bits32ToBytes(xr, dst, dstIndex); + Bits32ToBytes(xl, dst, dstIndex + 4); + } + + private function BytesTo32bits(b:ByteArray, i:uint):uint + { + return ((b[i] & 0xff) << 24) | ((b[i + 1] & 0xff) << 16) | ((b[i + 2] & 0xff) << 8) | ((b[i + 3] & 0xff)); + } + + private function Bits32ToBytes(i:uint, b:ByteArray, offset:uint):void + { + b[offset + 3] = i; + b[offset + 2] = (i >> 8); + b[offset + 1] = (i >> 16); + b[offset] = (i >> 24); + } + + public function toString():String { + return "blowfish"; + } + + } + +} diff --git a/source/com/hurlant/crypto/symmetric/CBCMode.as b/source/com/hurlant/crypto/symmetric/CBCMode.as new file mode 100644 index 0000000..e3781be --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/CBCMode.as @@ -0,0 +1,55 @@ +/** + * CBCMode + * + * An ActionScript 3 implementation of the CBC confidentiality mode + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import flash.utils.ByteArray; + + /** + * CBC confidentiality mode. why not. + */ + public class CBCMode extends IVMode implements IMode + { + + public function CBCMode(key:ISymmetricKey, padding:IPad = null) { + super(key, padding); + } + + public function encrypt(src:ByteArray):void { + padding.pad(src); + var vector:ByteArray = getIV4e(); + for (var i:uint=0;i=0;--j) { + X[j]++; + if (X[j]!=0) + break; + } + } + } + public function toString():String { + return key.toString()+"-ctr"; + } + + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/symmetric/DESKey.as b/source/com/hurlant/crypto/symmetric/DESKey.as new file mode 100644 index 0000000..4a0b755 --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/DESKey.as @@ -0,0 +1,365 @@ +/** + * DESKey + * + * An Actionscript 3 implementation of the Data Encryption Standard (DES) + * Copyright (c) 2007 Henri Torgemane + * + * Derived from: + * The Bouncy Castle Crypto package, + * Copyright (c) 2000-2004 The Legion Of The Bouncy Castle + * (http://www.bouncycastle.org) + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import flash.utils.ByteArray; + import com.hurlant.util.Hex; + import com.hurlant.util.Memory; + + public class DESKey implements ISymmetricKey + { + /** + * what follows is mainly taken from "Applied Cryptography", by Bruce + * Schneier, however it also bears great resemblance to Richard + * Outerbridge's D3DES... + */ + + private static const Df_Key:Array = [ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, + 0x10, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67 ]; + + private static const bytebit:Array = [ 128, 64, 32, 16, 8, 4, 2, 1 ]; + + private static const bigbyte:Array = [ 0x800000, 0x400000, 0x200000, 0x100000, 0x80000, 0x40000, 0x20000, 0x10000, 0x8000, + 0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100, 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1 ]; + + /* + * Use the key schedule specified in the Standard (ANSI X3.92-1981). + */ + + private static const pc1:Array = [ 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, + 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, + 4, 27, 19, 11, 3 ]; + + private static const totrot:Array = [ 1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28 ]; + + private static const pc2:Array = [ 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, + 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 ]; + + private static const SP1:Array = [ 0x01010400, 0x00000000, 0x00010000, 0x01010404, 0x01010004, 0x00010404, 0x00000004, + 0x00010000, 0x00000400, 0x01010400, 0x01010404, 0x00000400, 0x01000404, 0x01010004, 0x01000000, 0x00000004, + 0x00000404, 0x01000400, 0x01000400, 0x00010400, 0x00010400, 0x01010000, 0x01010000, 0x01000404, 0x00010004, + 0x01000004, 0x01000004, 0x00010004, 0x00000000, 0x00000404, 0x00010404, 0x01000000, 0x00010000, 0x01010404, + 0x00000004, 0x01010000, 0x01010400, 0x01000000, 0x01000000, 0x00000400, 0x01010004, 0x00010000, 0x00010400, + 0x01000004, 0x00000400, 0x00000004, 0x01000404, 0x00010404, 0x01010404, 0x00010004, 0x01010000, 0x01000404, + 0x01000004, 0x00000404, 0x00010404, 0x01010400, 0x00000404, 0x01000400, 0x01000400, 0x00000000, 0x00010004, + 0x00010400, 0x00000000, 0x01010004 ]; + + private static const SP2:Array = [ 0x80108020, 0x80008000, 0x00008000, 0x00108020, 0x00100000, 0x00000020, 0x80100020, + 0x80008020, 0x80000020, 0x80108020, 0x80108000, 0x80000000, 0x80008000, 0x00100000, 0x00000020, 0x80100020, + 0x00108000, 0x00100020, 0x80008020, 0x00000000, 0x80000000, 0x00008000, 0x00108020, 0x80100000, 0x00100020, + 0x80000020, 0x00000000, 0x00108000, 0x00008020, 0x80108000, 0x80100000, 0x00008020, 0x00000000, 0x00108020, + 0x80100020, 0x00100000, 0x80008020, 0x80100000, 0x80108000, 0x00008000, 0x80100000, 0x80008000, 0x00000020, + 0x80108020, 0x00108020, 0x00000020, 0x00008000, 0x80000000, 0x00008020, 0x80108000, 0x00100000, 0x80000020, + 0x00100020, 0x80008020, 0x80000020, 0x00100020, 0x00108000, 0x00000000, 0x80008000, 0x00008020, 0x80000000, + 0x80100020, 0x80108020, 0x00108000 ]; + + private static const SP3:Array = [ 0x00000208, 0x08020200, 0x00000000, 0x08020008, 0x08000200, 0x00000000, 0x00020208, + 0x08000200, 0x00020008, 0x08000008, 0x08000008, 0x00020000, 0x08020208, 0x00020008, 0x08020000, 0x00000208, + 0x08000000, 0x00000008, 0x08020200, 0x00000200, 0x00020200, 0x08020000, 0x08020008, 0x00020208, 0x08000208, + 0x00020200, 0x00020000, 0x08000208, 0x00000008, 0x08020208, 0x00000200, 0x08000000, 0x08020200, 0x08000000, + 0x00020008, 0x00000208, 0x00020000, 0x08020200, 0x08000200, 0x00000000, 0x00000200, 0x00020008, 0x08020208, + 0x08000200, 0x08000008, 0x00000200, 0x00000000, 0x08020008, 0x08000208, 0x00020000, 0x08000000, 0x08020208, + 0x00000008, 0x00020208, 0x00020200, 0x08000008, 0x08020000, 0x08000208, 0x00000208, 0x08020000, 0x00020208, + 0x00000008, 0x08020008, 0x00020200 ]; + + private static const SP4:Array = [ 0x00802001, 0x00002081, 0x00002081, 0x00000080, 0x00802080, 0x00800081, 0x00800001, + 0x00002001, 0x00000000, 0x00802000, 0x00802000, 0x00802081, 0x00000081, 0x00000000, 0x00800080, 0x00800001, + 0x00000001, 0x00002000, 0x00800000, 0x00802001, 0x00000080, 0x00800000, 0x00002001, 0x00002080, 0x00800081, + 0x00000001, 0x00002080, 0x00800080, 0x00002000, 0x00802080, 0x00802081, 0x00000081, 0x00800080, 0x00800001, + 0x00802000, 0x00802081, 0x00000081, 0x00000000, 0x00000000, 0x00802000, 0x00002080, 0x00800080, 0x00800081, + 0x00000001, 0x00802001, 0x00002081, 0x00002081, 0x00000080, 0x00802081, 0x00000081, 0x00000001, 0x00002000, + 0x00800001, 0x00002001, 0x00802080, 0x00800081, 0x00002001, 0x00002080, 0x00800000, 0x00802001, 0x00000080, + 0x00800000, 0x00002000, 0x00802080 ]; + + private static const SP5:Array = [ 0x00000100, 0x02080100, 0x02080000, 0x42000100, 0x00080000, 0x00000100, 0x40000000, + 0x02080000, 0x40080100, 0x00080000, 0x02000100, 0x40080100, 0x42000100, 0x42080000, 0x00080100, 0x40000000, + 0x02000000, 0x40080000, 0x40080000, 0x00000000, 0x40000100, 0x42080100, 0x42080100, 0x02000100, 0x42080000, + 0x40000100, 0x00000000, 0x42000000, 0x02080100, 0x02000000, 0x42000000, 0x00080100, 0x00080000, 0x42000100, + 0x00000100, 0x02000000, 0x40000000, 0x02080000, 0x42000100, 0x40080100, 0x02000100, 0x40000000, 0x42080000, + 0x02080100, 0x40080100, 0x00000100, 0x02000000, 0x42080000, 0x42080100, 0x00080100, 0x42000000, 0x42080100, + 0x02080000, 0x00000000, 0x40080000, 0x42000000, 0x00080100, 0x02000100, 0x40000100, 0x00080000, 0x00000000, + 0x40080000, 0x02080100, 0x40000100 ]; + + private static const SP6:Array = [ 0x20000010, 0x20400000, 0x00004000, 0x20404010, 0x20400000, 0x00000010, 0x20404010, + 0x00400000, 0x20004000, 0x00404010, 0x00400000, 0x20000010, 0x00400010, 0x20004000, 0x20000000, 0x00004010, + 0x00000000, 0x00400010, 0x20004010, 0x00004000, 0x00404000, 0x20004010, 0x00000010, 0x20400010, 0x20400010, + 0x00000000, 0x00404010, 0x20404000, 0x00004010, 0x00404000, 0x20404000, 0x20000000, 0x20004000, 0x00000010, + 0x20400010, 0x00404000, 0x20404010, 0x00400000, 0x00004010, 0x20000010, 0x00400000, 0x20004000, 0x20000000, + 0x00004010, 0x20000010, 0x20404010, 0x00404000, 0x20400000, 0x00404010, 0x20404000, 0x00000000, 0x20400010, + 0x00000010, 0x00004000, 0x20400000, 0x00404010, 0x00004000, 0x00400010, 0x20004010, 0x00000000, 0x20404000, + 0x20000000, 0x00400010, 0x20004010 ]; + + private static const SP7:Array = [ 0x00200000, 0x04200002, 0x04000802, 0x00000000, 0x00000800, 0x04000802, 0x00200802, + 0x04200800, 0x04200802, 0x00200000, 0x00000000, 0x04000002, 0x00000002, 0x04000000, 0x04200002, 0x00000802, + 0x04000800, 0x00200802, 0x00200002, 0x04000800, 0x04000002, 0x04200000, 0x04200800, 0x00200002, 0x04200000, + 0x00000800, 0x00000802, 0x04200802, 0x00200800, 0x00000002, 0x04000000, 0x00200800, 0x04000000, 0x00200800, + 0x00200000, 0x04000802, 0x04000802, 0x04200002, 0x04200002, 0x00000002, 0x00200002, 0x04000000, 0x04000800, + 0x00200000, 0x04200800, 0x00000802, 0x00200802, 0x04200800, 0x00000802, 0x04000002, 0x04200802, 0x04200000, + 0x00200800, 0x00000000, 0x00000002, 0x04200802, 0x00000000, 0x00200802, 0x04200000, 0x00000800, 0x04000002, + 0x04000800, 0x00000800, 0x00200002 ]; + + private static const SP8:Array = [ 0x10001040, 0x00001000, 0x00040000, 0x10041040, 0x10000000, 0x10001040, 0x00000040, + 0x10000000, 0x00040040, 0x10040000, 0x10041040, 0x00041000, 0x10041000, 0x00041040, 0x00001000, 0x00000040, + 0x10040000, 0x10000040, 0x10001000, 0x00001040, 0x00041000, 0x00040040, 0x10040040, 0x10041000, 0x00001040, + 0x00000000, 0x00000000, 0x10040040, 0x10000040, 0x10001000, 0x00041040, 0x00040000, 0x00041040, 0x00040000, + 0x10041000, 0x00001000, 0x00000040, 0x10040040, 0x00001000, 0x00041040, 0x10001000, 0x00000040, 0x10000040, + 0x10040000, 0x10040040, 0x10000000, 0x00040000, 0x10001040, 0x00000000, 0x10041040, 0x00040040, 0x10000040, + 0x10040000, 0x10001000, 0x10001040, 0x00000000, 0x10041040, 0x00041000, 0x00041000, 0x00001040, 0x00001040, + 0x00040040, 0x10000000, 0x10041000 ]; + + + protected var key:ByteArray; + protected var encKey:Array; + protected var decKey:Array; + + + public function DESKey(key:ByteArray) { + this.key = key; + this.encKey = generateWorkingKey(true, key, 0); + this.decKey = generateWorkingKey(false, key, 0); + } + + public function getBlockSize():uint + { + return 8; + } + + public function decrypt(block:ByteArray, index:uint=0):void + { + desFunc(decKey, block, index, block, index); + } + + public function dispose():void + { + var i:uint=0; + for (i=0;i>> 3)] & bytebit[l & 07]) != 0); + } + + for (var i:uint = 0; i < 16; i++) + { + var m:uint; + var n:uint; + + if (encrypting) + { + m = i << 1; + } + else + { + m = (15 - i) << 1; + } + + n = m + 1; + newKey[m] = newKey[n] = 0; + + for (j = 0; j < 28; j++) + { + l = j + totrot[i]; + if (l < 28) + { + pcr[j] = pc1m[l]; + } + else + { + pcr[j] = pc1m[l - 28]; + } + } + + for (j = 28; j < 56; j++) + { + l = j + totrot[i]; + if (l < 56) + { + pcr[j] = pc1m[l]; + } + else + { + pcr[j] = pc1m[l - 28]; + } + } + + for (j = 0; j < 24; j++) + { + if (pcr[pc2[j]]) + { + newKey[m] |= bigbyte[j]; + } + + if (pcr[pc2[j + 24]]) + { + newKey[n] |= bigbyte[j]; + } + } + } + + // + // store the processed key + // + for (i = 0; i != 32; i += 2) + { + var i1:uint; + var i2:uint; + + i1 = newKey[i]; + i2 = newKey[i + 1]; + + newKey[i] = ((i1 & 0x00fc0000) << 6) | ((i1 & 0x00000fc0) << 10) | ((i2 & 0x00fc0000) >>> 10) + | ((i2 & 0x00000fc0) >>> 6); + + newKey[i + 1] = ((i1 & 0x0003f000) << 12) | ((i1 & 0x0000003f) << 16) | ((i2 & 0x0003f000) >>> 4) + | (i2 & 0x0000003f); + } + return newKey; + } + + /** + * the DES engine. + */ + protected function desFunc(wKey:Array, inp:ByteArray, inOff:uint, out:ByteArray, outOff:uint):void + { + var work:uint; + var right:uint; + var left:uint; + + left = (inp[inOff + 0] & 0xff) << 24; + left |= (inp[inOff + 1] & 0xff) << 16; + left |= (inp[inOff + 2] & 0xff) << 8; + left |= (inp[inOff + 3] & 0xff); + + right = (inp[inOff + 4] & 0xff) << 24; + right |= (inp[inOff + 5] & 0xff) << 16; + right |= (inp[inOff + 6] & 0xff) << 8; + right |= (inp[inOff + 7] & 0xff); + + work = ((left >>> 4) ^ right) & 0x0f0f0f0f; + right ^= work; + left ^= (work << 4); + work = ((left >>> 16) ^ right) & 0x0000ffff; + right ^= work; + left ^= (work << 16); + work = ((right >>> 2) ^ left) & 0x33333333; + left ^= work; + right ^= (work << 2); + work = ((right >>> 8) ^ left) & 0x00ff00ff; + left ^= work; + right ^= (work << 8); + right = ((right << 1) | ((right >>> 31) & 1)) & 0xffffffff; + work = (left ^ right) & 0xaaaaaaaa; + left ^= work; + right ^= work; + left = ((left << 1) | ((left >>> 31) & 1)) & 0xffffffff; + + for (var round:uint = 0; round < 8; round++) + { + var fval:uint; + + work = (right << 28) | (right >>> 4); + work ^= wKey[round * 4 + 0]; + fval = SP7[work & 0x3f]; + fval |= SP5[(work >>> 8) & 0x3f]; + fval |= SP3[(work >>> 16) & 0x3f]; + fval |= SP1[(work >>> 24) & 0x3f]; + work = right ^ wKey[round * 4 + 1]; + fval |= SP8[work & 0x3f]; + fval |= SP6[(work >>> 8) & 0x3f]; + fval |= SP4[(work >>> 16) & 0x3f]; + fval |= SP2[(work >>> 24) & 0x3f]; + left ^= fval; + work = (left << 28) | (left >>> 4); + work ^= wKey[round * 4 + 2]; + fval = SP7[work & 0x3f]; + fval |= SP5[(work >>> 8) & 0x3f]; + fval |= SP3[(work >>> 16) & 0x3f]; + fval |= SP1[(work >>> 24) & 0x3f]; + work = left ^ wKey[round * 4 + 3]; + fval |= SP8[work & 0x3f]; + fval |= SP6[(work >>> 8) & 0x3f]; + fval |= SP4[(work >>> 16) & 0x3f]; + fval |= SP2[(work >>> 24) & 0x3f]; + right ^= fval; + } + + right = (right << 31) | (right >>> 1); + work = (left ^ right) & 0xaaaaaaaa; + left ^= work; + right ^= work; + left = (left << 31) | (left >>> 1); + work = ((left >>> 8) ^ right) & 0x00ff00ff; + right ^= work; + left ^= (work << 8); + work = ((left >>> 2) ^ right) & 0x33333333; + right ^= work; + left ^= (work << 2); + work = ((right >>> 16) ^ left) & 0x0000ffff; + left ^= work; + right ^= (work << 16); + work = ((right >>> 4) ^ left) & 0x0f0f0f0f; + left ^= work; + right ^= (work << 4); + + out[outOff + 0] = ((right >>> 24) & 0xff); + out[outOff + 1] = ((right >>> 16) & 0xff); + out[outOff + 2] = ((right >>> 8) & 0xff); + out[outOff + 3] = (right & 0xff); + out[outOff + 4] = ((left >>> 24) & 0xff); + out[outOff + 5] = ((left >>> 16) & 0xff); + out[outOff + 6] = ((left >>> 8) & 0xff); + out[outOff + 7] = (left & 0xff); + } + + + public function toString():String { + return "des"; + } + + + + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/symmetric/ECBMode.as b/source/com/hurlant/crypto/symmetric/ECBMode.as new file mode 100644 index 0000000..6d58eff --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/ECBMode.as @@ -0,0 +1,84 @@ +/** + * ECBMode + * + * An ActionScript 3 implementation of the ECB confidentiality mode + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import flash.utils.ByteArray; + import com.hurlant.util.Memory; + import com.hurlant.util.Hex; + + /** + * ECB mode. + * This uses a padding and a symmetric key. + * If no padding is given, PKCS#5 is used. + */ + public class ECBMode implements IMode + { + private var key:ISymmetricKey; + private var padding:IPad; + + public function ECBMode(key:ISymmetricKey, padding:IPad = null) { + this.key = key; + if (padding == null) { + padding = new PKCS5(key.getBlockSize()); + } + this.padding = padding; + } + + public function getBlockSize():uint { + return key.getBlockSize(); + } + + public function encrypt(src:ByteArray):void { + padding.pad(src); + src.position = 0; + var blockSize:uint = key.getBlockSize(); + var tmp:ByteArray = new ByteArray; + var dst:ByteArray = new ByteArray; + for (var i:uint=0;i0;i--) { + var v:uint = a[a.length-1]; + a.length--; + if (c!=v) throw new Error("PKCS#5:unpad: Invalid padding value. expected ["+c+"], found ["+v+"]"); + } + // that is all. + } + + public function setBlockSize(bs:uint):void { + blockSize = bs; + } + + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/symmetric/SimpleIVMode.as b/source/com/hurlant/crypto/symmetric/SimpleIVMode.as new file mode 100644 index 0000000..590f0df --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/SimpleIVMode.as @@ -0,0 +1,60 @@ +/** + * SimpleIVMode + * + * A convenience class that automatically places the IV + * at the beginning of the encrypted stream, so it doesn't have to + * be handled explicitely. + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import flash.utils.ByteArray; + import com.hurlant.util.Memory; + + public class SimpleIVMode implements IMode, ICipher + { + protected var mode:IVMode; + protected var cipher:ICipher; + + public function SimpleIVMode(mode:IVMode) { + this.mode = mode; + cipher = mode as ICipher; + } + + public function getBlockSize():uint { + return mode.getBlockSize(); + } + + public function dispose():void { + mode.dispose(); + mode = null; + cipher = null; + Memory.gc(); + } + + public function encrypt(src:ByteArray):void { + cipher.encrypt(src); + var tmp:ByteArray = new ByteArray; + tmp.writeBytes(mode.IV); + tmp.writeBytes(src); + src.position=0; + src.writeBytes(tmp); + } + + public function decrypt(src:ByteArray):void { + var tmp:ByteArray = new ByteArray; + tmp.writeBytes(src, 0, getBlockSize()); + mode.IV = tmp; + tmp = new ByteArray; + tmp.writeBytes(src, getBlockSize()); + cipher.decrypt(tmp); + src.length=0; + src.writeBytes(tmp); + } + public function toString():String { + return "simple-"+cipher.toString(); + } + } +} \ No newline at end of file diff --git a/source/com/hurlant/crypto/symmetric/TripleDESKey.as b/source/com/hurlant/crypto/symmetric/TripleDESKey.as new file mode 100644 index 0000000..1e75011 --- /dev/null +++ b/source/com/hurlant/crypto/symmetric/TripleDESKey.as @@ -0,0 +1,88 @@ +/** + * TripleDESKey + * + * An Actionscript 3 implementation of Triple DES + * Copyright (c) 2007 Henri Torgemane + * + * Derived from: + * The Bouncy Castle Crypto package, + * Copyright (c) 2000-2004 The Legion Of The Bouncy Castle + * (http://www.bouncycastle.org) + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.symmetric +{ + import flash.utils.ByteArray; + import com.hurlant.util.Memory; + import com.hurlant.util.Hex; + + public class TripleDESKey extends DESKey + { + protected var encKey2:Array; + protected var encKey3:Array; + protected var decKey2:Array; + protected var decKey3:Array; + + /** + * This supports 2TDES and 3TDES. + * If the key passed is 128 bits, 2TDES is used. + * If the key has 192 bits, 3TDES is used. + * Other key lengths give "undefined" results. + */ + public function TripleDESKey(key:ByteArray) + { + super(key); + encKey2 = generateWorkingKey(false, key, 8); + decKey2 = generateWorkingKey(true, key, 8); + if (key.length>16) { + encKey3 = generateWorkingKey(true, key, 16); + decKey3 = generateWorkingKey(false, key, 16); + } else { + encKey3 = encKey; + decKey3 = decKey; + } + } + + public override function dispose():void + { + super.dispose(); + var i:uint = 0; + if (encKey2!=null) { + for (i=0;i> 5)) + v1) ^ (sum + k[sum & 3]); + sum += delta; + v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); + } + block.position-=8; + block.writeUnsignedInt(v0); + block.writeUnsignedInt(v1); + } + + public function decrypt(block:ByteArray, index:uint=0):void { + block.position = index; + var v0:uint = block.readUnsignedInt(); + var v1:uint = block.readUnsignedInt(); + var i:uint; + var delta:uint = 0x9E3779B9; + var sum:uint = delta*NUM_ROUNDS; + for (i=0; i> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); + sum -= delta; + v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); + } + block.position-=8; + block.writeUnsignedInt(v0); + block.writeUnsignedInt(v1); + } + + public function dispose():void { + //private var k:Array; + var r:Random = new Random; + for (var i:uint=0;i