1/* 2 软件åç§°ï¼ckplayer 3 è½¯ä»¶çæ¬ï¼X 4 软件ä½è ï¼http://www.ckplayer.com 5 --------------------------------------------------------------------------------------------- 6 å¼å说æï¼ 7 使ç¨ç主è¦ç¨åºè¯è¨ï¼javascript(js)åactionscript3.0(as3.0)(as3.0主è¦ç¨äºflashplayeré¨åçå¼åï¼ä¸å¨è¯¥é¡µé¢åç°) 8 åè½ï¼ææ¾è§é¢ 9 ç¹ç¹ï¼å ¼å®¹HTML5-VIDEO(ä¼å )以åFlashPlayer 10 ===================================================================================================================== 11*/ 12function ckplayerConfig() { 13 return { 14 flashvars: {}, //ç¨æ¥è¡¥å flashvarséç对象 15 languagePath: '', //è¯è¨å æä»¶å°å 16 stylePath: '', //飿 ¼å æä»¶å°å 17 config: { 18 fullInteractive: true, //æ¯å¦å¼å¯äº¤äºåè½ 19 delay: 30, //å»¶è¿å è½½è§é¢ï¼åä½ï¼æ¯«ç§ 20 timeFrequency: 100, //计ç®å½åææ¾æ¶é´åå è½½éçæ¶é´é¢çï¼åä½ï¼æ¯«ç§ 21 autoLoad: true, //è§é¢æ¯å¦èªå¨å è½½ 22 loadNext: 0, //夿®µè§é¢é¢å è½½çæ®µæ°ï¼è®¾ç½®æ0åå ¨é¨å è½½ 23 definition: true, //æ¯å¦ä½¿ç¨æ¸ æ°åº¦ç»ä»¶ 24 smartRemove: true, //æ¯å¦ä½¿ç¨æºè½æ¸ çï¼ä½¿ç¨è¯¥åè½åå¨å¤æ®µæ¶å½åææ¾æ®µä¹åçæ®µé½ä¼è¢«æ¸ é¤åºå åï¼åå°å¯¹å åçä½¿ç¨ 25 bufferTime: 200, //ç¼ååºçé¿åº¦ï¼åä½ï¼æ¯«ç§,ä¸è¦å°äº10 26 click: true, //æ¯å¦æ¯æå±å¹å廿å 27 doubleClick: true, //æ¯å¦æ¯æå±å¹åå»å ¨å± 28 doubleClickInterval: 200, //夿åå»çæ åï¼å³äºæ¬¡åå»é´éçæ¶é´å·®ä¹å å¤æä¸ºæ¯åå»ï¼åä½ï¼æ¯«ç§ 29 keyDown: { 30 space: true, //æ¯å¦å¯ç¨ç©ºæ ¼é®åæ¢ææ¾/æå 31 left: true, //æ¯å¦å¯ç¨å·¦æ¹åé®å¿«é 32 right: true, //æ¯å¦å¯ç¨å³æ¹åé®å¿«è¿ 33 up: true, //æ¯å¦æ¯æä¸æ¹åé®å¢å é³é 34 down: true //æ¯å¦æ¯æä¸æ¹åé®åå°é³é 35 }, 36 timeJump: 10, //å¿«è¿å¿«éæ¶çç§æ° 37 volumeJump: 0.1, //é³éè°æ´çæ°éï¼å¤§äº0å°äº1çå°æ° 38 timeScheduleAdjust: 1, //æ¯å¦å¯è°èè°èæ ,0ä¸å¯ç¨ï¼1æ¯å¯ç¨ï¼2æ¯åªè½åè¿ï¼å峿å¨ï¼ï¼3æ¯åªè½åéï¼4æ¯åªè½åè¿ä½è½åå°ç¬¬ä¸æ¬¡æå¨æ¶çä½ç½®ï¼5æ¯çè¿çå°æ¹å¯ä»¥éææå¨ 39 previewDefaultLoad: true, //é¢è§å¾çæ¯å¦é»è®¤å è½½ï¼ä¼ç¹æ¯é¼ æ ç¬¬ä¸æ¬¡ç»è¿è¿åº¦æ¡å³å¯æ¾ç¤ºé¢è§å¾ç 40 promptSpotTime: false, //æç¤ºç¹æåæ¯å¦å¨åé¢å ä¸å¯¹åºæ¶é´ 41 buttonMode: { 42 player: false, //é¼ æ 卿æ¾å¨ä¸æ¯å¦æ¾ç¤ºå¯ç¹å»å½¢æ 43 controlBar: false, //é¼ æ 卿§å¶æ 䏿¯å¦æ¾ç¤ºå¯ç¹å»å½¢æ 44 timeSchedule: true, //é¼ æ 卿¶é´è¿åº¦æ¡ä¸æ¯å¦æ¾ç¤ºå¯ç¹å»å½¢æ 45 volumeSchedule: true //é¼ æ å¨é³éè°èæ 䏿¯å¦æ¾ç¤ºå¯ç¹å»å½¢æ 46 }, 47 liveAndVod: { //ç´æ+ç¹æ=åæåè½ 48 open: false, //æ¯å¦å¼å¯ï¼å¼å¯è¯¥åè½éè¦è®¾ç½®flashvarsélive=true 49 vodTime: 2, //å¯ä»¥åççæ´ç¹æ° 50 start: 'start' //åç请æ±åæ° 51 }, 52 errorNum: 3, //é误éè¿æ¬¡æ° 53 playCorrect: false, //æ¯å¦éè¦é误修æ£ï¼è¿æ¯é对rtmpç 54 timeCorrect: true, //httpè§é¢ææ¾æ¶é´éè¯¯çº æ£ï¼æäºå 为è§é¢æ ¼å¼çé®é¢å¯¼è´è§é¢æ²¡æå®é ææ¾ç»æè§é¢æä»¶å°±è¿åäºstopå½ä»¤ 55 m3u8Definition: { //m3u8èªå¨æ¸ æ°åº¦æ¶æå ³é®åæ¥è¿è¡å¤æ 56 //tags:['200k','110k','400k','600k','1000k'] 57 }, 58 m3u8MaxBufferLength: 30, //m3u8æ¯æ¬¡ç¼å²æ¶é´ï¼åä½ï¼ç§æ° 59 split: ',', //å½è§é¢å°åéç¨å符形å¼å¹¶ä¸éè¦ä½¿ç¨éå·æå ¶å®ç¬¦å·æ¥å岿°ç»éå®ä¹ 60 timeStamp: '', //ä¸ä¸ªå°åï¼ç¨æ¥è¯·æ±å½åæ¶é´æ³ï¼ç¨äºææ¾å¨å 鍿¶é´æå 61 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,deleteAnimate,changeConfig,getConfig,openUrl,fullScreen,quitFullScreen,switchFull,screenshot,custom,changeControlBarShow,getCurrentSrc'
62 //éè¦æ¯æçäºä»¶ 63 }, 64 menu: { //çæåç§°æ¯æ 65 ckkey: '', 66 name: '', 67 link: '', 68 version: '', 69 domain: '', 70 more: [] 71 }, 72 style: { //飿 ¼é¨åå 容é ç½®ï¼è¿é主è¦é ç½®loadingålogo以å广åçé¨åå 容 73 loading: { 74 file: 'data:image/swf;base64,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', 75 align: 'center', 76 vAlign: 'middle', 77 offsetX: -100, 78 offsetY: -40 79 }, 80 logo: { 81 //file: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAUCAYAAAD4BKGuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAVTSURBVHja1Fl/aJVVGP4cw/mH5tUWi3I53cA0WbeIzMgaq6lQoVawm0S6glHhIKM/TELICotqCxMSGWQRdFfRLEhc9mMxqA0rbdS2wsV0GkZXuaKUWlHvgeeNh7f3u1du3Ft74eGcnXu+c873vD/Pt0nZbDZyZL2gWZAQTBH8IjggeEjgPZASPIB+g/P7EsGT6J/BfHfjHFIv2Jpjj/+dlDskvCm42Jk7X3C7YJOgw/z2oOBGwdEYRW0RVAjOCZ4ugNggqwU3CTLRBJFyQ+xuwVRY14igB78tE9QKpgmeEHwkGKRnq9AeMesHRWwEsYGUxwSdBZ51ecweE4Lct0DsOVjaZvptA8jfC4JfghWpXIJ2jMY+EDShf1pwh6DvX5x1GtpDE43cNFlfhyFWpQ9xd5FgFo3fRi++C+2nCBNBRgU3O6RsEyyEQv4QLMb4CcE9RlFBLqS1WZ6BZ83A35ofVhuvfE5QJrjWebdgCJOx51qM1QgewbMzsO57MDQrB9DeC8ObHd5Xyb2eiNiQQxmtgkZBr+OuZwV7BIcF1RgbF1wTE2MbEccX48VY9sMzBilhTke/m+b1Q9lefpgruI7OsYhIGzPJuAnn3+6EM7vu1YKl5vkrYRSfCGZivCxoMklk7M5j6eFlXyRNRSAvAoFf0Fo/CC7LkbwuQjsZsf0qwbuI9wlYgIqGl6NEzDYibJ/gbmAfxpKoMDRcaSK8xZzjZbK+NMhSYoNSngV5e+ksKXp+JdqZwDDmdpSbsqa9gNAyi5JalSGv3iQ+dtNK9HvI+sNBh2AhvNYVaH+msRtAdsa4ehoKCuQsoP2PY8+kCSkJ5IRWjD2FZ4/BOFSWYv9KhI40eUKQ31CqdnLM1c1OOnHufKSS+iEZvgHNhji8g1yT5VZKdCnHO+ajvrYK/I7GkuSWjwvq8Mzl5M79NF89aCHaBNXmWv0sQVUUZEDwsDnbr2i9s31lKyGuFs7kITEBC+snJaToRYIFrRN0CeYgoSUxJ23WUm85eB41b4IUuIvGtyIMVMY8lzHGMoYworF7J/onKYk10/wVQL6zXYr+Zq9aOEhuXZPDel8Q3If+HMzTeHPKlForEK+mws3SMfH2UMxNLIJbasKsoIQZwVLbKFkN4T1C3HxUMM+EkCAfgjwNV40Y304KriOP+jIHqa+jvYsqnH/kqzKaGCFZxWnoTqooxky8+dHUsOGwr6Jf
81i9jmlVVTHGLnot9L3qGWqCToWYYRF5fDa96mtb93yI2g8B0IWxlTHWmi/hOG00D4mEJfJ5WhQX7ySCsDUaNkJeud6+sgXCgs3OLEG2/xdZSh10JBeiB1zQU0HuQdSib60rOdm9kFToIL8hmFiRHzm1YM0ylet5k579OFpcUk4I0oD0/QuJ7tcBy5ERY6ixdrh5uNwN3bUV7pd4E+J958HmPxbRRydqK/in6vxj5aH9din/udEPKtuU1GqBL24xJwBInQWiHLcbQVKBXTzkVpHP0tWHsIpZUqPeWcrScXuX2ImRkqlufBhdQl15ig3WLKH0/SeAmtD+uprBqGx1ThhlWN5LKG4lcNKbDblFDjVDU0wWK7yLLqnPNk6cKzKsfXt1GQmQQXSuwymhd3tr9lkvPJMUV152kc2PsmUEMxtzdPRk2SNX2DQ3Vhr02Is18LXjHVAz/bG0NEK8johus3UBiwyfkYlDkQUyLaWrwZBrbHMaB8Z3PJLaYk8IIVKKPSJdxbv3ecynNzLNr33GKLV1YVW4IyfycXfq0UxP4X5HJdXCqX4Wv0AKqYkkipw4LG6WxMNi+GhAtH+M/K8wVe7wuWvwQYAFT+UsGCXmX3AAAAAElFTkSuQmCC', 82 file:'', 83 align: 'right', 84 vAlign: 'top', 85 offsetX: -100, 86 offsetY: 10 87 }, 88 advertisement: { //广åç¸å ³çé ç½® 89 time: 5, //广åé»è®¤ææ¾æ¶é¿ä»¥åå¤ä¸ªå¹¿åæ¶æ¯ä¸ªå¹¿åé»è®¤ææ¾æ¶é´ï¼åä½ï¼ç§ 90 method: 'get', //广åçæµå°åé»è®¤è¯·æ±æ¹å¼ï¼get/post 91 videoForce: false, //é¢å¹¿åæ¯å¦å¼ºå¶ææ¾ç»æ 92 videoVolume: 0.8, //è§é¢é³é 93 skipButtonShow: true, //æ¯å¦æ¾ç¤ºè·³è¿å¹¿åæé® 94 linkButtonShow: true, //æ¯å¦æ¾ç¤ºå¹¿å龿¥æé®ï¼å¦æéæ©æ¾ç¤ºï¼åªæå¨æä¾äºå¹¿å龿¥å°åæ¶æä¼æ¾ç¤º 95 muteButtonShow: true, //æ¯å¦æ¾ç¤ºè·³è¿å¹¿åæé® 96 closeButtonShow: true, //æåæ¶æ¯å¦æ¾ç¤ºå ³é广åæé® 97 closeOtherButtonShow: true, //å ¶å®å¹¿åæ¯å¦éè¦å ³é广åæé® 98 frontSkipButtonDelay: 0, //å置广åè·³è¿å¹¿åæé®å»¶æ¶æ¾ç¤ºçæ¶é´ï¼åä½ï¼ç§ 99 insertSkipButtonDelay: 0, //æå ¥å¹¿åè·³è¿å¹¿åæé®å»¶æ¶æ¾ç¤ºçæ¶é´ï¼åä½ï¼ç§ 100 endSkipButtonDelay: 0, //å置广åè·³è¿å¹¿åæé®å»¶æ¶æ¾ç¤ºçæ¶é´ï¼åä½ï¼ç§ 101 frontStretched: 2, //å置广åæä¼¸æ¹å¼ï¼0=åå§å¤§å°ï¼1=èªå¨ç¼©æ¾ï¼2=åªæå½å¹¿åç宽æé«å¤§äºææ¾å¨å®½é«æ¶æè¿è¡ç¼©æ¾ï¼3=åèææ¾å¨å®½é«ï¼4=宽度åèææ¾å¨å®½ãé«åº¦èªå¨ï¼5=é«åº¦åèææ¾å¨é«ã宽度èªå¨
102 insertStretched: 2, //æå ¥å¹¿åæä¼¸æ¹å¼ï¼0=åå§å¤§å°ï¼1=èªå¨ç¼©æ¾ï¼2=åªæå½å¹¿åç宽æé«å¤§äºææ¾å¨å®½é«æ¶æè¿è¡ç¼©æ¾ï¼3=åèææ¾å¨å®½é«ï¼4=宽度åèææ¾å¨å®½ãé«åº¦èªå¨ï¼5=é«åº¦åèææ¾å¨é«ã宽度èªå¨ 103 pauseStretched: 2, //æå广åæä¼¸æ¹å¼ï¼0=åå§å¤§å°ï¼1=èªå¨ç¼©æ¾ï¼2=åªæå½å¹¿åç宽æé«å¤§äºææ¾å¨å®½é«æ¶æè¿è¡ç¼©æ¾ï¼3=åèææ¾å¨å®½é«ï¼4=宽度åèææ¾å¨å®½ãé«åº¦èªå¨ï¼5=é«åº¦åèææ¾å¨é«ã宽度èªå¨ 104 endStretched: 2 //ç»æå¹¿åæä¼¸æ¹å¼ï¼0=åå§å¤§å°ï¼1=èªå¨ç¼©æ¾ï¼2=åªæå½å¹¿åç宽æé«å¤§äºææ¾å¨å®½é«æ¶æè¿è¡ç¼©æ¾ï¼3=åèææ¾å¨å®½é«ï¼4=宽度åèææ¾å¨å®½ãé«åº¦èªå¨ï¼5=é«åº¦åèææ¾å¨é«ã宽度èªå¨ 105 }, 106 video: { //è§é¢çé»è®¤æ¯ä¾ 107 defaultWidth: 4, //宽度 108 defaultHeight: 3 //é«åº¦ 109 } 110 } 111 }; 112} 113!(function() { 114 var javascriptPath = ''; 115 ! function() { 116 var scriptList = document.scripts, 117 thisPath = scriptList[scriptList.length - 1].src; 118 javascriptPath = thisPath.substring(0, thisPath.lastIndexOf('/') + 1); 119 }(); 120 var ckplayer = function(obj) { 121 /* 122 javascripté¨åå¼åæç¨ç注é说æï¼ 123 1ï¼åå§å-ç¨åºè°ç¨æ¶å³è¿è¡ç代ç é¨å 124 2ï¼å®ä¹æ ·å¼-å®ä¹å®¹å¨ï¼div,p,canvasçï¼çæ ·å¼è¡¨ï¼å³css 125 3ï¼çå¬å¨ä½-çå¬å ç´ èç¹ï¼åå»-clickï¼é¼ æ è¿å ¥-mouseoverï¼é¼ æ 离å¼-mouseoutï¼é¼ æ ç§»å¨-mousemoveçï¼äºä»¶ 126 4ï¼çå¬äºä»¶-çå¬è§é¢çç¶æï¼ææ¾ï¼æåï¼å ¨å±ï¼é³éè°èçï¼äºä»¶ 127 5ï¼å ±ç¨å½æ°-è¿ç±»å½æ°å¨å¤é¨ä¹å¯ä»¥ä½¿ç¨ 128 6ï¼å ¨å±åé-å®ä¹æå ¨å±ä½¿ç¨çåé 129 7ï¼å ¶å®ç¸å ³æ³¨é 130 å ¨å±åé说æï¼ 131 卿¬è½¯ä»¶ä¸æä½¿ç¨å°çå ¨å±åéï¼åéï¼ç±»åï¼å æ¬Booleanï¼Stringï¼Intï¼Objectï¼å å«å ç´ å¯¹è±¡ååé对象ï¼ï¼Arrayï¼Functionçï¼ 132 ä¸é¢ååºéè¦çå ¨å±åéï¼ 133 V:Objectï¼è§é¢å¯¹è±¡ 134 VA:Arrayï¼è§é¢å表ï¼å æ¬è§é¢å°åï¼ç±»åï¼æ¸ æ°åº¦è¯´æï¼ 135 ID:Stringï¼è§é¢ID 136 CB:Objectï¼æ§å¶æ åå ç´ çéå对象 137 PD:Objectï¼å é¨è§é¢å®¹å¨å¯¹è±¡ 138 --------------------------------------------------------------------------------------------- 139 ç¨åºå¼å§ 140 ä¸é¢ä¸ºéè¦åå§åé ç½®çå ¨å±åé 141 åå§åé ç½® 142 configï¼å ¨å±åé/åéç±»åï¼Object/åè½ï¼å®ä¹ä¸äºåºæ¬é ç½® 143 */ 144 this.config = { 145 videoClick: true, //æ¯å¦æ¯æå廿æ¾/æåå¨ä½ 146 videoDbClick: true, //æ¯å¦æ¯æåå»å ¨å±/éåºå ¨å±å¨ä½ 147 errorTime: 100, //å»¶è¿å¤æå¤±è´¥çæ¶é´ï¼åä½ï¼æ¯«ç§ 148 videoDrawImage: false //æ¯å¦ä½¿ç¨è§é¢drawImageåè½ï¼æ³¨æï¼è¯¥åè½å¨ç§»å¨ç«¯è¡¨ç°ä¸äº 149 }; 150 //å ¨å±åé/åéç±»åï¼Object/åè½ï¼ææ¾å¨é»è®¤é ç½®ï¼å¨å¤é¨ä¼ éè¿æ¥ç¸åºé ç½®åï¼åè¿è¡ç¸å ³æ¿æ¢ 151 this.varsConfig = { 152 playerID: '', //ææ¾å¨ID 153 container: '', //è§é¢å®¹å¨çID 154 variable: 'ckplayer', //ææ¾å½æ°(åé)åç§° 155 volume: 0.8, //é»è®¤é³éï¼èå´0-1 156 poster: '', //å°é¢å¾çå°å 157 autoplay: false, //æ¯å¦èªå¨ææ¾ 158 loop: false, //æ¯å¦éè¦å¾ªç¯ææ¾ 159 live: false, //æ¯å¦æ¯ç´æ 160 duration: 0, //æå®æ»æ¶é´ 161 seek: 0, //é»è®¤éè¦è·³è½¬çç§æ° 162 drag: '', //æå¨æ¶æ¯æçåç½®åæ° 163 front: '', //åä¸éæé®å¨ä½ 164 next: '', //ä¸ä¸éæé®å¨ä½ 165 loaded: '', //å è½½ææ¾å¨åè°ç¨ç彿° 166 flashplayer: false, //设置ætrueå强å¶ä½¿ç¨flashplayer 167 html5m3u8: false, //PCå¹³å°ä¸æ¯å¦ä½¿ç¨h5ææ¾å¨ææ¾m3u8 168 track: null, //åå¹è½¨é 169 cktrack: null, //ckåå¹ 170 preview: null, //é¢è§å¾ç对象 171 prompt: null, //æç¤ºç¹åè½ 172 video: null, //è§é¢å°å 173 config: '', //è°ç¨é ç½®å½æ°åç§° 174 type: '', //è§é¢æ ¼å¼ 175 crossorigin: '', //设置html5è§é¢çcrossOrigin屿§ 176 crossdomain: '', //å®å ¨çç¥æä»¶å°å 177 unescape: false, //é»è®¤flashplayerééè¦è§£ç 178 mobileCkControls: false, //ç§»å¨ç«¯h5æ¾ç¤ºæ§å¶æ 179 playbackrate: 1, //é»è®¤åé 180 debug: false //æ¯å¦å¼å¯è°è¯æ¨¡å¼ 181 }; 182 this.vars = {}; 183 //å ¨å±åé/åéç±»åï¼Object/åè½ï¼è¯è¨é ç½® 184 this.language = { 185 volume: 'é³éï¼', 186 play: 'ç¹å»ææ¾', 187 pause: 'ç¹å»æå', 188 full: 'ç¹å»å ¨å±', 189 escFull: 'éåºå ¨å±', 190 mute: 'ç¹å»éé³', 191 escMute: 'åæ¶éé³', 192 front: 'ä¸ä¸é', 193 next: 'ä¸ä¸é', 194 definition: 'ç¹å»éæ©æ¸ æ°åº¦',
195 playbackRate: 'ç¹å»éæ©é度', 196 error: 'å è½½åºé' 197 }; 198 //å ¨å±åé/åéç±»åï¼Array/åè½ï¼å³é®èåï¼[èåæ é¢,ç±»å(link:龿¥ï¼default:ç°è²ï¼functionï¼è°ç¨å½æ°ï¼javascript:è°ç¨js彿°),æ§è¡å 容(å å«é¾æ¥å°åï¼å½æ°åç§°),[line(é´é线)]] 199 this.contextMenu = [ 200 ['ckplayer', 'link', 'http://www.ckplayer.com'], 201 ['version:X', 'default', 'line'] 202 ]; 203 //å ¨å±åé/åéç±»åï¼Array/åè½ï¼é误å表 204 this.errorList = [ 205 ['000', 'Object does not exist'], 206 ['001', 'Variables type is not a object'], 207 ['002', 'Video object does not exist'], 208 ['003', 'Video object format error'], 209 ['004', 'Video object format error'], 210 ['005', 'Video object format error'], 211 ['006', '[error] does not exist '], 212 ['007', 'Ajax error'], 213 ['008', 'Ajax error'], 214 ['009', 'Ajax object format error'], 215 ['010', 'Ajax.status:[error]'] 216 ]; 217 //å ¨å±åé/åéç±»åï¼Array/åè½ï¼HTML5åéææ¾ç弿°ç»/妿ä¸éè¦å¯ä»¥è®¾ç½®ænull 218 this.playbackRateArr = [ 219 [0.5, '0.5å'], 220 [1, 'æ£å¸¸'], 221 [1.25, '1.25å'], 222 [1.5, '1.5å'], 223 [2, '2åé'], 224 [4, '4åé'] 225 ]; 226 //å ¨å±åé/åéç±»åï¼Array/åè½ï¼HTML5é»è®¤åéææ¾çå¼ 227 this.playbackRateDefault = 1; 228 //å ¨å±åé/åéç±»åï¼String/åè½ï¼å®ä¹logo 229 this.logo = ''; 230 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼æ¯å¦å è½½äºææ¾å¨ 231 this.loaded = false; 232 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼çå¬è§é¢å è½½åºéçç¶æ 233 this.timerError = null; 234 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼æ¯å¦åºé 235 this.error = false; 236 //å ¨å±åé/åéç±»åï¼Array/åè½ï¼åºéå°åçæ°ç» 237 this.errorUrl = []; 238 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼çå¬å ¨å±ä¸éå ¨å±ç¶æ 239 this.timerFull = null; 240 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼æ¯å¦å ¨å±ç¶æ 241 this.full = false; 242 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼çå¬å½åçæ/æ¥ æ¶=å=ç§ 243 this.timerTime = null; 244 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼çå¬è§é¢å è½½ 245 this.timerBuffer = null; 246 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼è®¾ç½®è¿åº¦æé®åè¿åº¦æ¡æ¯å¦è·çæ¶é´ååï¼è¯¥å±æ§ä¸»è¦ç¨æ¥å¨æä¸è¿åº¦æé®æ¶æåè¿åº¦æé®ç§»å¨åè¿åº¦æ¡çé¿åº¦åå 247 this.isTimeButtonMove = true; 248 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼è¿åº¦æ æ¯å¦ææï¼å¦ææ¯ç´æï¼åä¸éè¦ç嬿¶é´è®©è¿åº¦æé®åè¿åº¦æ¡åå 249 this.isTimeButtonDown = false; 250 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼ç¨æ¥æ¨¡æåå»åè½ç夿 251 this.isClick = false; 252 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼ç¨æ¥æ¨¡æåå»åè½ç计æ¶å¨ 253 this.timerClick = null; 254 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼æè½¬loading 255 this.timerLoading = null; 256 //å ¨å±åé/åéç±»åï¼è®¡æ¶å¨/åè½ï¼çå¬é¼ æ å¨è§é¢ä¸ç§»å¨æ¾ç¤ºæ§å¶æ 257 this.timerCBar = null; 258 //å ¨å±åé/åéç±»åï¼Int/åè½ï¼ææ¾è§é¢æ¶å¦æè¯¥åéçå¼å¤§äº0ï¼åè¿è¡è·³è½¬å设置该å¼ä¸º0 259 this.needSeek = 0; 260 //å ¨å±åé/åéç±»åï¼Int/åè½ï¼å½åé³é 261 this.volume = 0; 262 //å ¨å±åé/åéç±»åï¼Int/åè½ï¼é鳿¶ä¿å临æ¶é³é 263 this.volumeTemp = 0; 264 //å ¨å±åé/åéç±»åï¼Number/åè½ï¼å½åææ¾æ¶é´ 265 this.time = 0; 266 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼å®ä¹é¦æ¬¡è°ç¨ 267 this.isFirst = true; 268 //å ¨å±åé/åéç±»åï¼Boolean/åè½ï¼æ¯å¦ä½¿ç¨HTML5-VIDEOææ¾ 269 this.html5Video = true; 270 //å ¨å±åé/åéç±»åï¼Object/åè½ï¼è®°å½è§é¢å®¹å¨èç¹çx;y 271 this.pdCoor = { 272 x: 0, 273 y: 0 274 }; 275 //å ¨å±åé/åéç±»åï¼String/åè½ï¼å¤æå½å使ç¨çææ¾å¨ç±»åï¼html5videoæflashplayer 276 this.playerType = ''; 277 //å ¨å±åé/åéç±»åï¼Int/åè½ï¼å è½½è¿åº¦æ¡çé¿åº¦ 278 this.loadTime = 0; 279 //å ¨å±åé/body对象 280 this.body = document.body || document.documentElement; 281 //å ¨å±åé/V/ææ¾å¨ 282 this.V = null; 283 //å ¨å±åé/ä¿åå¤é¨jsçå¬äºä»¶æ°ç» 284 this.listenerJsArr = []; 285 //å ¨å±åé/ä¿åæ§å¶æ æ¾ç¤ºå ç´ çæ»å®½åº¦ 286 this.buttonLen = 0; 287 //å ¨å±åé/ä¿åæ§å¶æ æ¾ç¤ºå ç´ çæ°ç» 288 this.buttonArr = []; 289 //å ¨å±åé/ä¿åæé®å ç´ ç宽 290 this.buttonWidth = {}; 291 //å ¨å±åé/ä¿åææ¾å¨ä¸æ°å¢å ä»¶çæ°ç» 292 this.elementArr = []; 293 //å ¨å±åé/åå¹å 容 294 this.track = []; 295 //å ¨å±åé/åå¹ç´¢å¼ 296 this.trackIndex = 0; 297 //å ¨å±åé/å½åæ¾ç¤ºçåå¹å 容 298 this.nowTrackShow = { 299 sn: '' 300 }; 301 //å ¨å±åé/ä¿ååå¹å ä»¶æ°ç» 302 this.trackElement = []; 303 //å ¨å±åé/å°è§é¢è½¬æ¢ä¸ºå¾ç 304 this.timerVCanvas = null; 305 //å ¨å±åé/animate 306 this.animateArray = []; 307 //å ¨å±åé/ä¿åanimateçå ä»¶ 308 this.animateElementArray = []; 309 //å ¨å±åé/ä¿åéè¦å¨æåæ¶åæ¢ç¼å¨çæ°ç» 310 this.animatePauseArray = []; 311 //å ¨å±åé/é¢è§å¾çå è½½ç¶æ/0=没æå è½½ï¼1=æ£å¨å è½½ï¼2=å è½½å®æ 312 this.previewStart = 0; 313 //å ¨å±åé/é¢è§å¾çå®¹å¨ 314 this.previewDiv = null; 315 //å ¨å±åé/é¢è§æ¡ 316 this.previewTop = null; 317 //å ¨å±åé/é¢è§æ¡ç宽 318 this.previewWidth = 120; 319 //å ¨å±åé/é¢è§å¾ç容å¨ç¼å¨å½æ° 320 this.previewTween = null; 321 //å ¨å±åé/æ¯å¦æ¯m3u8æ ¼å¼ï¼æ¯çè¯åå¯ä»¥å è½½hls.js 322 this.isM3u8 = false;
323 //å ¨å±åé/ä¿åæç¤ºç¹æ°ç» 324 this.promptArr = []; 325 //å ¨å±åé/æ¾ç¤ºæç¤ºç¹æä»¶çå®¹å¨ 326 this.promptElement = null; 327 //é ç½®æä»¶å½æ° 328 this.ckplayerConfig = {}; 329 //æ§å¶æ æ¯å¦æ¾ç¤º 330 this.showFace = true; 331 //æ¯å¦çå¬è¿h5çé误 332 this.errorAdd = false; 333 //æ¯å¦åéäºé误 334 this.errorSend = false; 335 //æ§å¶æ æ¯å¦éè 336 this.controlBarIsShow = true; 337 //åä½ 338 this.fontFamily = '"Microsoft YaHei"; YaHei; "\5FAE\8F6F\96C5\9ED1"; SimHei; "\9ED1\4F53";Arial'; 339 //è®°å½ç¬¬ä¸æ¬¡æå¨è¿åº¦æé®æ¶çä½ç½® 340 this.timeSliderLeftTemp = 0; 341 342 // é»è®¤è°ç¨ 343 if(obj) { 344 this.embed(obj); 345 } 346 }; 347 348 ckplayer.prototype = { 349 /* 350 主è¦å½æ°é¨åå¼å§ 351 主æ¥å£å½æ°ï¼ 352 è°ç¨ææ¾å¨éåå§åè¯¥å½æ° 353 */ 354 embed: function(c) { 355 //c:Objectï¼æ¯è°ç¨æ¥å£ä¼ éç屿§å¯¹è±¡ 356 if(window.location.href.substr(0, 7) == 'file://') { 357 alert('Please use the HTTP protocol to open the page'); 358 return; 359 } 360 if(c == undefined || !c) { 361 this.eject(this.errorList[0]); 362 return; 363 } 364 if(typeof(c) != 'object') { 365 this.eject(this.errorList[1]); 366 } 367 this.vars = this.standardization(this.varsConfig, c); 368 369 if(!this.vars['mobileCkControls'] && this.isMobile()) { 370 this.vars['flashplayer'] = false; 371 this.showFace = false; 372 } 373 var videoString = this.vars['video']; 374 // è§é¢è·¯å¾ 375 if(!videoString) { 376 this.eject(this.errorList[2]); 377 return; 378 } 379 // æ·»å iframe 380 var thirdUrl =["my.tv.sohu.com","sohu.com","qq.com","youtube.com",'youku.com','tudou.com','iqiyi.com','bilibili.com']; 381 var isThirdUrl = (function(){ 382 for(var i =0; i < thirdUrl.length; i++){ 383 if(videoString.indexOf(thirdUrl[i]) > -1){ 384 return true; 385 } 386 } 387 return false; 388 })(); 389 if (isThirdUrl){ 390 var iframebox = document.getElementById( this.vars['container'].substring(1)); 391 iframebox.innerHTML = "<iframe id='third-iframe' src='"+videoString+"' style='position:absolute;left:0;top:0;z-index:50;width:100%;height:100%;' frameborder=0 width='100%' height='100%' scrolling='no' allowfullscreen></iframe>"; 392 // 设置é«åº¦ 393 var iframeDom = document.getElementById('third-iframe'); 394 iframeDom.onload = function(){ 395 try{ 396 var ofw = iframebox.clientWidth; 397 var ofh = iframeDom.contentWindow.document.body.offsetHeight; 398 var bodyH = document.documentElement.clientHeight *0.8; // å¯è§ 399 ofh = ofh > bodyH ? bodyH: ofh; 400 var ofrate = (ofh/ofw).toFixed(4); 401 iframebox.style.paddingBottom = (ofrate*100)+'%'; 402 }catch(err){ 403 console.log('error:------------'); 404 console.log(err); 405 iframebox.style.minHeight = 200+'px'; 406 } 407 } 408 return; 409 } 410 if(typeof(videoString) == 'string') { 411 if(videoString.substr(0, 3) == 'CK:' || videoString.substr(0, 3) == 'CE:' || videoString.substr(8, 3) == 'CK:' || videoString.substr(8, 3) == 'CE:') { 412 this.vars['flashplayer'] = true; 413 } 414 } 415 if(this.vars['config']) { 416 this.ckplayerConfig = eval(this.vars['config'] + '()'); 417 } else { 418 this.ckplayerConfig = ckplayerConfig(); 419 } 420 if((!this.supportVideo() && this.vars['flashplayer'] != '') || (this.vars['flashplayer'] && this.uploadFlash()) || !this.isMsie()) { 421 this.html5Video = false; 422 this.getVideo(); 423 } else if(videoString) { 424 //夿è§é¢æ°æ®ç±»å 425 this.analysedVideoUrl(videoString); 426 return this; 427 } else { 428 this.eject(this.errorList[2]); 429 } 430 }, 431 /* 432 å é¨å½æ° 433 æ ¹æ®å¤é¨ä¼ éè¿æ¥çvideoå¼å§åæè§é¢å°å 434 */ 435 analysedVideoUrl: function(video) { 436 var i = 0, 437 y = 0; 438 var thisTemp = this; 439 //å®ä¹å ¨å±åéVA:Arrayï¼è§é¢å表ï¼å æ¬è§é¢å°åï¼ç±»åï¼æ¸ æ°åº¦è¯´æï¼ 440 this.VA = []; 441 if(typeof(video) == 'string') { //妿æ¯å符形å¼çå夿åç¼è¿è¡å¡«å 442 if(video.substr(0, 8) != 'website:') { 443 this.VA = [ 444 [video, '', '', 0] 445 ]; 446 var fileExt = this.getFileExt(video); 447 switch(fileExt) { 448 case '.mp4': 449 this.VA[0][1] = 'video/mp4'; 450 break; 451 case '.ogg': 452 this.VA[0][1] = 'video/ogg'; 453 break; 454 case '.webm': 455 this.VA[0][1] = 'video/webm'; 456 break; 457 default: 458 break; 459 } 460 this.getVideo(); 461 } else { 462 if(this.html5Video) { 463 var ajaxObj = { 464 url: video.substr(8), 465 success: function(data) { 466 if(data) { 467 thisTemp.analysedUrl(data); 468 } else { 469 thisTemp.eject(thisTemp.errorList[5]); 470 this.VA = video; 471 thisTemp.getVideo(); 472 } 473 } 474 }; 475 this.ajax(ajaxObj); 476 } else { 477 this.VA = video; 478 this.getVideo(); 479 } 480 481 } 482 } else if(typeof(video) == 'object') { //å¯¹è±¡ææ°ç» 483 if(!this.isUndefined(typeof(video.length))) { //è¯´ææ¯æ°ç» 484 if(!this.isUndefined(typeof(video[0].length))) { //è¯´ææ¯æ°ç»å½¢å¼çæ°ç» 485 this.VA = video; 486 } 487 this.getVideo(); 488 } else { 489 /* 490 妿videoæ ¼å¼æ¯å¯¹è±¡å½¢å¼ï¼ååäºç§ 491 妿video对象éå å«typeï¼åç´æ¥ææ¾ 492 */ 493 if(!this.isUndefined(video['type'])) {
494 this.VA.push([video['file'], video['type'], '', 0]); 495 this.getVideo(); 496 } else { 497 this.eject(this.errorList[5]); 498 } 499 } 500 } else { 501 this.eject(this.errorList[4]); 502 } 503 }, 504 /* 505 对请æ±å°çè§é¢å°åè¿è¡éæ°åæ 506 */ 507 analysedUrl: function(data) { 508 this.vars = this.standardization(this.vars, data); 509 if(!this.isUndefined(data['video'])) { 510 this.vars['video'] = data['video']; 511 } 512 this.analysedVideoUrl(this.vars['video']); 513 }, 514 /* 515 å é¨å½æ° 516 æ£æ¥æµè§å¨æ¯æçè§é¢æ ¼å¼ï¼å¦ææ¯åå°æ¯æçè§é¢æ ¼å¼éæ°åç»ç»ææ¾å表 517 */ 518 getHtml5Video: function() { 519 var va = this.VA; 520 var nva = []; 521 var mobile = false; 522 var video = document.createElement('video'); 523 var codecs = function(type) { 524 var cod = ''; 525 switch(type) { 526 case 'video/mp4': 527 cod = 'avc1.4D401E, mp4a.40.2'; 528 break; 529 case 'video/ogg': 530 cod = 'theora, vorbis'; 531 break; 532 case 'video/webm': 533 cod = 'vp8.0, vorbis'; 534 break; 535 default: 536 break; 537 } 538 return cod; 539 }; 540 var supportType = function(vidType, codType) { 541 if(!video.canPlayType) { 542 this.html5Video = false; 543 return; 544 } 545 var isSupp = video.canPlayType(vidType + ';codecs="' + codType + '"'); 546 if(isSupp == '') { 547 return false 548 } 549 return true; 550 }; 551 if(this.vars['flashplayer'] || !this.isMsie()) { 552 this.html5Video = false; 553 return; 554 } 555 if(this.isMobile()) { 556 mobile = true; 557 } 558 for(var i = 0; i < va.length; i++) { 559 var v = va[i]; 560 if(v) { 561 if(v[1] != '' && !mobile && supportType(v[1], codecs(v[1])) && v[0].substr(0, 4) != 'rtmp') { 562 nva.push(v); 563 } 564 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']) { 565 this.isM3u8 = true; 566 nva.push(v); 567 } 568 } 569 } 570 if(nva.length > 0) { 571 this.VA = nva; 572 } else { 573 if(!mobile) { 574 this.html5Video = false; 575 } 576 } 577 }, 578 /* 579 å é¨å½æ° 580 æ ¹æ®è§é¢å°åå¼å§æå»ºææ¾å¨ 581 */ 582 getVideo: function() { 583 //妿åå¨åå¹åå è½½ 584 if(this.V) { //å¦æææ¾å¨å·²åå¨ï¼å认为æ¯ä»newVideo彿°åéè¿æ¥çè¯·æ± 585 this.changeVideo(); 586 return; 587 } 588 if(this.vars['cktrack']) { 589 this.loadTrack(); 590 } 591 if(this.supportVideo() && !this.vars['flashplayer']) { 592 this.getHtml5Video(); //夿æµè§å¨æ¯æçè§é¢æ ¼å¼ 593 } 594 var thisTemp = this; 595 var v = this.vars; 596 var src = '', 597 source = '', 598 poster = '', 599 loop = '', 600 autoplay = '', 601 track = ''; 602 var video = v['video']; 603 var i = 0; 604 this.CD = this.getByElement(v['container']); 605 volume = v['volume']; 606 if(!this.CD) { 607 this.eject(this.errorList[6], v['container']); 608 return false; 609 } 610 //å¼å§æå»ºææ¾å®¹å¨ 611 var playerID = 'ckplayer' + this.randomString(); 612 var playerDiv = document.createElement('div'); 613 playerDiv.className = playerID; 614 this.V = undefined; 615 this.CD.innerHTML = ''; 616 this.CD.appendChild(playerDiv); 617 this.PD = this.getByElement(playerID); //PD:å®ä¹ææ¾å¨å®¹å¨å¯¹è±¡å ¨å±åé 618 this.css(this.CD, { 619 backgroundColor: '#000000', 620 overflow: 'hidden', 621 position: 'relative' 622 }); 623 this.css(this.PD, { 624 backgroundColor: '#000000', 625 width: '100%', 626 height: '100%', 627 fontFamily: this.fontFamily 628 }); 629 if(this.html5Video) { //å¦ææ¯æHTML5-VIDEOåé»è®¤ä½¿ç¨HTML5-VIDEOææ¾å¨ 630 //ç¦æ¢ææ¾å¨å®¹å¨ä¸é¼ æ éæ©ææ¬ 631 this.PD.onselectstart = this.PD.ondrag = function() { 632 return false; 633 }; 634 //ææ¾å®¹å¨æå»ºå®æå¹¶ä¸è®¾ç½®å¥½æ ·å¼ 635 //æå»ºææ¾å¨ 636 if(this.VA.length == 1) { 637 src = ' src="' + decodeURIComponent(this.VA[0][0]) + '"'; 638 } else { 639 var videoArr = this.VA.slice(0); 640 videoArr = this.arrSort(videoArr); 641 for(i = 0; i < videoArr.length; i++) { 642 var type = ''; 643 var va = videoArr[i]; 644 if(va[1]) { 645 type = ' type="' + va[1] + '"'; 646 if(type == ' type="video/m3u8"' || type == ' type="m3u8"') { 647 type = ''; 648 } 649 } 650 source += '<source src="' + decodeURIComponent(va[0]) + '"' + type + '>'; 651 } 652 } 653 //åæè§é¢å°åç»æ 654 if(v['autoplay']) { 655 autoplay = ' autoplay="autoplay"'; 656 } 657 if(v['poster']) { 658 poster = ' poster="' + v['poster'] + '"'; 659 } 660 if(v['loop']) { 661 loop = ' loop="loop"'; 662 } 663 if(v['seek'] > 0) { 664 this.needSeek = v['seek']; 665 }
666 if(v['track'] != null && v['cktrack'] == null) { 667 var trackArr = v['track']; 668 var trackDefault = ''; 669 var defaultHave = false; 670 for(i = 0; i < trackArr.length; i++) { 671 var trackObj = trackArr[i]; 672 if(trackObj['default'] && !defaultHave) { 673 trackDefault = ' default'; 674 defaultHave = true; 675 } else { 676 trackDefault = ''; 677 } 678 track += '<track kind="' + trackObj['kind'] + '" src="' + trackObj['src'] + '" srclang="' + trackObj['srclang'] + '" label="' + trackObj['label'] + '"' + trackDefault + '>'; 679 } 680 } 681 var autoLoad = this.ckplayerConfig['config']['autoLoad']; 682 var preload = ''; 683 if(!autoLoad) { 684 preload = ' preload="meta"'; 685 } 686 var vid = this.randomString(); 687 var controls = ''; 688 if(!this.showFace) { 689 controls = ' controls="controls"'; 690 } 691 var html = ''; 692 if(!this.isM3u8) { 693 html = '<video id="' + vid + '"' + src + ' width="100%" height="100%"' + autoplay + poster + loop + preload + controls + ' x5-playsinline="" playsinline="" webkit-playsinline="true">' + source + track + '</video>'; 694 } else { 695 html = '<video id="' + vid + '" width="100%" height="100%"' + poster + loop + preload + controls + ' x5-playsinline="" playsinline="" webkit-playsinline="true">' + track + '</video>'; 696 } 697 this.PD.innerHTML = html; 698 this.V = this.getByElement('#' + vid); //Vï¼å®ä¹ææ¾å¨å¯¹è±¡å ¨å±åé 699 if(this.vars['crossorigin']) { 700 this.V.crossOrigin = this.vars['crossorigin']; 701 } 702 try { 703 this.V.volume = volume; //å®ä¹é³é 704 if(this.playbackRateArr && this.vars['playbackrate'] > -1) { 705 if(this.vars['playbackrate'] < this.playbackRateArr.length) { 706 this.playbackRateDefault = this.vars['playbackrate']; 707 } 708 this.V.playbackRate = this.playbackRateArr[this.playbackRateDefault][0]; //å®ä¹åé 709 } 710 } catch(error) {} 711 this.css(this.V, { 712 width: '100%', 713 height: '100%' 714 }); 715 if(this.isM3u8) { 716 var loadJsHandler = function() { 717 thisTemp.embedHls(thisTemp.VA[0][0], v['autoplay']); 718 }; 719 this.loadJs(javascriptPath + 'hls/hls.min.js', loadJsHandler); 720 } 721 this.css(this.V, 'backgroundColor', '#000000'); 722 //å建ä¸ä¸ªç»å¸å®¹å¨ 723 if(this.config['videoDrawImage']) { 724 var canvasID = 'vcanvas' + this.randomString(); 725 var canvasDiv = document.createElement('div'); 726 canvasDiv.className = canvasID; 727 this.PD.appendChild(canvasDiv); 728 this.MD = this.getByElement(canvasID); //å®ä¹ç»å¸åå¨å®¹å¨ 729 this.css(this.MD, { 730 backgroundColor: '#000000', 731 width: '100%', 732 height: '100%', 733 position: 'absolute', 734 display: 'none', 735 cursor: 'pointer', 736 left: '0px', 737 top: '0px', 738 zIndex: '10' 739 }); 740 var cvid = 'ccanvas' + this.randomString(); 741 this.MD.innerHTML = this.newCanvas(cvid, this.PD.offsetWidth, this.PD.offsetHeight); 742 this.MDC = this.getByElement(cvid + '-canvas'); 743 this.MDCX = this.MDC.getContext('2d'); 744 } 745 this.playerType = 'html5video'; 746 //ææ¾å¨æå»ºå®æå¹¶ä¸è®¾ç½®å¥½æ ·å¼ 747 //å»ºç«ææ¾å¨ççå¬å½æ°ï¼å 嫿ä½çå¬åäºä»¶çå¬ 748 this.addVEvent(); 749 //æ ¹æ®æ¸ æ°åº¦çå¼æå»ºæ¸ æ°åº¦åæ¢æé® 750 if(this.showFace) { 751 this.definition(); 752 if(!this.vars['live'] && this.playbackRateArr && this.vars['playbackrate'] > -1) { 753 this.playbackRate(); 754 } 755 if(v['autoplay']) { 756 this.loadingStart(true); 757 } 758 } 759 this.playerLoad(); 760 } else { //妿䏿¯æHTML5-VIDEOåè°ç¨flashplayer 761 this.embedSWF(); 762 } 763 }, 764 /* 765 å é¨å½æ° 766 åéææ¾å¨å è½½æåçæ¶æ¯ 767 */ 768 playerLoad: function() { 769 var thisTemp = this; 770 if(this.isFirst) { 771 this.isFirst = false; 772 window.setTimeout(function() { 773 thisTemp.loadedHandler(); 774 }, 1); 775 } 776 }, 777 /* 778 å é¨å½æ° 779 å»ºç«ææ¾å¨ççå¬å½æ°ï¼å 嫿ä½çå¬åäºä»¶çå¬ 780 */ 781 addVEvent: function() { 782 var thisTemp = this; 783 //çå¬è§é¢åå»äºä»¶ 784 var eventVideoClick = function(event) { 785 thisTemp.videoClick(); 786 }; 787 this.addListenerInside('click', eventVideoClick); 788 this.addListenerInside('click', eventVideoClick, this.MDC); 789 //å»¶è¿è®¡ç®å 载失败äºä»¶ 790 this.timerErrorFun(); 791 //çå¬è§é¢å è½½å°å æ°æ®äºä»¶ 792 var eventJudgeIsLive = function(event) { 793 thisTemp.sendJS('loadedmetadata'); 794 thisTemp.sendJS('duration', thisTemp.V.duration); 795 thisTemp.judgeIsLive(); 796 }; 797 this.addListenerInside('loadedmetadata', eventJudgeIsLive); 798 //çå¬è§é¢ææ¾äºä»¶ 799 var eventPlaying = function(event) { 800 thisTemp.playingHandler(); 801 thisTemp.sendJS('play'); 802 thisTemp.sendJS('paused', false); 803 }; 804 this.addListenerInside('playing', eventPlaying); 805 //çå¬è§é¢æåäºä»¶ 806 var eventPause = function(event) { 807 thisTemp.pauseHandler(); 808 thisTemp.sendJS('pause'); 809 thisTemp.sendJS('paused', true); 810 }; 811 this.addListenerInside('pause', eventPause); 812 //çå¬è§é¢ææ¾æ¶é´äºä»¶ 813 var eventTimeupdate = function(event) { 814 if(thisTemp.timerLoading != null) { 815 thisTemp.loadingStart(false); 816 } 817 if(thisTemp.time) { 818 thisTemp.sendJS('time', thisTemp.time); 819 } 820 }; 821 this.addListenerInside('timeupdate', eventTimeupdate); 822 //çå¬è§é¢ç¼å²äºä»¶ 823 var eventWaiting = function(event) { 824 thisTemp.loadingStart(true); 825 }; 826 this.addListenerInside('waiting', eventWaiting); 827 //çå¬è§é¢seekå¼å§äºä»¶ 828 var eventSeeking = function(event) { 829 thisTemp.sendJS('seek', 'start'); 830 }; 831 this.addListenerInside('seeking', eventSeeking); 832 //çå¬è§é¢seekç»æäºä»¶ 833 var eventSeeked = function(event) { 834 thisTemp.seekedHandler(); 835 thisTemp.sendJS('seek', 'ended'); 836 }; 837 this.addListenerInside('seeked', eventSeeked); 838 //çå¬è§é¢ææ¾ç»æäºä»¶ 839 var eventEnded = function(event) { 840 thisTemp.endedHandler(); 841 thisTemp.sendJS('ended'); 842 }; 843 this.addListenerInside('ended', eventEnded); 844 //çå¬è§é¢é³é 845 var eventVolumeChange = function(event) { 846 try { 847 thisTemp.volumechangeHandler(); 848 thisTemp.sendJS('volume', thisTemp.volume || thisTemp.V.volume); 849 } catch(event) {} 850 }; 851 this.addListenerInside('volumechange', eventVolumeChange); 852 //çå¬å ¨å±äºä»¶ 853 var eventFullChange = function(event) { 854 var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; 855 thisTemp.sendJS('full', fullState); 856 }; 857 this.addListenerInside('fullscreenchange', eventFullChange); 858 this.addListenerInside('webkitfullscreenchange', eventFullChange); 859 this.addListenerInside('mozfullscreenchange', eventFullChange); 860 //建ç«çé¢
861 if(this.showFace) { 862 this.interFace(); 863 } 864 }, 865 /* 866 å é¨å½æ° 867 éç½®çé¢å ç´ 868 */ 869 resetPlayer: function() { 870 this.timeTextHandler(); 871 if(this.showFace) { 872 this.timeProgress(0, 1); //æ¹åæ¶é´è¿åº¦æ¡å®½ 873 this.changeLoad(0); 874 this.initPlayPause(); //夿æ¾ç¤ºææ¾ææåæé® 875 this.definition(); //æå»ºæ¸ æ°åº¦æé® 876 this.showFrontNext(); //æå»ºä¸ä¸éä¸ä¸éæé® 877 this.deletePrompt(); //å é¤æç¤ºç¹ 878 this.deletePreview(); //å é¤é¢è§å¾ 879 this.trackHide(); //éç½®åå¹ 880 this.resetTrack(); 881 this.trackElement = []; 882 this.track = []; 883 } 884 }, 885 /* 886 å é¨å½æ° 887 æå»ºçé¢å ç´ 888 */ 889 interFace: function() { 890 this.showFace = true; 891 var thisTemp = this; 892 var html = ''; //æ§å¶æ å 容 893 var i = 0; 894 var bWidth = 38, //æé®ç宽 895 bHeight = 38; //æé®çé« 896 var bBgColor = '#FFFFFF', //æé®å ç´ é»è®¤é¢è² 897 bOverColor = '#0782F5'; //æé®å ç´ é¼ æ ç»è¿æ¶çé¢è² 898 var timeInto = this.formatTime(0) + ' / ' + this.formatTime(this.vars['duration']); //æ¶é´æ¾ç¤ºæ¡é»è®¤æ¾ç¤ºå 容 899 var randomS = this.randomString(10); //è·åä¸ä¸ªéæºå符串 900 /* 901 以ä¸å®ä¹çé¢åå ç´ çIDï¼ç»ä¸ä»¥IDç»æ 902 */ 903 var controlBarBgID = 'controlbgbar' + randomS, //æ§å¶æ èæ¯ 904 controlBarID = 'controlbar' + randomS, //æ§å¶æ å®¹å¨ 905 timeProgressBgID = 'timeprogressbg' + randomS, //ææ¾è¿åº¦æ¡èæ¯ 906 loadProgressID = 'loadprogress' + randomS, //å è½½è¿åº¦æ¡ 907 timeProgressID = 'timeprogress' + randomS, //ææ¾è¿åº¦æ¡ 908 timeBOBGID = 'timebobg' + randomS, //ææ¾è¿åº¦æé®å®¹å¨ï¼è¯¥å ç´ ä¸ºä¸ä¸ªéæè¦ç卿æ¾è¿åº¦æ¡ä¸ 909 timeBOID = 'timebo' + randomS, //ææ¾è¿åº¦å¯æå¨æé®å¤æ¡ 910 timeBWID = 'timebw' + randomS, //ææ¾è¿åº¦å¯æå¨æé®å æ¡ 911 timeTextID = 'timetext' + randomS, //æ¶é´ææ¬æ¡ 912 playID = 'play' + randomS, //ææ¾æé® 913 pauseID = 'pause' + randomS, //æåæé® 914 frontID = 'front' + randomS, //åä¸éæé® 915 nextID = 'next' + randomS, //ä¸ä¸éæé® 916 fullID = 'full' + randomS, //å ¨å±æé® 917 escFullID = 'escfull' + randomS, //éåºå ¨å±æé® 918 muteID = 'mute' + randomS, //éé³æé® 919 escMuteID = 'escmute' + randomS, //åæ¶éé³æé® 920 volumeID = 'volume' + randomS, //é³éè°èæ¡å®¹å¨ 921 volumeDbgID = 'volumedbg' + randomS, //é³éè°èæ¡å®¹å¨èæ¯ 922 volumeBgID = 'volumebg' + randomS, //é³éè°èæ¡èæ¯å± 923 volumeUpID = 'volumeup' + randomS, //é³éè°èæ¡å¯åå®½åº¦å± 924 volumeBOID = 'volumebo' + randomS, //é³éè°èæé®å¤æ¡ 925 volumeBWID = 'volumebw' + randomS, //é³éè°èæé®å æ¡ 926 definitionID = 'definition' + randomS, //æ¸ æ°åº¦å®¹å¨ 927 definitionPID = 'definitionp' + randomS, //æ¸ æ°åº¦åè¡¨å®¹å¨ 928 playbackRateID = 'playbackrate' + randomS, //æ¸ æ°åº¦å®¹å¨ 929 playbackRatePID = 'playbackratep' + randomS, //æ¸ æ°åº¦åè¡¨å®¹å¨ 930 promptBgID = 'promptbg' + randomS, //æç¤ºæ¡èæ¯ 931 promptID = 'prompt' + randomS, //æç¤ºæ¡ 932 dlineID = 'dline' + randomS, //åéçº¿å ±ç¨åç¼ 933 menuID = 'menu' + randomS, //å³é®å®¹å¨ 934 pauseCenterID = 'pausecenter' + randomS, //ä¸é´æåæé® 935 loadingID = 'loading' + randomS, //ç¼å² 936 errorTextID = 'errortext' + randomS, //éè¯¯ææ¬æ¡ 937 logoID = 'logo' + randomS; //logo 938 //æå»ºä¸äºPDï¼ææ¾å¨å®¹å¨ï¼é使ç¨çå ç´ 939 var controlBarBg = document.createElement('div'), 940 controlBar = document.createElement('div'), 941 timeProgressBg = document.createElement('div'), 942 timeBoBg = document.createElement('div'), 943 pauseCenter = document.createElement('div'), 944 errorText = document.createElement('div'), 945 promptBg = document.createElement('div'), 946 prompt = document.createElement('div'), 947 menuDiv = document.createElement('div'), 948 definitionP = document.createElement('div'), 949 playbackrateP = document.createElement('div'), 950 loading = document.createElement('div'), 951 logo = document.createElement('div'); 952 953 controlBarBg.className = controlBarBgID; 954 controlBar.className = controlBarID; 955 timeProgressBg.className = timeProgressBgID; 956 timeBoBg.className = timeBOBGID; 957 promptBg.className = promptBgID; 958 prompt.className = promptID; 959 menuDiv.className = menuID; 960 definitionP.className = definitionPID; 961 definitionP.id = 'definitionSelect'; 962 playbackrateP.className = playbackRatePID; 963 pauseCenter.className = pauseCenterID; 964 loading.className = loadingID; 965 logo.className = logoID; 966 errorText.className = errorTextID; 967 968 this.PD.appendChild(controlBarBg); 969 this.PD.appendChild(controlBar); 970 this.PD.appendChild(timeProgressBg); 971 this.PD.appendChild(timeBoBg); 972 this.PD.appendChild(promptBg); 973 this.PD.appendChild(prompt); 974 this.PD.appendChild(definitionP); 975 this.PD.appendChild(playbackrateP); 976 this.PD.appendChild(pauseCenter); 977 978 this.PD.appendChild(loading); 979 this.PD.appendChild(errorText); 980 this.PD.appendChild(logo); 981 this.body.appendChild(menuDiv); 982 //æå»ºä¸äºPDï¼ææ¾å¨å®¹å¨ï¼é使ç¨çå ç´ ç»æ 983 984 if(this.vars['live']) { //妿æ¯ç´æï¼æ¶é´æ¾ç¤ºææ¬æ¡éæ¾ç¤ºå½åç³»ç»æ¶é´ 985 timeInto = this.getNowDate(); 986 } 987 //æå»ºæ§å¶æ çå 容 988 html += '<div class="' + playID + '" data-title="' + thisTemp.language['play'] + '">' + this.newCanvas(playID, bWidth, bHeight) + '</div>'; //ææ¾æé® 989 html += '<div class="' + pauseID + '" data-title="' + thisTemp.language['pause'] + '">' + this.newCanvas(pauseID, bWidth, bHeight) + '</div>'; //æåæé® 990 html += '<div class="' + dlineID + '-la"></div>'; //åé线 991 html += '<div class="' + frontID + '" data-title="' + thisTemp.language['front'] + '">' + this.newCanvas(frontID, bWidth, bHeight) + '</div>'; //åä¸éæé® 992 html += '<div class="' + dlineID + '-lb"></div>'; //åé线 993 html += '<div class="' + nextID + '" data-title="' + thisTemp.language['next'] + '">' + this.newCanvas(nextID, bWidth, bHeight) + '</div>'; //ä¸ä¸éæé® 994 html += '<div class="' + dlineID + '-lc"></div>'; //åé线 995 996 html += '<div class="' + timeTextID + '">' + timeInto + '</div>';
996 //æ¶é´ææ¬ 997 html += '<div class="' + fullID + '" data-title="' + thisTemp.language['full'] + '">' + this.newCanvas(fullID, bWidth, bHeight) + '</div>'; //å ¨å±æé® 998 html += '<div class="' + escFullID + '" data-title="' + thisTemp.language['escFull'] + '">' + this.newCanvas(escFullID, bWidth, bHeight) + '</div>'; //éåºå ¨å±æé® 999 html += '<div class="' + dlineID + '-ra"></div>'; //åé线 1000 html += '<div class="' + definitionID + '" data-title="' + thisTemp.language['definition'] + '"></div>'; //æ¸ æ°åº¦å®¹å¨ 1001 html += '<div class="' + dlineID + '-rb"></div>'; //åé线 1002 html += '<div class="' + playbackRateID + '" data-title="' + thisTemp.language['playbackRate'] + '"></div>'; //åé 1003 html += '<div class="' + dlineID + '-rc"></div>'; //åé线 1004 html += '<div class="' + volumeID + '"><div class="' + volumeDbgID + '"><div class="' + volumeBgID + '"><div class="' + volumeUpID + '"></div></div><div class="' + volumeBOID + '"><div class="' + volumeBWID + '"></div></div></div></div>'; //é³éè°èæ¡,é³éè°èæé® 1005 html += '<div class="' + muteID + '" data-title="' + thisTemp.language['mute'] + '">' + this.newCanvas(muteID, bWidth, bHeight) + '</div>'; //éé³æé® 1006 html += '<div class="' + escMuteID + '" data-title="' + thisTemp.language['escMute'] + '">' + this.newCanvas(escMuteID, bWidth, bHeight) + '</div>'; //éåºéé³æé® 1007 html += '<div class="' + dlineID + '-rd"></div>'; //åé线 1008 this.getByElement(controlBarID).innerHTML = html; 1009 //æå»ºæ§å¶æ å å®¹ç»æ 1010 //æå»ºè¿åº¦æ¡å 容 1011 this.getByElement(timeProgressBgID).innerHTML = '<div class="' + loadProgressID + '"></div><div class="' + timeProgressID + '"></div>'; 1012 this.getByElement(timeBOBGID).innerHTML = '<div class="' + timeBOID + '"><div class="' + timeBWID + '"></div></div>'; 1013 //æå»ºè¿åº¦æ¡å å®¹ç»æ 1014 this.getByElement(pauseCenterID).innerHTML = this.newCanvas(pauseCenterID, 80, 80); //æå»ºä¸é´æåæé® 1015 this.getByElement(loadingID).innerHTML = this.newCanvas(loadingID, 60, 60); //æå»ºä¸é´ç¼å²æ¶æ¾ç¤ºç徿 1016 this.getByElement(errorTextID).innerHTML = this.language['error']; //æå»ºéè¯¯æ¶æ¾ç¤ºçææ¬æ¡ 1017 if(this.ckplayerConfig['style']['logo']) { 1018 if(this.ckplayerConfig['style']['logo']['file']) { 1019 var logoFile = this.ckplayerConfig['style']['logo']['file']; 1020 if(logoFile.substr(0, 15) == 'data:image/png;' || logoFile.substr(0, 15) == 'data:image/jpg;' || logoFile.substr(0, 15) == 'data:image/jpeg;') { 1021 this.getByElement(logoID).innerHTML = '<img src="' + logoFile + '" border="0">'; //æå»ºlogo 1022 } 1023 } 1024 } else { 1025 this.getByElement(logoID).innerHTML = this.vars['logo'] || this.logo || ''; //æå»ºlogo 1026 } 1027 //CB:Objectï¼å ¨å±åéï¼å°ä¸äºå ¨å±éè¦ç¨å°çå ç´ ç»ä¸æ¾å¨CB对象é 1028 var pd = this.PD; 1029 this.CB = { 1030 controlBarBg: this.getByElement(controlBarBgID, pd), 1031 controlBar: this.getByElement(controlBarID, pd), 1032 promptBg: this.getByElement(promptBgID, pd), 1033 prompt: this.getByElement(promptID, pd), 1034 timeProgressBg: this.getByElement(timeProgressBgID, pd), 1035 loadProgress: this.getByElement(loadProgressID, pd), 1036 timeProgress: this.getByElement(timeProgressID, pd), 1037 timeBoBg: this.getByElement(timeBOBGID, pd), 1038 timeButton: this.getByElement(timeBOID, pd), 1039 timeText: this.getByElement(timeTextID, pd), 1040 play: this.getByElement(playID, pd), 1041 front: this.getByElement(frontID, pd), 1042 next: this.getByElement(nextID, pd), 1043 pause: this.getByElement(pauseID, pd), 1044 definition: this.getByElement(definitionID, pd), 1045 definitionP: this.getByElement(definitionPID, pd), 1046 definitionLine: this.getByElement(dlineID + '-rb', pd), 1047 playbackrate: this.getByElement(playbackRateID, pd), 1048 playbackrateP: this.getByElement(playbackRatePID, pd), 1049 playbackrateLine: this.getByElement(dlineID + '-rc', pd), 1050 full: this.getByElement(fullID, pd), 1051 escFull: this.getByElement(escFullID, pd), 1052 mute: this.getByElement(muteID, pd), 1053 escMute: this.getByElement(escMuteID, pd), 1054 volume: this.getByElement(volumeID, pd), 1055 volumeBg: this.getByElement(volumeBgID, pd), 1056 volumeUp: this.getByElement(volumeUpID, pd), 1057 volumeBO: this.getByElement(volumeBOID, pd), 1058 pauseCenter: this.getByElement(pauseCenterID, pd), 1059 menu: this.getByElement(menuID), 1060 loading: this.getByElement(loadingID, pd), 1061 loadingCanvas: this.getByElement(loadingID + '-canvas', pd), 1062 errorText: this.getByElement(errorTextID, pd), 1063 logo: this.getByElement(logoID, pd), 1064 playLine: this.getByElement(dlineID + '-la', pd), 1065 frontLine: this.getByElement(dlineID + '-lb', pd), 1066 nextLine: this.getByElement(dlineID + '-lc', pd), 1067 fullLine: this.getByElement(dlineID + '-ra'), 1068 definitionLine: this.getByElement(dlineID + '-rb', pd), 1069 muteLine: this.getByElement(dlineID + '-rd', pd) 1070 }; 1071 this.buttonWidth = { 1072 play: bWidth, 1073 full: bWidth, 1074 front: bWidth, 1075 next: bWidth, 1076 mute: bWidth 1077 }; 1078 //å®ä¹çé¢å ç´ çæ ·å¼ 1079 //æ§å¶æ èæ¯ 1080 this.css(controlBarBgID, { 1081 width: '100%', 1082 height: bHeight + 'px', 1083 backgroundColor: '#000000', 1084 position: 'absolute', 1085 bottom: '0px', 1086 filter: 'alpha(opacity:0.8)', 1087 opacity: '0.8', 1088 zIndex: '90' 1089 }); 1090 //æ§å¶æ å®¹å¨ 1091 this.css(controlBarID, { 1092 width: '100%', 1093 height: bHeight + 'px', 1094 position: 'absolute', 1095 bottom: '0px', 1096 zIndex: '90' 1097 }); 1098 //ä¸é´æåæé® 1099 this.css(pauseCenterID, { 1100 width: '80px', 1101 height: '80px', 1102 borderRadius: '50%', 1103 position: 'absolute', 1104 display: 'none', 1105 cursor: 'pointer', 1106 zIndex: '100' 1107 }); 1108 //loading 1109 this.css(loadingID, { 1110 width: '60px', 1111 height: '60px', 1112 position: 'absolute', 1113 display: 'none', 1114 zIndex: '100' 1115 }); 1116 //åºéææ¬æ¡ 1117 this.css(errorTextID, { 1118 width: '120px', 1119 height: '30px', 1120 lineHeight: '30px',
1121 color: '#FFFFFF', 1122 fontSize: '14px', 1123 textAlign: 'center', 1124 position: 'absolute', 1125 display: 'none', 1126 zIndex: '101', 1127 cursor: 'default', 1128 zIndex: '100' 1129 }); 1130 //å®ä¹logoæåçæ ·å¼ 1131 this.css(logoID, { 1132 height: '30px', 1133 lineHeight: '30px', 1134 color: '#FFFFFF', 1135 fontFamily: 'Arial', 1136 fontSize: '28px', 1137 textAlign: 'center', 1138 position: 'absolute', 1139 float: 'left', 1140 left: '-1000px', 1141 top: '20px', 1142 zIndex: '100', 1143 filter: 'alpha(opacity:0.8)', 1144 opacity: '0.8', 1145 cursor: 'default' 1146 }); 1147 1148 this.css(this.CB['loadingCanvas'], { 1149 transform: 'rotate(0deg)', 1150 msTransform: 'rotate(0deg)', 1151 mozTransform: 'rotate(0deg)', 1152 webkitTransform: 'rotate(0deg)', 1153 oTransform: 'rotate(0deg)' 1154 }); 1155 //å®ä¹æç¤ºè¯çæ ·å¼ 1156 this.css([promptBgID, promptID], { 1157 height: '30px', 1158 lineHeight: '30px', 1159 color: '#FFFFFF', 1160 fontSize: '14px', 1161 textAlign: 'center', 1162 position: 'absolute', 1163 borderRadius: '5px', 1164 paddingLeft: '5px', 1165 paddingRight: '5px', 1166 bottom: '0px', 1167 display: 'none', 1168 zIndex: '95' 1169 }); 1170 this.css(promptBgID, { 1171 backgroundColor: '#000000', 1172 filter: 'alpha(opacity:0.5)', 1173 opacity: '0.5' 1174 }); 1175 //æ¶é´è¿åº¦æ¡èæ¯å®¹å¨ 1176 this.css(timeProgressBgID, { 1177 width: '100%', 1178 height: '6px', 1179 backgroundColor: '#3F3F3F', 1180 overflow: 'hidden', 1181 position: 'absolute', 1182 bottom: '38px', 1183 zIndex: '88' 1184 }); 1185 //å è½½è¿åº¦åæ¶é´è¿åº¦ 1186 this.css([loadProgressID, timeProgressID], { 1187 width: '1px', 1188 height: '6px', 1189 position: 'absolute', 1190 bottom: '38px', 1191 top: '0px', 1192 zIndex: '91' 1193 }); 1194 this.css(loadProgressID, 'backgroundColor', '#6F6F6F'); 1195 this.css(timeProgressID, 'backgroundColor', bOverColor); 1196 //æ¶é´è¿åº¦æé® 1197 this.css(timeBOBGID, { 1198 width: '100%', 1199 height: '14px', 1200 overflow: 'hidden', 1201 position: 'absolute', 1202 bottom: '34px', 1203 cursor: 'pointer', 1204 zIndex: '92' 1205 }); 1206 this.css(timeBOID, { 1207 width: '14px', 1208 height: '14px', 1209 overflow: 'hidden', 1210 borderRadius: '50%', 1211 backgroundColor: bBgColor, 1212 cursor: 'pointer', 1213 position: 'absolute', 1214 top: '0px', 1215 zIndex: '20' 1216 }); 1217 this.css(timeBWID, { 1218 width: '8px', 1219 height: '8px', 1220 overflow: 'hidden', 1221 borderRadius: '50%', 1222 position: 'absolute', 1223 backgroundColor: bOverColor, 1224 left: '3px', 1225 top: '3px' 1226 }); 1227 this.css(timeTextID, { 1228 lineHeight: bHeight + 'px',
1229 color: '#FFFFFF', 1230 fontFamily: 'arial', 1231 fontSize: '16px', 1232 paddingLeft: '10px', 1233 float: 'left', 1234 overflow: 'hidden', 1235 cursor: 'default' 1236 }); 1237 //åé线 1238 this.css([dlineID + '-la', dlineID + '-lb', dlineID + '-lc', dlineID + '-ra', dlineID + '-rb', dlineID + '-rc', dlineID + '-rd'], { 1239 width: '0px', 1240 height: bHeight + 'px', 1241 overflow: 'hidden', 1242 borderLeft: '1px solid #303030', 1243 borderRight: '1px solid #151515', 1244 filter: 'alpha(opacity:0.9)', 1245 opacity: '0.9' 1246 }); 1247 this.css([dlineID + '-la', dlineID + '-lb', dlineID + '-lc'], 'float', 'left'); 1248 this.css([dlineID + '-ra', dlineID + '-rb', dlineID + '-rc', dlineID + '-rd'], 'float', 'right'); 1249 this.css([dlineID + '-lb', dlineID + '-lc', dlineID + '-rb', dlineID + '-rc'], 'display', 'none'); 1250 //ææ¾/æå/ä¸ä¸é/ä¸ä¸éæé® 1251 this.css([playID, pauseID, frontID, nextID], { 1252 width: bWidth + 'px', 1253 height: bHeight + 'px', 1254 float: 'left', 1255 overflow: 'hidden', 1256 cursor: 'pointer' 1257 }); 1258 this.css([frontID, nextID], 'display', 'none'); 1259 //åå§åå¤æææ¾/æåæé®éè项 1260 this.initPlayPause(); 1261 1262 //设置éé³/åæ¶éé³çæé®æ ·å¼ 1263 this.css([muteID, escMuteID], { 1264 width: bWidth + 'px', 1265 height: bHeight + 'px', 1266 float: 'right', 1267 overflow: 'hidden', 1268 cursor: 'pointer' 1269 }); 1270 if(this.vars['volume'] > 0) { 1271 this.css(escMuteID, 'display', 'none'); 1272 } else { 1273 this.css(muteID, 'display', 'none'); 1274 } 1275 //é³éè°èæ¡ 1276 this.css([volumeID, volumeDbgID], { 1277 width: '110px', 1278 height: bHeight + 'px', 1279 overflow: 'hidden', 1280 float: 'right' 1281 }); 1282 this.css(volumeDbgID, { 1283 position: 'absolute' 1284 }); 1285 this.css([volumeBgID, volumeUpID], { 1286 width: '100px', 1287 height: '6px', 1288 overflow: 'hidden', 1289 borderRadius: '5px', 1290 cursor: 'pointer' 1291 }); 1292 this.css(volumeBgID, { 1293 position: 'absolute', 1294 top: '16px' 1295 }); 1296 this.css(volumeBgID, 'backgroundColor', '#666666'); 1297 this.css(volumeUpID, 'backgroundColor', bOverColor); 1298 this.buttonWidth['volume'] = 100; 1299 //é³éè°èæé® 1300 this.css(volumeBOID, { 1301 width: '12px', 1302 height: '12px', 1303 overflow: 'hidden', 1304 borderRadius: '50%', 1305 position: 'absolute', 1306 backgroundColor: bBgColor, 1307 top: '13px', 1308 left: '0px', 1309 cursor: 'pointer' 1310 }); 1311 this.css(volumeBWID, { 1312 width: '6px', 1313 height: '6px', 1314 overflow: 'hidden', 1315 borderRadius: '50%', 1316 position: 'absolute', 1317 backgroundColor: bOverColor, 1318 left: '3px', 1319 top: '3px' 1320 }); 1321 //æ¸ æ°åº¦å®¹å¨ 1322 this.css(definitionID, { 1323 lineHeight: bHeight + 'px',
1324 color: '#FFFFFF', 1325 float: 'right', 1326 fontSize: '14px', 1327 textAlign: 'center', 1328 overflow: 'hidden', 1329 display: 'none', 1330 cursor: 'pointer' 1331 }); 1332 this.css(definitionPID, { 1333 lineHeight: (bHeight - 8) + 'px', 1334 color: '#FFFFFF', 1335 overflow: 'hidden', 1336 position: 'absolute', 1337 bottom: '4px', 1338 backgroundColor: '#000000', 1339 textAlign: 'center', 1340 zIndex: '95', 1341 cursor: 'pointer', 1342 display: 'none' 1343 }); 1344 //åéå®¹å¨ 1345 this.css(playbackRateID, { 1346 lineHeight: bHeight + 'px', 1347 color: '#FFFFFF', 1348 float: 'right', 1349 fontSize: '14px', 1350 textAlign: 'center', 1351 overflow: 'hidden', 1352 display: 'none', 1353 cursor: 'pointer' 1354 }); 1355 this.css(playbackRatePID, { 1356 lineHeight: (bHeight - 8) + 'px', 1357 color: '#FFFFFF', 1358 overflow: 'hidden', 1359 position: 'absolute', 1360 bottom: '4px', 1361 backgroundColor: '#000000', 1362 textAlign: 'center', 1363 zIndex: '95', 1364 cursor: 'pointer', 1365 display: 'none' 1366 }); 1367 //è®¾ç½®å ¨å±/éåºå ¨å±æé®æ ·å¼ 1368 this.css([fullID, escFullID], { 1369 width: bWidth + 'px', 1370 height: bHeight + 'px', 1371 float: 'right', 1372 overflow: 'hidden', 1373 cursor: 'pointer' 1374 }); 1375 this.css(escFullID, 'display', 'none'); 1376 //æå»ºåæé®çå½¢ç¶ 1377 //ææ¾æé® 1378 var cPlay = this.getByElement(playID + '-canvas').getContext('2d'); 1379 var cPlayFillRect = function() { 1380 thisTemp.canvasFill(cPlay, [ 1381 [12, 10], 1382 [29, 19], 1383 [12, 28] 1384 ]); 1385 }; 1386 cPlay.fillStyle = bBgColor; 1387 cPlayFillRect(); 1388 var cPlayOver = function(event) { 1389 cPlay.clearRect(0, 0, bWidth, bHeight); 1390 cPlay.fillStyle = bOverColor; 1391 cPlayFillRect(); 1392 }; 1393 var cPlayOut = function(event) { 1394 cPlay.clearRect(0, 0, bWidth, bHeight); 1395 cPlay.fillStyle = bBgColor; 1396 cPlayFillRect(); 1397 }; 1398 1399 this.addListenerInside('mouseover', cPlayOver, this.getByElement(playID + '-canvas')); 1400 this.addListenerInside('mouseout', cPlayOut, this.getByElement(playID + '-canvas')); 1401 //æåæé® 1402 var cPause = this.getByElement(pauseID + '-canvas').getContext('2d'); 1403 var cPauseFillRect = function() { 1404 thisTemp.canvasFillRect(cPause, [ 1405 [10, 10, 5, 18], 1406 [22, 10, 5, 18] 1407 ]); 1408 }; 1409 cPause.fillStyle = bBgColor; 1410 cPauseFillRect(); 1411 var cPauseOver = function(event) { 1412 cPause.clearRect(0, 0, bWidth, bHeight); 1413 cPause.fillStyle = bOverColor; 1414 cPauseFillRect(); 1415 }; 1416 var cPauseOut = function(event) { 1417 cPause.clearRect(0, 0, bWidth, bHeight); 1418 cPause.fillStyle = bBgColor; 1419 cPauseFillRect(); 1420 }; 1421 this.addListenerInside('mouseover', cPauseOver, this.getByElement(pauseID + '-canvas')); 1422 this.addListenerInside('mouseout', cPauseOut, this.getByElement(pauseID + '-canvas')); 1423 //åä¸éæé® 1424 var cFront = this.getByElement(frontID + '-canvas').getContext('2d'); 1425 var cFrontFillRect = function() { 1426 thisTemp.canvasFill(cFront, [ 1427 [16, 19], 1428 [30, 10], 1429 [30, 28] 1430 ]); 1431 thisTemp.canvasFillRect(cFront, [ 1432 [8, 10, 5, 18] 1433 ]); 1434 }; 1435 cFront.fillStyle = bBgColor; 1436 cFrontFillRect(); 1437 var cFrontOver = function(event) { 1438 cFront.clearRect(0, 0, bWidth, bHeight); 1439 cFront.fillStyle = bOverColor; 1440 cFrontFillRect(); 1441 }; 1442 var cFrontOut = function(event) { 1443 cFront.clearRect(0, 0, bWidth, bHeight); 1444 cFront.fillStyle = bBgColor; 1445 cFrontFillRect(); 1446 }; 1447 1448 this.addListenerInside('mouseover', cFrontOver, this.getByElement(frontID + '-canvas')); 1449 this.addListenerInside('mouseout', cFrontOut, this.getByElement(frontID + '-canvas')); 1450 //ä¸ä¸éæé® 1451 var cNext = this.getByElement(nextID + '-canvas').getContext('2d'); 1452 var cNextFillRect = function() { 1453 thisTemp.canvasFill(cNext, [ 1454 [8, 10], 1455 [22, 19], 1456 [8, 28] 1457 ]); 1458 thisTemp.canvasFillRect(cNext, [ 1459 [25, 10, 5, 18] 1460 ]); 1461 }; 1462 cNext.fillStyle = bBgColor; 1463 cNextFillRect(); 1464 var cNextOver = function(event) { 1465 cNext.clearRect(0, 0, bWidth, bHeight); 1466 cNext.fillStyle = bOverColor; 1467 cNextFillRect(); 1468 }; 1469 var cNextOut = function(event) { 1470 cNext.clearRect(0, 0, bWidth, bHeight); 1471 cNext.fillStyle = bBgColor; 1472 cNextFillRect(); 1473 };
1474 this.addListenerInside('mouseover', cNextOver, this.getByElement(nextID + '-canvas')); 1475 this.addListenerInside('mouseout', cNextOut, this.getByElement(nextID + '-canvas')); 1476 //å ¨å±æé® 1477 var cFull = this.getByElement(fullID + '-canvas').getContext('2d'); 1478 var cFullFillRect = function() { 1479 thisTemp.canvasFillRect(cFull, [ 1480 [19, 10, 9, 3], 1481 [25, 13, 3, 6], 1482 [10, 19, 3, 9], 1483 [13, 25, 6, 3] 1484 ]); 1485 }; 1486 cFull.fillStyle = bBgColor; 1487 cFullFillRect(); 1488 var cFullOver = function() { 1489 cFull.clearRect(0, 0, bWidth, bHeight); 1490 cFull.fillStyle = bOverColor; 1491 cFullFillRect(); 1492 }; 1493 var cFullOut = function() { 1494 cFull.clearRect(0, 0, bWidth, bHeight); 1495 cFull.fillStyle = bBgColor; 1496 cFullFillRect(); 1497 }; 1498 this.addListenerInside('mouseover', cFullOver, this.getByElement(fullID + '-canvas')); 1499 this.addListenerInside('mouseout', cFullOut, this.getByElement(fullID + '-canvas')); 1500 //å®ä¹éåºå ¨å±æé®æ ·å¼ 1501 var cEscFull = this.getByElement(escFullID + '-canvas').getContext('2d'); 1502 var cEscFullFillRect = function() { 1503 thisTemp.canvasFillRect(cEscFull, [ 1504 [20, 9, 3, 9], 1505 [23, 15, 6, 3], 1506 [9, 20, 9, 3], 1507 [15, 23, 3, 6] 1508 ]); 1509 }; 1510 cEscFull.fillStyle = bBgColor; 1511 cEscFullFillRect(); 1512 1513 var cEscFullOver = function() { 1514 cEscFull.clearRect(0, 0, bWidth, bHeight); 1515 cEscFull.fillStyle = bOverColor; 1516 cEscFullFillRect(); 1517 }; 1518 var cEscFullOut = function() { 1519 cEscFull.clearRect(0, 0, bWidth, bHeight); 1520 cEscFull.fillStyle = bBgColor; 1521 cEscFullFillRect(); 1522 }; 1523 this.addListenerInside('mouseover', cEscFullOver, this.getByElement(escFullID + '-canvas')); 1524 this.addListenerInside('mouseout', cEscFullOut, this.getByElement(escFullID + '-canvas')); 1525 //å®ä¹å ¨å±æé®çæ ·å¼ 1526 var cMute = this.getByElement(muteID + '-canvas').getContext('2d'); 1527 var cMuteFillRect = function() { 1528 thisTemp.canvasFill(cMute, [ 1529 [10, 15], 1530 [15, 15], 1531 [21, 10], 1532 [21, 28], 1533 [15, 23], 1534 [10, 23] 1535 ]); 1536 thisTemp.canvasFillRect(cMute, [ 1537 [23, 15, 2, 8], 1538 [27, 10, 2, 18] 1539 ]); 1540 }; 1541 cMute.fillStyle = bBgColor; 1542 cMuteFillRect(); 1543 var cMuteOver = function() { 1544 cMute.clearRect(0, 0, bWidth, bHeight); 1545 cMute.fillStyle = bOverColor; 1546 cMuteFillRect(); 1547 }; 1548 var cMuteOut = function() { 1549 cMute.clearRect(0, 0, bWidth, bHeight); 1550 cMute.fillStyle = bBgColor; 1551 cMuteFillRect(); 1552 }; 1553 this.addListenerInside('mouseover', cMuteOver, this.getByElement(muteID + '-canvas')); 1554 this.addListenerInside('mouseout', cMuteOut, this.getByElement(muteID + '-canvas')); 1555 //å®ä¹éåºå ¨å±æé®æ ·å¼ 1556 var cEscMute = this.getByElement(escMuteID + '-canvas').getContext('2d'); 1557 var cEscMuteFillRect = function() { 1558 thisTemp.canvasFill(cEscMute, [ 1559 [10, 15], 1560 [15, 15], 1561 [21, 10], 1562 [21, 28], 1563 [15, 23], 1564 [10, 23] 1565 ]); 1566 thisTemp.canvasFill(cEscMute, [ 1567 [23, 13], 1568 [24, 13], 1569 [33, 25], 1570 [32, 25] 1571 ]); 1572 thisTemp.canvasFill(cEscMute, [ 1573 [32, 13], 1574 [33, 13], 1575 [24, 25], 1576 [23, 25] 1577 ]); 1578 }; 1579 cEscMute.fillStyle = bBgColor; 1580 cEscMuteFillRect(); 1581 var cEscMuteOver = function() { 1582 cEscMute.clearRect(0, 0, bWidth, bHeight); 1583 cEscMute.fillStyle = bOverColor; 1584 cEscMuteFillRect(); 1585 }; 1586 var cEscMuteOut = function() { 1587 cEscMute.clearRect(0, 0, bWidth, bHeight); 1588 cEscMute.fillStyle = bBgColor; 1589 cEscMuteFillRect(); 1590 }; 1591 this.addListenerInside('mouseover', cEscMuteOver, this.getByElement(escMuteID + '-canvas')); 1592 this.addListenerInside('mouseout', cEscMuteOut, this.getByElement(escMuteID + '-canvas')); 1593 //å®ä¹loadingæ ·å¼ 1594 var cLoading = this.getByElement(loadingID + '-canvas').getContext('2d'); 1595 var cLoadingFillRect = function() { 1596 cLoading.save(); 1597 var grad = cLoading.createLinearGradient(0, 0, 60, 60); 1598 grad.addColorStop(0, bBgColor); 1599 var grad2 = cLoading.createLinearGradient(0, 0, 80, 60); 1600 grad2.addColorStop(1, bOverColor); 1601 var grad3 = cLoading.createLinearGradient(0, 0, 80, 60); 1602 grad3.addColorStop(1, '#FF9900'); 1603 var grad4 = cLoading.createLinearGradient(0, 0, 80, 60); 1604 grad4.addColorStop(1, '#CC3300'); 1605 cLoading.strokeStyle = grad; //设置æè¾¹æ ·å¼ 1606 cLoading.lineWidth = 8; //设置线宽 1607 cLoading.beginPath(); //è·¯å¾å¼å§ 1608 cLoading.arc(30, 30, 25, 0, 0.4 * Math.PI, false); //ç¨äºç»å¶åå¼§context.arc(xåæ ï¼yåæ ï¼åå¾ï¼èµ·å§è§åº¦ï¼ç»æ¢è§åº¦ï¼
1608顺æ¶é/éæ¶é) 1609 cLoading.stroke(); //ç»å¶ 1610 cLoading.closePath(); //è·¯å¾ç»æ 1611 cLoading.beginPath(); //è·¯å¾å¼å§ 1612 cLoading.strokeStyle = grad2; //设置æè¾¹æ ·å¼ 1613 cLoading.arc(30, 30, 25, 0.5 * Math.PI, 0.9 * Math.PI, false); //ç¨äºç»å¶åå¼§context.arc(xåæ ï¼yåæ ï¼åå¾ï¼èµ·å§è§åº¦ï¼ç»æ¢è§åº¦ï¼é¡ºæ¶é/éæ¶é) 1614 cLoading.stroke(); //ç»å¶ 1615 cLoading.beginPath(); //è·¯å¾å¼å§ 1616 cLoading.strokeStyle = grad3; //设置æè¾¹æ ·å¼ 1617 cLoading.arc(30, 30, 25, Math.PI, 1.4 * Math.PI, false); //ç¨äºç»å¶åå¼§context.arc(xåæ ï¼yåæ ï¼åå¾ï¼èµ·å§è§åº¦ï¼ç»æ¢è§åº¦ï¼é¡ºæ¶é/éæ¶é) 1618 cLoading.stroke(); //ç»å¶ 1619 cLoading.beginPath(); //è·¯å¾å¼å§ 1620 cLoading.strokeStyle = grad4; //设置æè¾¹æ ·å¼ 1621 cLoading.arc(30, 30, 25, 1.5 * Math.PI, 1.9 * Math.PI, false); //ç¨äºç»å¶åå¼§context.arc(xåæ ï¼yåæ ï¼åå¾ï¼èµ·å§è§åº¦ï¼ç»æ¢è§åº¦ï¼é¡ºæ¶é/éæ¶é) 1622 cLoading.stroke(); //ç»å¶ 1623 cLoading.closePath(); //è·¯å¾ç»æ 1624 cLoading.restore(); 1625 }; 1626 cLoading.fillStyle = bBgColor; 1627 cLoadingFillRect(); 1628 //å®ä¹ä¸é´æåæé®çæ ·å¼ 1629 var cPauseCenter = this.getByElement(pauseCenterID + '-canvas').getContext('2d'); 1630 var cPauseCenterFillRect = function() { 1631 thisTemp.canvasFill(cPauseCenter, [ 1632 [28, 22], 1633 [59, 38], 1634 [28, 58] 1635 ]); 1636 /* æå®å 个é¢è² */ 1637 cPauseCenter.save(); 1638 cPauseCenter.lineWidth = 5; //设置线宽 1639 cPauseCenter.beginPath(); //è·¯å¾å¼å§ 1640 cPauseCenter.arc(40, 40, 35, 0, 2 * Math.PI, false); //ç¨äºç»å¶åå¼§context.arc(xåæ ï¼yåæ ï¼åå¾ï¼èµ·å§è§åº¦ï¼ç»æ¢è§åº¦ï¼é¡ºæ¶é/éæ¶é) 1641 cPauseCenter.stroke(); //ç»å¶ 1642 cPauseCenter.closePath(); //è·¯å¾ç»æ 1643 cPauseCenter.restore(); 1644 }; 1645 cPauseCenter.fillStyle = bBgColor; 1646 cPauseCenter.strokeStyle = bBgColor; 1647 cPauseCenterFillRect(); 1648 var cPauseCenterOver = function() { 1649 cPauseCenter.clearRect(0, 0, 80, 80); 1650 cPauseCenter.fillStyle = bOverColor; 1651 cPauseCenter.strokeStyle = bOverColor; 1652 cPauseCenterFillRect(); 1653 }; 1654 var cPauseCenterOut = function() { 1655 cPauseCenter.clearRect(0, 0, 80, 80); 1656 cPauseCenter.fillStyle = bBgColor; 1657 cPauseCenter.strokeStyle = bBgColor; 1658 cPauseCenterFillRect(); 1659 }; 1660 this.addListenerInside('mouseover', cPauseCenterOver, this.getByElement(pauseCenterID + '-canvas')); 1661 this.addListenerInside('mouseout', cPauseCenterOut, this.getByElement(pauseCenterID + '-canvas')); 1662 1663 //é¼ æ ç»è¿/离å¼é³éè°èæé® 1664 var volumeBOOver = function() { 1665 thisTemp.css(volumeBOID, 'backgroundColor', bOverColor); 1666 thisTemp.css(volumeBWID, 'backgroundColor', bBgColor); 1667 }; 1668 var volumeBOOut = function() { 1669 thisTemp.css(volumeBOID, 'backgroundColor', bBgColor); 1670 thisTemp.css(volumeBWID, 'backgroundColor', bOverColor); 1671 }; 1672 this.addListenerInside('mouseover', volumeBOOver, this.getByElement(volumeBOID)); 1673 this.addListenerInside('mouseout', volumeBOOut, this.getByElement(volumeBOID)); 1674 //é¼ æ ç»è¿/离å¼è¿åº¦æé® 1675 var timeBOOver = function() { 1676 thisTemp.css(timeBOID, 'backgroundColor', bOverColor); 1677 thisTemp.css(timeBWID, 'backgroundColor', bBgColor); 1678 }; 1679 var timeBOOut = function() { 1680 thisTemp.css(timeBOID, 'backgroundColor', bBgColor); 1681 thisTemp.css(timeBWID, 'backgroundColor', bOverColor); 1682 }; 1683 this.addListenerInside('mouseover', timeBOOver, this.getByElement(timeBOID)); 1684 this.addListenerInside('mouseout', timeBOOut, this.getByElement(timeBOID)); 1685 1686 this.addButtonEvent(); //注åæé®åé³éè°èï¼è¿åº¦æä½äºä»¶ 1687 this.newMenu(); //åç¬è®¾ç½®å³é®çæ ·å¼åäºä»¶ 1688 this.controlBarHide(); //åç¬æ³¨åæ§å¶æ éèäºä»¶ 1689 this.keypress(); //åç¬æ³¨åé®çäºä»¶ 1690 //åå§åé³éè°èæ¡ 1691 this.changeVolume(this.vars['volume']); 1692 //åå§å夿æ¯å¦éè¦æ¾ç¤ºä¸ä¸éåä¸ä¸éæé® 1693 this.showFrontNext(); 1694 window.setTimeout(function() { 1695 thisTemp.elementCoordinate(); //è°æ´ä¸é´æåæé®/loadingçä½ç½®/errorçä½ç½® 1696 }, 100); 1697 this.checkBarWidth(); 1698 var resize = function() { 1699 thisTemp.elementCoordinate(); 1700 thisTemp.timeUpdateHandler(); 1701 thisTemp.changeLoad(); 1702 thisTemp.checkBarWidth(); 1703 thisTemp.changeElementCoor(); //ä¿®æ¹æ°å å ä»¶çåæ 1704 thisTemp.changePrompt(); 1705 }; 1706 this.addListenerInside('resize', resize, window); 1707 }, 1708 /* 1709 å é¨å½æ° 1710 å建æé®ï¼ä½¿ç¨canvasç»å¸ 1711 */ 1712 newCanvas: function(id, width, height) { 1713 return '<canvas class="' + id + '-canvas" width="' + width + '" height="' + height + '"></canvas>'; 1714 }, 1715 /* 1716 å é¨å½æ° 1717 注åæé®ï¼é³éè°èæ¡ï¼è¿åº¦æä½æ¡äºä»¶ 1718 */ 1719 addButtonEvent: function() { 1720 var thisTemp = this; 1721 //å®ä¹æé®çåå»äºä»¶ 1722 var playClick = function(event) { 1723 thisTemp.videoPlay(); 1724 thisTemp.sendJS('clickEvent', 'actionScript->videoPlay'); 1725 }; 1726 this.addListenerInside('click', playClick, this.CB['play']); 1727 this.addListenerInside('click', playClick, this.CB['pauseCenter']); 1728 var pauseClick = function(event) { 1729 thisTemp.videoPause(); 1730 thisTemp.sendJS('clickEvent', 'actionScript->videoPause'); 1731 }; 1732 this.addListenerInside('click', pauseClick, this.CB['pause']); 1733 var frontClick = function(event) { 1734 if(thisTemp.vars['front']) { 1735 eval(thisTemp.vars['front'] + '()'); 1736 thisTemp.sendJS('clickEvent', 'actionScript->' + thisTemp.vars['front']); 1737 } 1738 }; 1739 this.addListenerInside('click', frontClick, this.CB['front']); 1740 var nextClick = function(event) { 1741 if(thisTemp.vars['next']) { 1742 eval(thisTemp.vars['next'] + '()'); 1743 thisTemp.sendJS('clickEvent', 'actionScript->' + thisTemp.vars['next']); 1744 } 1745 }; 1746 this.addListenerInside('click', nextClick, this.CB['next']); 1747 var muteClick = function(event) { 1748 thisTemp.videoMute(); 1749 thisTemp.sendJS('clickEvent', 'actionScript->videoMute'); 1750 }; 1751 this.addListenerInside('click', muteClick, this.CB['mute']); 1752 var escMuteClick = function(event) { 1753 thisTemp.videoEscMute(); 1754 thisTemp.sendJS('clickEvent', 'actionScript->videoEscMute'); 1755 }; 1756 this.addListenerInside('click', escMuteClick, this.CB['escMute']); 1757 var fullClick = function(event) { 1758 thisTemp.fullScreen(); 1759 thisTemp.sendJS('clickEvent', 'actionScript->fullScreen'); 1760 }; 1761 this.addListenerInside('click', fullClick, this.CB['full']); 1762 var escFullClick = function(event) { 1763 thisTemp.quitFullScreen(); 1764 thisTemp.sendJS('clickEvent', 'actionScript->quitFullScreen'); 1765 }; 1766 this.addListenerInside('click', escFullClick, this.CB['escFull']); 1767 //å®ä¹å个æé®çé¼ æ ç»è¿/离å¼äºä»¶ 1768 var promptHide = function(event) { 1769 thisTemp.promptShow(false); 1770 }; 1771 var playOver = function(event) { 1772 thisTemp.promptShow(thisTemp.CB['play']); 1773 }; 1774 this.addListenerInside('mouseover', playOver, this.CB['play']); 1775 this.addListenerInside('mouseout', promptHide, this.CB['play']); 1776 var pauseOver = function(event) { 1777 thisTemp.promptShow(thisTemp.CB['pause']); 1778 }; 1779 this.addListenerInside('mouseover', pauseOver, this.CB['pause']); 1780 this.addListenerInside('mouseout', promptHide, this.CB['pause']); 1781 var frontOver = function(event) { 1782 thisTemp.promptShow(thisTemp.CB['front']); 1783 }; 1784 this.addListenerInside('mouseover', frontOver, this.CB['front']); 1785 this.addListenerInside('mouseout', promptHide, this.CB['front']); 1786 var nextOver = function(event) { 1787 thisTemp.promptShow(thisTemp.CB['next']); 1788 }; 1789 this.addListenerInside('mouseover', nextOver, this.CB['next']); 1790 this.addListenerInside('mouseout', promptHide, this.CB['next']); 1791 var muteOver = function(event) { 1792 thisTemp.promptShow(thisTemp.CB['mute']); 1793 }; 1794 this.addListenerInside('mouseover', muteOver, this.CB['mute']); 1795 this.addListenerInside('mouseout', promptHide, this.CB['mute']); 1796 var escMuteOver = function(event) { 1797 thisTemp.promptShow(thisTemp.CB['escMute']); 1798 }; 1799 this.addListenerInside('mouseover', escMuteOver, this.CB['escMute']); 1800 this.addListenerInside('mouseout', promptHide, this.CB['escMute']); 1801 var fullOver = function(event) { 1802 thisTemp.promptShow(thisTemp.CB['full']); 1803 }; 1804 this.addListenerInside('mouseover', fullOver, this.CB['full']); 1805 this.addListenerInside('mouseout', promptHide, this.CB['full']); 1806 var escFullOver = function(event) { 1807 thisTemp.promptShow(thisTemp.CB['escFull']); 1808 }; 1809 this.addListenerInside('mouseover', escFullOver, this.CB['escFull']); 1810 this.addListenerInside('mouseout', promptHide, this.CB['escFull']); 1811 var definitionOver = function(event) { 1812 thisTemp.promptShow(thisTemp.CB['definition']); 1813 }; 1814 this.addListenerInside('mouseover', definitionOver, this.CB['definition']); 1815 this.addListenerInside('mouseout', promptHide, this.CB['definition']); 1816 var playbackrateOver = function(event) { 1817 thisTemp.promptShow(thisTemp.CB['playbackrate']); 1818 }; 1819 this.addListenerInside('mouseover', playbackrateOver, this.CB['playbackrate']); 1820 this.addListenerInside('mouseout', promptHide, this.CB['playbackrate']); 1821 //å®ä¹é³éåè¿åº¦æé®çæ»åäºä»¶ 1822 1823 var volumePrompt = function(vol) { 1824 var volumeBOXY = thisTemp.getCoor(thisTemp.CB['volumeBO']); 1825 var promptObj = { 1826 title: thisTemp.language['volume'] + vol + '%', 1827 x: volumeBOXY['x'] + thisTemp.CB['volumeBO'].offsetWidth * 0.5, 1828 y: volumeBOXY['y'] 1829 }; 1830 thisTemp.promptShow(false, promptObj); 1831 }; 1832 var volumeObj = { 1833 slider: this.CB['volumeBO'], 1834 follow: this.CB['volumeUp'], 1835 refer: this.CB['volumeBg'], 1836 grossValue: 'volume', 1837 pd: true, 1838 startFun: function(vol) {}, 1839 monitorFun: function(vol) { 1840 thisTemp.changeVolume(vol * 0.01, false, false); 1841 volumePrompt(vol); 1842 }, 1843 endFun: function(vol) {}, 1844 overFun: function(vol) { 1845 volumePrompt(vol); 1846 } 1847 }; 1848 this.slider(volumeObj); 1849 var volumeClickObj = { 1850 refer: this.CB['volumeBg'], 1851 grossValue: 'volume', 1852 fun: function(vol) { 1853 thisTemp.changeVolume(vol * 0.01, true, true); 1854 } 1855 }; 1856 this.progressClick(volumeClickObj); 1857 this.timeButtonMouseDown(); //ç¨åå»ç彿°æ¥å¤ææ¯å¦éè¦å»ºç«æ§å¶æ çå¬ 1858 //é¼ æ ç»è¿/离å¼é³éè°èæ¡æ¶ç 1859 var volumeBgMove = function(event) { 1860 var volumeBgXY = thisTemp.getCoor(thisTemp.CB['volumeBg']); 1861 var eventX = thisTemp.client(event)['x']; 1862 var eventVolume = parseInt((eventX - volumeBgXY['x']) * 100 / thisTemp.CB['volumeBg'].offsetWidth); 1863 var buttonPromptObj = { 1864 title: thisTemp.language['volume'] + eventVolume + '%', 1865 x: eventX, 1866 y: volumeBgXY['y'] 1867 }; 1868 thisTemp.promptShow(false, buttonPromptObj); 1869 }; 1870 this.addListenerInside('mousemove', volumeBgMove, this.CB['volumeBg']); 1871 this.addListenerInside('mouseout', promptHide, this.CB['volumeBg']); 1872 this.addListenerInside('mouseout', promptHide, this.CB['volumeBO']); 1873 //æ³¨åæ¸ æ°åº¦ç¸å ³äºä»¶ 1874 this.addDefListener(); 1875 //注ååéç¸å ³äºä»¶ 1876 this.addPlaybackrate(); 1877 }, 1878 /* 1879 å é¨å½æ° 1880 注ååå»è§é¢å¨ä½ 1881 */ 1882 videoClick: function() { 1883 var thisTemp = this; 1884 var clearTimerClick = function() { 1885 if(thisTemp.timerClick != null) { 1886 if(thisTemp.timerClick.runing) { 1887 thisTemp.timerClick.stop(); 1888 } 1889 thisTemp.timerClick = null; 1890 } 1891 }; 1892 var timerClickFun = function() { 1893 clearTimerClick(); 1894 thisTemp.isClick = false;
1895 thisTemp.playOrPause(); 1896 1897 }; 1898 clearTimerClick(); 1899 if(this.isClick) { 1900 this.isClick = false; 1901 if(thisTemp.config['videoDbClick']) { 1902 if(!this.full) { 1903 thisTemp.fullScreen(); 1904 } else { 1905 thisTemp.quitFullScreen(); 1906 } 1907 } 1908 1909 } else { 1910 this.isClick = true; 1911 this.timerClick = new this.timer(300, timerClickFun, 1) 1912 //this.timerClick.start(); 1913 } 1914 1915 }, 1916 /* 1917 å é¨å½æ° 1918 注åé¼ æ ç»è¿è¿åº¦æ»åçäºä»¶ 1919 */ 1920 timeButtonMouseDown: function() { 1921 var thisTemp = this; 1922 var timePrompt = function(time) { 1923 if(isNaN(time)) { 1924 time = 0; 1925 } 1926 var timeButtonXY = thisTemp.getCoor(thisTemp.CB['timeButton']); 1927 var promptObj = { 1928 title: thisTemp.formatTime(time), 1929 x: timeButtonXY['x'] - thisTemp.pdCoor['x'] + thisTemp.CB['timeButton'].offsetWidth * 0.5, 1930 y: timeButtonXY['y'] - thisTemp.pdCoor['y'] 1931 }; 1932 thisTemp.promptShow(false, promptObj); 1933 }; 1934 var timeObj = { 1935 slider: this.CB['timeButton'], 1936 follow: this.CB['timeProgress'], 1937 refer: this.CB['timeBoBg'], 1938 grossValue: 'time', 1939 pd: false, 1940 startFun: function(time) { 1941 thisTemp.isTimeButtonMove = false; 1942 }, 1943 monitorFun: function(time) {}, 1944 endFun: function(time) { 1945 if(thisTemp.V) { 1946 if(thisTemp.V.duration > 0) { 1947 thisTemp.needSeek = 0; 1948 thisTemp.videoSeek(parseInt(time)); 1949 } 1950 } 1951 }, 1952 overFun: function(time) { 1953 timePrompt(time); 1954 } 1955 }; 1956 var timeClickObj = { 1957 refer: this.CB['timeBoBg'], 1958 grossValue: 'time', 1959 fun: function(time) { 1960 if(thisTemp.V) { 1961 if(thisTemp.V.duration > 0) { 1962 thisTemp.needSeek = 0; 1963 thisTemp.videoSeek(parseInt(time)); 1964 } 1965 } 1966 } 1967 }; 1968 var timeBoBgmousemove = function(event) { 1969 var timeBoBgXY = thisTemp.getCoor(thisTemp.CB['timeBoBg']); 1970 var eventX = thisTemp.client(event)['x']; 1971 var eventTime = parseInt((eventX - timeBoBgXY['x']) * thisTemp.V.duration / thisTemp.CB['timeBoBg'].offsetWidth); 1972 var buttonPromptObj = { 1973 title: thisTemp.formatTime(eventTime), 1974 x: eventX, 1975 y: timeBoBgXY['y'] 1976 }; 1977 thisTemp.promptShow(false, buttonPromptObj); 1978 var def = false; 1979 if(!thisTemp.isUndefined(thisTemp.CB['definitionP'])) { 1980 if(thisTemp.css(thisTemp.CB['definitionP'], 'display') != 'block') { 1981 def = true; 1982 } 1983 } 1984 if(thisTemp.vars['preview'] != null && def) { 1985 buttonPromptObj['time'] = eventTime; 1986 thisTemp.preview(buttonPromptObj); 1987 } 1988 }; 1989 var promptHide = function(event) { 1990 thisTemp.promptShow(false); 1991 if(thisTemp.previewDiv != null) { 1992 thisTemp.css([thisTemp.previewDiv, thisTemp.previewTop], 'display', 'none'); 1993 } 1994 }; 1995 if(!this.vars['live']) { //妿䏿¯ç´æ 1996 this.isTimeButtonDown = true; 1997 this.addListenerInside('mousemove', timeBoBgmousemove, this.CB['timeBoBg']); 1998 this.addListenerInside('mouseout', promptHide, this.CB['timeBoBg']); 1999 } else { 2000 this.isTimeButtonDown = false; 2001 timeObj['removeListenerInside'] = true; 2002 timeClickObj['removeListenerInside'] = true; 2003 } 2004 this.slider(timeObj); 2005 this.progressClick(timeClickObj); 2006 2007 }, 2008 /* 2009 å é¨å½æ° 2010 注åè°èæ¡ä¸åå»äºä»¶ï¼å å«é³éè°èæ¡åææ¾æ¶åº¦è°èæ¡ 2011 */ 2012 progressClick: function(obj) { 2013 /* 2014 refer:åè对象 2015 fun:è¿å彿° 2016 refer:åèå ç´ ï¼å³èæ¯ 2017 grossValue:è°ç¨çåèå¼ç±»å 2018 pd: 2019 */ 2020 //建ç«åèå ç´ çmouseClickäºä»¶ï¼ç¨æ¥åä¸ºé¼ æ å¨å ¶ä¸æä¸æ¶è§¦åçç¶æ 2021 var thisTemp = this; 2022 var referMouseClick = function(event) { 2023 var referX = thisTemp.client(event)['x'] - thisTemp.getCoor(obj['refer'])['x']; 2024 var rWidth = obj['refer'].offsetWidth; 2025 var grossValue = 0; 2026 if(obj['grossValue'] == 'volume') { 2027 grossValue = 100; 2028 } else { 2029 if(thisTemp.V) { 2030 grossValue = thisTemp.V.duration; 2031 } 2032 } 2033 var nowZ = parseInt(referX * grossValue / rWidth); 2034 if(obj['fun']) { 2035 if(obj['grossValue'] === 'time') { 2036 var sliderXY = thisTemp.getCoor(thisTemp.CB['timeButton']); 2037 sliderLeft = sliderXY['x']; 2038 if(!thisTemp.checkSlideLeft(referX, sliderLeft, rWidth)) { 2039 return; 2040 } 2041 var bimeButtonWB = thisTemp.CB['timeButton'].offsetWidth * 0.5; 2042 thisTemp.css(thisTemp.CB['timeButton'], 'left', (referX - bimeButtonWB) + 'px'); 2043 thisTemp.css(thisTemp.CB['timeProgress'], 'width', (referX) + 'px'); 2044 } 2045 obj['fun'](nowZ); 2046 } 2047 }; 2048 if(this.isUndefined(obj['removeListenerInside'])) { 2049 this.addListenerInside('click', referMouseClick, obj['refer']); 2050 } else { 2051 this.removeListenerInside('click', referMouseClick, obj['refer']); 2052 } 2053 2054 }, 2055 2056 /* 2057 å é¨å½æ° 2058 å ±ç¨çæ³¨åæ»åäºä»¶ 2059 */ 2060 slider: function(obj) { 2061 /* 2062 obj={ 2063 slider:æ»åå ç´ 2064 follow:è·éæ»åçå ç´ 2065 refer:åèå ç´ ï¼å³èæ¯ 2066 grossValue:è°ç¨çåèå¼ç±»å 2067 startFun:å¼å§è°ç¨çå ç´ 2068 monitorFun:çå¬å½æ° 2069 endFun:ç»æè°ç¨ç彿° 2070 overFun:é¼ æ æ¾ä¸å»åè°ç¨ç彿° 2071 pd:æ¯å¦éè¦ä¿®æ£ 2072 } 2073 */ 2074 var thisTemp = this; 2075 var clientX = 0, 2076 criterionWidth = 0, 2077 sliderLeft = 0, 2078 referLeft = 0; 2079 var value = 0; 2080 var calculation = function() { //æ ¹æ®æ»åçleft计ç®ç¾åæ¯ 2081 var sLeft = parseInt(thisTemp.css(obj['slider'], 'left')); 2082 var rWidth = obj['refer'].offsetWidth - obj['slider'].offsetWidth; 2083 var grossValue = 0; 2084 if(thisTemp.isUndefined(sLeft) || isNaN(sLeft)) { 2085 sLeft = 0; 2086 } 2087 if(obj['grossValue'] == 'volume') { 2088 grossValue = 100; 2089 } else { 2090 if(thisTemp.V) { 2091 grossValue = thisTemp.V.duration; 2092 } 2093 } 2094 return parseInt(sLeft * grossValue / rWidth); 2095 }; 2096 var mDown = function(event) { 2097 thisTemp.addListenerInside('mousemove', mMove, document); 2098 thisTemp.addListenerInside('mouseup', mUp, document); 2099 var referXY = thisTemp.getCoor(obj['refer']); 2100 var sliderXY = thisTemp.getCoor(obj['slider']); 2101 clientX = thisTemp.client(event)['x']; 2102 referLeft = referXY['x']; 2103 sliderLeft = sliderXY['x']; 2104 criterionWidth = clientX - sliderLeft; 2105 if(obj['startFun']) { 2106 obj['startFun'](calculation()); 2107 } 2108 }; 2109 var mMove = function(event) { 2110 clientX = thisTemp.client(event)['x']; 2111 var newX = clientX - criterionWidth - referLeft; 2112 if(newX < 0) { 2113 newX = 0; 2114 } 2115 if(newX > obj['refer'].offsetWidth - obj['slider'].offsetWidth) { 2116 newX = obj['refer'].offsetWidth - obj['slider'].offsetWidth; 2117 } 2118 if(obj['slider'] === thisTemp.CB['timeButton']) { 2119 if(!thisTemp.checkSlideLeft(newX, sliderLeft, obj['refer'].offsetWidth)) { 2120 return; 2121 } 2122 } 2123 thisTemp.css(obj['slider'], 'left', newX + 'px'); 2124 thisTemp.css(obj['follow'], 'width', (newX + obj['slider'].offsetWidth * 0.5) + 'px'); 2125 var nowZ = calculation(); 2126 if(obj['monitorFun']) { 2127 obj['monitorFun'](nowZ); 2128 } 2129 }; 2130 var mUp = function(event) { 2131 thisTemp.removeListenerInside('mousemove', mMove, document); 2132 thisTemp.removeListenerInside('mouseup', mUp, document); 2133 if(obj['endFun']) { 2134 obj['endFun'](calculation()); 2135 } 2136 }; 2137 var mOver = function(event) { 2138 if(obj['overFun']) { 2139 obj['overFun'](calculation()); 2140 } 2141 2142 }; 2143 if(this.isUndefined(obj['removeListenerInside'])) { 2144 this.addListenerInside('mousedown', mDown, obj['slider']); 2145 this.addListenerInside('mouseover', mOver, obj['slider']); 2146 } else { 2147 this.removeListenerInside('mousedown', mDown, obj['slider']); 2148 this.removeListenerInside('mouseover', mOver, obj['slider']); 2149 } 2150 }, 2151 /* 2152 å é¨å½æ° 2153 夿æ¯å¦å¯ä»¥æå¨è¿åº¦æé®æç¹å»è¿åº¦æ 2154 */ 2155 checkSlideLeft: function(newX, sliderLeft, refer) { 2156 var timeSA = this.ckplayerConfig['config']['timeScheduleAdjust']; 2157 switch(timeSA) { 2158 case 0: 2159 return false;
2160 break; 2161 case 2: 2162 if(newX < sliderLeft) { 2163 return false; 2164 } 2165 break; 2166 case 3: 2167 if(newX > sliderLeft) { 2168 return false; 2169 } 2170 break; 2171 case 4: 2172 if(!this.timeSliderLeftTemp) { 2173 this.timeSliderLeftTemp = sliderLeft / refer; 2174 } 2175 if(newX < this.timeSliderLeftTemp * refer) { 2176 return false; 2177 } 2178 break; 2179 case 5: 2180 if(!this.timeSliderLeftTemp) { 2181 this.timeSliderLeftTemp = sliderLeft / refer; 2182 } else { 2183 var timeSliderMax = sliderLeft / refer; 2184 if(timeSliderMax > this.timeSliderLeftTemp) { 2185 this.timeSliderLeftTemp = timeSliderMax; 2186 } 2187 } 2188 if(newX > this.timeSliderLeftTemp * refer) { 2189 return false; 2190 } 2191 break; 2192 default: 2193 return true; 2194 break; 2195 } 2196 return true; 2197 }, 2198 /* 2199 å é¨å½æ° 2200 æ¾ç¤ºloading 2201 */ 2202 loadingStart: function(rot) { 2203 var thisTemp = this; 2204 if(this.isUndefined(rot)) { 2205 rot = true; 2206 } 2207 if(this.showFace) { 2208 this.css(thisTemp.CB['loading'], 'display', 'none'); 2209 } 2210 if(this.timerLoading != null) { 2211 if(this.timerLoading.runing) { 2212 this.timerLoading.stop(); 2213 } 2214 this.timerLoading = null; 2215 } 2216 var buffer = 0; 2217 var loadingFun = function() { 2218 var nowRotate = '0'; 2219 try { 2220 nowRotate = thisTemp.css(thisTemp.CB['loadingCanvas'], 'transform') || thisTemp.css(thisTemp.CB['loadingCanvas'], '-ms-transform') || thisTemp.css(thisTemp.CB['loadingCanvas'], '-moz-transform') || thisTemp.css(thisTemp.CB['loadingCanvas'], '-webkit-transform') || thisTemp.css(thisTemp.CB['loadingCanvas'], '-o-transform') || '0'; 2221 } catch(event) {} 2222 nowRotate = parseInt(nowRotate.replace('rotate(', '').replace('deg);', ''));
2223 nowRotate += 4; 2224 if(nowRotate > 360) { 2225 nowRotate = 0; 2226 } 2227 if(thisTemp.showFace) { 2228 thisTemp.css(thisTemp.CB['loadingCanvas'], { 2229 transform: 'rotate(' + nowRotate + 'deg)', 2230 msTransform: 'rotate(' + nowRotate + 'deg)', 2231 mozTransform: 'rotate(' + nowRotate + 'deg)', 2232 webkitTransform: 'rotate(' + nowRotate + 'deg)', 2233 oTransform: 'rotate(' + nowRotate + 'deg)' 2234 }); 2235 } 2236 buffer++; 2237 if(buffer >= 99) { 2238 buffer = 99; 2239 } 2240 thisTemp.sendJS('buffer', buffer); 2241 }; 2242 if(rot) { 2243 this.timerLoading = new this.timer(10, loadingFun); 2244 //this.timerLoading.start(); 2245 if(this.showFace) { 2246 this.css(thisTemp.CB['loading'], 'display', 'block'); 2247 } 2248 } else { 2249 thisTemp.sendJS('buffer', 100); 2250 } 2251 }, 2252 /* 2253 å é¨å½æ° 2254 夿æ¯å¦éè¦æ¾ç¤ºä¸ä¸éåä¸ä¸é 2255 */ 2256 showFrontNext: function() { 2257 if(!this.showFace) { 2258 return; 2259 } 2260 if(this.vars['front']) { 2261 this.css([this.CB['front'], this.CB['frontLine']], 'display', 'block'); 2262 } else { 2263 this.css([this.CB['front'], this.CB['frontLine']], 'display', 'none'); 2264 } 2265 if(this.vars['next']) { 2266 this.css([this.CB['next'], this.CB['nextLine']], 'display', 'block'); 2267 } else { 2268 this.css([this.CB['next'], this.CB['nextLine']], 'display', 'none'); 2269 } 2270 }, 2271 /* 2272 å é¨å½æ° 2273 æ¾ç¤ºæç¤ºè¯ 2274 */ 2275 promptShow: function(ele, data) { 2276 if(!this.showFace) { 2277 return; 2278 } 2279 var obj = {}; 2280 if(ele || data) { 2281 if(!this.isUndefined(data)) { 2282 obj = data; 2283 } else { 2284 var offsetCoor = this.getCoor(ele); 2285 obj = { 2286 title: this.getDataset(ele, 'title'), 2287 x: offsetCoor['x'] + ele.offsetWidth * 0.5, 2288 y: offsetCoor['y'] 2289 }; 2290 } 2291 this.CB['prompt'].innerHTML = obj['title']; 2292 this.css(this.CB['prompt'], 'display', 'block'); 2293 var promoptWidth = this.getStringLen(obj['title']) * 10; 2294 this.css(this.CB['promptBg'], 'width', promoptWidth + 'px'); 2295 this.css(this.CB['prompt'], 'width', promoptWidth + 'px'); 2296 promoptWidth += 10; 2297 var x = obj['x'] - (promoptWidth * 0.5); 2298 var y = this.PD.offsetHeight - obj['y'] + 8; 2299 if(x < 0) { 2300 x = 0; 2301 } 2302 if(x > this.PD.offsetWidth - promoptWidth) { 2303 x = this.PD.offsetWidth - promoptWidth; 2304 } 2305 this.css([this.CB['promptBg'], this.CB['prompt']], { 2306 display: 'block', 2307 left: x + 'px', 2308 bottom: y + 'px' 2309 }); 2310 } else { 2311 this.css([this.CB['promptBg'], this.CB['prompt']], { 2312 display: 'none' 2313 }); 2314 } 2315 }, 2316 /* 2317 å é¨å½æ° 2318 çå¬é误 2319 */ 2320 timerErrorFun: function() { 2321 var thisTemp = this; 2322 this.errorSend = false; 2323 var clearIntervalError = function(event) { 2324 if(thisTemp.timerError != null) { 2325 if(thisTemp.timerError.runing) { 2326 thisTemp.timerError.stop(); 2327 } 2328 thisTemp.timerError = null; 2329 } 2330 }; 2331 var errorFun = function(event) { 2332 clearIntervalError(); 2333 thisTemp.error = true; 2334 //æåéè¯¯ææ¾å°å 2335 thisTemp.errorUrl = thisTemp.getVideoUrl(); 2336 //æåéè¯¯ææ¾å°åç»æ 2337 if(!thisTemp.errorSend) { 2338 thisTemp.errorSend = true; 2339 thisTemp.sendJS('error'); 2340 }
2341 if(thisTemp.showFace) { 2342 thisTemp.css(thisTemp.CB['errorText'], 'display', 'block'); 2343 thisTemp.css(thisTemp.CB['pauseCenter'], 'display', 'none'); 2344 thisTemp.css(thisTemp.CB['loading'], 'display', 'none'); 2345 } 2346 thisTemp.V.removeAttribute('poster'); 2347 thisTemp.resetPlayer(); 2348 }; 2349 var errorListenerFun = function(event) { 2350 window.setTimeout(function() { 2351 if(isNaN(thisTemp.V.duration)) { 2352 errorFun(event); 2353 } 2354 }, 500); 2355 2356 }; 2357 if(!this.errorAdd) { 2358 this.errorAdd = true; 2359 this.addListenerInside('error', errorListenerFun, this.V); 2360 } 2361 clearIntervalError(); 2362 var timerErrorFun = function() { 2363 if(thisTemp.V && parseInt(thisTemp.V.networkState) == 3) { 2364 errorFun(); 2365 } 2366 }; 2367 this.timerError = new this.timer(this.config['errorTime'], timerErrorFun); 2368 //this.timerError.start(); 2369 }, 2370 /* 2371 å é¨å½æ° 2372 æå»ºå¤æå ¨å±è¿æ¯éå ¨å±ç夿 2373 */ 2374 judgeFullScreen: function() { 2375 var thisTemp = this; 2376 if(this.timerFull != null) { 2377 if(this.timerFull.runing) { 2378 this.timerFull.stop(); 2379 } 2380 this.timerFull = null; 2381 } 2382 var fullFun = function() { 2383 thisTemp.isFullScreen(); 2384 }; 2385 this.timerFull = new this.timer(20, fullFun); 2386 }, 2387 /* 2388 å é¨å½æ° 2389 夿æ¯å¦æ¯å ¨å± 2390 */ 2391 isFullScreen: function() { 2392 if(!this.showFace) { 2393 return; 2394 } 2395 var fullState = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement; 2396 if(fullState && !this.full) { 2397 this.full = true; 2398 this.sendJS('full', true); 2399 this.elementCoordinate(); 2400 this.css(this.CB['full'], 'display', 'none'); 2401 this.css(this.CB['escFull'], 'display', 'block'); 2402 if(this.vars['live'] == 0) { 2403 this.timeUpdateHandler(); 2404 } 2405 this.PD.appendChild(this.CB['menu']); 2406 } 2407 if(!fullState && this.full) { 2408 this.full = false; 2409 this.sendJS('full', false); 2410 this.elementCoordinate(); 2411 this.css(this.CB['full'], 'display', 'block'); 2412 this.css(this.CB['escFull'], 'display', 'none'); 2413 if(this.timerFull != null) { 2414 if(this.timerFull.runing) { 2415 this.timerFull.stop(); 2416 } 2417 this.timerFull = null; 2418 } 2419 if(this.vars['live'] == 0) { 2420 this.timeUpdateHandler(); 2421 } 2422 this.body.appendChild(this.CB['menu']); 2423 } 2424 }, 2425 /* 2426 å é¨å½æ° 2427 æå»ºå³é®å 容忳¨åç¸å ³å¨ä½äºä»¶ 2428 */ 2429 newMenu: function() { 2430 var thisTemp = this; 2431 var i = 0; 2432 this.css(this.CB['menu'], { 2433 backgroundColor: '#FFFFFF', 2434 padding: '5px', 2435 position: 'absolute', 2436 left: '10px', 2437 top: '20px', 2438 display: 'none', 2439 zIndex: '999', 2440 color: '#A1A9BE', 2441 boxShadow: '2px 2px 3px #AAAAAA' 2442 }); 2443 var mArr = this.contextMenu; 2444 var cMenu = this.ckplayerConfig['menu']; 2445 if(cMenu['name']) { 2446 if(cMenu['link']) { 2447 mArr[0] = [cMenu['name'], 'link', cMenu['link']]; 2448 } else { 2449 mArr[0] = [cMenu['name'], 'default']; 2450 } 2451 } 2452 if(cMenu['version']) { 2453 mArr[1] = [cMenu['version'], 'default', 'line']; 2454 } 2455 if(cMenu['more']) { 2456 if(typeof(cMenu['more']) == 'object') { 2457 if(cMenu['more'].length > 0) { 2458 var moreArr = cMenu['more']; 2459 for(i = 0; i < moreArr.length; i++) { 2460 var mTemp = moreArr[i]; 2461 var arrTemp = []; 2462 if(mTemp['name']) { 2463 arrTemp.push(mTemp['name']); 2464 } 2465 if(mTemp['clickEvent'] && mTemp['clickEvent'] != 'none') { 2466 var eveObj = this.clickEvent(mTemp['clickEvent']); 2467 arrTemp.push(eveObj['type']); 2468 if(eveObj['fun']) { 2469 arrTemp.push(eveObj['fun']); 2470 } 2471 if(eveObj['link']) { 2472 arrTemp.push(eveObj['link']); 2473 } 2474 if(eveObj['target']) { 2475 arrTemp.push(' target="' + eveObj['target'] + '"'); 2476 } 2477 } 2478 if(mTemp['separatorBefore']) { 2479 arrTemp.push('line'); 2480 } 2481 mArr.push(arrTemp); 2482 } 2483 } 2484 } 2485 } 2486 var html = ''; 2487 for(i = 0; i < mArr.length; i++) { 2488 var me = mArr[i]; 2489 switch(me[1]) { 2490 case 'default': 2491 html += '<p>' + me[0] + '</p>'; 2492 break; 2493 case 'link': 2494 html += '<p><a href="' + me[2] + '"' + me[3] + '>
2494' + me[0] + '</a></p>'; 2495 break; 2496 case 'javaScript': 2497 html += '<p><a href="javascript:' + me[2] + '">' + me[0] + '</a></p>'; 2498 break; 2499 case 'actionScript': 2500 html += '<p><a href="javascript:' + this.vars['variable'] + me[2].replace('thisTemp', '') + '">' + me[0] + '</a></p>'; 2501 break; 2502 default: 2503 break; 2504 } 2505 } 2506 this.CB['menu'].innerHTML = html; 2507 var pArr = this.CB['menu'].childNodes; 2508 for(i = 0; i < pArr.length; i++) { 2509 this.css(pArr[i], { 2510 height: '30px', 2511 lineHeight: '30px', 2512 margin: '0px', 2513 fontFamily: this.fontFamily, 2514 fontSize: '12px', 2515 paddingLeft: '10px', 2516 paddingRight: '30px' 2517 }); 2518 if(mArr[i][mArr[i].length - 1] == 'line') { 2519 this.css(pArr[i], 'borderBottom', '1px solid #e9e9e9'); 2520 } 2521 var aArr = pArr[i].childNodes; 2522 for(var n = 0; n < aArr.length; n++) { 2523 if(aArr[n].localName == 'a') { 2524 this.css(aArr[n], { 2525 color: '#000000', 2526 textDecoration: 'none' 2527 }); 2528 } 2529 } 2530 } 2531 this.PD.oncontextmenu = function(event) { 2532 var eve = event || window.event; 2533 var client = thisTemp.client(event); 2534 if(eve.button == 2) { 2535 eve.returnvalue = false; 2536 var x = client['x'] + thisTemp.pdCoor['x'] - 2; 2537 var y = client['y'] + thisTemp.pdCoor['y'] - 2; 2538 thisTemp.css(thisTemp.CB['menu'], { 2539 display: 'block', 2540 left: x + 'px', 2541 top: y + 'px' 2542 }); 2543 return false; 2544 } 2545 return true; 2546 }; 2547 var setTimeOutPClose = function() { 2548 if(setTimeOutP) { 2549 window.clearTimeout(setTimeOutP); 2550 setTimeOutP = null; 2551 } 2552 }; 2553 var setTimeOutP = null; 2554 var mouseOut = function(event) { 2555 setTimeOutPClose(); 2556 setTimeOutP = window.setTimeout(function(event) { 2557 thisTemp.css(thisTemp.CB['menu'], 'display', 'none'); 2558 }, 500); 2559 }; 2560 this.addListenerInside('mouseout', mouseOut, thisTemp.CB['menu']); 2561 var mouseOver = function(event) { 2562 setTimeOutPClose(); 2563 }; 2564 this.addListenerInside('mouseover', mouseOver, thisTemp.CB['menu']); 2565 2566 }, 2567 /* 2568 å é¨å½æ° 2569 æå»ºæ§å¶æ éèäºä»¶ 2570 */ 2571 controlBarHide: function(hide) { 2572 var thisTemp = this; 2573 var client = { 2574 x: 0, 2575 y: 0 2576 }, 2577 oldClient = { 2578 x: 0, 2579 y: 0 2580 }; 2581 var cShow = true, 2582 force = false; 2583 var oldCoor = [0, 0]; 2584 var controlBarShow = function(show) { 2585 if(show && !cShow && thisTemp.controlBarIsShow) { 2586 cShow = true; 2587 thisTemp.sendJS('controlBar', true); 2588 thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'block'); 2589 thisTemp.css(thisTemp.CB['controlBar'], 'display', 'block'); 2590 thisTemp.css(thisTemp.CB['timeProgressBg'], 'display', 'block'); 2591 thisTemp.css(thisTemp.CB['timeBoBg'], 'display', 'block'); 2592 thisTemp.changeVolume(thisTemp.volume); 2593 thisTemp.changeLoad(); 2594 if(!thisTemp.timerBuffer) { 2595 thisTemp.bufferEdHandler(); 2596 } 2597 } else { 2598 if(cShow) { 2599 cShow = false; 2600 var paused = thisTemp.getMetaDate()['paused']; 2601 if(force) { 2602 paused = false; 2603 } 2604 if(!paused) { 2605 thisTemp.sendJS('controlBar', false); 2606 thisTemp.css(thisTemp.CB['controlBarBg'], 'display', 'none'); 2607 thisTemp.css(thisTemp.CB['controlBar'], 'display', 'none'); 2608 thisTemp.css(thisTemp.CB['timeProgressBg'], 'display', 'none'); 2609 thisTemp.css(thisTemp.CB['timeBoBg'], 'display', 'none'); 2610 thisTemp.promptShow(false); 2611 2612 } 2613 } 2614 } 2615 }; 2616 var cbarFun = function(event) { 2617 if(client['x'] == oldClient['x'] && client['y'] == oldClient['y']) { 2618 var cdH = parseInt(thisTemp.CD.offsetHeight); 2619 if((client['y'] < cdH - 50 || client['y'] > cdH - 2) && cShow) { 2620 controlBarShow(false); 2621 } 2622 } else { 2623 if(!cShow) { 2624 controlBarShow(true); 2625 } 2626 } 2627 oldClient = { 2628 x: client['x'], 2629 y: client['y'] 2630 } 2631 }; 2632 this.timerCBar = new this.timer(2000, cbarFun); 2633 var cdMove = function(event) { 2634 var getClient = thisTemp.client(event); 2635 client['x'] = getClient['x']; 2636 client['y'] = getClient['y']; 2637 if(!cShow) { 2638 controlBarShow(true); 2639 } 2640 }; 2641 this.addListenerInside('mousemove', cdMove, thisTemp.CD); 2642 this.addListenerInside('ended', cdMove); 2643 this.addListenerInside('resize', cdMove, window); 2644 if(hide === true) { 2645 cShow = true; 2646 force = true; 2647 controlBarShow(false); 2648 } 2649 if(hide === false) { 2650 cShow = false;
2651 force = true; 2652 controlBarShow(true); 2653 } 2654 }, 2655 2656 /* 2657 å é¨å½æ° 2658 注åé®çæé®äºä»¶ 2659 */ 2660 keypress: function() { 2661 var thisTemp = this; 2662 var keyDown = function(eve) { 2663 var keycode = eve.keyCode || eve.which; 2664 switch(keycode) { 2665 case 32: 2666 thisTemp.playOrPause(); 2667 break; 2668 case 37: 2669 thisTemp.fastBack(); 2670 break; 2671 case 39: 2672 thisTemp.fastNext(); 2673 break; 2674 case 38: 2675 now = thisTemp.volume + thisTemp.ckplayerConfig['config']['volumeJump']; 2676 thisTemp.changeVolume(now > 1 ? 1 : now); 2677 break; 2678 case 40: 2679 now = thisTemp.volume - thisTemp.ckplayerConfig['config']['volumeJump']; 2680 thisTemp.changeVolume(now < 0 ? 0 : now); 2681 break; 2682 default: 2683 break; 2684 } 2685 }; 2686 this.addListenerInside('keydown', keyDown, window || document); 2687 }, 2688 /* 2689 å é¨å½æ° 2690 注ååéç¸å ³ 2691 */ 2692 playbackRate: function() { 2693 if(!this.showFace) { 2694 return; 2695 } 2696 var thisTemp = this; 2697 var vArr = this.playbackRateArr; 2698 var html = ''; 2699 var nowD = ''; //å½åçæ¸ æ°åº¦ 2700 var i = 0; 2701 if(!nowD) { 2702 nowD = vArr[this.playbackRateDefault][1]; 2703 } 2704 if(vArr.length > 1) { 2705 var zlen = 0; 2706 for(i = 0; i < vArr.length; i++) { 2707 html = '<p>' + vArr[i][1] + '</p>' + html; 2708 var dlen = this.getStringLen(vArr[i][1]); 2709 if(dlen > zlen) { 2710 zlen = dlen; 2711 } 2712 } 2713 if(html) { 2714 html += '<p>' + nowD + '</p>'; 2715 } 2716 this.CB['playbackrate'].innerHTML = nowD; 2717 this.CB['playbackrateP'].innerHTML = html; 2718 this.css([this.CB['playbackrate'], this.CB['playbackrateLine']], 'display', 'block'); 2719 var pArr = this.CB['playbackrateP'].childNodes; 2720 for(var i = 0; i < pArr.length; i++) { 2721 var fontColor = '#FFFFFF'; 2722 if(pArr[i].innerHTML == nowD) { 2723 fontColor = '#0782F5'; 2724 } 2725 this.css(pArr[i], { 2726 color: fontColor, 2727 margin: '0px', 2728 padding: '0px', 2729 fontSize: '14px' 2730 }); 2731 if(i < pArr.length - 1) { 2732 this.css(pArr[i], 'borderBottom', '1px solid #282828') 2733 } 2734 var defClick = function(event) { 2735 if(nowD != this.innerHTML) { 2736 thisTemp.css(thisTemp.CB['playbackrateP'], 'display', 'none'); 2737 thisTemp.newPlaybackrate(this.innerHTML); 2738 thisTemp.sendJS('clickEvent', 'actionScript->newPlaybackrate'); 2739 } 2740 }; 2741 this.addListenerInside('click', defClick, pArr[i]); 2742 2743 } 2744 var pW = (zlen * 10) + 20; 2745 this.css(this.CB['playbackrateP'], { 2746 width: pW + 'px' 2747 }); 2748 this.css(this.CB['playbackrate'], { 2749 width: pW + 'px' 2750 }); 2751 this.buttonWidth['playbackrate'] = this.CB['playbackrate'].offsetWidth; 2752 } else { 2753 this.CB['playbackrate'].innerHTML = ''; 2754 this.CB['playbackrateP'].innerHTML = ''; 2755 this.css([this.CB['playbackrate'], this.CB['playbackrateLine']], 'display', 'none'); 2756 } 2757 }, 2758 /* 2759 å é¨å½æ° 2760 注å忢åéææ¾ç¸å ³äºä»¶ 2761 */ 2762 addPlaybackrate: function() { 2763 var thisTemp = this; 2764 var setTimeOutP = null; 2765 var defClick = function(event) { 2766 thisTemp.css(thisTemp.CB['playbackrateP'], { 2767 left: thisTemp.getCoor(thisTemp.CB['playbackrate'])['x'] + 'px', 2768 display: 'block' 2769 }); 2770 }; 2771 this.addListenerInside('click', defClick, this.CB['playbackrate']); 2772 var defMouseOut = function(event) { 2773 if(setTimeOutP) { 2774 window.clearTimeout(setTimeOutP); 2775 setTimeOutP = null; 2776 } 2777 setTimeOutP = window.setTimeout(function(event) { 2778 thisTemp.css(thisTemp.CB['playbackrateP'], 'display', 'none'); 2779 }, 500); 2780 }; 2781 this.addListenerInside('mouseout', defMouseOut, thisTemp.CB['playbackrateP']); 2782 var defMouseOver = function(event) { 2783 if(setTimeOutP) { 2784 window.clearTimeout(setTimeOutP); 2785 setTimeOutP = null; 2786 } 2787 }; 2788 this.addListenerInside('mouseover', defMouseOver, thisTemp.CB['playbackrateP']); 2789 }, 2790 /* 2791 å é¨å½æ° 2792 忢åéååççå¨ä½ 2793 */ 2794 newPlaybackrate: function(title) { 2795 var vArr = this.playbackRateArr; 2796 var nVArr = []; 2797 var i = 0; 2798 for(i = 0; i < vArr.length; i++) { 2799 var v = vArr[i]; 2800 if(v[1] == title) { 2801 this.playbackRateDefault = i; 2802 this.V.playbackRate = v[0];
2803 if(this.showFace) { 2804 this.CB['playbackrate'].innerHTML = v[1]; 2805 this.playbackRate(); 2806 } 2807 this.sendJS('playbackRate', v); 2808 } 2809 } 2810 }, 2811 2812 /* 2813 å é¨å½æ° 2814 æå»ºæ¸ æ°åº¦æé®å忢äºä»¶(Clickäºä»¶) 2815 */ 2816 definition: function() { 2817 if(!this.showFace) { 2818 return; 2819 } 2820 var thisTemp = this; 2821 var vArr = this.VA; 2822 var dArr = []; 2823 var html = ''; 2824 var nowD = ''; //å½åçæ¸ æ°åº¦ 2825 var i = 0; 2826 for(i = 0; i < vArr.length; i++) { 2827 var d = vArr[i][2]; 2828 if(dArr.indexOf(d) == -1) { 2829 dArr.push(d); 2830 } 2831 if(this.V) { 2832 if(vArr[i][0] == this.V.currentSrc) { 2833 nowD = d; 2834 } 2835 } 2836 } 2837 if(!nowD) { 2838 nowD = dArr[0]; 2839 } 2840 if(dArr.length > 1) { 2841 var zlen = 0; 2842 for(i = dArr.length - 1; i > -1; i--) { 2843 html = '<p>' + dArr[i] + '</p>' + html; 2844 var dlen = this.getStringLen(dArr[i]); 2845 if(dlen > zlen) { 2846 zlen = dlen; 2847 } 2848 } 2849 if(html) { 2850 html += '<p>' + nowD + '</p>'; 2851 } 2852 this.CB['definition'].innerHTML = nowD; 2853 this.CB['definitionP'].innerHTML = html; 2854 this.css([this.CB['definition'], this.CB['definitionLine']], 'display', 'block'); 2855 var pArr = this.CB['definitionP'].childNodes; 2856 for(var i = 0; i < pArr.length; i++) { 2857 var fontColor = '#FFFFFF'; 2858 if(pArr[i].innerHTML == nowD) { 2859 fontColor = '#0782F5'; 2860 } 2861 this.css(pArr[i], { 2862 color: fontColor, 2863 margin: '0px', 2864 padding: '0px', 2865 fontSize: '14px' 2866 }); 2867 if(i < pArr.length - 1) { 2868 this.css(pArr[i], 'borderBottom', '1px solid #282828') 2869 } 2870 var defClick = function() { 2871 if(nowD != this.innerHTML) { 2872 thisTemp.css(thisTemp.CB['definitionP'], 'display', 'none'); 2873 thisTemp.newDefinition(this.innerHTML); 2874 } 2875 }; 2876 this.addListenerInside('click', defClick, pArr[i]); 2877 2878 } 2879 var pW = (zlen * 10) + 20; 2880 this.css(this.CB['definitionP'], { 2881 width: pW + 'px' 2882 }); 2883 this.css(this.CB['definition'], { 2884 width: pW + 'px' 2885 }); 2886 this.buttonWidth['definition'] = this.CB['definition'].offsetWidth; 2887 } else { 2888 this.CB['definition'].innerHTML = ''; 2889 this.CB['definitionP'].innerHTML = ''; 2890 this.css([this.CB['definition'], this.CB['definitionLine']], 'display', 'none'); 2891 } 2892 }, 2893 /* 2894 å é¨å½æ° 2895 æ³¨åæ¸ æ°åº¦ç¸å ³äºä»¶ 2896 */ 2897 addDefListener: function() { 2898 var thisTemp = this; 2899 var setTimeOutP = null; 2900 var defClick = function(event) { 2901 thisTemp.css(thisTemp.CB['definitionP'], { 2902 left: thisTemp.getCoor(thisTemp.CB['definition'])['x'] + 'px', 2903 display: 'block' 2904 }); 2905 }; 2906 this.addListenerInside('click', defClick, this.CB['definition']); 2907 var defMouseOut = function(event) { 2908 if(setTimeOutP) { 2909 window.clearTimeout(setTimeOutP); 2910 setTimeOutP = null; 2911 } 2912 setTimeOutP = window.setTimeout(function(event) { 2913 thisTemp.css(thisTemp.CB['definitionP'], 'display', 'none'); 2914 }, 500); 2915 }; 2916 this.addListenerInside('mouseout', defMouseOut, thisTemp.CB['definitionP']); 2917 var defMouseOver = function(event) { 2918 if(setTimeOutP) { 2919 window.clearTimeout(setTimeOutP); 2920 setTimeOutP = null; 2921 } 2922 }; 2923 this.addListenerInside('mouseover', defMouseOver, thisTemp.CB['definitionP']); 2924 }, 2925 /* 2926 å é¨å½æ° 2927 åæ¢æ¸ æ°åº¦ååççå¨ä½ 2928 */ 2929 newDefinition: function(title) { 2930 var vArr = this.VA; 2931 var nVArr = []; 2932 var i = 0; 2933 for(i = 0; i < vArr.length; i++) { 2934 var v = vArr[i]; 2935 if(v[2] == title) { 2936 nVArr.push(v); 2937 this.sendJS('definitionChange', i + ''); 2938 } 2939 } 2940 if(nVArr.length < 1) { 2941 return; 2942 } 2943 if(this.V != null && this.needSeek == 0) { 2944 this.needSeek = this.V.currentTime; 2945 } 2946 if(this.getFileExt(nVArr[0][0]) != '.m3u8') { 2947 this.isM3u8 = false; 2948 } 2949 if(!this.isM3u8) { 2950 if(nVArr.length == 1) { 2951 this.V.innerHTML = ''; 2952 this.V.src = nVArr[0][0]; 2953 } else { 2954 var source = ''; 2955 nVArr = this.arrSort(nVArr); 2956 for(i = 0; i < nVArr.length; i++) { 2957 var type = ''; 2958 var va = nVArr[i]; 2959 if(va[1]) { 2960 type = ' type="' + va[1] + '"'; 2961 } 2962 source += '<source src="' + va[0] + '"' + type + '>'; 2963 } 2964 this.V.removeAttribute('src'); 2965 this.V.innerHTML = source; 2966 } 2967 } else { 2968 this.embedHls(vArr[0][0], this.vars['autoplay']); 2969 } 2970 this.V.autoplay = 'autoplay'; 2971 this.V.load(); 2972 this.timerErrorFun(); 2973 }, 2974 /* 2975 å ç½®å½æ° 2976 ææ¾hls 2977 */ 2978 embedHls: function(url, autoplay) { 2979 var thisTemp = this; 2980 if(Hls.isSupported()) { 2981 var hls = new Hls(); 2982 hls.loadSource(url); 2983 hls.attachMedia(this.V); 2984 hls.on(Hls.Events.MANIFEST_PARSED, function() { 2985 thisTemp.playerLoad(); 2986 if(autoplay) { 2987 thisTemp.videoPlay(); 2988 } 2989 }); 2990 } 2991 }, 2992 /* 2993 å é¨å½æ° 2994 æå»ºæç¤ºç¹ 2995 */ 2996 prompt: function() {
2997 if(!this.showFace) { 2998 return; 2999 } 3000 var thisTemp = this; 3001 var prompt = this.vars['promptSpot']; 3002 if(prompt == null || this.promptArr.length > 0) { 3003 return; 3004 } 3005 var showPrompt = function(event) { 3006 if(thisTemp.promptElement == null) { 3007 var random2 = 'prompte' + thisTemp.randomString(5); 3008 var ele2 = document.createElement('div'); 3009 ele2.className = random2; 3010 thisTemp.PD.appendChild(ele2); 3011 thisTemp.promptElement = thisTemp.getByElement(random2); 3012 thisTemp.css(thisTemp.promptElement, { 3013 overflowX: 'hidden', 3014 lineHeight: '22px', 3015 fontSize: '14px', 3016 color: '#FFFFFF', 3017 position: 'absolute', 3018 display: 'block', 3019 zIndex: '90' 3020 }); 3021 } 3022 var pcon = thisTemp.getPromptTest(); 3023 var pW = pcon['pW'], 3024 pT = pcon['pT'], 3025 pL = parseInt(thisTemp.css(this, 'left')) - parseInt(pW * 0.5); 3026 if(pcon['pL'] > 10) { 3027 pL = pcon['pL']; 3028 } 3029 if(pL < 0) { 3030 pL = 0; 3031 } 3032 thisTemp.css(thisTemp.promptElement, { 3033 width: pW + 'px', 3034 left: (-pW - 10) + 'px', 3035 display: 'block' 3036 }); 3037 thisTemp.promptElement.innerHTML = thisTemp.getDataset(this, 'words'); 3038 thisTemp.css(thisTemp.promptElement, { 3039 left: pL + 'px', 3040 top: (pT - thisTemp.promptElement.offsetHeight - 10) + 'px' 3041 }); 3042 }; 3043 var hidePrompt = function(event) { 3044 if(thisTemp.promptElement != null) { 3045 thisTemp.css(thisTemp.promptElement, { 3046 display: 'none' 3047 }); 3048 } 3049 }; 3050 var i = 0; 3051 for(i = 0; i < prompt.length; i++) { 3052 var pr = prompt[i]; 3053 var words = pr['words']; 3054 var time = pr['time']; 3055 var random = 'prompt' + this.randomString(5); 3056 var ele = document.createElement('div'); 3057 ele.className = random; 3058 this.CB['timeBoBg'].appendChild(ele); 3059 var div = this.getByElement(random); 3060 div.setAttribute('data-time', time); 3061 div.setAttribute('data-words', words); 3062 this.css(div, { 3063 width: '6px', 3064 height: '6px', 3065 backgroundColor: '#FFFFFF', 3066 position: 'absolute', 3067 top: '4px', 3068 left: '-100px', 3069 display: 'none', 3070 zIndex: '1', 3071 borderRadius: '6px' 3072 }); 3073 3074 this.addListenerInside('mouseover', showPrompt, div); 3075 this.addListenerInside('mouseout', hidePrompt, div); 3076 this.promptArr.push(div); 3077 } 3078 this.changePrompt(); 3079 }, 3080 /* 3081 å é¨å½æ° 3082 è®¡ç®æç¤ºææ¬çä½ç½® 3083 */ 3084 getPromptTest: function() { 3085 var pW = this.previewWidth, 3086 pT = this.getCoor(this.CB['timeButton'])['y'], 3087 pL = 0; 3088 if(this.previewTop != null) { 3089 pT -= parseInt(this.css(this.previewTop, 'height')); 3090 pL = parseInt(this.css(this.previewTop, 'left')); 3091 } else { 3092 pT -= 35; 3093 } 3094 pL += 2; 3095 if(pL < 0) { 3096 pL = 0; 3097 } 3098 if(pL > this.PD.offsetWidth - pW) { 3099 pL = this.PD.offsetWidth - pW; 3100 } 3101 return { 3102 pW: pW, 3103 pT: pT, 3104 pL: pL 3105 }; 3106 }, 3107 /* 3108 å é¨å½æ° 3109 å é¤æç¤ºç¹ 3110 */ 3111 deletePrompt: function() { 3112 var arr = this.promptArr; 3113 if(arr.length > 0) { 3114 for(var i = 0; i < arr.length; i++) { 3115 if(arr[i]) { 3116 this.deleteChild(arr[i]); 3117 } 3118 } 3119 } 3120 this.promptArr = []; 3121 }, 3122 /* 3123 å é¨å½æ° 3124 è®¡ç®æç¤ºç¹åæ 3125 */ 3126 changePrompt: function() { 3127 if(this.promptArr.length == 0) { 3128 return; 3129 } 3130 var arr = this.promptArr; 3131 var duration = this.getMetaDate()['duration']; 3132 var bw = this.CB['timeBoBg'].offsetWidth; 3133 for(var i = 0; i < arr.length; i++) { 3134 var time = parseInt(this.getDataset(arr[i], 'time')); 3135 var left = parseInt(time * bw / duration) - parseInt(arr[i].offsetWidth * 0.5); 3136 if(left < 0) { 3137 left = 0; 3138 } 3139 if(left > bw - parseInt(arr[i].offsetWidth * 0.5)) { 3140 left = bw - parseInt(arr[i].offsetWidth * 0.5); 3141 } 3142 this.css(arr[i], { 3143 left: left + 'px', 3144 display: 'block' 3145 }); 3146 } 3147 }, 3148 /* 3149 å é¨å½æ° 3150 æå»ºé¢è§å¾çææ 3151 */ 3152 preview: function(obj) { 3153 var thisTemp = this; 3154 var preview = { 3155 file: null, 3156 scale: 0 3157 }; 3158 preview = this.standardization(preview, this.vars['preview']); 3159 if(preview['file'] == null || preview['scale'] <= 0) { 3160 return; 3161 }
3162 var srcArr = preview['file']; 3163 if(this.previewStart == 0) { //å¦æè¿æ²¡ææå»ºï¼åå è¿è¡æå»º 3164 this.previewStart = 1; 3165 if(srcArr.length > 0) { 3166 var i = 0; 3167 var imgW = 0, 3168 imgH = 0; 3169 var random = thisTemp.randomString(10); 3170 var loadNum = 0; 3171 var loadImg = function(i) { 3172 srcArr[i] = thisTemp.getNewUrl(srcArr[i]); 3173 var n = 0; 3174 var img = new Image(); 3175 img.src = srcArr[i]; 3176 img.className = random + i; 3177 img.onload = function(event) { 3178 loadNum++; 3179 if(thisTemp.previewDiv == null) { //å¦ææ²¡æå»ºç«DIVï¼å建 3180 imgW = img.width; 3181 imgH = img.height; 3182 thisTemp.previewWidth = parseInt(imgW * 0.1); 3183 var ele = document.createElement('div'); 3184 ele.className = random; 3185 thisTemp.PD.appendChild(ele); 3186 thisTemp.previewDiv = thisTemp.getByElement(random); 3187 var eleTop = (obj['y'] - parseInt(imgH * 0.1) + 2); 3188 thisTemp.css(thisTemp.previewDiv, { 3189 width: srcArr.length * imgW * 10 + 'px', 3190 height: parseInt(imgH * 0.1) + 'px', 3191 backgroundColor: '#000000', 3192 position: 'absolute', 3193 left: '0px', 3194 top: eleTop + 'px', 3195 display: 'none', 3196 zIndex: '80' 3197 }); 3198 ele.setAttribute('data-x', '0'); 3199 ele.setAttribute('data-y', eleTop); 3200 var ele2 = document.createElement('div'); 3201 ele2.className = random + 'd2'; 3202 thisTemp.PD.appendChild(ele2); 3203 thisTemp.previewTop = thisTemp.getByElement(ele2.className); 3204 thisTemp.css(thisTemp.previewTop, { 3205 width: parseInt(imgW * 0.1) + 'px', 3206 height: parseInt(imgH * 0.1) + 'px', 3207 position: 'absolute', 3208 border: '5px solid ' + thisTemp.css(thisTemp.CB['timeProgress'], 'backgroundColor'), 3209 left: '0px', 3210 top: (obj['y'] - parseInt(imgH * 0.1) + 2) + 'px', 3211 display: 'none', 3212 zIndex: '81' 3213 }); 3214 var html = ''; 3215 for(n = 0; n < srcArr.length; n++) { 3216 html += thisTemp.newCanvas(random + n, imgW * 10, parseInt(imgH * 0.1)) 3217 } 3218 thisTemp.previewDiv.innerHTML = html; 3219 } 3220 thisTemp.previewDiv.appendChild(img); 3221 var cimg = thisTemp.getByElement(img.className); 3222 var canvas = thisTemp.getByElement(img.className + '-canvas'); 3223 var context = canvas.getContext('2d'); 3224 var sx = 0, 3225 sy = 0, 3226 x = 0, 3227 h = parseInt(imgH * 0.1); 3228 for(n = 0; n < 100; n++) { 3229 x = parseInt(n * imgW * 0.1); 3230 context.drawImage(cimg, sx, sy, parseInt(imgW * 0.1), h, x, 0, parseInt(imgW * 0.1), h); 3231 sx += parseInt(imgW * 0.1); 3232 if(sx >= imgW) { 3233 sx = 0; 3234 sy += h; 3235 } 3236 thisTemp.css(cimg, 'display', 'none'); 3237 } 3238 if(loadNum == srcArr.length) { 3239 thisTemp.previewStart = 2; 3240 } else { 3241 i++; 3242 loadImg(i); 3243 } 3244 }; 3245 }; 3246 } 3247 loadImg(i); 3248 return; 3249 } 3250 if(this.previewStart == 2) { 3251 var isTween = true; 3252 var nowNum = parseInt(obj['time'] / this.vars['preview']['scale']); 3253 var numTotal = parseInt(thisTemp.getMetaDate()['duration'] / this.vars['preview']['scale']); 3254 if(thisTemp.css(thisTemp.previewDiv, 'display') == 'none') { 3255 isTween = false; 3256 } 3257 thisTemp.css(thisTemp.previewDiv, 'display', 'block'); 3258 var imgWidth = thisTemp.previewDiv.offsetWidth * 0.01 / srcArr.length; 3259 var left = (imgWidth * nowNum) - obj['x'] + parseInt(imgWidth * 0.5), 3260 top = obj['y'] - thisTemp.previewDiv.offsetHeight; 3261 thisTemp.css(thisTemp.previewDiv, 'top', top + 2 + 'px'); 3262 var topLeft = obj['x'] - parseInt(imgWidth * 0.5); 3263 var timepieces = 0; 3264 if(topLeft < 0) { 3265 topLeft = 0; 3266 timepieces = obj['x'] - topLeft - imgWidth * 0.5; 3267 } 3268 if(topLeft > thisTemp.PD.offsetWidth - imgWidth) { 3269 topLeft = thisTemp.PD.offsetWidth - imgWidth; 3270 timepieces = obj['x'] - topLeft - imgWidth * 0.5; 3271 } 3272 if(left < 0) { 3273 left = 0; 3274 } 3275 if(left > numTotal * imgWidth - thisTemp.PD.offsetWidth) { 3276 left = numTotal * imgWidth - thisTemp.PD.offsetWidth; 3277 } 3278 thisTemp.css(thisTemp.previewTop, { 3279 left: topLeft + 'px', 3280 top: top + 2 + 'px', 3281 display: 'block' 3282 }); 3283 if(thisTemp.previewTop.offsetHeight > thisTemp.previewDiv.offsetHeight) { 3284 thisTemp.css(thisTemp.previewTop, { 3285 height: thisTemp.previewDiv.offsetHeight - (thisTemp.previewTop.offsetHeight - thisTemp.previewDiv.offsetHeight) + 'px' 3286 }); 3287 } 3288 if(this.previewTween != null) { 3289 this.animatePause(this.previewTween); 3290 this.previewTween = null 3291 } 3292 var nowLeft = parseInt(thisTemp.css(thisTemp.previewDiv, 'left')); 3293 var leftC = nowLeft + left; 3294 if(nowLeft == -(left + timepieces)) { 3295 return; 3296 } 3297 if(isTween) { 3298 var obj = { 3299 element: thisTemp.previewDiv, 3300 start: null, 3301 end: -(left + timepieces), 3302 speed: 0.3 3303 }; 3304 this.previewTween = this.animate(obj); 3305 } else { 3306 thisTemp.css(thisTemp.previewDiv, 'left', -(left + timepieces) + 'px') 3307 } 3308 } 3309 }, 3310 /* 3311 å é¨å½æ° 3312 å é¤é¢è§å¾èç¹ 3313 */ 3314 deletePreview: function() { 3315 if(this.previewDiv != null) { 3316 this.deleteChild(this.previewDiv); 3317 this.previewDiv = null; 3318 this.previewStart = 0; 3319 } 3320 }, 3321 /* 3322 å é¨å½æ° 3323 ä¿®æ¹è§é¢å°åï¼å±æ§ 3324 */ 3325 changeVideo: function() { 3326 if(!this.html5Video) { 3327 this.getVarsObject(); 3328 this.V.newVideo(this.vars); 3329 return; 3330 } 3331 var vArr = this.VA; 3332 var v = this.vars; 3333 var i = 0; 3334 if(vArr.length < 1) { 3335 return; 3336 } 3337 if(this.V != null && this.needSeek == 0) { 3338 this.needSeek = this.V.currentTime; 3339 } 3340 if(v['poster']) { 3341 this.V.poster = v['poster']; 3342 } else { 3343 this.V.removeAttribute('poster'); 3344 } 3345 if(v['loop']) { 3346 this.V.loop = 'loop'; 3347 } else { 3348 this.V.removeAttribute('loop'); 3349 } 3350 if(v['seek'] > 0) { 3351 this.needSeek = v['seek']; 3352 } else { 3353 this.needSeek = 0; 3354 } 3355 if(this.getFileExt(vArr[0][0]) != '.m3u8') { 3356 this.isM3u8 = false;
3357 } 3358 if(!this.isM3u8) { 3359 if(vArr.length == 1) { 3360 this.V.innerHTML = ''; 3361 this.V.src = vArr[0][0]; 3362 } else { 3363 var source = ''; 3364 vArr = this.arrSort(vArr); 3365 for(i = 0; i < vArr.length; i++) { 3366 var type = ''; 3367 var va = vArr[i]; 3368 if(va[1]) { 3369 type = ' type="' + va[1] + '"'; 3370 } 3371 source += '<source src="' + va[0] + '"' + type + '>'; 3372 } 3373 this.V.removeAttribute('src'); 3374 this.V.innerHTML = source; 3375 } 3376 //åæè§é¢å°åç»æ 3377 if(v['autoplay']) { 3378 this.V.autoplay = 'autoplay'; 3379 } else { 3380 this.V.removeAttribute('autoplay'); 3381 } 3382 this.V.load(); 3383 } else { 3384 this.embedHls(vArr[0][0], v['autoplay']); 3385 } 3386 if(!this.isUndefined(v['volume'])) { 3387 this.changeVolume(v['volume']); 3388 } 3389 this.resetPlayer(); //éç½®çé¢å ç´ 3390 this.timerErrorFun(); 3391 //妿åå¨åå¹åå è½½ 3392 if(this.vars['cktrack']) { 3393 this.loadTrack(); 3394 } 3395 }, 3396 /* 3397 å é¨å½æ° 3398 è°æ´ä¸é´æåæé®,ç¼å²loadingï¼é误æç¤ºææ¬æ¡çä½ç½® 3399 */ 3400 elementCoordinate: function() { 3401 this.pdCoor = this.getXY(this.PD); 3402 this.css(this.CB['pauseCenter'], { 3403 left: parseInt((this.PD.offsetWidth - 80) * 0.5) + 'px', 3404 top: parseInt((this.PD.offsetHeight - 80) * 0.5) + 'px' 3405 }); 3406 this.css(this.CB['loading'], { 3407 left: parseInt((this.PD.offsetWidth - 60) * 0.5) + 'px', 3408 top: parseInt((this.PD.offsetHeight - 60) * 0.5) + 'px' 3409 }); 3410 this.css(this.CB['errorText'], { 3411 left: parseInt((this.PD.offsetWidth - 120) * 0.5) + 'px', 3412 top: parseInt((this.PD.offsetHeight - 30) * 0.5) + 'px' 3413 }); 3414 this.css(this.CB['logo'], { 3415 left: parseInt(this.PD.offsetWidth - this.CB['logo'].offsetWidth - 20) + 'px', 3416 top: '20px' 3417 }); 3418 this.checkBarWidth(); 3419 }, 3420 /* 3421 å é¨å½æ° 3422 彿æ¾å¨å°ºå¯¸ååæ¶ï¼æ¾ç¤ºåéèç¸å ³èç¹ 3423 */ 3424 checkBarWidth: function() { 3425 if(!this.showFace) { 3426 return; 3427 } 3428 var controlBarW = this.CB['controlBar'].offsetWidth; 3429 var ele = []; 3430 ele.push([ 3431 [this.CB['full'], this.CB['escFull'], this.CB['fullLine']], this.buttonWidth['full'] + 2, 'full' 3432 ]); 3433 if(this.vars['front'] != '') { 3434 ele.push([ 3435 [this.CB['front'], this.CB['frontLine']], this.buttonWidth['front'] + 2 3436 ]); 3437 } 3438 if(this.vars['next'] != '') { 3439 ele.push([ 3440 [this.CB['next'], this.CB['nextLine']], this.buttonWidth['next'] + 2 3441 ]); 3442 } 3443 if(this.CB['definition'].innerHTML != '') { 3444 ele.push([ 3445 [this.CB['definition'], this.CB['definitionLine']], this.buttonWidth['definition'] + 2 3446 ]); 3447 } 3448 ele.push([ 3449 [this.CB['volume']], this.buttonWidth['volume'] 3450 ]); 3451 ele.push([ 3452 [this.CB['mute'], this.CB['escMute'], this.CB['muteLine']], this.buttonWidth['mute'] + 2, 'mute' 3453 ]); 3454 ele.push([ 3455 [this.CB['timeText']], this.buttonWidth['timeText'] 3456 ]); 3457 ele.push([ 3458 [this.CB['play'], this.CB['pause'], this.CB['playLine']], this.buttonWidth['play'] + 2, 'play' 3459 ]); 3460 3461 var i = 0; 3462 var len = 0; 3463 var isc = true; 3464 //è®¡ç®ææè¦æ¾ç¤ºçèç¹çæ»å®½åº¦ 3465 for(var i = 0; i < ele.length; i++) { 3466 var nlen = ele[i][1]; 3467 if(nlen > 2) { 3468 len += nlen; 3469 } else { 3470 isc = false; 3471 } 3472 } 3473 if(isc) { 3474 this.buttonLen = len; 3475 this.buttonArr = ele; 3476 } 3477 len = this.buttonLen; 3478 ele = this.buttonArr; 3479 for(var i = 0; i < ele.length; i++) { 3480 if(len > controlBarW) { 3481 len -= ele[i][1]; 3482 this.css(ele[i][0], 'display', 'none'); 3483 } else { 3484 this.css(ele[i][0], 'display', 'block'); 3485 if(ele[i].length == 3) { 3486 var name = ele[i][2]; 3487 switch(name) { 3488 case 'mute': 3489 if(this.volume == 0) { 3490 this.css(this.CB['mute'], 'display', 'none'); 3491 } else { 3492 this.css(this.CB['escMute'], 'display', 'none'); 3493 } 3494 break; 3495 case 'play': 3496 this.playShow(this.V.paused ? false : true); 3497 break; 3498 case 'full': 3499 if(this.full) { 3500 this.css(this.CB['full'], 'display', 'none'); 3501 } else { 3502 this.css(this.CB['escFull'], 'display', 'none'); 3503 } 3504 break; 3505 } 3506 } 3507 } 3508 } 3509 }, 3510 /* 3511 å é¨å½æ° 3512 åå§åæåæææ¾æé® 3513 */ 3514 initPlayPause: function() {
3515 if(!this.showFace) { 3516 return; 3517 } 3518 if(this.vars['autoplay']) { 3519 this.css([this.CB['play'], this.CB['pauseCenter']], 'display', 'none'); 3520 this.css(this.CB['pause'], 'display', 'block'); 3521 } else { 3522 this.css(this.CB['play'], 'display', 'block'); 3523 if(this.css(this.CB['errorText'], 'display') == 'none') { 3524 this.css(this.CB['pauseCenter'], 'display', 'block'); 3525 } 3526 this.css(this.CB['pause'], 'display', 'none'); 3527 } 3528 }, 3529 3530 /* 3531 ä¸é¢ä¸ºçå¬äºä»¶ 3532 å é¨å½æ° 3533 çå¬å æ°æ®å·²å è½½ 3534 */ 3535 loadedHandler: function() { 3536 this.loaded = true; 3537 if(this.vars['loaded'] != '') { 3538 try { 3539 eval(this.vars['loaded'] + '()'); 3540 } catch(event) { 3541 this.log(event); 3542 } 3543 } 3544 }, 3545 /* 3546 å é¨å½æ° 3547 çå¬ææ¾ 3548 */ 3549 playingHandler: function() { 3550 this.playShow(true); 3551 if(this.needSeek > 0) { 3552 this.videoSeek(this.needSeek); 3553 this.needSeek = 0; 3554 } 3555 if(this.animatePauseArray.length > 0) { 3556 this.animateResume('pause'); 3557 } 3558 if(this.playerType == 'html5video' && this.V != null && this.config['videoDrawImage']) { 3559 this.sendVCanvas(); 3560 } 3561 }, 3562 /* 3563 å é¨å½æ° 3564 使ç¨ç»å¸éå è§é¢ 3565 */ 3566 sendVCanvas: function() { 3567 if(this.timerVCanvas == null) { 3568 this.css(this.V, 'display', 'none'); 3569 this.css(this.MD, 'display', 'block'); 3570 var thisTemp = this; 3571 var videoCanvas = function() { 3572 if(thisTemp.MDCX.width != thisTemp.PD.offsetWidth) { 3573 thisTemp.MDC.width = thisTemp.PD.offsetWidth; 3574 } 3575 if(thisTemp.MDCX.height != thisTemp.PD.offsetHeight) { 3576 thisTemp.MDC.height = thisTemp.PD.offsetHeight; 3577 } 3578 thisTemp.MDCX.clearRect(0, 0, thisTemp.MDCX.width, thisTemp.MDCX.height); 3579 var coor = thisTemp.getProportionCoor(thisTemp.PD.offsetWidth, thisTemp.PD.offsetHeight, thisTemp.V.videoWidth, thisTemp.V.videoHeight); 3580 thisTemp.MDCX.drawImage(thisTemp.V, 0, 0, thisTemp.V.videoWidth, thisTemp.V.videoHeight, coor['x'], coor['y'], coor['width'], coor['height']); 3581 }; 3582 this.timerVCanvas = new this.timer(0, videoCanvas); 3583 } 3584 }, 3585 /* 3586 å é¨å½æ° 3587 ç嬿å 3588 */ 3589 pauseHandler: function() { 3590 this.playShow(false); 3591 if(this.animatePauseArray.length > 0) { 3592 this.animatePause('pause'); 3593 } 3594 if(this.playerType == 'html5video' && this.V != null && this.config['videoDrawImage']) { 3595 this.stopVCanvas(); 3596 } 3597 }, 3598 /* 3599 å é¨å½æ° 3600 忢ç»å¸ 3601 */ 3602 stopVCanvas: function() { 3603 if(this.timerVCanvas != null) { 3604 this.css(this.V, 'display', 'block'); 3605 this.css(this.MD, 'display', 'none'); 3606 if(this.timerVCanvas.runing) { 3607 this.timerVCanvas.stop(); 3608 } 3609 this.timerVCanvas = null; 3610 } 3611 }, 3612 /* 3613 å é¨å½æ° 3614 æ ¹æ®å½åææ¾è¿æ¯æåç¡®è®¤å¾æ æ¾ç¤º 3615 */ 3616 playShow: function(b) { 3617 if(!this.showFace) { 3618 return; 3619 } 3620 if(b) { 3621 this.css(this.CB['play'], 'display', 'none'); 3622 this.css(this.CB['pauseCenter'], 'display', 'none'); 3623 this.css(this.CB['pause'], 'display', 'block'); 3624 } else { 3625 this.css(this.CB['play'], 'display', 'block'); 3626 if(this.css(this.CB['errorText'], 'display') == 'none') { 3627 this.css(this.CB['pauseCenter'], 'display', 'block'); 3628 } else { 3629 this.css(this.CB['pauseCenter'], 'display', 'none'); 3630 } 3631 this.css(this.CB['pause'], 'display', 'none'); 3632 } 3633 }, 3634 /* 3635 å é¨å½æ° 3636 çå¬seekç»æ 3637 */ 3638 seekedHandler: function() { 3639 this.resetTrack(); 3640 this.isTimeButtonMove = true; 3641 if(this.V.paused) { 3642 this.videoPlay(); 3643 } 3644 }, 3645 /* 3646 å é¨å½æ° 3647 ç嬿æ¾ç»æ 3648 */ 3649 endedHandler: function() { 3650 if(!this.vars['loop']) { 3651 this.videoPause(); 3652 } 3653 }, 3654 /* 3655 å é¨å½æ° 3656 çå¬é³éæ¹å 3657 */ 3658 volumechangeHandler: function() { 3659 if(!this.showFace) { 3660 return; 3661 } 3662 try { 3663 if(this.V.volume > 0) { 3664 this.css(this.CB['mute'], 'display', 'block'); 3665 this.css(this.CB['escMute'], 'display', 'none'); 3666 } else { 3667 this.css(this.CB['mute'], 'display', 'none'); 3668 this.css(this.CB['escMute'], 'display', 'block'); 3669 } 3670 } catch(event) {} 3671 }, 3672 3673 /* 3674 å é¨å½æ° 3675 çå¬ææ¾æ¶é´è°èè¿åº¦æ¡ 3676 */ 3677 timeUpdateHandler: function() { 3678 var duration = 0; 3679 if(this.playerType == 'html5video') { 3680 try { 3681 duration = this.V.duration; 3682 } catch(event) {} 3683 } 3684 if(duration > 0) { 3685 this.time = this.V.currentTime; 3686 this.timeTextHandler(); 3687 this.trackShowHandler(); 3688 if(this.isTimeButtonMove) { 3689 this.timeProgress(this.time, duration); 3690 } 3691 } 3692 }, 3693 /* 3694 å é¨å½æ° 3695 ææ¶é´æ¹åè¿åº¦æ¡ 3696 */ 3697 timeProgress: function(time, duration) {
3698 if(!this.showFace) { 3699 return; 3700 } 3701 var timeProgressBgW = this.CB['timeProgressBg'].offsetWidth; 3702 var timeBOW = parseInt((time * timeProgressBgW / duration) - (this.CB['timeButton'].offsetWidth * 0.5)); 3703 if(timeBOW > timeProgressBgW - this.CB['timeButton'].offsetWidth) { 3704 timeBOW = timeProgressBgW - this.CB['timeButton'].offsetWidth; 3705 } 3706 if(timeBOW < 0) { 3707 timeBOW = 0; 3708 } 3709 this.css(this.CB['timeProgress'], 'width', timeBOW + 'px'); 3710 this.css(this.CB['timeButton'], 'left', parseInt(timeBOW) + 'px'); 3711 }, 3712 /* 3713 å é¨å½æ° 3714 çå¬ææ¾æ¶é´æ¹åæ¶é´æ¾ç¤ºææ¬æ¡ 3715 */ 3716 timeTextHandler: function() { //æ¾ç¤ºæ¶é´/æ»æ¶é´ 3717 if(!this.showFace) { 3718 return; 3719 } 3720 var duration = this.V.duration; 3721 var time = this.V.currentTime; 3722 if(isNaN(duration) || parseInt(duration) < 0.2) { 3723 duration = this.vars['duration']; 3724 } 3725 this.CB['timeText'].innerHTML = this.formatTime(time) + ' / ' + this.formatTime(duration); 3726 if(this.CB['timeText'].offsetWidth > 0) { 3727 this.buttonWidth['timeText'] = this.CB['timeText'].offsetWidth; 3728 } 3729 }, 3730 /* 3731 å é¨å½æ° 3732 ç嬿¯å¦æ¯ç¼å²ç¶æ 3733 */ 3734 bufferEdHandler: function() { 3735 if(!this.showFace || this.playerType == 'flashplayer') { 3736 return; 3737 } 3738 var thisTemp = this; 3739 var clearTimerBuffer = function() { 3740 if(thisTemp.timerBuffer != null) { 3741 if(thisTemp.timerBuffer.runing) { 3742 thisTemp.sendJS('buffer', 100); 3743 thisTemp.timerBuffer.stop(); 3744 } 3745 thisTemp.timerBuffer = null; 3746 } 3747 }; 3748 clearTimerBuffer(); 3749 var bufferFun = function() { 3750 if(thisTemp.V.buffered.length > 0) { 3751 var duration = thisTemp.V.duration; 3752 var len = thisTemp.V.buffered.length; 3753 var bufferStart = thisTemp.V.buffered.start(len - 1); 3754 var bufferEnd = thisTemp.V.buffered.end(len - 1); 3755 var loadTime = bufferStart + bufferEnd; 3756 var loadProgressBgW = thisTemp.CB['timeProgressBg'].offsetWidth; 3757 var timeButtonW = thisTemp.CB['timeButton'].offsetWidth; 3758 var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); 3759 if(loadW >= loadProgressBgW) { 3760 loadW = loadProgressBgW; 3761 clearTimerBuffer(); 3762 } 3763 thisTemp.changeLoad(loadTime); 3764 } 3765 }; 3766 this.timerBuffer = new this.timer(200, bufferFun); 3767 }, 3768 /* 3769 å é¨å½æ° 3770 åç¬è®¡ç®å è½½è¿åº¦ 3771 */ 3772 changeLoad: function(loadTime) { 3773 if(this.V == null) { 3774 return; 3775 } 3776 if(!this.showFace) { 3777 return; 3778 } 3779 var loadProgressBgW = this.CB['timeProgressBg'].offsetWidth; 3780 var timeButtonW = this.CB['timeButton'].offsetWidth; 3781 var duration = this.V.duration; 3782 if(this.isUndefined(loadTime)) { 3783 loadTime = this.loadTime; 3784 } else { 3785 this.loadTime = loadTime; 3786 } 3787 var loadW = parseInt((loadTime * loadProgressBgW / duration) + timeButtonW); 3788 this.css(this.CB['loadProgress'], 'width', loadW + 'px'); 3789 }, 3790 /* 3791 å é¨å½æ° 3792 夿æ¯å¦æ¯ç´æ 3793 */ 3794 judgeIsLive: function() { 3795 var thisTemp = this; 3796 if(this.timerError != null) { 3797 if(this.timerError.runing) { 3798 this.timerError.stop(); 3799 } 3800 this.timerError = null; 3801 } 3802 this.error = false; 3803 if(this.showFace) { 3804 this.css(this.CB['errorText'], 'display', 'none'); 3805 } 3806 var timeupdate = function(event) { 3807 thisTemp.timeUpdateHandler(); 3808 }; 3809 if(!this.vars['live']) { 3810 if(this.V != null && this.playerType == 'html5video') { 3811 this.addListenerInside('timeupdate', timeupdate); 3812 thisTemp.timeTextHandler(); 3813 thisTemp.prompt(); //æ·»å æç¤ºç¹ 3814 window.setTimeout(function() { 3815 thisTemp.bufferEdHandler(); 3816 }, 200); 3817 } 3818 } else { 3819 this.removeListenerInside('timeupdate', timeupdate); 3820 if(this.timerTime != null) { 3821 window.clearInterval(this.timerTime); 3822 timerTime = null; 3823 } 3824 if(this.timerTime != null) { 3825 if(this.timerTime.runing) { 3826 this.timerTime.stop(); 3827 } 3828 this.timerTime = null; 3829 } 3830 var timeFun = function() { 3831 if(thisTemp.V != null && !thisTemp.V.paused && thisTemp.show
3831Face) { 3832 thisTemp.CB['timeText'].innerHTML = thisTemp.getNowDate(); 3833 } 3834 }; 3835 this.timerTime = new this.timer(1000, timeFun); 3836 //timerTime.start(); 3837 } 3838 this.definition(); 3839 }, 3840 /* 3841 å é¨å½æ° 3842 å è½½åå¹ 3843 */ 3844 loadTrack: function() { 3845 if(this.playerType == 'flashplayer' || this.vars['flashplayer'] == true) { 3846 return; 3847 } 3848 var thisTemp = this; 3849 var track = this.vars['cktrack']; 3850 var obj = { 3851 method: 'get', 3852 dataType: 'text', 3853 url: track, 3854 charset: 'utf-8', 3855 success: function(data) { 3856 thisTemp.track = thisTemp.parseSrtSubtitles(data); 3857 thisTemp.trackIndex = 0; 3858 thisTemp.nowTrackShow = { 3859 sn: '' 3860 }; 3861 } 3862 }; 3863 this.ajax(obj); 3864 }, 3865 /* 3866 å é¨å½æ° 3867 éç½®åå¹ 3868 */ 3869 resetTrack: function() { 3870 this.trackIndex = 0; 3871 this.nowTrackShow = { 3872 sn: '' 3873 }; 3874 }, 3875 /* 3876 å é¨å½æ° 3877 æ ¹æ®æ¶é´æ¹åè¯»åæ¾ç¤ºåå¹ 3878 */ 3879 trackShowHandler: function() { 3880 if(!this.showFace) { 3881 return; 3882 } 3883 if(this.track.length < 1) { 3884 return; 3885 } 3886 if(this.trackIndex >= this.track.length) { 3887 this.trackIndex = 0; 3888 } 3889 var nowTrack = this.track[this.trackIndex]; //å½åç¼å·å¯¹åºçåå¹å 容 3890 /* 3891 this.nowTrackShow=å½åæ¾ç¤ºå¨çé¢ä¸çå 容 3892 妿å½åæ¶é´æ£å¥½å¨nowTrackæ¶é´å ï¼åéè¦å¤æ 3893 */ 3894 if(this.time >= nowTrack['startTime'] && this.time <= nowTrack['endTime']) { 3895 /* 3896 妿å½åæ¾ç¤ºçå 容ä¸çäºå½åéè¦æ¾ç¤ºçå 容æ¶ï¼åéè¦æ¾ç¤ºæ£ç¡®çå 容 3897 */ 3898 var nowShow = this.nowTrackShow; 3899 if(nowShow['sn'] != nowTrack['sn']) { 3900 this.trackHide(); 3901 this.trackShow(nowTrack); 3902 } 3903 } else { 3904 /*
3905 * 妿å½åææ¾æ¶é´ä¸å¨å½åç¼å·åå¹å ï¼åéè¦å æ¸ ç©ºå½åçåå¹å 容ï¼åæ¾ç¤ºæ°çåå¹å 容 3906 */ 3907 this.trackHide(); 3908 this.checkTrack(); 3909 } 3910 }, 3911 /* 3912 å é¨å½æ° 3913 æ¾ç¤ºåå¹å 容 3914 */ 3915 trackShow: function(track) { 3916 this.nowTrackShow = track; 3917 var arr = track['content']; 3918 for(var i = 0; i < arr.length; i++) { 3919 var obj = { 3920 list: [{ 3921 type: 'text', 3922 text: arr[i], 3923 color: '#FFFFFF', 3924 size: 16, 3925 font: this.fontFamily, 3926 lineHeight: 30 3927 }], 3928 position: [1, 2, null, -(arr.length - i) * 30 - 50] 3929 }; 3930 var ele = this.addElement(obj); 3931 this.trackElement.push(ele); 3932 } 3933 }, 3934 /* 3935 å é¨å½æ° 3936 éèååå¹å 容 3937 */ 3938 trackHide: function() { 3939 for(var i = 0; i < this.trackElement.length; i++) { 3940 this.deleteElement(this.trackElement[i]); 3941 } 3942 this.trackElement = []; 3943 }, 3944 /* 3945 å é¨å½æ° 3946 éæ°è®¡ç®åå¹çç¼å· 3947 */ 3948 checkTrack: function() { 3949 var num = this.trackIndex; 3950 var arr = this.track; 3951 var i = 0; 3952 for(i = num; i < arr.length; i++) { 3953 if(this.time >= arr[i]['startTime'] && this.time <= arr[i]['endTime']) { 3954 this.trackIndex = i; 3955 break; 3956 } 3957 } 3958 }, 3959 /* 3960 -----------------------------------------------------------------------------æ¥å£å½æ°å¼å§ 3961 æ¥å£å½æ° 3962 卿æ¾åæåä¹é´åæ¢ 3963 */ 3964 playOrPause: function() { 3965 if(!this.loaded) { 3966 return; 3967 } 3968 if(this.config['videoClick']) { 3969 if(this.V == null) { 3970 return; 3971 } 3972 if(this.playerType == 'flashplayer') { 3973 this.V.playOrPause(); 3974 return; 3975 } 3976 if(this.V.paused) { 3977 this.videoPlay(); 3978 } else { 3979 this.videoPause(); 3980 } 3981 } 3982 }, 3983 /* 3984 æ¥å£å½æ° 3985 ææ¾å¨ä½ 3986 */ 3987 videoPlay: function() { 3988 if(!this.loaded) { 3989 return; 3990 } 3991 if(this.playerType == 'flashplayer') { 3992 this.V.videoPlay(); 3993 return; 3994 } 3995 this.V.play(); 3996 }, 3997 /* 3998 æ¥å£å½æ° 3999 æåå¨ä½ 4000 */ 4001 videoPause: function() { 4002 if(!this.loaded) { 4003 return; 4004 } 4005 if(this.playerType == 'flashplayer') { 4006 this.V.videoPause(); 4007 return; 4008 } 4009 this.V.pause(); 4010 }, 4011 /* 4012 æ¥å£å½æ° 4013 跳转æ¶é´å¨ä½ 4014 */ 4015 videoSeek: function(time) { 4016 if(!this.loaded) { 4017 return; 4018 } 4019 if(this.playerType == 'flashplayer') { 4020 this.V.videoSeek(time); 4021 return; 4022 } 4023 var meta = this.getMetaDate(); 4024 var duration = meta['duration']; 4025 if(duration > 0 && time > duration) { 4026 time = duration; 4027 } 4028 if(time >= 0) { 4029 this.V.currentTime = time; 4030 this.sendJS('seekTime', time); 4031 } 4032 }, 4033 /* 4034 æ¥å£å½æ° 4035 è°èé³é/è·åé³é 4036 */ 4037 changeVolume: function(vol, bg, button) { 4038 if(this.loaded) { 4039 if(this.playerType == 'flashplayer') { 4040 this.V.changeVolume(time); 4041 return; 4042 } 4043 } 4044 if(isNaN(vol) || this.isUndefined(vol)) { 4045 vol = 0; 4046 } 4047 if(!this.loaded) { 4048 this.vars['volume'] = vol; 4049 } 4050 if(!this.html5Video) { 4051 this.V.changeVolume(vol); 4052 return; 4053 } 4054 try { 4055 if(this.isUndefined(bg)) { 4056 bg = true; 4057 } 4058 } catch(e) {} 4059 try { 4060 if(this.isUndefined(button)) { 4061 button = true; 4062 } 4063 } catch(e) {} 4064 if(!vol) { 4065 vol = 0; 4066 } 4067 if(vol < 0) { 4068 vol = 0; 4069 } 4070 if(vol > 1) { 4071 vol = 1; 4072 } 4073 try { 4074 this.V.volume = vol; 4075 } catch(error) {} 4076 this.volume = vol; 4077 if(bg && this.showFace) { 4078 var bgW = vol * this.CB['volumeBg'].offsetWidth; 4079 if(bgW < 0) { 4080 bgW = 0; 4081 } 4082 if(bgW > this.CB['volumeBg'].offsetWidth) { 4083 bgW = this.CB['volumeBg'].offsetWidth; 4084 } 4085 this.css(this.CB['volumeUp'], 'width', bgW + 'px'); 4086 } 4087 4088 if(button && this.showFace) { 4089 var buLeft = parseInt(this.CB['volumeUp'].offsetWidth - (this.CB['volumeBO'].offsetWidth * 0.5)); 4090 if(buLeft > this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth) { 4091 buLeft = this.CB['volumeBg'].offsetWidth - this.CB['volumeBO'].offsetWidth 4092 } 4093 if(buLeft < 0) { 4094 buLeft = 0; 4095 } 4096 this.css(this.CB['volumeBO'], 'left', buLeft + 'px'); 4097 } 4098 }, 4099 /* 4100 æ¥å£å½æ° 4101 éé³ 4102 */ 4103 videoMute: function() { 4104 if(!this.loaded) { 4105 return; 4106 } 4107 if(this.playerType == 'flashplayer') { 4108 this.V.videoMute(); 4109 return; 4110 } 4111 this.volumeTemp = this.V ? (this.V.volume > 0 ? this.V.volume : this.vars['volume']) : this.vars['volume']; 4112 this.changeVolume(0); 4113 }, 4114 /* 4115 æ¥å£å½æ° 4116 åæ¶éé³ 4117 */ 4118 videoEscMute: function() { 4119 if(!this.loaded) { 4120 return; 4121 } 4122 if(this.playerType == 'flashplayer') { 4123 this.V.videoEscMute(); 4124 return; 4125 } 4126 this.changeVolume(this.volumeTemp > 0 ? this.volumeTemp : this.vars['volume']); 4127 }, 4128 /* 4129 æ¥å£å½æ° 4130 å¿«é 4131 */ 4132 fastBack: function() { 4133 if(!this.loaded) { 4134 return; 4135 } 4136 if(this.playerType == 'flashplayer') { 4137 this.V.fastBack(); 4138 return; 4139 } 4140 var time = this.time - this.ckplayerConfig['config']['timeJump']; 4141 if(time < 0) { 4142 time = 0; 4143 } 4144 this.videoSeek(time); 4145 }, 4146 /* 4147 æ¥å£å½æ° 4148 å¿«è¿ 4149 */ 4150 fastNext: function() { 4151 if(!this.loaded) { 4152 return; 4153 } 4154 if(this.playerType == 'flashplayer') { 4155 this.V.fastNext(); 4156 return; 4157 } 4158 var time = this.time + this.ckplayerConfig['config']['timeJump']; 4159 if(time > this.V.duration) { 4160 time = this.V.duration; 4161 } 4162 this.videoSeek(time); 4163 }, 4164 /* 4165 æ¥å£å½æ° 4166 è·åå½åææ¾çå°å 4167 */ 4168 getCurrentSrc:function(){ 4169 if(!this.loaded) { 4170 return; 4171 } 4172 if(this.playerType == 'flashplayer') { 4173 return this.V.getCurrentSrc(); 4174 } 4175 return this.V.currentSrc; 4176 }, 4177 /* 4178 å ç½®å½æ° 4179 å ¨å±/éåºå ¨å±å¨ä½ï¼è¯¥å¨ä½åªè½æ¯ç¨æ·æä½æå¯ä»¥è§¦åï¼
4179æ¯å¦ç¨æ·ç¹å»æé®è§¦å该äºä»¶ 4180 */ 4181 switchFull: function() { 4182 if(this.full) { 4183 this.quitFullScreen(); 4184 } else { 4185 this.fullScreen(); 4186 } 4187 }, 4188 /* 4189 å ç½®å½æ° 4190 å ¨å±å¨ä½ï¼è¯¥å¨ä½åªè½æ¯ç¨æ·æä½æå¯ä»¥è§¦åï¼æ¯å¦ç¨æ·ç¹å»æé®è§¦å该äºä»¶ 4191 */ 4192 fullScreen: function() { 4193 if(this.html5Video && this.playerType == 'html5video') { 4194 var element = this.PD; 4195 if(element.requestFullscreen) { 4196 element.requestFullscreen(); 4197 } else if(element.mozRequestFullScreen) { 4198 element.mozRequestFullScreen(); 4199 } else if(element.webkitRequestFullscreen) { 4200 element.webkitRequestFullscreen(); 4201 } else if(element.msRequestFullscreen) { 4202 element.msRequestFullscreen(); 4203 } else if(element.oRequestFullscreen) { 4204 element.oRequestFullscreen(); 4205 } 4206 this.judgeFullScreen(); 4207 } else { 4208 //this.V.fullScreen(); 4209 } 4210 }, 4211 /* 4212 æ¥å£å½æ° 4213 éåºå ¨å±å¨ä½ 4214 */ 4215 quitFullScreen: function() { 4216 if(this.html5Video && this.playerType == 'html5video') { 4217 if(document.exitFullscreen) { 4218 document.exitFullscreen(); 4219 } else if(document.msExitFullscreen) { 4220 document.msExitFullscreen(); 4221 } else if(document.mozCancelFullScreen) { 4222 document.mozCancelFullScreen(); 4223 } else if(document.oRequestFullscreen) { 4224 document.oCancelFullScreen(); 4225 } else if(document.requestFullscreen) { 4226 document.requestFullscreen(); 4227 } else if(document.webkitExitFullscreen) { 4228 document.webkitExitFullscreen(); 4229 } else { 4230 this.css(document.documentElement, 'cssText', ''); 4231 this.css(document.document.body, 'cssText', ''); 4232 this.css(this.PD, 'cssText', ''); 4233 } 4234 this.judgeFullScreen(); 4235 } 4236 }, 4237 /* 4238 ä¸é¢ååºåªæflashplayer鿝æç 4239 */ 4240 videoRotation: function(n) { 4241 if(!this.loaded) { 4242 return; 4243 } 4244 if(this.playerType == 'flashplayer') { 4245 this.V.videoRotation(n); 4246 return; 4247 } 4248 if(this.isUndefined(n)) { 4249 n = 0; 4250 } 4251 var tf = this.css(this.V, 'transform'); 4252 if(this.isUndefined(tf) && !tf) { 4253 tf = 'rotate(0deg)'; 4254 } 4255 var reg = tf.match(/rotate\([^)]+\)/); 4256 reg = reg ? reg[0].replace('rotate(', '').replace('deg)', '') : ''; 4257 if(reg == '') { 4258 reg = 0; 4259 } else { 4260 reg = parseInt(reg); 4261 } 4262 if(n == -1) { 4263 reg -= 90; 4264 } else if(n == 1) { 4265 reg += 90; 4266 } else { 4267 if(n != 90 && n != 180 && n != 270 && n != -90 && n != -180 && n != -270) { 4268 reg = 0; 4269 } else { 4270 reg = n; 4271 } 4272 } 4273 n = reg; 4274 tf = tf.replace(/rotate\([^)]+\)/, '') + ' rotate(' + n + 'deg)'; 4275 this.css(this.V, 'transform', tf); 4276 return; 4277 }, 4278 videoBrightness: function(n) { 4279 if(!this.loaded) { 4280 return; 4281 } 4282 if(this.playerType == 'flashplayer') { 4283 this.V.videoBrightness(n); 4284 return; 4285 } 4286 }, 4287 videoContrast: function(n) { 4288 if(!this.loaded) { 4289 return; 4290 } 4291 if(this.playerType == 'flashplayer') { 4292 this.V.videoContrast(n); 4293 return; 4294 } 4295 }, 4296 videoSaturation: function(n) { 4297 if(!this.loaded) { 4298 return; 4299 } 4300 if(this.playerType == 'flashplayer') { 4301 this.V.videoSaturation(n); 4302 return; 4303 } 4304 }, 4305 videoHue: function(n) { 4306 if(!this.loaded) { 4307 return; 4308 } 4309 if(this.playerType == 'flashplayer') { 4310 this.V.videoHue(n); 4311 return; 4312 } 4313 }, 4314 videoZoom: function(n) { 4315 if(!this.loaded) { 4316 return; 4317 } 4318 if(this.playerType == 'flashplayer') { 4319 this.V.videoZoom(n); 4320 return; 4321 } 4322 if(this.isUndefined(n)) { 4323 n = 1; 4324 } 4325 if(n < 0) { 4326 n = 0; 4327 } 4328 if(n > 2) { 4329 n = 2; 4330 } 4331 var tf = this.css(this.V, 'transform'); 4332 tf = tf.replace(/scale\([^)]+\)/, '') + ' scale(' + n + ')'; 4333 this.css(this.V, 'transform', tf); 4334 return; 4335 }, 4336 videoProportion: function(w, h) { 4337 if(!this.loaded) { 4338 return; 4339 } 4340 if(this.playerType == 'flashplayer') { 4341 this.V.videoProportion(w, h); 4342 return; 4343 } 4344 }, 4345 adPlay: function() { 4346 if(!this.loaded) { 4347 return; 4348 } 4349 if(this.playerType == 'flashplayer') { 4350 this.V.adPlay(); 4351 return; 4352 } 4353 }, 4354 adPause: function() { 4355 if(!this.loaded) { 4356 return; 4357 } 4358 if(this.playerType == 'flashplayer') { 4359 this.V.adPause(); 4360 return; 4361 } 4362 }, 4363 videoError: function(n) { 4364 if(!this.loaded) { 4365 return; 4366 } 4367 if(this.playerType == 'flashplayer') { 4368 this.V.videoError(n); 4369 return; 4370 } 4371 }, 4372 changeConfig: function() { 4373 if(!this.loaded) { 4374 return; 4375 } 4376 if(this.playerType == 'flashplayer') { 4377 this.V.changeConfig(arguments); 4378 return; 4379 } 4380 var obj = this.ckplayerConfig; 4381 var arg = arguments; 4382 for(var i = 0; i < arg.length - 1; i++) { 4383 if(obj.hasOwnProperty(arg[i])) { 4384 obj = obj[arg[i]]; 4385 } else { 4386 return; 4387 } 4388 } 4389 var val = arg[arg.length - 1]; 4390 switch(arg.length) { 4391 case 2: 4392 this.ckplayerConfig[arg[0]] = val; 4393 break; 4394 case 3: 4395 this.ckplayerConfig[arg[0]][arg[1]] = val; 4396 break; 4397 case 4: 4398 this.ckplayerConfig[arg[0]][arg[1]][arg[2]] = val; 4399 break; 4400 case 5: 4401 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]] = val; 4402 break; 4403 case 6: 4404 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]] = val; 4405 break; 4406 case 7: 4407 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]] = val; 4408 break; 4409 case 8: 4410 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]] = val; 4411 break; 4412 case 9: 4413 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]] = val; 4414 break; 4415 case 10: 4416 this.ckplayerConfig[arg[0]][arg[1]][arg[2]][arg[3]][arg[4]][arg[5]][arg[6]][arg[7]][arg[8]] = val; 4417 break; 4418 default: 4419 return; 4420 break; 4421 } 4422 this.sendJS('configChange', this.ckplayerConfig); 4423 }, 4424 custom: function() { 4425 if(!this.loaded) { 4426 return; 4427 } 4428 if(this.playerType == 'flashplayer') { 4429 this.V.custom(arguments); 4430 return; 4431 } 4432 }, 4433 getConfig: function() { 4434 if(!this.loaded) { 4435 return null; 4436 } 4437 if(this.playerType == 'flashplayer') { 4438 return this.V.getConfig(arguments); 4439 } 4440 }, 4441 openUrl: function(n) { 4442 if(!this.loaded) { 4443 return; 4444 } 4445 if(this.playerType == 'flashplayer') { 4446 this.V.openUrl(n); 4447 return; 4448 } 4449 }, 4450 /* 4451 æ¥å£å½æ° 4452 æ¸ é¤è§é¢ 4453 */ 4454 videoClear: function() { 4455 if(!this.loaded) { 4456 return; 4457 } 4458 if(this.playerType == 'flashplayer') { 4459 this.V.videoClear(); 4460 return; 4461 } 4462 }, 4463 /* 4464 æ¥å£å½æ° 4465 åææ¾å¨ä¼ éæ°çè§é¢å°å 4466 */ 4467 newVideo: function(c) { 4468 if(this.playerType == 'flashplayer') { 4469 this.V.newVideo(c); 4470 return; 4471 } else { 4472 this.embed(c); 4473 } 4474 }, 4475 /* 4476 æ¥å£å½æ° 4477 æªå¾ 4478 */ 4479 screenshot: function(obj, save, name) { 4480 if(!this.loaded) { 4481 return; 4482 } 4483 if(this.playerType == 'flashplayer') { 4484 try { 4485 this.V.screenshot(obj, save, name); 4486 } catch(error) { 4487 this.log(error); 4488 } 4489 return; 4490 } 4491 if(obj == 'video') { 4492 var newCanvas = document.createElement('canvas'); 4493 newCanvas.width = this.V.videoWidth; 4494 newCanvas.height = this.V.videoHeight; 4495 newCanvas.getContext('2d').drawImage(this.V, 0, 0, this.V.videoWidth, this.V.videoHeight);
4496 try { 4497 var base64 = newCanvas.toDataURL('image/jpeg'); 4498 this.sendJS('screenshot', { 4499 object: obj, 4500 save: save, 4501 name: name, 4502 base64: base64 4503 }); 4504 } catch(error) { 4505 this.log(error); 4506 } 4507 } 4508 }, 4509 /* 4510 æ¥å£å½æ° 4511 æ¹åææ¾å¨å°ºå¯¸ 4512 */ 4513 changeSize: function(w, h) { 4514 if(this.isUndefined(w)) { 4515 w = 0; 4516 } 4517 if(this.isUndefined(h)) { 4518 h = 0; 4519 } 4520 if(w > 0) { 4521 this.css(this.CD, 'width', w + 'px'); 4522 } 4523 if(h > 0) { 4524 this.css(this.CD, 'height', h + 'px'); 4525 } 4526 if(this.html5Video) { 4527 this.elementCoordinate(); 4528 } 4529 }, 4530 /* 4531 æ¥å£å½æ° 4532 æ¹åè§é¢ææ¾é度 4533 */ 4534 changePlaybackRate: function(n) { 4535 if(this.html5Video) { 4536 var arr = this.playbackRateArr; 4537 n = parseInt(n); 4538 if(n < arr.length) { 4539 this.newPlaybackrate(arr[n][1]); 4540 } 4541 } 4542 }, 4543 /* 4544 å é¨å½æ° 4545 æ³¨åæ§å¶æ§å¶æ æ¾ç¤ºä¸éè彿° 4546 */ 4547 changeControlBarShow: function(show) { 4548 if(!this.loaded) { 4549 return; 4550 } 4551 if(this.playerType == 'flashplayer') { 4552 this.V.changeControlBarShow(show); 4553 return; 4554 } 4555 if(show) { 4556 this.controlBarIsShow = true; 4557 this.controlBarHide(false); 4558 } else { 4559 this.controlBarIsShow = false; 4560 this.controlBarHide(true); 4561 } 4562 }, 4563 /* 4564 ----------------------------------------------------------------------- 4565 è°ç¨flashplayer 4566 */ 4567 embedSWF: function() { 4568 var vid = this.randomString(); 4569 var flashvars = this.getFlashVars(); 4570 var param = this.getFlashplayerParam(); 4571 var flashplayerUrl = 'http://www.macromedia.com/go/getflashplayer'; 4572 var html = '', 4573 src = javascriptPath + 'ckplayer.swf'; 4574 id = 'id="' + vid + '" name="' + vid + '" '; 4575 html += '<object pluginspage="' + flashplayerUrl + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,3,0,0" width="100%" height="100%" ' + id + ' align="middle">'; 4576 html += param['v']; 4577 html += '<param name="movie" value="' + src + '">'; 4578 html += '<param name="flashvars" value="' + flashvars + '">'; 4579 html += '<embed ' + param['w'] + ' src="' + src + '" flashvars="' + flashvars + '" width="100%" height="100%" ' + id + ' align="middle" type="application/x-shockwave-flash" pluginspage="' + flashplayerUrl + '" />'; 4580 html += '</object>'; 4581 this.PD.innerHTML = html; 4582 this.V = this.getObjectById(vid); //Vï¼å®ä¹ææ¾å¨å¯¹è±¡å ¨å±åé 4583 this.playerType = 'flashplayer'; 4584 //this.loaded=true; 4585 }, 4586 /* 4587 å ç½®å½æ° 4588 å°varså¯¹è±¡è½¬æ¢æå符 4589 */ 4590 getFlashVars: function() { 4591 this.getVarsObject(); 4592 var v = this.vars; 4593 var z = ''; 4594 for(k in v) { 4595 if(k != 'flashplayer' && k != 'container' && v[k] != '') { 4596 if(z != '') { 4597 z += '&'; 4598 } 4599 var vk = v[k]; 4600 if(vk == true) { 4601 vk = 1; 4602 } 4603 if(vk == false) { 4604 vk = 0; 4605 } 4606 z += k + '=' + vk; 4607 } 4608 4609 } 4610 if(!v.hasOwnProperty('volume') || !v['volume']) { 4611 if(z != '') { 4612 z += '&'; 4613 } 4614 z += 'volume=0'; 4615 } 4616 return z; 4617 }, 4618 /* 4619 å ç½®å½æ° 4620 å°varsæ ¼å¼åæflashè½æ¥åç对象ãåç±getFlashVars彿°è½¬åæå符串æç±newVideoç´æ¥ä½¿ç¨ 4621 */ 4622 getVarsObject: function() { 4623 var v = this.vars; 4624 var f = '', 4625 d = '', 4626 w = ''; //f=è§é¢å°åï¼d=æ¸ æ°åº¦å°å,w=æéï¼z=æç»å°å 4627 var arr = this.VA; 4628 var prompt = v['promptSpot']; 4629 var i = 0; 4630 var video = this.vars['video']; 4631 if(typeof(video) == 'object') { //å¯¹è±¡ææ°ç» 4632 if(!this.isUndefined(typeof(video.length))) { //è¯´ææ¯æ°ç» 4633 var arr = video; 4634 for(i = 0; i < arr.length; i++) { 4635 var arr2 = arr[i]; 4636 if(arr2) { 4637 if(f != '') { 4638 f += this.ckplayerConfig['config']['split']; 4639 d += ','; 4640 w += ','; 4641 v['type']+=this.ckplayerConfig['config']['split']; 4642 } 4643 f += encodeURIComponent(decodeURIComponent(arr2[0])); 4644 d += arr2[2]; 4645 w += arr2[3]; 4646 v['type']+=arr2[1].replace('video/',''); 4647 } 4648 } 4649 } else { 4650 f = encodeURIComponent(decodeURIComponent(video['file'])); 4651 if(!this.isUndefined(video['type'])) { 4652 v['type'] = video['type']; 4653 } 4654 d = ''; 4655 w = ''; 4656 } 4657 } else { 4658 f = encodeURIComponent(decodeURIComponent(video)); 4659 } 4660 if(v['preview'] != null) { 4661 v['previewscale'] = v['preview']['scale']; 4662 v['preview'] = v['preview']['file'].join(','); 4663 4664 } 4665 if(prompt != null) { 4666 v['promptspot'] = ''; 4667 v['promptspottime'] = ''; 4668 for(i = 0; i < prompt.length; i++) { 4669 if(v['promptspot'] != '') { 4670 v['promptspot'] += ','; 4671 v['promptspottime'] += ','; 4672 } 4673 v['promptspot'] += prompt[i]['words']; 4674 v['promptspottime'] += prompt[i]['time']; 4675 } 4676 4677 } 4678 if(f != '') { 4679 v['video'] = f; 4680 v['definition'] = d; 4681 v['weight'] = w; 4682 } 4683 if(!v['volume']) { 4684 v['volume'] = 0; 4685 } 4686 var newV = {}; 4687 4688 for(var k in v) { 4689 if(v[k] != null) { 4690 newV[k] = v[k]; 4691 } 4692 if(k == 'type') { 4693 newV[k] = v[k].replace('video/m3u8', 'm3u8'); 4694 } 4695 } 4696 4697 this.vars = newV; 4698 }, 4699 /* 4700 å ç½®å½æ° 4701 å°embedSWFéçparamç对象è¿è¡è½¬æ¢ 4702 */
4703 getFlashplayerParam: function() { 4704 var w = '', 4705 v = '', 4706 o = { 4707 allowScriptAccess: 'always', 4708 allowFullScreen: true, 4709 quality: 'high', 4710 bgcolor: '#000' 4711 }; 4712 for(var e in o) { 4713 w += e + '="' + o[e] + '" '; 4714 v += '<param name="' + e + '" value="' + o[e] + '" />'; 4715 } 4716 w = w.replace('movie=', 'src='); 4717 return { 4718 w: w, 4719 v: v 4720 }; 4721 }, 4722 4723 /* 4724 æä½å¨ä½ç»æ 4725 ----------------------------------------------------------------------- 4726 4727 æ¥å£å½æ° 4728 è·åå æ°æ®é¨å 4729 */ 4730 getMetaDate: function() { 4731 if(!this.loaded || this.V == null) { 4732 return false; 4733 } 4734 if(this.playerType == 'html5video') { 4735 var duration = 0; 4736 try { 4737 duration = !isNaN(this.V.duration) ? this.V.duration : 0; 4738 } catch(event) {this.log(event);} 4739 var data = { 4740 duration: duration, 4741 volume: this.V.volume, 4742 playbackRate: this.V.playbackRate, 4743 width: this.PD.offsetWidth || this.V.offsetWidth || this.V.width, 4744 height: this.PD.offsetHeight || this.V.offsetHeight || this.V.height, 4745 streamWidth: this.V.videoWidth, 4746 streamHeight: this.V.videoHeight, 4747 videoWidth: this.V.offsetWidth, 4748 videoHeight: this.V.offsetHeight, 4749 paused: this.V.paused 4750 }; 4751 return data; 4752 } else { 4753 try{ 4754 return this.V.getMetaDate(); 4755 } 4756 catch(event){ 4757 this.log(event); 4758 } 4759 } 4760 return false; 4761 }, 4762 /* 4763 æ¥å£å½æ° 4764 åå½åæä¾ç»ææ¾å¨ææ¾çè§é¢å表 4765 */ 4766 getVideoUrl: function() { 4767 if(this.playerType == 'flashplayer') { 4768 return this.V.getVideoUrl(); 4769 } 4770 var arr = []; 4771 if(this.V.src) { 4772 arr.push(this.V.src); 4773 } else { 4774 var uArr = this.V.childNodes; 4775 for(var i = 0; i < uArr.length; i++) { 4776 arr.push(uArr[i].src); 4777 } 4778 } 4779 return arr; 4780 }, 4781 /* 4782 å ç½®å½æ° 4783 æ ¼å¼å彿° 4784 */ 4785 clickEvent: function(call) { 4786 if(call == 'none' || call == '' || call == null) { 4787 return { 4788 type: 'none' 4789 }; 4790 } 4791 var callArr = call.split('->'); 4792 var type = '', 4793 fun = '', 4794 link = '', 4795 target = ''; 4796 if(callArr.length == 2) { 4797 var callM = callArr[0]; 4798 var callE = callArr[1]; 4799 if(!callE) { 4800 return { 4801 type: 'none' 4802 }; 4803 } 4804 var val = ''; 4805 var eArr = []; 4806 type = callM; 4807 switch(callM) { 4808 case 'actionScript': 4809 //trace(THIS.hasOwnProperty(callE)); 4810 4811 if(callE.indexOf('(') > -1) { 4812 eArr = callE.split('('); 4813 callE = eArr[0]; 4814 val = eArr[1].replace(')', ''); 4815 } 4816 if(val == '') { 4817 fun = 'thisTemp.' + callE + '()'; 4818 } else { 4819 fun = 'thisTemp.' + callE + '(' + val + ')'; 4820 } 4821 break; 4822 case 'javaScript': 4823 if(callE.substr(0, 11) == '[flashvars]') { 4824 callE = callE.substr(11); 4825 if(this.vars.hasOwnProperty(callE)) { 4826 callE = this.vars[callE]; 4827 } else { 4828 break; 4829 } 4830 4831 } 4832 if(callE.indexOf('(') > -1) { 4833 eArr = callE.split('('); 4834 callE = eArr[0]; 4835 val = eArr[1].replace(')', ''); 4836 } 4837 if(val == '') { 4838 fun = callE + '()'; 4839 } else { 4840 fun = callE + '(' + val + ')'; 4841 } 4842 break; 4843 case "link": 4844 var callLink = (callE + ',').split(','); 4845 if(callLink[0].substr(0, 11) == '[flashvars]') { 4846 var fl = callLink[0].replace('[flashvars]', ''); 4847 if(this.vars.hasOwnProperty(fl)) { 4848 callLink[0] = this.vars[fl]; 4849 } else { 4850 break; 4851 } 4852 } 4853 if(!callLink[1]) { 4854 callLink[1] = '_blank'; 4855 } 4856 link = callLink[0]; 4857 target = callLink[1]; 4858 break; 4859 } 4860 } 4861 return { 4862 type: type, 4863 fun: fun, 4864 link: link, 4865 target: target 4866 } 4867 }, 4868 /* 4869 å ç½®å½æ° 4870 åææ¾å¨ç颿·»å ä¸ä¸ªææ¬ 4871 */ 4872 addElement: function(attribute) { 4873 var thisTemp = this; 4874 if(this.playerType == 'flashplayer') { 4875 return this.V.addElement(attribute); 4876 } 4877 var i = 0; 4878 var obj = { 4879 list: null, 4880 x: '100%', 4881 y: "50%", 4882 position: null, 4883 alpha: 1, 4884 backgroundColor: '', 4885 backAlpha: 1, 4886 backRadius: 0, 4887 clickEvent: '' 4888 }; 4889 obj = this.standardization(obj, attribute); 4890 var list = obj['list']; 4891 if(list == null) { 4892 return ''; 4893 } 4894 var id = 'element' + this.randomString(10); 4895 var ele = document.createElement('div'); 4896 ele.className = id; 4897 if(obj['x']) { 4898 ele.setAttribute('data-x', obj['x']); 4899 } 4900 if(obj['y']) { 4901 ele.setAttribute('data-y', obj['y']); 4902 } 4903 if(obj['position'] != null) { 4904 ele.setAttribute('data-position', obj['position'].join(',')); 4905 } 4906 4907 this.PD.appendChild(ele); 4908 var eid = this.getByElement(id); 4909 this.css(eid, { 4910 position: 'absolute', 4911 filter: 'alpha(opacity:' + obj['alpha'] + ')', 4912 opacity: obj['alpha'].toString(), 4913 width: '800px', 4914 zIndex: '20' 4915 }); 4916 var bgid = 'elementbg' + this.randomString(10); 4917 var bgAlpha = obj['alpha'].toString(); 4918 var bgColor = obj['backgroundColor'].replace('0x', '#'); 4919 var html = ''; 4920 var idArr = []; 4921 var clickArr = []; 4922 if(!this.isUndefined(list) && list.length > 0) { 4923 var textObj, returnObj, clickEvent; 4924 for(i = 0; i < list.length; i++) { 4925 var newEleid = 'elementnew' + this.randomString(10); 4926 switch(list[i]['type']) { 4927 case 'image': 4928 case 'png': 4929 case 'jpg': 4930 case 'jpeg': 4931 case 'gif': 4932 textObj = { 4933 type: 'image', 4934 file: '', 4935 radius: 0, //åè§å¼§åº¦ 4936 width: 30, //å®ä¹å®½ï¼å¿ éè¦å®ä¹ 4937 height: 30, //å®ä¹é«ï¼å¿ éè¦å®ä¹
4938 alpha: 1, //éæåº¦ 4939 paddingLeft: 0, //左边è·ç¦» 4940 paddingRight: 0, //å³è¾¹è·ç¦» 4941 paddingTop: 0, 4942 paddingBottom: 0, 4943 marginLeft: 0, 4944 marginRight: 0, 4945 marginTop: 0, 4946 marginBottom: 0, 4947 backgroundColor: '', 4948 clickEvent: '' 4949 }; 4950 4951 list[i] = this.standardization(textObj, list[i]); 4952 clickEvent = this.clickEvent(list[i]['clickEvent']); 4953 clickArr.push(clickEvent); 4954 if(clickEvent['type'] == 'link') { 4955 html += '<div class="' + newEleid + '" data-i="' + i + '"><a href="' + clickEvent['link'] + '" target="' + clickEvent['target'] + '"><img class="' + newEleid + '_image" src="' + list[i]['file'] + '" style="border:0;"></a></div>'; 4956 } else { 4957 html += '<div class="' + newEleid + '" data-i="' + i + '"><img class="' + newEleid + '_image" src="' + list[i]['file'] + '" style="border:0;"></div>'; 4958 } 4959 break; 4960 case 'text': 4961 textObj = { 4962 type: 'text', //è¯´ææ¯ææ¬ 4963 text: '', //ææ¬å 容 4964 color: '0xFFFFFF', 4965 size: 14, 4966 font: this.fontFamily, 4967 leading: 0, 4968 alpha: 1, //éæåº¦ 4969 paddingLeft: 0, //左边è·ç¦» 4970 paddingRight: 0, //å³è¾¹è·ç¦» 4971 paddingTop: 0, 4972 paddingBottom: 0, 4973 marginLeft: 0, 4974 marginRight: 0, 4975 marginTop: 0, 4976 marginBottom: 0, 4977 backgroundColor: '', 4978 backAlpha: 1, 4979 backRadius: 0, //èæ¯åè§å¼§åº¦ï¼æ¯ææ°åç»ä¸è®¾ç½®ï¼ä¹æ¯æåå¼è®¾ç½®[30,20,20,50]ï¼å¯¹åºä¸å·¦ï¼ä¸å³ï¼ä¸å³ï¼ä¸å·¦ 4980 clickEvent: '' 4981 }; 4982 list[i] = this.standardization(textObj, list[i]); 4983 clickEvent = this.clickEvent(list[i]['clickEvent']); 4984 clickArr.push(clickEvent); 4985 if(clickEvent['type'] == 'link') { 4986 html += '<div class="' + newEleid + '" data-i="' + i + '"><div class="' + newEleid + '_bg"></div><div class="' + newEleid + '_text"><a href="' + clickEvent['link'] + '" target="' + clickEvent['target'] + '">' + list[i]['text'] + '</a></div></div>'; 4987 } else { 4988 html += '<div class="' + newEleid + '" data-i="' + i + '"><div class="' + newEleid + '_bg"></div><div class="' + newEleid + '_text">' + list[i]['text'] + '</div></div>'; 4989 } 4990 break; 4991 default: 4992 break; 4993 } 4994 idArr.push(newEleid); 4995 } 4996 } 4997 var objClickEvent = this.clickEvent(obj['clickEvent']); 4998 /*if(objClickEvent['type']=='link'){ 4999 html = '<a href="'+objClickEvent['link']+'" target="'+objClickEvent['target']+'">' + html + '</a>'; 5000 }*/ 5001 eid.innerHTML = '<div class="' + bgid + '"></div><div class="' + bgid + '_c">' + html + '</div>'; 5002 if(objClickEvent['type'] == 'javaScript' || objClickEvent['type'] == 'actionScript') { 5003 var objClickHandler = function() { 5004 eval(objClickEvent['fun']); 5005 thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); 5006 }; 5007 this.addListenerInside('click', objClickHandler, this.getByElement(bgid + '_c')) 5008 } 5009 this.css(bgid + '_c', { 5010 position: 'absolute', 5011 zIndex: '2' 5012 }); 5013 for(i = 0; i < idArr.length; i++) { 5014 var clk = clickArr[i]; 5015 5016 if(clk['type'] == 'javaScript' || clk['type'] == 'actionScript') { 5017 var clickHandler = function() { 5018 clk = clickArr[this.getAttribute('data-i')]; 5019 eval(clk['fun']); 5020 thisTemp.sendJS('clickEvent', clk['type'] + '->' + clk['fun'].replace('thisTemp.', '').replace('()', '')); 5021 }; 5022 this.addListenerInside('click', clickHandler, this.getByElement(idArr[i])) 5023 } 5024 switch(list[i]['type']) { 5025 case 'image': 5026 case 'png': 5027 case 'jpg': 5028 case 'jpeg': 5029 case 'gif': 5030 this.css(idArr[i], { 5031 float: 'left', 5032 width: list[i]['width'] + 'px', 5033 height: list[i]['height'] + 'px', 5034 filter: 'alpha(opacity:' + list[i]['alpha'] + ')', 5035 opacity: list[i]['alpha'].toString(), 5036 marginLeft: list[i]['marginLeft'] + 'px', 5037 marginRight: list[i]['marginRight'] + 'px', 5038 marginTop: list[i]['marginTop'] + 'px', 5039 marginBottom: list[i]['marginBottom'] + 'px', 5040 borderRadius: list[i]['radius'] + 'px', 5041 cursor: 'pointer' 5042 }); 5043 this.css(idArr[i] + '_image', { 5044 width: list[i]['width'] + 'px', 5045 height: list[i]['height'] + 'px', 5046 borderRadius: list[i]['radius'] + 'px' 5047 }); 5048 break; 5049 case 'text': 5050 this.css(idArr[i] + '_text', { 5051 filter: 'alpha(opacity:' + list[i]['alpha'] + ')', 5052 opacity: list[i]['alpha'].toString(), 5053 borderRadius: list[i]['radius'] + 'px', 5054 fontFamily: list[i]['font'], 5055 fontSize: list[i]['size'] + 'px', 5056 color: list[i]['color'].replace('0x', '#'), 5057 lineHeight: list[i]['leading'] > 0 ? list[i]['leading'] + 'px' : '', 5058 paddingLeft: list[i]['paddingLeft'] + 'px', 5059 paddingRight: list[i]['paddingRight'] + 'px', 5060 paddingTop: list[i]['paddingTop'] + 'px', 5061 paddingBottom: list[i]['paddingBottom'] + 'px', 5062 whiteSpace: 'nowrap', 5063 position: 'absolute', 5064 zIndex: '3', 5065 cursor: 'pointer' 5066 }); 5067 this.css(idArr[i], { 5068 float: 'left', 5069 width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', 5070 height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', 5071 marginLeft: list[i]['marginLeft'] + 'px', 5072 marginRight: list[i]['marginRight'] + 'px', 5073 marginTop: list[i]['marginTop'] + 'px', 5074 marginBottom: list[i]['marginBottom'] + 'px' 5075 }); 5076 this.css(idArr[i] + '_bg', { 5077 width: this.getByElement(idArr[i] + '_text').offsetWidth + 'px', 5078 height: this.getByElement(idArr[i] + '_text').offsetHeight + 'px', 5079 filter: 'alpha(opacity:' + list[i]['backAlpha'] + ')', 5080 opacity: list[i]['backAlpha'].toString(), 5081 borderRadius: list[i]['backRadius'] + 'px', 5082 backgroundColor: list[i]['backgroundColor'].replace('0x', '#'), 5083 position: 'absolute', 5084 zIndex: '2' 5085 }); 5086 break; 5087 default: 5088 break; 5089 } 5090 } 5091 this.css(bgid, { 5092 width: this.getByElement(bgid + '_c').offsetWidth + 'px', 5093 height: this.getByElement(bgid + '_c').offsetHeight + 'px', 5094 position: 'absolute', 5095 filter: 'alpha(opacity:' + bgAlpha + ')', 5096 opacity: bgAlpha, 5097 backgroundColor: bgColor.replace('0x', '#'), 5098 borderRadius: obj['backRadius'] + 'px', 5099 zIndex: '1' 5100 }); 5101 this.css(eid, { 5102 width: this.getByElement(bgid).offsetWidth + 'px', 5103 height: this.getByElement(bgid).offsetHeight + 'px' 5104 }); 5105 var eidCoor = this.calculationCoor(eid); 5106 this.css(eid, { 5107 left: eidCoor['x'] + 'px', 5108 top: eidCoor['y'] + 'px' 5109 }); 5110 5111 this.elementArr.push(eid.className); 5112 return eid; 5113 }, 5114 /* 5115 å ç½®å½æ° 5116 è·åå ä»¶ç屿§ï¼å æ¬x,y,width,height,alpha 5117 */ 5118 getElement: function(element) { 5119 if(this.playerType == 'flashplayer') { 5120 return this.V.getElement(element); 5121 } 5122 var ele = element; 5123 if(typeof(element) == 'string') { 5124 ele = this.getByElement(element); 5125 } 5126 var coor = this.getCoor(ele); 5127 return { 5128 x: coor['x'], 5129 y: coor['y'], 5130 width: ele.offsetWidth, 5131 height: ele.offsetHeight, 5132 alpha: !this.isUndefined(this.css(ele, 'opacity')) ? parseFloat(this.css(ele, 'opacity')) : 1 5133 }; 5134 }, 5135 /* 5136 å ç½®å½æ° 5137 æ ¹æ®èç¹çx,y计ç®å¨ææ¾å¨éçåæ 5138 */ 5139 calculationCoor: function(ele) { 5140 if(this.playerType == 'flashplayer') { 5141 return this.V.calculationCoor(ele); 5142 } 5143 if(ele == []) { 5144 return; 5145 } 5146 var x, y, position = []; 5147 var w = this.PD.offsetWidth, 5148 h = this.PD.offsetHeight; 5149 var ew = ele.offsetWidth, 5150 eh = ele.offsetHeight; 5151 if(!this.isUndefined(this.getDataset(ele, 'x'))) { 5152 x = this.getDataset(ele, 'x'); 5153 } 5154 if(!this.isUndefined(this.getDataset(ele, 'y'))) { 5155 y = this.getDataset(ele, 'y'); 5156 } 5157 if(!this.isUndefined(this.getDataset(ele, 'position'))) { 5158 try{ 5159 position = this.getDataset(ele, 'position').toString().split(','); 5160 } 5161 catch(event){} 5162 } 5163 if(position.length > 0) { 5164 position.push(null, null, null, null); 5165 var i = 0; 5166 for(i = 0; i < position.length; i++) {
5167 if(this.isUndefined(position[i]) || position[i] == null || position[i] == 'null' || position[i] == '') { 5168 position[i] = null; 5169 } else { 5170 position[i] = parseFloat(position[i]); 5171 } 5172 } 5173 5174 if(position[2] == null) { 5175 switch(position[0]) { 5176 case 0: 5177 x = 0; 5178 break; 5179 case 1: 5180 x = parseInt((w - ew) * 0.5); 5181 break; 5182 default: 5183 x = w - ew; 5184 break; 5185 } 5186 } else { 5187 switch(position[0]) { 5188 case 0: 5189 x = position[2]; 5190 break; 5191 case 1: 5192 x = parseInt(w * 0.5) + position[2]; 5193 break; 5194 default: 5195 x = w + position[2]; 5196 break; 5197 } 5198 } 5199 if(position[3] == null) { 5200 switch(position[1]) { 5201 case 0: 5202 y = 0; 5203 break; 5204 case 1: 5205 y = parseInt((h - eh) * 0.5); 5206 break; 5207 default: 5208 y = h - eh; 5209 break; 5210 } 5211 } else { 5212 switch(position[1]) { 5213 case 0: 5214 y = position[3]; 5215 break; 5216 case 1: 5217 y = parseInt(h * 0.5) + position[3]; 5218 break; 5219 default: 5220 y = h + position[3]; 5221 break; 5222 } 5223 } 5224 } else { 5225 if(x.substring(x.length - 1, x.length) == '%') { 5226 x = Math.floor(parseInt(x.substring(0, x.length - 1)) * w * 0.01); 5227 } 5228 if(y.substring(y.length - 1, y.length) == '%') { 5229 y = Math.floor(parseInt(y.substring(0, y.length - 1)) * h * 0.01); 5230 } 5231 } 5232 return { 5233 x: x, 5234 y: y 5235 } 5236 5237 }, 5238 /* 5239 å ç½®å½æ° 5240 ä¿®æ¹æ°å¢å ä»¶çåæ 5241 */ 5242 changeElementCoor: function() { 5243 for(var i = 0; i < this.elementArr.length; i++) { 5244 if(this.getByElement(this.elementArr[i]) != []) { 5245 var c = this.calculationCoor(this.getByElement(this.elementArr[i])); 5246 if(c['x'] && c['y']){ 5247 this.css(this.elementArr[i], { 5248 top: c['y'] + 'px', 5249 left: c['x'] + 'px' 5250 }); 5251 } 5252 } 5253 } 5254 }, 5255 /* 5256 å ç½®å½æ° 5257 ç¼å¨ææé 5258 */ 5259 tween: function() { 5260 var Tween = { 5261 None: { //åéè¿å¨ 5262 easeIn: function(t, b, c, d) { 5263 return c * t / d + b; 5264 }, 5265 easeOut: function(t, b, c, d) { 5266 return c * t / d + b; 5267 }, 5268 easeInOut: function(t, b, c, d) { 5269 return c * t / d + b; 5270 } 5271 }, 5272 Quadratic: { 5273 easeIn: function(t, b, c, d) { 5274 return c * (t /= d) * t + b; 5275 }, 5276 easeOut: function(t, b, c, d) { 5277 return -c * (t /= d) * (t - 2) + b; 5278 }, 5279 easeInOut: function(t, b, c, d) { 5280 if((t /= d / 2) < 1) return c / 2 * t * t + b; 5281 return -c / 2 * ((--t) * (t - 2) - 1) + b; 5282 } 5283 }, 5284 Cubic: { 5285 easeIn: function(t, b, c, d) { 5286 return c * (t /= d) * t * t + b; 5287 }, 5288 easeOut: function(t, b, c, d) { 5289 return c * ((t = t / d - 1) * t * t + 1) + b; 5290 }, 5291 easeInOut: function(t, b, c, d) { 5292 if((t /= d / 2) < 1) return c / 2 * t * t * t + b; 5293 return c / 2 * ((t -= 2) * t * t + 2) + b; 5294 } 5295 }, 5296 Quartic: { 5297 easeIn: function(t, b, c, d) { 5298 return c * (t /= d) * t * t * t + b; 5299 }, 5300 easeOut: function(t, b, c, d) { 5301 return -c * ((t = t / d - 1) * t * t * t - 1) + b; 5302 }, 5303 easeInOut: function(t, b, c, d) { 5304 if((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; 5305 return -c / 2 * ((t -= 2) * t * t * t - 2) + b; 5306 } 5307 }, 5308 Quintic: { 5309 easeIn: function(t, b, c, d) { 5310 return c * (t /= d) * t * t * t * t + b; 5311 }, 5312 easeOut: function(t, b, c, d) { 5313 return c * ((t = t / d - 1) * t * t * t * t + 1) + b; 5314 }, 5315 easeInOut: function(t, b, c, d) { 5316 if((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; 5317 return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; 5318 } 5319 }, 5320 Sine: { 5321 easeIn: function(t, b, c, d) { 5322 return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; 5323 }, 5324 easeOut: function(t, b, c, d) { 5325 return c * Math.sin(t / d * (Math.PI / 2)) + b; 5326 }, 5327 easeInOut: function(t, b, c, d) { 5328 return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; 5329 } 5330 }, 5331 Exponential: { 5332 easeIn: function(t, b, c, d) { 5333 return(t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; 5334 }, 5335 easeOut: function(t, b, c, d) { 5336 return(t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; 5337 }, 5338 easeInOut: function(t, b, c, d) { 5339 if(t == 0) return b; 5340 if(t == d) return b + c; 5341 if((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; 5342 return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; 5343 } 5344 }, 5345 Circular: { 5346 easeIn: function(t, b, c, d) { 5347 return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; 5348 }, 5349 easeOut: function(t, b, c, d) { 5350 return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; 5351 }, 5352 easeInOut: function(t, b, c, d) { 5353 if((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; 5354 return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; 5355 } 5356 }, 5357 Elastic: { 5358 easeIn: function(t, b, c, d, a, p) { 5359 if(t == 0) return b; 5360 if((t /= d) == 1) return b + c; 5361 if(!p) p = d * .3; 5362 if(!a || a < Math.abs(c)) { 5363 a = c; 5364 var s = p / 4; 5365 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 5366 return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 5367 }, 5368 easeOut: function(t, b, c, d, a, p) { 5369 if(t == 0) return b; 5370 if((t /= d) == 1) return b + c; 5371 if(!p) p = d * .3; 5372 if(!a || a < Math.abs(c)) { 5373 a = c; 5374 var s = p / 4; 5375 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 5376 return(a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b); 5377 }, 5378 easeInOut: function(t, b, c, d, a, p) { 5379 if(t == 0) return b; 5380 if((t /= d / 2) == 2) return b + c; 5381 if(!p) p = d * (.3 * 1.5); 5382 if(!a || a < Math.abs(c)) { 5383 a = c; 5384 var s = p / 4; 5385 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 5386 if(t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 5387 return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; 5388 } 5389 }, 5390 Back: { 5391 easeIn: function(t, b, c, d, s) { 5392 if(s == undefined) s = 1.70158; 5393 return c * (t /= d) * t * ((s + 1) * t - s) + b; 5394 }, 5395 easeOut: function(t, b, c, d, s) { 5396 if(s == undefined) s = 1.70158;
5397 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; 5398 }, 5399 easeInOut: function(t, b, c, d, s) { 5400 if(s == undefined) s = 1.70158; 5401 if((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; 5402 return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; 5403 } 5404 }, 5405 Bounce: { 5406 easeIn: function(t, b, c, d) { 5407 return c - Tween.Bounce.easeOut(d - t, 0, c, d) + b; 5408 }, 5409 easeOut: function(t, b, c, d) { 5410 if((t /= d) < (1 / 2.75)) { 5411 return c * (7.5625 * t * t) + b; 5412 } else if(t < (2 / 2.75)) { 5413 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; 5414 } else if(t < (2.5 / 2.75)) { 5415 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; 5416 } else { 5417 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; 5418 } 5419 }, 5420 easeInOut: function(t, b, c, d) { 5421 if(t < d / 2) return Tween.Bounce.easeIn(t * 2, 0, c, d) * .5 + b; 5422 else return Tween.Bounce.easeOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b; 5423 } 5424 } 5425 }; 5426 return Tween; 5427 }, 5428 /* 5429 æ¥å£å½æ° 5430 ç¼å¨ææ 5431 ele:Object=éè¦ç¼å¨ç对象, 5432 parameter:String=éè¦æ¹åç屿§ï¼x,y,width,height,alpha, 5433 effect:String=ææåç§°, 5434 start:Int=èµ·å§å¼, 5435 end:Int=ç»æå¼, 5436 speed:Number=è¿å¨çæ»ç§æ°ï¼æ¯æå°æ° 5437 */ 5438 animate: function(attribute) { 5439 if(this.playerType == 'flashplayer') { 5440 return this.V.animate(attribute); 5441 } 5442 var thisTemp = this; 5443 var animateId = 'animate_' + this.randomString(); 5444 var obj = { 5445 element: null, 5446 parameter: 'x', 5447 static: false, 5448 effect: 'None.easeIn', 5449 start: null, 5450 end: null, 5451 speed: 0, 5452 overStop: false, 5453 pauseStop: false, //æåææ¾æ¶ç¼å¨æ¯å¦æå 5454 callBack: null 5455 }; 5456 obj = this.standardization(obj, attribute); 5457 if(obj['element'] == null || obj['speed'] == 0) { 5458 return false; 5459 } 5460 var w = this.PD.offsetWidth, 5461 h = this.PD.offsetHeight; 5462 var effArr = (obj['effect'] + '.').split('.'); 5463 var tweenFun = this.tween()[effArr[0]][effArr[1]]; 5464 var eleCoor = { 5465 x: 0, 5466 y: 0 5467 }; 5468 if(this.isUndefined(tweenFun)) { 5469 return false; 5470 } 5471 //å å°è¯¥å ä»¶ä»å ä»¶æ°ç»éå é¤ï¼è®©å ¶ä¸åè·éææ¾å¨ç尺寸æ¹åèæ¹åä½ç½® 5472 var def = this.arrIndexOf(this.elementArr, obj['element'].className); 5473 if(def > -1) { 5474 this.elementArr.splice(def, 1); 5475 } 5476 //var run = true; 5477 var css = {}; 5478 //å¯¹ä¼ éçåæ°è¿è¡è½¬åï¼xåy转åæleft,top 5479 var pm = this.getElement(obj['element']); //å å«x,y,width,height,alpha屿§ 5480 var t = 0; //å½åæ¶é´ 5481 var b = 0; //åå§å¼ 5482 var c = 0; //ååé 5483 var d = obj['speed'] * 1000; //æç»æ¶é´ 5484 var timerTween = null; 5485 var tweenObj = null; 5486 var start = obj['start'] == null ? '' : obj['start'].toString(); 5487 var end = obj['end'] == null ? '' : obj['end'].toString(); 5488 switch(obj['parameter']) { 5489 case 'x': 5490 if(obj['start'] == null) { 5491 b = pm['x']; 5492 } else { 5493 if(start.substring(start.length - 1, start.length) == '%') { 5494 b = parseInt(start) * w * 0.01; 5495 } else { 5496 b = parseInt(start); 5497 } 5498 5499 } 5500 if(obj['end'] == null) { 5501 c = pm['x'] - b; 5502 } else { 5503 if(end.substring(end.length - 1, end.length) == '%') { 5504 c = parseInt(end) * w * 0.01 - b; 5505 } else if(end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { 5506 if(typeof(obj['end']) == 'number') { 5507 c = parseInt(obj['end']) - b; 5508 } else { 5509 c = parseInt(end); 5510 } 5511 5512 } else { 5513 c = parseInt(end) - b; 5514 } 5515 } 5516 break; 5517 case 'y': 5518 if(obj['start'] == null) { 5519 b = pm['y']; 5520 } else { 5521 if(start.substring(start.length - 1, start.length) == '%') { 5522 b = parseInt(start) * h * 0.01; 5523 } else { 5524 b = parseInt(start); 5525 } 5526 5527 } 5528 if(obj['end'] == null) { 5529 c = pm['y'] - b; 5530 } else { 5531 if(end.substring(end.length - 1, end.length) == '%') { 5532 c = parseInt(end) * h * 0.01 - b; 5533 } else if(end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { 5534 if(typeof(obj['end']) == 'number') { 5535 c = parseInt(obj['end']) - b; 5536 } else { 5537 c = parseInt(end); 5538 } 5539 } else { 5540 c = parseInt(end) - b; 5541 } 5542 } 5543 break; 5544 case 'alpha': 5545 if(obj['start'] == null) { 5546 b = pm['alpha'] * 100; 5547 } else { 5548 if(start.substring(start.length - 1, start.length) == '%') { 5549 b = parseInt(obj['start']); 5550 } else { 5551 b = parseInt(obj['start'] * 100); 5552 } 5553 5554 } 5555 if(obj['end'] == null) { 5556 c = pm['alpha'] * 100 - b; 5557 } else { 5558 if(end.substring(end.length - 1, end.length) == '%') { 5559 c = parseInt(end) - b; 5560 } else if(end.substring(0, 1) == '-' || end.substring(0, 1) == '+') { 5561 if(typeof(obj['end']) == 'number') { 5562 c = parseInt(obj['end']) * 100 - b; 5563 } else { 5564 c = parseInt(obj['end']) * 100; 5565 } 5566 } else { 5567 c = parseInt(obj['end']) * 100 - b; 5568 } 5569 } 5570 break; 5571 } 5572 var callBack = function() { 5573 var index = thisTemp.arrIndexOf(thisTemp.animateElementArray, animateId); 5574 if(index > -1) { 5575 thisTemp.animateArray.splice(index, 1); 5576 thisTemp.animateElementArray.splice(index, 1); 5577 } 5578 index = thisTemp.arrIndexOf(thisTemp.animatePauseArray, animateId); 5579 if(index > -1) { 5580 thisTemp.animatePauseArray.splice(index, 1); 5581 } 5582 if(obj['callBack'] != null && obj['element'] && obj['callBack'] != 'callBack' && obj['callBack'] != 'tweenX' && obj['tweenY'] != 'callBack' && obj['callBack'] != 'tweenAlpha') { 5583 var cb = eval(obj['callBack']); 5584 cb(obj['element']); 5585 obj['callBack'] = null; 5586 } 5587 }; 5588 var stopTween = function() { 5589 if(timerTween != null) { 5590 if(timerTween.runing) { 5591 timerTween.stop(); 5592 } 5593 timerTween = null; 5594 } 5595 }; 5596 var tweenX = function() { 5597 if(t < d) { 5598 t += 10; 5599 css = { 5600 left: Math.ceil(tweenFun(t, b, c, d)) + 'px' 5601 }; 5602 if(obj['static']) { 5603 eleCoor = thisTemp.calculationCoor(obj['element']); 5604 css['top'] = eleCoor['y'] + 'px'; 5605 } 5606 thisTemp.css(obj['element'], css); 5607 5608 } else { 5609 stopTween(); 5610 thisTemp.elementArr.push(obj['element'].className); 5611 callBack(); 5612 } 5613 }; 5614 var tweenY = function() { 5615 if(t < d) { 5616 t += 10; 5617 css = { 5618 top: Math.ceil(tweenFun(t, b, c, d)) + 'px' 5619 }; 5620 if(obj['static']) { 5621 eleCoor = thisTemp.calculationCoor(obj['element']); 5622 css['left'] = eleCoor['x'] + 'px'; 5623 } 5624 thisTemp.css(obj['element'], css); 5625 } else { 5626 stopTween(); 5627 thisTemp.elementArr.push(obj['element'].className); 5628 callBack(); 5629 } 5630 }; 5631 var tweenAlpha = function() { 5632 if(t < d) { 5633 t += 10; 5634 eleCoor = thisTemp.calculationCoor(obj['element']); 5635 var ap = Math.ceil(tweenFun(t, b, c, d)) * 0.01; 5636 css = { 5637 filter: 'alpha(opacity:' + ap + ')', 5638 opacity: ap.toString() 5639 }; 5640 if(obj['static']) { 5641 eleCoor = thisTemp.calculationCoor(obj['element']); 5642 css['top'] = eleCoor['y'] + 'px'; 5643 css['left'] = eleCoor['x'] + 'px'; 5644 } 5645 thisTemp.css(obj['element'], css); 5646 } else { 5647 stopTween(); 5648 thisTemp.elementArr.push(obj['element'].className); 5649 callBack(); 5650 } 5651 }; 5652 switch(obj['parameter']) { 5653 case 'x': 5654 tweenObj = tweenX; 5655 break; 5656 case 'y': 5657 tweenObj = tweenY; 5658 break; 5659 case 'alpha': 5660 tweenObj = tweenAlpha; 5661 break; 5662 default: 5663 break; 5664 } 5665 timerTween = new thisTemp.timer(10, tweenObj); 5666 timerTween.callBackFunction=callBack; 5667 if(obj['overStop']) { 5668 var mouseOver = function() { 5669 if(timerTween != null && timerTween.runing) { 5670 timerTween.stop(); 5671 } 5672 }; 5673 this.addListenerInside('mouseover', mouseOver, obj['element']); 5674 var mouseOut = function() { 5675 var start = true; 5676 if(obj['pauseStop'] && thisTemp.getMetaDate()['paused']) { 5677 start = false;
5678 } 5679 if(timerTween != null && !timerTween.runing && start) { 5680 timerTween.start(); 5681 } 5682 }; 5683 this.addListenerInside('mouseout', mouseOut, obj['element']); 5684 } 5685 5686 this.animateArray.push(timerTween); 5687 this.animateElementArray.push(animateId); 5688 if(obj['pauseStop']) { 5689 this.animatePauseArray.push(animateId); 5690 } 5691 return animateId; 5692 }, 5693 /* 5694 æ¥å£å½æ°å½æ° 5695 ç»§ç»è¿è¡animate 5696 */ 5697 animateResume: function(id) { 5698 if(this.playerType == 'flashplayer') { 5699 this.V.animateResume(this.isUndefined(id) ? '' : id); 5700 return; 5701 } 5702 var arr = []; 5703 if(id != '' && !this.isUndefined(id) && id != 'pause') { 5704 arr.push(id); 5705 } else { 5706 if(id === 'pause') { 5707 arr = this.animatePauseArray; 5708 } else { 5709 arr = this.animateElementArray; 5710 } 5711 } 5712 for(var i = 0; i < arr.length; i++) { 5713 var index = this.arrIndexOf(this.animateElementArray, arr[i]); 5714 if(index > -1) { 5715 this.animateArray[index].start(); 5716 } 5717 } 5718 5719 }, 5720 /* 5721 æ¥å£å½æ° 5722 æåè¿è¡animate 5723 */ 5724 animatePause: function(id) { 5725 if(this.playerType == 'flashplayer') { 5726 this.V.animatePause(this.isUndefined(id) ? '' : id); 5727 return; 5728 } 5729 var arr = []; 5730 if(id != '' && !this.isUndefined(id) && id != 'pause') { 5731 arr.push(id); 5732 } else { 5733 if(id === 'pause') { 5734 arr = this.animatePauseArray; 5735 } else { 5736 arr = this.animateElementArray; 5737 } 5738 } 5739 for(var i = 0; i < arr.length; i++) { 5740 var index = this.arrIndexOf(this.animateElementArray, arr[i]); 5741 if(index > -1) { 5742 this.animateArray[index].stop(); 5743 } 5744 } 5745 }, 5746 /* 5747 å ç½®å½æ° 5748 æ ¹æ®IDå 餿°ç»é对åºçå 容 5749 */ 5750 deleteAnimate: function(id) { 5751 if(this.playerType == 'flashplayer' && this.V) { 5752 try { 5753 this.V.deleteAnimate(id); 5754 } catch(event) {this.log(event);} 5755 return; 5756 } 5757 //console.log(this.animateElementArray) 5758 var index = this.arrIndexOf(this.animateElementArray, id); 5759 if(index > -1) { 5760 this.animateArray[index].callBackFunction(); 5761 this.animateArray.splice(index, 1); 5762 this.animateElementArray.splice(index, 1); 5763 } 5764 }, 5765 /* 5766 å ç½®å½æ° 5767 å é¤å¤é¨æ°å»ºçå ä»¶ 5768 */ 5769 deleteElement: function(ele) { 5770 if(this.playerType == 'flashplayer' && this.V) { 5771 try { 5772 this.V.deleteElement(ele); 5773 } catch(event) {} 5774 return; 5775 } 5776 //å å°è¯¥å ä»¶ä»å ä»¶æ°ç»éå é¤ï¼è®©å ¶ä¸åè·éææ¾å¨ç尺寸æ¹åèæ¹åä½ç½® 5777 var def = this.arrIndexOf(this.elementArr, ele.className); 5778 if(def > -1) { 5779 this.elementArr.splice(def, 1); 5780 } 5781 this.deleteAnimate(ele); 5782 this.deleteChild(ele); 5783 5784 }, 5785 /* 5786 -------------------------------------------------------------- 5787 å ±ç¨å½æ°é¨å 5788 以ä¸å½æ°å¹¶éåªè½å¨æ¬ç¨åºä¸ä½¿ç¨ï¼ä¹å¯ä»¥å¨é¡µé¢å ¶å®é¡¹ç®ä¸ä½¿ç¨ 5789 æ ¹æ®IDè·åå ç´ å¯¹è±¡ 5790 */ 5791 getByElement: function(obj, parent) { 5792 if(this.isUndefined(parent)) { 5793 parent = document; 5794 } 5795 var num = obj.substr(0, 1); 5796 var res = []; 5797 if(num != '#') { 5798 if(num == '.') { 5799 obj = obj.substr(1, obj.length); 5800 } 5801 if(parent.getElementsByClassName) { 5802 res = parent.getElementsByClassName(obj); 5803 } else { 5804 var reg = new RegExp(' ' + obj + ' ', 'i'); 5805 var ele = parent.getElementsByTagName('*'); 5806 5807 for(var i = 0; i < ele.length; i++) { 5808 if(reg.test(' ' + ele[i].className + ' ')) { 5809 res.push(ele[i]); 5810 } 5811 } 5812 } 5813 5814 if(res.length > 0) { 5815 return res[0]; 5816 } else { 5817 return res; 5818 } 5819 } else { 5820 if(num == '#') { 5821 obj = obj.substr(1, obj.length); 5822 } 5823 return document.getElementById(obj); 5824 } 5825 }, 5826 /* 5827 å ±ç¨å½æ° 5828 åè½ï¼ä¿®æ¹æ ·å¼æè·åæå®æ ·å¼çå¼ï¼ 5829 elemï¼ID对象æID对åºçå符ï¼å¦æå¤ä¸ªå¯¹è±¡ä¸èµ·è®¾ç½®ï¼åå¯ä»¥ä½¿ç¨æ°ç» 5830 attributeï¼æ ·å¼åç§°æå¯¹è±¡ï¼å¦ææ¯å¯¹è±¡ï¼åçç¥ævalueå¼ 5831 valueï¼attributeä¸ºæ ·å¼åç§°æ¶ï¼å®ä¹çæ ·å¼å¼ 5832 示ä¾ä¸ï¼ 5833 this.css(ID,'width','100px'); 5834 示ä¾äºï¼ 5835 this.css('id','width','100px'); 5836 示ä¾ä¸ï¼ 5837 this.css([ID1,ID2,ID3],'width','100px'); 5838 示ä¾åï¼ 5839 this.css(ID,{ 5840 width:'100px', 5841 height:'100px' 5842 }); 5843 示ä¾äº(è·å宽度)ï¼ 5844 var width=this.css(ID,'width'); 5845 */ 5846 css: function(elem, attribute, value) { 5847 var i = 0; 5848 var k = ''; 5849 if(typeof(elem) == 'object') { //å¯¹è±¡ææ°ç» 5850 if(!this.isUndefined(typeof(elem.length))) { //è¯´ææ¯æ°ç» 5851 for(i = 0; i < elem.length; i++) { 5852 var el; 5853 if(typeof(elem[i]) == 'string') { 5854 el = this.getByElement(elem[i]) 5855 } else { 5856 el = elem[i]; 5857 } 5858 if(typeof(attribute) != 'object') { 5859 if(!this.isUndefined(value)) { 5860 el.style[attribute] = value; 5861 } 5862 } else { 5863 for(k in attribute) { 5864 if(!this.isUndefined(attribute[k])) { 5865 el.style[k] = attribute[k]; 5866 } 5867 } 5868 } 5869 } 5870 return; 5871 } 5872 5873 } 5874 if(typeof(elem) == 'string') { 5875 elem = this.getByElement(elem); 5876 } 5877 5878 if(typeof(attribute) != 'object') { 5879 if(!this.isUndefined(value)) { 5880 elem.style[attribute] = value; 5881 } else { 5882 if(!this.isUndefined(this.getStyle(elem, attribute))) {
5883 return this.getStyle(elem, attribute); 5884 } else { 5885 return false; 5886 } 5887 } 5888 } else { 5889 for(k in attribute) { 5890 if(!this.isUndefined(attribute[k])) { 5891 elem.style[k] = attribute[k]; 5892 } 5893 } 5894 } 5895 5896 }, 5897 /* 5898 å ç½®å½æ° 5899 å ¼å®¹åè·åstyle 5900 */ 5901 getStyle: function(obj, attr) { 5902 if(!this.isUndefined(obj.style[attr])) { 5903 return obj.style[attr]; 5904 } else { 5905 if(obj.currentStyle) { 5906 return obj.currentStyle[attr]; 5907 } else { 5908 return getComputedStyle(obj, false)[attr]; 5909 } 5910 } 5911 }, 5912 /* 5913 å ±ç¨å½æ° 5914 夿å鿝å¦å卿弿¯å¦ä¸ºundefined 5915 */ 5916 isUndefined: function(value) { 5917 try { 5918 if(value == 'undefined' || value == undefined) { 5919 return true; 5920 } 5921 } catch(event) {this.log(event);} 5922 return false; 5923 }, 5924 /* 5925 å ±ç¨å½æ° 5926 å¤é¨çå¬å½æ° 5927 */ 5928 addListener: function(name, funName) { 5929 if(name && funName) { 5930 if(this.playerType == 'flashplayer') { 5931 var ff = ''; //å®ä¹ç¨æ¥åflashplayerä¼ éç彿°å符 5932 if(typeof(funName) == 'function') { 5933 ff = this.getParameterNames(funName); 5934 } 5935 this.V.addListener(name, ff); 5936 return; 5937 } 5938 var have = false; 5939 for(var i = 0; i < this.listenerJsArr.length; i++) { 5940 var arr = this.listenerJsArr[i]; 5941 if(arr[0] == name && arr[1] == funName) { 5942 have = true; 5943 break; 5944 } 5945 } 5946 if(!have) { 5947 this.listenerJsArr.push([name, funName]); 5948 } 5949 } 5950 }, 5951 /* 5952 å ±ç¨å½æ° 5953 å¤é¨å é¤çå¬å½æ° 5954 */ 5955 removeListener: function(name, funName) { 5956 if(name && funName) { 5957 if(this.playerType == 'flashplayer') { 5958 var ff = ''; //å®ä¹ç¨æ¥åflashplayerä¼ éç彿°å符 5959 if(typeof(funName) == 'function') { 5960 ff = this.getParameterNames(funName); 5961 } 5962 this.V.removeListener(name, ff); 5963 return; 5964 } 5965 for(var i = 0; i < this.listenerJsArr.length; i++) { 5966 var arr = this.listenerJsArr[i]; 5967 if(arr[0] == name && arr[1] == funName) { 5968 this.listenerJsArr.splice(i, 1); 5969 break; 5970 } 5971 } 5972 } 5973 }, 5974 /* 5975 å é¨çå¬å½æ°ï¼è°ç¨æ¹å¼ï¼ 5976 this.addListenerInside('click',function(event){},[ID]); 5977 då¼ä¸ºç©ºæ¶ï¼å表示çå¬å½åçè§é¢ææ¾å¨ 5978 */ 5979 addListenerInside: function(e, f, d, t) { 5980 if(this.isUndefined(t)) { 5981 t = false; 5982 } 5983 var o = this.V; 5984 if(!this.isUndefined(d)) { 5985 o = d; 5986 } 5987 if(o.addEventListener) { 5988 try { 5989 o.addEventListener(e, f, t); 5990 } catch(event) {} 5991 } else if(o.attachEvent) { 5992 try { 5993 o.attachEvent('on' + e, f); 5994 } catch(event) {} 5995 } else { 5996 o['on' + e] = f; 5997 } 5998 }, 5999 /* 6000 å é¤å é¨çå¬å½æ°ï¼è°ç¨æ¹å¼ï¼ 6001 this.removeListenerInside('click',function(event){}[,ID]); 6002 då¼ä¸ºç©ºæ¶ï¼å表示çå¬å½åçè§é¢ææ¾å¨ 6003 */ 6004 removeListenerInside: function(e, f, d, t) { 6005 /*if(this.playerType=='flashplayer' && this.getParameterNames(f) && this.isUndefined(d)) { 6006 return; 6007 }*/ 6008 if(this.isUndefined(t)) { 6009 t = false; 6010 } 6011 var o = this.V; 6012 if(!this.isUndefined(d)) { 6013 o = d; 6014 } 6015 if(o.removeEventListener) { 6016 try { 6017 this.addNum--; 6018 o.removeEventListener(e, f, t); 6019 } catch(e) {} 6020 } else if(o.detachEvent) { 6021 try { 6022 o.detachEvent('on' + e, f); 6023 } catch(e) {} 6024 } else { 6025 o['on' + e] = null; 6026 } 6027 }, 6028 /* 6029 å ±ç¨å½æ° 6030 ç»ä¸åé çå¬ï¼ä»¥è¾¾å°è·as3åæ ·ææ 6031 */ 6032 sendJS: function(name, val) { 6033 var list = this.listenerJsArr; 6034 var obj = { 6035 variable: this.vars['variable'] 6036 }; 6037 if(this.vars['playerID']) { 6038 obj['playerID'] = this.vars['playerID']; 6039 } 6040 for(var i = 0; i < list.length; i++) { 6041 var arr = list[i]; 6042 if(arr[0] == name) { 6043 if(val) { 6044 switch(arr[1].length) { 6045 case 1: 6046 arr[1](val); 6047 break; 6048 case 2: 6049 arr[1](val, obj); 6050 break; 6051 default: 6052 arr[1](); 6053 break; 6054 } 6055 6056 } else { 6057 switch(arr[1].length) { 6058 case 1: 6059 arr[1](obj); 6060 break; 6061 default: 6062 arr[1](); 6063 break; 6064 } 6065 6066 } 6067 } 6068 } 6069 }, 6070 /* 6071 å ±ç¨å½æ° 6072 è·å彿°åç§°ï¼å¦ function ckplayer(){} var fun=ckplayerï¼ågetParameterNames(fun)=ckplayer 6073 */ 6074 getParameterNames: function(fn) { 6075 if(typeof(fn) !== 'function') { 6076 return false;
6077 } 6078 var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; 6079 var code = fn.toString().replace(COMMENTS, ''); 6080 var result = code.slice(code.indexOf(' ') + 1, code.indexOf('(')); 6081 return result === null ? false : result; 6082 }, 6083 /* 6084 å ±ç¨å½æ° 6085 è·åå½åæ¬å°æ¶é´ 6086 */ 6087 getNowDate: function() { 6088 var nowDate = new Date(); 6089 var month = nowDate.getMonth() + 1; 6090 var date = nowDate.getDate(); 6091 var hours = nowDate.getHours(); 6092 var minutes = nowDate.getMinutes(); 6093 var seconds = nowDate.getSeconds(); 6094 var tMonth = '', 6095 tDate = '', 6096 tHours = '', 6097 tMinutes = '', 6098 tSeconds = '', 6099 tSeconds = (seconds < 10) ? '0' + seconds : seconds + '', 6100 tMinutes = (minutes < 10) ? '0' + minutes : minutes + '', 6101 tHours = (hours < 10) ? '0' + hours : hours + '', 6102 tDate = (date < 10) ? '0' + date : date + '', 6103 tMonth = (month < 10) ? '0' + month : month + ''; 6104 return tMonth + '/' + tDate + ' ' + tHours + ':' + tMinutes + ':' + tSeconds; 6105 }, 6106 /* 6107 å ±ç¨å½æ° 6108 æ ¼å¼åæ¶åç§ 6109 seconds:Intï¼ç§æ° 6110 ishours:Booleanï¼æ¯å¦æ¾ç¤ºå°æ¶ï¼å¦æè®¾ç½®æfalseï¼å伿¾ç¤ºå¦80:20ï¼è¡¨ç¤º1å°æ¶20åé20ç§ 6111 */ 6112 formatTime: function(seconds, ishours) { 6113 var tSeconds = '', 6114 tMinutes = '', 6115 tHours = ''; 6116 if(isNaN(seconds)) { 6117 seconds = 0; 6118 } 6119 var s = Math.floor(seconds % 60), 6120 m = 0, 6121 h = 0; 6122 if(ishours) { 6123 m = Math.floor(seconds / 60) % 60; 6124 h = Math.floor(seconds / 3600); 6125 } else { 6126 m = Math.floor(seconds / 60); 6127 } 6128 tSeconds = (s < 10) ? '0' + s : s + ''; 6129 tMinutes = (m > 0) ? ((m < 10) ? '0' + m + ':' : m + ':') : '00:'; 6130 tHours = (h > 0) ? ((h < 10) ? '0' + h + ':' : h + ':') : ''; 6131 if(ishours) { 6132 return tHours + tMinutes + tSeconds; 6133 } else { 6134 return tMinutes + tSeconds; 6135 } 6136 }, 6137 /* 6138 å ±ç¨å½æ° 6139 è·åä¸ä¸ªéæºå符 6140 lenï¼éæºå符é¿åº¦ 6141 */ 6142 randomString: function(len) { 6143 len = len || 16; 6144 var chars = 'abcdefghijklmnopqrstuvwxyz'; 6145 var maxPos = chars.length; 6146 var val = ''; 6147 for(i = 0; i < len; i++) { 6148 val += chars.charAt(Math.floor(Math.random() * maxPos)); 6149 } 6150 return 'ch' + val; 6151 }, 6152 /* 6153 å ±ç¨å½æ° 6154 è·åå符串é¿åº¦,䏿ç®ä¸¤,è±ææ°åç®1 6155 */ 6156 getStringLen: function(str) { 6157 var len = 0; 6158 for(var i = 0; i < str.length; i++) { 6159 if(str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) { 6160 len += 2; 6161 } else { 6162 len++; 6163 } 6164 } 6165 return len; 6166 }, 6167 /* 6168 å é¨å½æ° 6169 ç¨æ¥ä¸ºajaxæä¾æ¯æ 6170 */ 6171 createXHR: function() { 6172 if(window.XMLHttpRequest) { 6173 //IE7+ãFirefoxãOperaãChrome åSafari 6174 return new XMLHttpRequest(); 6175 } else if(window.ActiveXObject) { 6176 //IE6 åä»¥ä¸ 6177 try { 6178 return new ActiveXObject('Microsoft.XMLHTTP'); 6179 } catch(event) { 6180 try { 6181 return new ActiveXObject('Msxml2.XMLHTTP'); 6182 } catch(event) { 6183 this.eject(this.errorList[7]); 6184 } 6185 } 6186 } else { 6187 this.eject(this.errorList[8]); 6188 } 6189 }, 6190 /* 6191 å ±ç¨å½æ° 6192 ajaxè°ç¨ 6193 */ 6194 ajax: function(cObj) { 6195 var thisTemp = this; 6196 var callback = null; 6197 var obj = { 6198 method: 'get', //请æ±ç±»å 6199 dataType: 'json', //请æ±çæ°æ®ç±»å 6200 charset: 'utf-8', 6201 async: false, //trueè¡¨ç¤ºå¼æ¥ï¼falseè¡¨ç¤ºåæ¥ 6202 url: '', 6203 data: null, 6204 success: null 6205 }; 6206 if(typeof(cObj) != 'object') { 6207 this.eject(this.errorList[9]); 6208 return; 6209 } 6210 obj = this.standardization(obj, cObj); 6211 if(obj.dataType === 'json' || obj.dataType === 'text' || obj.dataType === 'html') { 6212 var xhr = this.createXHR(); 6213 callback = function() { 6214 //夿httpçäº¤äºæ¯å¦æå 6215 if(xhr.status == 200) { 6216 if(obj.success == null) { 6217 return; 6218 } 6219 if(obj.dataType === 'json') { 6220 try { 6221 obj.success(eval('(' + xhr.responseText + ')')); //åè°ä¼ éåæ° 6222 } catch(event) { 6223 obj.success(null); 6224 } 6225 } else { 6226 obj.success(xhr.responseText); //åè°ä¼ éåæ° 6227 } 6228 } else { 6229 thisTemp.eject(thisTemp.errorList[10], 'Ajax.status:' + xhr.status); 6230 } 6231 }; 6232 obj.url = obj.url + '?rand=' + this.randomString(6); 6233 obj.data = this.formatParams(obj.data);
6233 //éè¿params()å°åå¼å¯¹è½¬æ¢æå符串 6234 if(obj.method === 'get' && !this.isUndefined(obj.data)) { 6235 obj.url += obj.url.indexOf('?') == -1 ? '?' + obj.data : '&' + obj.data; 6236 } 6237 if(obj.async === true) { //trueè¡¨ç¤ºå¼æ¥ï¼falseè¡¨ç¤ºåæ¥ 6238 xhr.onreadystatechange = function() { 6239 if(xhr.readyState == 4) { //å¤æå¯¹è±¡çç¶ææ¯å¦äº¤äºå®æ 6240 callback(); //åè° 6241 } 6242 }; 6243 } 6244 xhr.open(obj.method, obj.url, obj.async); 6245 if(obj.method === 'post') { 6246 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 6247 xhr.setRequestHeader('charset', obj['charset']); 6248 xhr.send(obj.data); 6249 } else { 6250 xhr.send(null); //getæ¹å¼åå¡«null 6251 } 6252 if(obj.async === false) { //忥 6253 callback(); 6254 } 6255 6256 } else if(obj.dataType === 'jsonp') { 6257 var oHead = document.getElementsByTagName('head')[0]; 6258 var oScript = document.createElement('script'); 6259 var callbackName = 'callback' + new Date().getTime(); 6260 var params = this.formatParams(obj.data) + '&callback=' + callbackName; //ææ¶é´æ³æ¼æ¥å符串 6261 callback = obj.success; 6262 //æ¼æ¥å¥½src 6263 oScript.src = obj.url.split('?') + '?' + params; 6264 //æå ¥scriptæ ç¾ 6265 oHead.insertBefore(oScript, oHead.firstChild); 6266 //jsonpçåè°å½æ° 6267 window[callbackName] = function(json) { 6268 callback(json); 6269 oHead.removeChild(oScript); 6270 }; 6271 } 6272 }, 6273 /* 6274 å ç½®å½æ° 6275 卿å è½½js 6276 */ 6277 loadJs: function(path, success) { 6278 var oHead = document.getElementsByTagName('HEAD').item(0); 6279 var oScript = document.createElement('script'); 6280 oScript.type = 'text/javascript'; 6281 oScript.src = this.getNewUrl(path); 6282 oHead.appendChild(oScript); 6283 oScript.onload = function() { 6284 success(); 6285 } 6286 }, 6287 /* 6288 å ±ç¨å½æ° 6289 æé¤IE6-9 6290 */ 6291 isMsie: function() { 6292 var browser = navigator.appName; 6293 var b_version = navigator.appVersion; 6294 var version = b_version.split(';'); 6295 var trim_Version = ''; 6296 if(version.length > 1) { 6297 trim_Version = version[1].replace(/[ ]/g, ''); 6298 } 6299 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')) { 6300 return false; 6301 } 6302 return true; 6303 }, 6304 /* 6305 å ±ç¨å½æ° 6306 夿æ¯å¦å®è£ äºflashplayer 6307 */ 6308 uploadFlash: function() { 6309 var swf; 6310 if(navigator.userAgent.indexOf('MSIE') > 0) { 6311 try { 6312 var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 6313 return true; 6314 } catch(e) { 6315 return false; 6316 } 6317 } 6318 if(navigator.userAgent.indexOf('Firefox') > 0) { 6319 swf = navigator.plugins['Shockwave Flash']; 6320 if(swf) { 6321 return true 6322 } else { 6323 return false; 6324 } 6325 } 6326 return true; 6327 }, 6328 /* 6329 å ±ç¨å½æ° 6330 æ£æµæµè§å¨æ¯å¦æ¯æHTML5-Video 6331 */ 6332 supportVideo: function() { 6333 if(!this.isMsie()) { 6334 return false; 6335 } 6336 if(!!document.createElement('video').canPlayType) { 6337 var vidTest = document.createElement('video'); 6338 var oggTest; 6339 try { 6340 oggTest = vidTest.canPlayType('video/ogg; codecs="theora, vorbis"'); 6341 } catch(error) { 6342 oggTest = false; 6343 } 6344 if(!oggTest) { 6345 var h264Test; 6346 try { 6347 h264Test = vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); 6348 } catch(error) { 6349 h264Test = false; 6350 } 6351 if(!h264Test) { 6352 return false; 6353 } else { 6354 if(h264Test == "probably") { 6355 return true; 6356 } else { 6357 return false; 6358 } 6359 } 6360 } else { 6361 if(oggTest == "probably") { 6362 return true; 6363 } else { 6364 return false; 6365 } 6366 } 6367 } else { 6368 return false; 6369 } 6370 }, 6371 /* 6372 å ±ç¨å½æ° 6373 è·å屿§å¼ 6374 */ 6375 getDataset: function(ele, z) { 6376 try { 6377 return ele.dataset[z]; 6378 } catch(error) { 6379 try { 6380 return ele.getAttribute('data-' + z) 6381 } catch(error) { 6382 return false; 6383 } 6384 } 6385 }, 6386 /* 6387 å ±ç¨å½æ° 6388 è¿åflashplayerç对象 6389 */ 6390 getObjectById: function(id) { 6391 var x = null; 6392 var y = this.getByElement('#' + id); 6393 var r = 'embed'; 6394 if(y && y.nodeName == 'OBJECT') { 6395 if(typeof(y.SetVariable) != 'undefined') { 6396 x = y; 6397 } else { 6398 var z = y.getElementsByTagName(r)[0]; 6399 if(z) { 6400 x = z; 6401 } 6402 } 6403 } 6404 return x; 6405 }, 6406 /* 6407 å ±ç¨å½æ° 6408 对象转å°åå符串 6409 */ 6410 formatParams: function(data) { 6411 var arr = []; 6412 for(var i in data) { 6413 arr.push(encodeURIComponent(i) + '=' + encodeURIComponent(data[i])); 6414 } 6415 return arr.join('&'); 6416 }, 6417 /* 6418 å ç½®å½æ° 6419 对å°åè¿è¡å泡æåº 6420 */ 6421 arrSort: function(arr) { 6422 var temp = []; 6423 for(var i = 0; i < arr.length; i++) { 6424 for(var j = 0; j < arr.length - i; j++) { 6425 if(!this.isUndefined(arr[j + 1]) && arr[j][3] < arr[j + 1][3]) { 6426 temp = arr[j + 1]; 6427 arr[j + 1] = arr[j]; 6428 arr[j] = temp; 6429 } 6430 } 6431 } 6432 return arr; 6433 }, 6434 /* 6435 å ç½®å½æ° 6436 夿æä»¶åç¼ 6437 */ 6438 getFileExt: function(filepath) { 6439 if(filepath != '' && !this.isUndefined(filepath)) { 6440 if(filepath.indexOf('?') > -1) { 6441 filepath = filepath.split('?')[0]; 6442 } 6443 var pos = '.' + filepath.replace(/.+\./, ''); 6444 return pos; 6445 } 6446 return ''; 6447 }, 6448 /* 6449 å ç½®å½æ° 6450 夿æ¯å¦æ¯ç§»å¨ç«¯ 6451 */ 6452 isMobile: function() { 6453 if(navigator.userAgent.match(/(iPhone|iPad|iPod|Android|ios)/i)) { 6454 return true; 6455 } 6456 return false;
6457 }, 6458 /* 6459 å ç½®å½æ° 6460 æç´¢å符串stræ¯å¦å å«key 6461 */ 6462 isContains: function(str, key) { 6463 return str.indexOf(key) > -1; 6464 }, 6465 /* 6466 å ç½®å½æ° 6467 ç»å°åæ·»å éæºæ° 6468 */ 6469 getNewUrl: function(url) { 6470 if(this.isContains(url, '?')) { 6471 return url += '&' + this.randomString(8) + '=' + this.randomString(8); 6472 } else { 6473 return url += '?' + this.randomString(8) + '=' + this.randomString(8); 6474 } 6475 }, 6476 /* 6477 å ±ç¨å½æ° 6478 è·åclientXåclientY 6479 */ 6480 client: function(event) { 6481 var eve = event || window.event; 6482 if(this.isUndefined(eve)) { 6483 eve = { 6484 clientX: 0, 6485 clientY: 0 6486 }; 6487 } 6488 return { 6489 x: eve.clientX + (document.documentElement.scrollLeft || this.body.scrollLeft) - this.pdCoor['x'], 6490 y: eve.clientY + (document.documentElement.scrollTop || this.body.scrollTop) - this.pdCoor['y'] 6491 } 6492 }, 6493 /* 6494 å ç½®å½æ° 6495 è·åèç¹çç»å¯¹åæ 6496 */ 6497 getCoor: function(obj) { 6498 var coor = this.getXY(obj); 6499 return { 6500 x: coor['x'] - this.pdCoor['x'], 6501 y: coor['y'] - this.pdCoor['y'] 6502 }; 6503 }, 6504 getXY: function(obj) { 6505 var parObj = obj; 6506 var left = obj.offsetLeft; 6507 var top = obj.offsetTop; 6508 while(parObj = parObj.offsetParent) { 6509 left += parObj.offsetLeft; 6510 top += parObj.offsetTop; 6511 } 6512 return { 6513 x: left, 6514 y: top 6515 }; 6516 }, 6517 /* 6518 å ç½®å½æ° 6519 å 餿¬å¯¹è±¡çææå±æ§ 6520 */ 6521 removeChild: function() { 6522 if(this.playerType == 'html5video') { 6523 //å é¤è®¡æ¶å¨ 6524 var i = 0; 6525 var timerArr = [this.timerError, this.timerFull, this.timerTime, this.timerBuffer, this.timerClick, this.timerLoading, this.timerCBar, this.timerVCanvas]; 6526 for(i = 0; i < timerArr.length; i++) { 6527 if(timerArr[i] != null) { 6528 if(timerArr[i].runing) { 6529 timerArr[i].stop(); 6530 } 6531 timerArr[i] = null; 6532 } 6533 } 6534 //å é¤äºä»¶çå¬ 6535 var ltArr = this.listenerJsArr; 6536 for(i = 0; i < ltArr.length; i++) { 6537 this.removeListener(ltArr[i][0], ltArr[i][1]); 6538 } 6539 } 6540 this.playerType == ''; 6541 this.V = null; 6542 if(this.showFace) { 6543 this.deleteChild(this.CB['menu']); 6544 } 6545 this.deleteChild(this.PD); 6546 this.CD.innerHTML = ''; 6547 }, 6548 /* 6549 å ç½®å½æ° 6550 ç»å°éçå¾å½¢ 6551 */ 6552 canvasFill: function(name, path) { 6553 name.beginPath(); 6554 for(var i = 0; i < path.length; i++) { 6555 var d = path[i]; 6556 if(i > 0) { 6557 name.lineTo(d[0], d[1]); 6558 } else { 6559 name.moveTo(d[0], d[1]); 6560 } 6561 } 6562 name.closePath(); 6563 name.fill(); 6564 }, 6565 /* 6566 å ç½®å½æ° 6567 ç»ç©å½¢ 6568 */ 6569 canvasFillRect: function(name, path) { 6570 for(var i = 0; i < path.length; i++) { 6571 var d = path[i]; 6572 name.fillRect(d[0], d[1], d[2], d[3]); 6573 } 6574 }, 6575 /* 6576 å ±ç¨å½æ° 6577 å é¤å®¹å¨èç¹ 6578 */ 6579 deleteChild: function(f) { 6580 var def = this.arrIndexOf(this.elementArr, f.className); 6581 if(def > -1) { 6582 this.elementArr.splice(def, 1); 6583 } 6584 var childs = f.childNodes; 6585 for(var i = childs.length - 1; i >= 0; i--) { 6586 f.removeChild(childs[i]); 6587 } 6588 6589 if(f && f != null && f.parentNode) { 6590 try { 6591 if(f.parentNode) { 6592 f.parentNode.removeChild(f); 6593 6594 } 6595 6596 } catch(event) {} 6597 } 6598 }, 6599 /* 6600 å ç½®å½æ° 6601 æ ¹æ®å®¹å¨ç宽é«,å é¨èç¹ç宽é«è®¡ç®åºå é¨èç¹ç宽é«ååæ 6602 */ 6603 getProportionCoor: function(stageW, stageH, vw, vh) { 6604 var w = 0, 6605 h = 0, 6606 x = 0, 6607 y = 0; 6608 if(stageW / stageH < vw / vh) { 6609 w = stageW; 6610 h = w * vh / vw; 6611 } else { 6612 h = stageH; 6613 w = h * vw / vh; 6614 } 6615 x = (stageW - w) * 0.5; 6616 y = (stageH - h) * 0.5; 6617 return { 6618 width: parseInt(w), 6619 height: parseInt(h), 6620 x: parseInt(x), 6621 y: parseInt(y) 6622 }; 6623 }, 6624 /* 6625 å ±ç¨å½æ° 6626 å°å广件å å®¹è½¬æ¢ææ°ç» 6627 */ 6628 parseSrtSubtitles: function(srt) { 6629 var subtitles = []; 6630 var textSubtitles = []; 6631 var i = 0; 6632 var arrs = srt.split('\n'); 6633 var arr = []; 6634 var delHtmlTag = function(str) { 6635 return str.replace(/<[^>]+>/g, ''); //廿ææçhtmlæ è®° 6636 }; 6637 for(i = 0; i < arrs.length; i++) { 6638 if(arrs[i].replace(/\s/g, '').length > 0) { 6639 arr.push(arrs[i]); 6640 } else { 6641 if(arr.length > 0) { 6642 textSubtitles.push(arr); 6643 } 6644 arr = []; 6645 } 6646 } 6647 for(i = 0; i < textSubtitles.length; ++i) { 6648 var textSubtitle = textSubtitles[i]; 6649 if(textSubtitle.length >= 2) { 6650 var sn = textSubtitle[0]; // åå¹çåºå· 6651 var startTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[0])); // åå¹çå¼å§æ¶é´ 6652 var endTime = this.toSeconds(this.trim(textSubtitle[1].split(' --> ')[1])); // åå¹çç»ææ¶é´ 6653 var content = [delHtmlTag(textSubtitle[2])]; // åå¹çå 容 6654 // åå¹å¯è½æå¤è¡ 6655 if(textSubtitle.length > 2) { 6656 for(var j = 3; j < textSubtitle.length; j++) { 6657 content.push(delHtmlTag(textSubtitle[j])); 6658 } 6659 } 6660 // åå¹å¯¹è±¡ 6661 var subtitle = { 6662 sn: sn, 6663 startTime: startTime, 6664 endTime: endTime, 6665 content: content 6666 }; 6667 subtitles.push(subtitle); 6668 } 6669 } 6670 return subtitles; 6671 }, 6672 /* 6673 å ±ç¨å½æ° 6674 计æ¶å¨,è¯¥å½æ°æ¨¡æas3ä¸çtimeråç 6675 time:è®¡æ¶æ¶é´,åä½:æ¯«ç§ 6676 fun:æ¥å彿° 6677 number:è¿è¡æ¬¡æ°,ä¸è®¾ç½®åæ éè¿è¡ 6678 */ 6679 timer: function(time, fun, number) { 6680 var thisTemp = this; 6681 this.time = 10; //è¿è¡é´é 6682 this.fun = null; //çå¬å½æ° 6683 this.timeObj = null;
6683 //setInterval对象 6684 this.number = 0; //å·²è¿è¡æ¬¡æ° 6685 this.numberTotal = null; //æ»è³éè¦æ¬¡æ° 6686 this.runing = false; //å½åç¶æ 6687 this.startFun = function() { 6688 thisTemp.number++; 6689 thisTemp.fun(); 6690 if(thisTemp.numberTotal != null && thisTemp.number >= thisTemp.numberTotal) { 6691 thisTemp.stop(); 6692 } 6693 }; 6694 this.start = function() { 6695 if(!thisTemp.runing) { 6696 thisTemp.runing = true; 6697 thisTemp.timeObj = window.setInterval(thisTemp.startFun, time); 6698 } 6699 }; 6700 this.stop = function() { 6701 if(thisTemp.runing) { 6702 thisTemp.runing = false; 6703 window.clearInterval(thisTemp.timeObj); 6704 thisTemp.timeObj = null; 6705 } 6706 }; 6707 if(time) { 6708 this.time = time; 6709 } 6710 if(fun) { 6711 this.fun = fun; 6712 } 6713 if(number) { 6714 this.numberTotal = number; 6715 } 6716 this.start(); 6717 }, 6718 /* 6719 å ±ç¨å½æ° 6720 å°æ¶åç§è½¬æ¢æç§ 6721 */ 6722 toSeconds: function(t) { 6723 var s = 0.0; 6724 if(t) { 6725 var p = t.split(':'); 6726 for(i = 0; i < p.length; i++) { 6727 s = s * 60 + parseFloat(p[i].replace(',', '.')); 6728 } 6729 } 6730 return s; 6731 }, 6732 /* 6733 å ±ç¨å½æ° 6734 å°å¯¹è±¡Objectæ åå 6735 */ 6736 standardization: function(o, n) { //næ¿æ¢è¿o 6737 var h = {}; 6738 var k; 6739 for(k in o) { 6740 h[k] = o[k]; 6741 } 6742 for(k in n) { 6743 var type = typeof(h[k]); 6744 switch(type) { 6745 case 'number': 6746 h[k] = parseFloat(n[k]); 6747 break; 6748 default: 6749 h[k] = n[k]; 6750 break; 6751 } 6752 6753 } 6754 return h; 6755 }, 6756 /* 6757 å ±ç¨å½æ° 6758 æç´¢æ°ç» 6759 */ 6760 arrIndexOf: function(arr, key) { 6761 var re = new RegExp(key, ['']); 6762 return(arr.toString().replace(re, 'â¢').replace(/[^,â¢]/g, '')).indexOf('â¢'); 6763 }, 6764 /* 6765 å ±ç¨å½æ° 6766 å»æç©ºæ ¼ 6767 */ 6768 trim: function(str) { 6769 if(str!=''){ 6770 return str.replace(/(^\s*)|(\s*$)/g, ''); 6771 } 6772 return ''; 6773 }, 6774 /* 6775 å ±ç¨å½æ° 6776 è¾åºå 容尿§å¶å° 6777 */ 6778 log: function(val) { 6779 try { 6780 console.log(val); 6781 } catch(e) {} 6782 }, 6783 /* 6784 å ±ç¨å½æ° 6785 å¼¹åºæç¤º 6786 */ 6787 eject: function(er, val) { 6788 if(!this.vars['debug']) { 6789 return; 6790 } 6791 var errorVal = er[1]; 6792 if(!this.isUndefined(val)) { 6793 errorVal = errorVal.replace('[error]', val); 6794 } 6795 var value = 'error ' + er[0] + ':' + errorVal; 6796 try { 6797 this.log(value); 6798 } catch(e) {} 6799 } 6800 }; 6801 window.ckplayer = ckplayer; 6802})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.