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