blackoutworm

FlashSportStreams.tv rtmp token stream setup swf

Mar 29th, 2012
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 613.53 KB | None | 0 0
  1. package com.wowza.encryptionAS3 {
  2.  
  3. public class TEA {
  4.  
  5. public static function encrypt(_arg1:string, _arg2:string):string{
  6. var _local9:number;
  7. var _local10:number;
  8. var _local14:number;
  9. if (_arg1.length == 0){
  10. return ("");
  11. };
  12. var _local3:array = charsToLongs(strToChars(_arg1));
  13. if (_local3.length <= 1){
  14. _local3[1] = 0;
  15. };
  16. var _local4:array = charsToLongs(strToChars(_arg2.substr(0, 16)));
  17. var _local5:number = _local3.length;
  18. var _local6:number = _local3[(_local5 - 1)];
  19. var _local7:number = _local3[0];
  20. var _local8:number = 2654435769;
  21. var _local11:number = math.floor((6 + (52 / _local5)));
  22. var _local12:number = 0;
  23. while (_local11-- > 0) {
  24. _local12 = (_local12 + _local8);
  25. _local10 = ((_local12 >>> 2) & 3);
  26. _local14 = 0;
  27. while (_local14 < _local5) {
  28. _local7 = _local3[((_local14 + 1) % _local5)];
  29. _local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local14 & 3) ^ _local10)] ^ _local6)));
  30. _local6 = (_local3[_local14] = (_local3[_local14] + _local9));
  31. _local14++;
  32. };
  33. };
  34. var _local13:array = longsToChars(_local3);
  35. return (charsToHex(_local13));
  36. }
  37. public static function decrypt(_arg1:string, _arg2:string):string{
  38. var _local9:number;
  39. var _local10:number;
  40. var _local14:number;
  41. if (_arg1.length == 0){
  42. return ("");
  43. };
  44. var _local3:array = charsToLongs(hexToChars(_arg1));
  45. var _local4:array = charsToLongs(strToChars(_arg2.substr(0, 16)));
  46. var _local5:number = _local3.length;
  47. var _local6:number = _local3[(_local5 - 1)];
  48. var _local7:number = _local3[0];
  49. var _local8:number = 2654435769;
  50. var _local11:number = math.floor((6 + (52 / _local5)));
  51. var _local12:number = (_local11 * _local8);
  52. while (_local12 != 0) {
  53. _local10 = ((_local12 >>> 2) & 3);
  54. _local14 = (_local5 - 1);
  55. while (_local14 >= 0) {
  56. _local6 = _local3[(((_local14 > 0)) ? (_local14 - 1) : (_local5 - 1))];
  57. _local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local14 & 3) ^ _local10)] ^ _local6)));
  58. _local7 = (_local3[_local14] = (_local3[_local14] - _local9));
  59. _local14--;
  60. };
  61. _local12 = (_local12 - _local8);
  62. };
  63. var _local13:array = longsToChars(_local3);
  64. return (charsToStr(_local13));
  65. }
  66. private static function charsToLongs(_arg1:array):array{
  67. var _local2:array = new array(math.ceil((_arg1.length / 4)));
  68. var _local3:number = 0;
  69. while (_local3 < _local2.length) {
  70. _local2[_local3] = (((_arg1[(_local3 * 4)] + (_arg1[((_local3 * 4) + 1)] << 8)) + (_arg1[((_local3 * 4) + 2)] << 16)) + (_arg1[((_local3 * 4) + 3)] << 24));
  71. _local3++;
  72. };
  73. return (_local2);
  74. }
  75. private static function longsToChars(_arg1:array):array{
  76. var _local2:array = new array();
  77. var _local3:number = 0;
  78. while (_local3 < _arg1.length) {
  79. _local2.push((_arg1[_local3] & 0xFF), ((_arg1[_local3] >>> 8) & 0xFF), ((_arg1[_local3] >>> 16) & 0xFF), ((_arg1[_local3] >>> 24) & 0xFF));
  80. _local3++;
  81. };
  82. return (_local2);
  83. }
  84. private static function longToChars(_arg1:number):array{
  85. var _local2:array = new array();
  86. _local2.push((_arg1 & 0xFF), ((_arg1 >>> 8) & 0xFF), ((_arg1 >>> 16) & 0xFF), ((_arg1 >>> 24) & 0xFF));
  87. return (_local2);
  88. }
  89. private static function charsToHex(_arg1:array):string{
  90. var _local2:string = new string("");
  91. var _local3:array = new array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
  92. var _local4:number = 0;
  93. while (_local4 < _arg1.length) {
  94. _local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
  95. _local4++;
  96. };
  97. return (_local2);
  98. }
  99. private static function hexToChars(_arg1:string):array{
  100. var _local2:array = new array();
  101. var _local3:number = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
  102. while (_local3 < _arg1.length) {
  103. _local2.push(parseint(_arg1.substr(_local3, 2), 16));
  104. _local3 = (_local3 + 2);
  105. };
  106. return (_local2);
  107. }
  108. private static function charsToStr(_arg1:array):string{
  109. var _local2:string = new string("");
  110. var _local3:number = 0;
  111. while (_local3 < _arg1.length) {
  112. _local2 = (_local2 + string.fromcharcode(_arg1[_local3]));
  113. _local3++;
  114. };
  115. return (_local2);
  116. }
  117. private static function strToChars(_arg1:string):array{
  118. var _local2:array = new array();
  119. var _local3:number = 0;
  120. while (_local3 < _arg1.length) {
  121. _local2.push(_arg1.charcodeat(_local3));
  122. _local3++;
  123. };
  124. return (_local2);
  125. }
  126.  
  127. }
  128. }//package com.wowza.encryptionAS3
  129. package com.nochump.util.zip {
  130. import flash.utils.*;
  131.  
  132. public class ZipFile {
  133.  
  134. private var buf:ByteArray;
  135. private var entryList:array;
  136. private var entryTable:Dictionary;
  137. private var locOffsetTable:Dictionary;
  138.  
  139. public function ZipFile(_arg1:IDataInput){
  140. this.buf = new ByteArray();
  141. this.buf.endian = Endian.LITTLE_ENDIAN;
  142. _arg1.readBytes(this.buf);
  143. this.readEntries();
  144. }
  145. public function get entries():array{
  146. return (this.entryList);
  147. }
  148. public function get size():uint{
  149. return (this.entryList.length);
  150. }
  151. public function getEntry(_arg1:string):ZipEntry{
  152. return (this.entryTable[_arg1]);
  153. }
  154. public function getInput(_arg1:ZipEntry):ByteArray{
  155. var _local4:ByteArray;
  156. var _local5:Inflater;
  157. this.buf.position = ((this.locOffsetTable[_arg1.name] + ZipConstants.LOCHDR) - 2);
  158. var _local2:uint = this.buf.readShort();
  159. this.buf.position = (this.buf.position + (_arg1.name.length + _local2));
  160. var _local3:ByteArray = new ByteArray();
  161. if (_arg1.compressedSize > 0){
  162. this.buf.readBytes(_local3, 0, _arg1.compressedSize);
  163. };
  164. switch (_arg1.method){
  165. case ZipConstants.STORED:
  166. return (_local3);
  167. case ZipConstants.DEFLATED:
  168. _local4 = new ByteArray();
  169. _local5 = new Inflater();
  170. _local5.setInput(_local3);
  171. _local5.inflate(_local4);
  172. return (_local4);
  173. default:
  174. throw (new ZipError("invalid compression method"));
  175. };
  176. }
  177. private function readEntries():void{
  178. var _local2:ByteArray;
  179. var _local3:uint;
  180. var _local4:ZipEntry;
  181. this.readEND();
  182. this.entryTable = new Dictionary();
  183. this.locOffsetTable = new Dictionary();
  184. var _local1:uint;
  185. while (_local1 < this.entryList.length) {
  186. _local2 = new ByteArray();
  187. _local2.endian = Endian.LITTLE_ENDIAN;
  188. this.buf.readBytes(_local2, 0, ZipConstants.CENHDR);
  189. if (_local2.readUnsignedInt() != ZipConstants.CENSIG){
  190. throw (new ZipError("invalid CEN header (bad signature)"));
  191. };
  192. _local2.position = ZipConstants.CENNAM;
  193. _local3 = _local2.readUnsignedShort();
  194. if (_local3 == 0){
  195. throw (new ZipError("missing entry name"));
  196. };
  197. _local4 = new ZipEntry(this.buf.readUTFBytes(_local3));
  198. _local3 = _local2.readUnsignedShort();
  199. _local4.extra = new ByteArray();
  200. if (_local3 > 0){
  201. this.buf.readBytes(_local4.extra, 0, _local3);
  202. };
  203. this.buf.position = (this.buf.position + _local2.readUnsignedShort());
  204. _local2.position = ZipConstants.CENVER;
  205. _local4.version = _local2.readUnsignedShort();
  206. _local4.flag = _local2.readUnsignedShort();
  207. if ((_local4.flag & 1) == 1){
  208. throw (new ZipError("encrypted ZIP entry not supported"));
  209. };
  210. _local4.method = _local2.readUnsignedShort();
  211. _local4.dostime = _local2.readUnsignedInt();
  212. _local4.crc = _local2.readUnsignedInt();
  213. _local4.compressedSize = _local2.readUnsignedInt();
  214. _local4.size = _local2.readUnsignedInt();
  215. this.entryList[_local1] = _local4;
  216. this.entryTable[_local4.name] = _local4;
  217. _local2.position = ZipConstants.CENOFF;
  218. this.locOffsetTable[_local4.name] = _local2.readUnsignedInt();
  219. _local1++;
  220. };
  221. }
  222. private function readEND():void{
  223. var _local1:ByteArray = new ByteArray();
  224. _local1.endian = Endian.LITTLE_ENDIAN;
  225. this.buf.position = this.findEND();
  226. this.buf.readBytes(_local1, 0, ZipConstants.ENDHDR);
  227. _local1.position = ZipConstants.ENDTOT;
  228. this.entryList = new array(_local1.readUnsignedShort());
  229. _local1.position = ZipConstants.ENDOFF;
  230. this.buf.position = _local1.readUnsignedInt();
  231. }
  232. private function findEND():uint{
  233. var _local1:uint = (this.buf.length - ZipConstants.ENDHDR);
  234. var _local2:uint = math.max(0, (_local1 - 0xFFFF));
  235. while (_local1 >= _local2) {
  236. if (this.buf[_local1] != 80){
  237. } else {
  238. this.buf.position = _local1;
  239. if (this.buf.readUnsignedInt() == ZipConstants.ENDSIG){
  240. return (_local1);
  241. };
  242. };
  243. _local1--;
  244. };
  245. throw (new ZipError("invalid zip"));
  246. }
  247.  
  248. }
  249. }//package com.nochump.util.zip
  250. package com.nochump.util.zip {
  251.  
  252. class ZipConstants {
  253.  
  254. static const LOCSIG:uint = 67324752;
  255. static const LOCHDR:uint = 30;
  256. static const LOCVER:uint = 4;
  257. static const LOCNAM:uint = 26;
  258. static const EXTSIG:uint = 134695760;
  259. static const EXTHDR:uint = 16;
  260. static const CENSIG:uint = 33639248;
  261. static const CENHDR:uint = 46;
  262. static const CENVER:uint = 6;
  263. static const CENNAM:uint = 28;
  264. static const CENOFF:uint = 42;
  265. static const ENDSIG:uint = 101010256;
  266. static const ENDHDR:uint = 22;
  267. static const ENDTOT:uint = 10;
  268. static const ENDOFF:uint = 16;
  269. static const STORED:uint = 0;
  270. static const DEFLATED:uint = 8;
  271.  
  272. }
  273. }//package com.nochump.util.zip
  274. package com.nochump.util.zip {
  275. import flash.utils.*;
  276.  
  277. public class ZipEntry {
  278.  
  279. private var _name:string;
  280. private var _size:int = -1;
  281. private var _compressedSize:int = -1;
  282. private var _crc:uint;
  283. var dostime:uint;
  284. private var _method:int = -1;
  285. private var _extra:ByteArray;
  286. private var _comment:string;
  287. var flag:int;
  288. var version:int;
  289. var offset:int;
  290.  
  291. public function ZipEntry(_arg1:string){
  292. this._name = _arg1;
  293. }
  294. public function get name():string{
  295. return (this._name);
  296. }
  297. public function get time():number{
  298. var _local1:date = new date((((this.dostime >> 25) & 127) + 1980), (((this.dostime >> 21) & 15) - 1), ((this.dostime >> 16) & 31), ((this.dostime >> 11) & 31), ((this.dostime >> 5) & 63), ((this.dostime & 31) << 1));
  299. return (_local1.time);
  300. }
  301. public function set time(_arg1:number):void{
  302. var _local2:date = new date(_arg1);
  303. this.dostime = ((((((((_local2.fullYear - 1980) & 127) << 25) | ((_local2.month + 1) << 21)) | (_local2.day << 16)) | (_local2.hours << 11)) | (_local2.minutes << 5)) | (_local2.seconds >> 1));
  304. }
  305. public function get size():int{
  306. return (this._size);
  307. }
  308. public function set size(_arg1:int):void{
  309. this._size = _arg1;
  310. }
  311. public function get compressedSize():int{
  312. return (this._compressedSize);
  313. }
  314. public function set compressedSize(_arg1:int):void{
  315. this._compressedSize = _arg1;
  316. }
  317. public function get crc():uint{
  318. return (this._crc);
  319. }
  320. public function set crc(_arg1:uint):void{
  321. this._crc = _arg1;
  322. }
  323. public function get method():int{
  324. return (this._method);
  325. }
  326. public function set method(_arg1:int):void{
  327. this._method = _arg1;
  328. }
  329. public function get extra():ByteArray{
  330. return (this._extra);
  331. }
  332. public function set extra(_arg1:ByteArray):void{
  333. this._extra = _arg1;
  334. }
  335. public function get comment():string{
  336. return (this._comment);
  337. }
  338. public function set comment(_arg1:string):void{
  339. this._comment = _arg1;
  340. }
  341. public function isDirectory():boolean{
  342. return ((this._name.charat((this._name.length - 1)) == "/"));
  343. }
  344. public function tostring():string{
  345. return (this._name);
  346. }
  347.  
  348. }
  349. }//package com.nochump.util.zip
  350. package com.nochump.util.zip {
  351. import flash.utils.*;
  352.  
  353. public class Inflater {
  354.  
  355. private static const MAXBITS:int = 15;
  356. private static const MAXLCODES:int = 286;
  357. private static const MAXDCODES:int = 30;
  358. private static const MAXCODES:int = 316;
  359. private static const FIXLCODES:int = 288;
  360. private static const LENS:array = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258];
  361. private static const LEXT:array = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];
  362. private static const DISTS:array = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 0x0101, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577];
  363. private static const DEXT:array = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
  364.  
  365. private var inbuf:ByteArray;
  366. private var incnt:uint;
  367. private var bitbuf:int;
  368. private var bitcnt:int;
  369. private var lencode:object;
  370. private var distcode:object;
  371.  
  372. public function setInput(_arg1:ByteArray):void{
  373. this.inbuf = _arg1;
  374. this.inbuf.endian = Endian.LITTLE_ENDIAN;
  375. }
  376. public function inflate(_arg1:ByteArray):uint{
  377. var _local3:int;
  378. var _local4:int;
  379. this.incnt = (this.bitbuf = (this.bitcnt = 0));
  380. var _local2:int;
  381. do {
  382. _local3 = this.bits(1);
  383. _local4 = this.bits(2);
  384. if (_local4 == 0){
  385. this.stored(_arg1);
  386. } else {
  387. if (_local4 == 3){
  388. throw (new error("invalid block type (type == 3)", -1));
  389. };
  390. this.lencode = {
  391. count:[],
  392. symbol:[]
  393. };
  394. this.distcode = {
  395. count:[],
  396. symbol:[]
  397. };
  398. if (_local4 == 1){
  399. this.constructFixedTables();
  400. } else {
  401. if (_local4 == 2){
  402. _local2 = this.constructDynamicTables();
  403. };
  404. };
  405. if (_local2 != 0){
  406. return (_local2);
  407. };
  408. _local2 = this.codes(_arg1);
  409. };
  410. if (_local2 != 0){
  411. break;
  412. };
  413. } while (!(_local3));
  414. return (_local2);
  415. }
  416. private function bits(_arg1:int):int{
  417. var _local2:int = this.bitbuf;
  418. while (this.bitcnt < _arg1) {
  419. if (this.incnt == this.inbuf.length){
  420. throw (new error("available inflate data did not terminate", 2));
  421. };
  422. _local2 = (_local2 | (this.inbuf[this.incnt++] << this.bitcnt));
  423. this.bitcnt = (this.bitcnt + 8);
  424. };
  425. this.bitbuf = (_local2 >> _arg1);
  426. this.bitcnt = (this.bitcnt - _arg1);
  427. return ((_local2 & ((1 << _arg1) - 1)));
  428. }
  429. private function construct(_arg1:object, _arg2:array, _arg3:int):int{
  430. var _local4:array = [];
  431. var _local5:int;
  432. while (_local5 <= MAXBITS) {
  433. _arg1.count[_local5] = 0;
  434. _local5++;
  435. };
  436. var _local6:int;
  437. while (_local6 < _arg3) {
  438. var _local8 = _arg1.count;
  439. var _local9 = _arg2[_local6];
  440. var _local10 = (_local8[_local9] + 1);
  441. _local8[_local9] = _local10;
  442. _local6++;
  443. };
  444. if (_arg1.count[0] == _arg3){
  445. return (0);
  446. };
  447. var _local7 = 1;
  448. _local5 = 1;
  449. while (_local5 <= MAXBITS) {
  450. _local7 = (_local7 << 1);
  451. _local7 = (_local7 - _arg1.count[_local5]);
  452. if (_local7 < 0){
  453. return (_local7);
  454. };
  455. _local5++;
  456. };
  457. _local4[1] = 0;
  458. _local5 = 1;
  459. while (_local5 < MAXBITS) {
  460. _local4[(_local5 + 1)] = (_local4[_local5] + _arg1.count[_local5]);
  461. _local5++;
  462. };
  463. _local6 = 0;
  464. while (_local6 < _arg3) {
  465. if (_arg2[_local6] != 0){
  466. _local9 = _local4;
  467. _local10 = _arg2[_local6];
  468. var _local11 = (_local9[_local10] + 1);
  469. _local9[_local10] = _local11;
  470. _local8 = _local9[_local10];
  471. _arg1.symbol[_local8] = _local6;
  472. };
  473. _local6++;
  474. };
  475. return (_local7);
  476. }
  477. private function decode(_arg1:object):int{
  478. var _local6:int;
  479. var _local2:int;
  480. var _local3:int;
  481. var _local4:int;
  482. var _local5 = 1;
  483. while (_local5 <= MAXBITS) {
  484. _local2 = (_local2 | this.bits(1));
  485. _local6 = _arg1.count[_local5];
  486. if (_local2 < (_local3 + _local6)){
  487. return (_arg1.symbol[(_local4 + (_local2 - _local3))]);
  488. };
  489. _local4 = (_local4 + _local6);
  490. _local3 = (_local3 + _local6);
  491. _local3 = (_local3 << 1);
  492. _local2 = (_local2 << 1);
  493. _local5++;
  494. };
  495. return (-9);
  496. }
  497. private function codes(_arg1:ByteArray):int{
  498. var _local2:int;
  499. var _local3:int;
  500. var _local4:uint;
  501. do {
  502. _local2 = this.decode(this.lencode);
  503. if (_local2 < 0){
  504. return (_local2);
  505. };
  506. if (_local2 < 0x0100){
  507. _arg1[_arg1.length] = _local2;
  508. } else {
  509. if (_local2 > 0x0100){
  510. _local2 = (_local2 - 0x0101);
  511. if (_local2 >= 29){
  512. throw (new error("invalid literal/length or distance code in fixed or dynamic block", -9));
  513. };
  514. _local3 = (LENS[_local2] + this.bits(LEXT[_local2]));
  515. _local2 = this.decode(this.distcode);
  516. if (_local2 < 0){
  517. return (_local2);
  518. };
  519. _local4 = (DISTS[_local2] + this.bits(DEXT[_local2]));
  520. if (_local4 > _arg1.length){
  521. throw (new error("distance is too far back in fixed or dynamic block", -10));
  522. };
  523. while (_local3--) {
  524. _arg1[_arg1.length] = _arg1[(_arg1.length - _local4)];
  525. };
  526. };
  527. };
  528. } while (_local2 != 0x0100);
  529. return (0);
  530. }
  531. private function stored(_arg1:ByteArray):void{
  532. this.bitbuf = 0;
  533. this.bitcnt = 0;
  534. if ((this.incnt + 4) > this.inbuf.length){
  535. throw (new error("available inflate data did not terminate", 2));
  536. };
  537. var _local2:uint = this.inbuf[this.incnt++];
  538. var _temp1 = _local2;
  539. _local2 = (_temp1 | (this.inbuf[this++] << 8));
  540. if (((!((this.inbuf[this.incnt++] == (~(_local2) & 0xFF)))) || (!((this.inbuf[this.incnt++] == ((~(_local2) >> 8) & 0xFF)))))){
  541. throw (new error("stored block length did not match one's complement", -2));
  542. };
  543. if ((this.incnt + _local2) > this.inbuf.length){
  544. throw (new error("available inflate data did not terminate", 2));
  545. };
  546. while (_local2--) {
  547. _arg1[_arg1.length] = this.inbuf[this.incnt++];
  548. };
  549. }
  550. private function constructFixedTables():void{
  551. var _local1:array = [];
  552. var _local2:int;
  553. while (_local2 < 144) {
  554. _local1[_local2] = 8;
  555. _local2++;
  556. };
  557. while (_local2 < 0x0100) {
  558. _local1[_local2] = 9;
  559. _local2++;
  560. };
  561. while (_local2 < 280) {
  562. _local1[_local2] = 7;
  563. _local2++;
  564. };
  565. while (_local2 < FIXLCODES) {
  566. _local1[_local2] = 8;
  567. _local2++;
  568. };
  569. this.construct(this.lencode, _local1, FIXLCODES);
  570. _local2 = 0;
  571. while (_local2 < MAXDCODES) {
  572. _local1[_local2] = 5;
  573. _local2++;
  574. };
  575. this.construct(this.distcode, _local1, MAXDCODES);
  576. }
  577. private function constructDynamicTables():int{
  578. var _local8:int;
  579. var _local9:int;
  580. var _local1:array = [];
  581. var _local2:array = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
  582. var _local3:int = (this.bits(5) + 0x0101);
  583. var _local4:int = (this.bits(5) + 1);
  584. var _local5:int = (this.bits(4) + 4);
  585. if ((((_local3 > MAXLCODES)) || ((_local4 > MAXDCODES)))){
  586. throw (new error("dynamic block code description: too many length or distance codes", -3));
  587. };
  588. var _local6:int;
  589. while (_local6 < _local5) {
  590. _local1[_local2[_local6]] = this.bits(3);
  591. _local6++;
  592. };
  593. while (_local6 < 19) {
  594. _local1[_local2[_local6]] = 0;
  595. _local6++;
  596. };
  597. var _local7:int = this.construct(this.lencode, _local1, 19);
  598. if (_local7 != 0){
  599. throw (new error("dynamic block code description: code lengths codes incomplete", -4));
  600. };
  601. _local6 = 0;
  602. while (_local6 < (_local3 + _local4)) {
  603. _local8 = this.decode(this.lencode);
  604. if (_local8 < 16){
  605. var _temp1 = _local6;
  606. _local6 = (_local6 + 1);
  607. var _local10 = _temp1;
  608. _local1[_local10] = _local8;
  609. } else {
  610. _local9 = 0;
  611. if (_local8 == 16){
  612. if (_local6 == 0){
  613. throw (new error("dynamic block code description: repeat lengths with no first length", -5));
  614. };
  615. _local9 = _local1[(_local6 - 1)];
  616. _local8 = (3 + this.bits(2));
  617. } else {
  618. if (_local8 == 17){
  619. _local8 = (3 + this.bits(3));
  620. } else {
  621. _local8 = (11 + this.bits(7));
  622. };
  623. };
  624. if ((_local6 + _local8) > (_local3 + _local4)){
  625. throw (new error("dynamic block code description: repeat more than specified lengths", -6));
  626. };
  627. while (_local8--) {
  628. var _temp2 = _local6;
  629. _local6 = (_local6 + 1);
  630. _local10 = _temp2;
  631. _local1[_local10] = _local9;
  632. };
  633. };
  634. };
  635. _local7 = this.construct(this.lencode, _local1, _local3);
  636. if ((((_local7 < 0)) || ((((_local7 > 0)) && (!(((_local3 - this.lencode.count[0]) == 1))))))){
  637. throw (new error("dynamic block code description: invalid literal/length code lengths", -7));
  638. };
  639. _local7 = this.construct(this.distcode, _local1.slice(_local3), _local4);
  640. if ((((_local7 < 0)) || ((((_local7 > 0)) && (!(((_local4 - this.distcode.count[0]) == 1))))))){
  641. throw (new error("dynamic block code description: invalid distance code lengths", -8));
  642. };
  643. return (_local7);
  644. }
  645.  
  646. }
  647. }//package com.nochump.util.zip
  648. package com.nochump.util.zip {
  649. import flash.errors.*;
  650.  
  651. public class ZipError extends IOError {
  652.  
  653. public function ZipError(_arg1:string="", _arg2:int=0){
  654. super(_arg1, _arg2);
  655. }
  656. }
  657. }//package com.nochump.util.zip
  658. package com.jeroenwijering.events {
  659.  
  660. public class ModelStates {
  661.  
  662. public static var IDLE:string = "IDLE";
  663. public static var BUFFERING:string = "BUFFERING";
  664. public static var PLAYING:string = "PLAYING";
  665. public static var PAUSED:string = "PAUSED";
  666. public static var COMPLETED:string = "COMPLETED";
  667.  
  668. }
  669. }//package com.jeroenwijering.events
  670. package com.jeroenwijering.events {
  671. import flash.events.*;
  672.  
  673. public class ControllerEvent extends Event {
  674.  
  675. public static var error:string = "ERROR";
  676. public static var ITEM:string = "ITEM";
  677. public static var MUTE:string = "MUTE";
  678. public static var play:string = "PLAY";
  679. public static var PLAYLIST:string = "PLAYLIST";
  680. public static var RESIZE:string = "RESIZE";
  681. public static var seek:string = "SEEK";
  682. public static var stop:string = "STOP";
  683. public static var VOLUME:string = "VOLUME";
  684.  
  685. private var _data:object;
  686.  
  687. public function ControllerEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
  688. super(_arg1, _arg3, _arg4);
  689. this._data = _arg2;
  690. }
  691. public function get data():object{
  692. return (this._data);
  693. }
  694.  
  695. }
  696. }//package com.jeroenwijering.events
  697. package com.jeroenwijering.events {
  698.  
  699. public interface PluginInterface {
  700.  
  701. function initializePlugin(_arg1:AbstractView):void;
  702.  
  703. }
  704. }//package com.jeroenwijering.events
  705. package com.jeroenwijering.events {
  706. import flash.events.*;
  707. import flash.display.*;
  708.  
  709. public class AbstractView extends EventDispatcher {
  710.  
  711. public function get config():object{
  712. return (new object());
  713. }
  714. public function get playlist():array{
  715. return (new array());
  716. }
  717. public function get skin():movieclip{
  718. return (new movieclip());
  719. }
  720. public function addControllerListener(_arg1:string, _arg2:function):void{
  721. }
  722. public function removeControllerListener(_arg1:string, _arg2:function):void{
  723. }
  724. public function addModelListener(_arg1:string, _arg2:function):void{
  725. }
  726. public function removeModelListener(_arg1:string, _arg2:function):void{
  727. }
  728. public function addViewListener(_arg1:string, _arg2:function):void{
  729. }
  730. public function removeViewListener(_arg1:string, _arg2:function):void{
  731. }
  732. public function getPlugin(_arg1:string):object{
  733. return ({});
  734. }
  735. public function getPluginConfig(_arg1:object):object{
  736. return ({});
  737. }
  738. public function loadPlugin(_arg1:string, _arg2:string=null):boolean{
  739. return (true);
  740. }
  741. public function sendEvent(_arg1:string, _arg2:object=undefined):void{
  742. }
  743.  
  744. }
  745. }//package com.jeroenwijering.events
  746. package com.jeroenwijering.events {
  747. import flash.events.*;
  748.  
  749. public class ViewEvent extends Event {
  750.  
  751. public static var FULLSCREEN:string = "FULLSCREEN";
  752. public static var ITEM:string = "ITEM";
  753. public static var LINK:string = "LINK";
  754. public static var load:string = "LOAD";
  755. public static var MUTE:string = "MUTE";
  756. public static var NEXT:string = "NEXT";
  757. public static var play:string = "PLAY";
  758. public static var PREV:string = "PREV";
  759. public static var REDRAW:string = "REDRAW";
  760. public static var seek:string = "SEEK";
  761. public static var stop:string = "STOP";
  762. public static var trace:string = "TRACE";
  763. public static var VOLUME:string = "VOLUME";
  764.  
  765. private var _data:object;
  766.  
  767. public function ViewEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
  768. super(_arg1, _arg3, _arg4);
  769. this._data = _arg2;
  770. }
  771. public function get data():object{
  772. return (this._data);
  773. }
  774.  
  775. }
  776. }//package com.jeroenwijering.events
  777. package com.jeroenwijering.events {
  778. import flash.events.*;
  779.  
  780. public class ModelEvent extends Event {
  781.  
  782. public static var BUFFER:string = "BUFFER";
  783. public static var error:string = "ERROR";
  784. public static var loaded:string = "LOADED";
  785. public static var META:string = "META";
  786. public static var STATE:string = "STATE";
  787. public static var time:string = "TIME";
  788.  
  789. private var _data:object;
  790.  
  791. public function ModelEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
  792. super(_arg1, _arg3, _arg4);
  793. this._data = _arg2;
  794. }
  795. public function get data():object{
  796. return (this._data);
  797. }
  798.  
  799. }
  800. }//package com.jeroenwijering.events
  801. package com.jeroenwijering.events {
  802. import flash.events.*;
  803.  
  804. public class PlayerEvent extends Event {
  805.  
  806. public static var READY:string = "READY";
  807.  
  808. public function PlayerEvent(_arg1:string, _arg2:boolean=false, _arg3:boolean=false):void{
  809. super(_arg1, _arg2, _arg3);
  810. }
  811. }
  812. }//package com.jeroenwijering.events
  813. package com.adobe.serialization.json {
  814.  
  815. public class JSONToken {
  816.  
  817. private var _value:object;
  818. private var _type:int;
  819.  
  820. public function JSONToken(_arg1:int=-1, _arg2:object=null){
  821. this._type = _arg1;
  822. this._value = _arg2;
  823. }
  824. public function get value():object{
  825. return (this._value);
  826. }
  827. public function get type():int{
  828. return (this._type);
  829. }
  830. public function set type(_arg1:int):void{
  831. this._type = _arg1;
  832. }
  833. public function set value(_arg1:object):void{
  834. this._value = _arg1;
  835. }
  836.  
  837. }
  838. }//package com.adobe.serialization.json
  839. package com.adobe.serialization.json {
  840.  
  841. public class JSONDecoder {
  842.  
  843. private var strict:boolean;
  844. private var value;
  845. private var tokenizer:JSONTokenizer;
  846. private var token:JSONToken;
  847.  
  848. public function JSONDecoder(_arg1:string, _arg2:boolean){
  849. this.strict = _arg2;
  850. this.tokenizer = new JSONTokenizer(_arg1, _arg2);
  851. this.nextToken();
  852. this.value = this.parseValue();
  853. if (((_arg2) && (!((this.nextToken() == null))))){
  854. this.tokenizer.parseError("Unexpected characters left in input stream");
  855. };
  856. }
  857. private function nextToken():JSONToken{
  858. return ((this.token = this.tokenizer.getNextToken()));
  859. }
  860. private function parseObject():object{
  861. var _local2:string;
  862. var _local1:object = new object();
  863. this.nextToken();
  864. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  865. return (_local1);
  866. };
  867. if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
  868. this.nextToken();
  869. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  870. return (_local1);
  871. };
  872. this.tokenizer.parseError(("Leading commas are not supported. Expecting '}' but found " + this.token.value));
  873. };
  874. if (this.token.type == JSONTokenType.string){
  875. _local2 = string(this.token.value);
  876. this.nextToken();
  877. if (this.token.type == JSONTokenType.COLON){
  878. this.nextToken();
  879. _local1[_local2] = this.parseValue();
  880. this.nextToken();
  881. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  882. return (_local1);
  883. };
  884. if (this.token.type == JSONTokenType.COMMA){
  885. this.nextToken();
  886. if (!this.strict){
  887. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  888. return (_local1);
  889. };
  890. };
  891. } else {
  892. this.tokenizer.parseError(("Expecting } or , but found " + this.token.value));
  893. };
  894. } else {
  895. this.tokenizer.parseError(("Expecting : but found " + this.token.value));
  896. };
  897. } else {
  898. this.tokenizer.parseError(("Expecting string but found " + this.token.value));
  899. };
  900. //unresolved jump
  901. }
  902. private function parseArray():array{
  903. var _local1:array = new array();
  904. this.nextToken();
  905. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  906. return (_local1);
  907. };
  908. if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
  909. this.nextToken();
  910. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  911. return (_local1);
  912. };
  913. this.tokenizer.parseError(("Leading commas are not supported. Expecting ']' but found " + this.token.value));
  914. };
  915. _local1.push(this.parseValue());
  916. this.nextToken();
  917. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  918. return (_local1);
  919. };
  920. if (this.token.type == JSONTokenType.COMMA){
  921. this.nextToken();
  922. if (!this.strict){
  923. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  924. return (_local1);
  925. };
  926. };
  927. } else {
  928. this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value));
  929. };
  930. //unresolved jump
  931. }
  932. public function getValue(){
  933. return (this.value);
  934. }
  935. private function parseValue():object{
  936. if (this.token == null){
  937. this.tokenizer.parseError("Unexpected end of input");
  938. };
  939. switch (this.token.type){
  940. case JSONTokenType.LEFT_BRACE:
  941. return (this.parseObject());
  942. case JSONTokenType.LEFT_BRACKET:
  943. return (this.parseArray());
  944. case JSONTokenType.string:
  945. case JSONTokenType.number:
  946. case JSONTokenType.true:
  947. case JSONTokenType.false:
  948. case JSONTokenType.null:
  949. return (this.token.value);
  950. case JSONTokenType.nan:
  951. if (!this.strict){
  952. return (this.token.value);
  953. };
  954. this.tokenizer.parseError(("Unexpected " + this.token.value));
  955. default:
  956. this.tokenizer.parseError(("Unexpected " + this.token.value));
  957. };
  958. return (null);
  959. }
  960.  
  961. }
  962. }//package com.adobe.serialization.json
  963. package com.adobe.serialization.json {
  964.  
  965. public class JSONTokenType {
  966.  
  967. public static const false:int = 8;
  968. public static const RIGHT_BRACKET:int = 4;
  969. public static const null:int = 9;
  970. public static const number:int = 11;
  971. public static const true:int = 7;
  972. public static const RIGHT_BRACE:int = 2;
  973. public static const string:int = 10;
  974. public static const LEFT_BRACKET:int = 3;
  975. public static const LEFT_BRACE:int = 1;
  976. public static const UNKNOWN:int = -1;
  977. public static const COMMA:int = 0;
  978. public static const nan:int = 12;
  979. public static const COLON:int = 6;
  980.  
  981. }
  982. }//package com.adobe.serialization.json
  983. package com.adobe.serialization.json {
  984.  
  985. public class JSONTokenizer {
  986.  
  987. private var ch:string;
  988. private var loc:int;
  989. private var jsonString:string;
  990. private var strict:boolean;
  991. private var controlCharsRegExp:RegExp;
  992. private var obj:object;
  993.  
  994. public function JSONTokenizer(_arg1:string, _arg2:boolean){
  995. this.controlCharsRegExp = /[\x00-\x1F]/;
  996. super();
  997. this.jsonString = _arg1;
  998. this.strict = _arg2;
  999. this.loc = 0;
  1000. this.nextChar();
  1001. }
  1002. private function skipComments():void{
  1003. if (this.ch == "/"){
  1004. this.nextChar();
  1005. switch (this.ch){
  1006. case "/":
  1007. do {
  1008. this.nextChar();
  1009. } while (((!((this.ch == "\n"))) && (!((this.ch == "")))));
  1010. this.nextChar();
  1011. break;
  1012. case "*":
  1013. this.nextChar();
  1014. while (true) {
  1015. if (this.ch == "*"){
  1016. this.nextChar();
  1017. if (this.ch == "/"){
  1018. this.nextChar();
  1019. break;
  1020. };
  1021. } else {
  1022. this.nextChar();
  1023. };
  1024. if (this.ch == ""){
  1025. this.parseError("Multi-line comment not closed");
  1026. };
  1027. };
  1028. break;
  1029. default:
  1030. this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )"));
  1031. };
  1032. };
  1033. }
  1034. private function isDigit(_arg1:string):boolean{
  1035. return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
  1036. }
  1037. private function readNumber():JSONToken{
  1038. var _local3:JSONToken;
  1039. var _local1 = "";
  1040. if (this.ch == "-"){
  1041. _local1 = (_local1 + "-");
  1042. this.nextChar();
  1043. };
  1044. if (!this.isDigit(this.ch)){
  1045. this.parseError("Expecting a digit");
  1046. };
  1047. if (this.ch == "0"){
  1048. _local1 = (_local1 + this.ch);
  1049. this.nextChar();
  1050. if (this.isDigit(this.ch)){
  1051. this.parseError("A digit cannot immediately follow 0");
  1052. } else {
  1053. if (((!(this.strict)) && ((this.ch == "x")))){
  1054. _local1 = (_local1 + this.ch);
  1055. this.nextChar();
  1056. if (this.isHexDigit(this.ch)){
  1057. _local1 = (_local1 + this.ch);
  1058. this.nextChar();
  1059. } else {
  1060. this.parseError("Number in hex format require at least one hex digit after \"0x\"");
  1061. };
  1062. while (this.isHexDigit(this.ch)) {
  1063. _local1 = (_local1 + this.ch);
  1064. this.nextChar();
  1065. };
  1066. };
  1067. };
  1068. } else {
  1069. while (this.isDigit(this.ch)) {
  1070. _local1 = (_local1 + this.ch);
  1071. this.nextChar();
  1072. };
  1073. };
  1074. if (this.ch == "."){
  1075. _local1 = (_local1 + ".");
  1076. this.nextChar();
  1077. if (!this.isDigit(this.ch)){
  1078. this.parseError("Expecting a digit");
  1079. };
  1080. while (this.isDigit(this.ch)) {
  1081. _local1 = (_local1 + this.ch);
  1082. this.nextChar();
  1083. };
  1084. };
  1085. if ((((this.ch == "e")) || ((this.ch == "E")))){
  1086. _local1 = (_local1 + "e");
  1087. this.nextChar();
  1088. if ((((this.ch == "+")) || ((this.ch == "-")))){
  1089. _local1 = (_local1 + this.ch);
  1090. this.nextChar();
  1091. };
  1092. if (!this.isDigit(this.ch)){
  1093. this.parseError("Scientific notation number needs exponent value");
  1094. };
  1095. while (this.isDigit(this.ch)) {
  1096. _local1 = (_local1 + this.ch);
  1097. this.nextChar();
  1098. };
  1099. };
  1100. var _local2:number = number(_local1);
  1101. if (((isfinite(_local2)) && (!(isnan(_local2))))){
  1102. _local3 = new JSONToken();
  1103. _local3.type = JSONTokenType.number;
  1104. _local3.value = _local2;
  1105. return (_local3);
  1106. };
  1107. this.parseError((("Number " + _local2) + " is not valid!"));
  1108. return (null);
  1109. }
  1110. public function unescapeString(_arg1:string):string{
  1111. var _local6:*;
  1112. var _local7:*;
  1113. var _local8:*;
  1114. var _local9:*;
  1115. var _local10:*;
  1116. if (((this.strict) && (this.controlCharsRegExp.test(_arg1)))){
  1117. this.parseError("String contains unescaped control character (0x00-0x1F)");
  1118. };
  1119. var _local2 = "";
  1120. var _local3:int;
  1121. var _local4:int;
  1122. var _local5:int = _arg1.length;
  1123. do {
  1124. _local3 = _arg1.indexof("\\", _local4);
  1125. if (_local3 >= 0){
  1126. _local2 = (_local2 + _arg1.substr(_local4, (_local3 - _local4)));
  1127. _local4 = (_local3 + 2);
  1128. _local6 = (_local3 + 1);
  1129. _local7 = _arg1.charat(_local6);
  1130. switch (_local7){
  1131. case "\"":
  1132. _local2 = (_local2 + "\"");
  1133. break;
  1134. case "\\":
  1135. _local2 = (_local2 + "\\");
  1136. break;
  1137. case "n":
  1138. _local2 = (_local2 + "\n");
  1139. break;
  1140. case "r":
  1141. _local2 = (_local2 + "\r");
  1142. break;
  1143. case "t":
  1144. _local2 = (_local2 + "\t");
  1145. break;
  1146. case "u":
  1147. _local8 = "";
  1148. if ((_local4 + 4) > _local5){
  1149. this.parseError("Unexpected end of input. Expecting 4 hex digits after \\u.");
  1150. };
  1151. _local9 = _local4;
  1152. while (_local9 < (_local4 + 4)) {
  1153. _local10 = _arg1.charat(_local9);
  1154. if (!this.isHexDigit(_local10)){
  1155. this.parseError(("Excepted a hex digit, but found: " + _local10));
  1156. };
  1157. _local8 = (_local8 + _local10);
  1158. _local9++;
  1159. };
  1160. _local2 = (_local2 + string.fromcharcode(parseint(_local8, 16)));
  1161. _local4 = (_local4 + 4);
  1162. break;
  1163. case "f":
  1164. _local2 = (_local2 + "\f");
  1165. break;
  1166. case "/":
  1167. _local2 = (_local2 + "/");
  1168. break;
  1169. case "b":
  1170. _local2 = (_local2 + "\b");
  1171. break;
  1172. default:
  1173. _local2 = (_local2 + ("\\" + _local7));
  1174. };
  1175. } else {
  1176. _local2 = (_local2 + _arg1.substr(_local4));
  1177. break;
  1178. };
  1179. } while (_local4 < _local5);
  1180. return (_local2);
  1181. }
  1182. private function skipWhite():void{
  1183. while (this.isWhiteSpace(this.ch)) {
  1184. this.nextChar();
  1185. };
  1186. }
  1187. private function isWhiteSpace(_arg1:string):boolean{
  1188. if ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r")))){
  1189. return (true);
  1190. };
  1191. if (((!(this.strict)) && ((_arg1.charcodeat(0) == 160)))){
  1192. return (true);
  1193. };
  1194. return (false);
  1195. }
  1196. public function parseError(_arg1:string):void{
  1197. throw (new JSONParseError(_arg1, this.loc, this.jsonString));
  1198. }
  1199. private function readString():JSONToken{
  1200. var _local3:*;
  1201. var _local4:*;
  1202. var _local1:int = this.loc;
  1203. do {
  1204. _local1 = this.jsonString.indexof("\"", _local1);
  1205. if (_local1 >= 0){
  1206. _local3 = 0;
  1207. _local4 = (_local1 - 1);
  1208. while (this.jsonString.charat(_local4) == "\\") {
  1209. _local3++;
  1210. _local4--;
  1211. };
  1212. if ((_local3 % 2) == 0){
  1213. break;
  1214. };
  1215. _local1++;
  1216. } else {
  1217. this.parseError("Unterminated string literal");
  1218. };
  1219. } while (true);
  1220. var _local2:JSONToken = new JSONToken();
  1221. _local2.type = JSONTokenType.string;
  1222. _local2.value = this.unescapeString(this.jsonString.substr(this.loc, (_local1 - this.loc)));
  1223. this.loc = (_local1 + 1);
  1224. this.nextChar();
  1225. return (_local2);
  1226. }
  1227. private function nextChar():string{
  1228. return ((this.ch = this.jsonString.charat(this.loc++)));
  1229. }
  1230. private function skipIgnored():void{
  1231. var _local1:int;
  1232. do {
  1233. _local1 = this.loc;
  1234. this.skipWhite();
  1235. this.skipComments();
  1236. } while (_local1 != this.loc);
  1237. }
  1238. private function isHexDigit(_arg1:string):boolean{
  1239. return (((((this.isDigit(_arg1)) || ((((_arg1 >= "A")) && ((_arg1 <= "F")))))) || ((((_arg1 >= "a")) && ((_arg1 <= "f"))))));
  1240. }
  1241. public function getNextToken():JSONToken{
  1242. var _local2:string;
  1243. var _local3:string;
  1244. var _local4:string;
  1245. var _local5:string;
  1246. var _local1:JSONToken = new JSONToken();
  1247. this.skipIgnored();
  1248. switch (this.ch){
  1249. case "{":
  1250. _local1.type = JSONTokenType.LEFT_BRACE;
  1251. _local1.value = "{";
  1252. this.nextChar();
  1253. break;
  1254. case "}":
  1255. _local1.type = JSONTokenType.RIGHT_BRACE;
  1256. _local1.value = "}";
  1257. this.nextChar();
  1258. break;
  1259. case "[":
  1260. _local1.type = JSONTokenType.LEFT_BRACKET;
  1261. _local1.value = "[";
  1262. this.nextChar();
  1263. break;
  1264. case "]":
  1265. _local1.type = JSONTokenType.RIGHT_BRACKET;
  1266. _local1.value = "]";
  1267. this.nextChar();
  1268. break;
  1269. case ",":
  1270. _local1.type = JSONTokenType.COMMA;
  1271. _local1.value = ",";
  1272. this.nextChar();
  1273. break;
  1274. case ":":
  1275. _local1.type = JSONTokenType.COLON;
  1276. _local1.value = ":";
  1277. this.nextChar();
  1278. break;
  1279. case "t":
  1280. _local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar());
  1281. if (_local2 == "true"){
  1282. _local1.type = JSONTokenType.true;
  1283. _local1.value = true;
  1284. this.nextChar();
  1285. } else {
  1286. this.parseError(("Expecting 'true' but found " + _local2));
  1287. };
  1288. break;
  1289. case "f":
  1290. _local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar());
  1291. if (_local3 == "false"){
  1292. _local1.type = JSONTokenType.false;
  1293. _local1.value = false;
  1294. this.nextChar();
  1295. } else {
  1296. this.parseError(("Expecting 'false' but found " + _local3));
  1297. };
  1298. break;
  1299. case "n":
  1300. _local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar());
  1301. if (_local4 == "null"){
  1302. _local1.type = JSONTokenType.null;
  1303. _local1.value = null;
  1304. this.nextChar();
  1305. } else {
  1306. this.parseError(("Expecting 'null' but found " + _local4));
  1307. };
  1308. break;
  1309. case "N":
  1310. _local5 = (("N" + this.nextChar()) + this.nextChar());
  1311. if (_local5 == "NaN"){
  1312. _local1.type = JSONTokenType.nan;
  1313. _local1.value = nan;
  1314. this.nextChar();
  1315. } else {
  1316. this.parseError(("Expecting 'NaN' but found " + _local5));
  1317. };
  1318. break;
  1319. case "\"":
  1320. _local1 = this.readString();
  1321. break;
  1322. default:
  1323. if (((this.isDigit(this.ch)) || ((this.ch == "-")))){
  1324. _local1 = this.readNumber();
  1325. } else {
  1326. if (this.ch == ""){
  1327. return (null);
  1328. };
  1329. this.parseError((("Unexpected " + this.ch) + " encountered"));
  1330. };
  1331. };
  1332. return (_local1);
  1333. }
  1334.  
  1335. }
  1336. }//package com.adobe.serialization.json
  1337. package com.adobe.serialization.json {
  1338.  
  1339. public class JSONParseError extends error {
  1340.  
  1341. private var _location:int;
  1342. private var _text:string;
  1343.  
  1344. public function JSONParseError(_arg1:string="", _arg2:int=0, _arg3:string=""){
  1345. super(_arg1);
  1346. name = "JSONParseError";
  1347. this._location = _arg2;
  1348. this._text = _arg3;
  1349. }
  1350. public function get location():int{
  1351. return (this._location);
  1352. }
  1353. public function get text():string{
  1354. return (this._text);
  1355. }
  1356.  
  1357. }
  1358. }//package com.adobe.serialization.json
  1359. package com.longtailvideo.jwplayer.player {
  1360. import com.longtailvideo.jwplayer.model.*;
  1361. import com.longtailvideo.jwplayer.view.interfaces.*;
  1362. import com.longtailvideo.jwplayer.plugins.*;
  1363. import com.longtailvideo.jwplayer.view.*;
  1364. import flash.events.*;
  1365. import com.longtailvideo.jwplayer.events.*;
  1366.  
  1367. public interface IPlayer extends IEventDispatcher, IGlobalEventDispatcher {
  1368.  
  1369. function get config():PlayerConfig;
  1370. function get version():string;
  1371. function get skin():ISkin;
  1372. function get state():string;
  1373. function get playlist():IPlaylist;
  1374. function get locked():boolean;
  1375. function lock(_arg1:IPlugin, _arg2:function):void;
  1376. function unlock(_arg1:IPlugin):boolean;
  1377. function volume(_arg1:number):boolean;
  1378. function mute(_arg1:boolean):void;
  1379. function play():boolean;
  1380. function pause():boolean;
  1381. function stop():boolean;
  1382. function seek(_arg1:number):boolean;
  1383. function load(_arg1):boolean;
  1384. function playlistItem(_arg1:number):boolean;
  1385. function playlistNext():boolean;
  1386. function playlistPrev():boolean;
  1387. function redraw():boolean;
  1388. function fullscreen(_arg1:boolean):void;
  1389. function get controls():IPlayerComponents;
  1390. function overrideComponent(_arg1:IPlayerComponent):void;
  1391.  
  1392. }
  1393. }//package com.longtailvideo.jwplayer.player
  1394. package com.longtailvideo.jwplayer.player {
  1395.  
  1396. public class PlayerState {
  1397.  
  1398. public static var IDLE:string = "IDLE";
  1399. public static var BUFFERING:string = "BUFFERING";
  1400. public static var PLAYING:string = "PLAYING";
  1401. public static var PAUSED:string = "PAUSED";
  1402.  
  1403. }
  1404. }//package com.longtailvideo.jwplayer.player
  1405. package com.longtailvideo.jwplayer.player {
  1406. import com.longtailvideo.jwplayer.view.interfaces.*;
  1407. import flash.events.*;
  1408. import com.longtailvideo.jwplayer.events.*;
  1409. import flash.utils.*;
  1410. import com.longtailvideo.jwplayer.utils.*;
  1411. import flash.external.*;
  1412.  
  1413. public class JavascriptAPI {
  1414.  
  1415. protected var _player:IPlayer;
  1416. protected var _playerBuffer:number = 0;
  1417. protected var _playerPosition:number = 0;
  1418. protected var _listeners:object;
  1419. protected var _queuedEvents:array;
  1420.  
  1421. public function JavascriptAPI(_arg1:IPlayer){
  1422. this._queuedEvents = [];
  1423. super();
  1424. this._listeners = {};
  1425. this._player = _arg1;
  1426. this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
  1427. this.setupPlayerListeners();
  1428. this.setupJSListeners();
  1429. this._player.addGlobalListener(this.queueEvents);
  1430. }
  1431. protected function playerReady(_arg1:PlayerEvent):void{
  1432. var evt:* = _arg1;
  1433. var timer:* = new Timer(50, 1);
  1434. timer.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:TimerEvent):void{
  1435. var _local3:string;
  1436. _player.removeGlobalListener(queueEvents);
  1437. var _local2:string = ((_player.config.playerready) ? ((_player.config.playerready + ",") + "playerReady") : "playerReady");
  1438. if (ExternalInterface.available){
  1439. for each (_local3 in _local2.replace(/\s/, "").split(",")) {
  1440. try {
  1441. ExternalInterface.call(_local3, {
  1442. id:evt.id,
  1443. client:evt.client,
  1444. version:evt.version
  1445. });
  1446. } catch(e:error) {
  1447. };
  1448. };
  1449. clearQueuedEvents();
  1450. };
  1451. });
  1452. timer.start();
  1453. }
  1454. protected function queueEvents(_arg1:Event):void{
  1455. this._queuedEvents.push(_arg1);
  1456. }
  1457. protected function clearQueuedEvents():void{
  1458. var _local1:Event;
  1459. for each (_local1 in this._queuedEvents) {
  1460. this.listenerCallback(_local1);
  1461. };
  1462. this._queuedEvents = null;
  1463. }
  1464. protected function setupPlayerListeners():void{
  1465. this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.resetPosition);
  1466. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.updatePosition);
  1467. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.updateBuffer);
  1468. }
  1469. protected function resetPosition(_arg1:PlaylistEvent):void{
  1470. this._playerPosition = 0;
  1471. this._playerBuffer = 0;
  1472. }
  1473. protected function updatePosition(_arg1:MediaEvent):void{
  1474. this._playerPosition = _arg1.position;
  1475. }
  1476. protected function updateBuffer(_arg1:MediaEvent):void{
  1477. this._playerBuffer = _arg1.bufferPercent;
  1478. }
  1479. protected function setupJSListeners():void{
  1480. try {
  1481. ExternalInterface.addCallback("jwAddEventListener", this.js_addEventListener);
  1482. ExternalInterface.addCallback("jwRemoveEventListener", this.js_removeEventListener);
  1483. ExternalInterface.addCallback("jwGetBuffer", this.js_getBuffer);
  1484. ExternalInterface.addCallback("jwGetDuration", this.js_getDuration);
  1485. ExternalInterface.addCallback("jwGetFullscreen", this.js_getFullscreen);
  1486. ExternalInterface.addCallback("jwGetHeight", this.js_getHeight);
  1487. ExternalInterface.addCallback("jwGetMute", this.js_getMute);
  1488. ExternalInterface.addCallback("jwGetPlaylist", this.js_getPlaylist);
  1489. ExternalInterface.addCallback("jwGetPlaylistIndex", this.js_getPlaylistIndex);
  1490. ExternalInterface.addCallback("jwGetPosition", this.js_getPosition);
  1491. ExternalInterface.addCallback("jwGetState", this.js_getState);
  1492. ExternalInterface.addCallback("jwGetWidth", this.js_getWidth);
  1493. ExternalInterface.addCallback("jwGetVersion", this.js_getVersion);
  1494. ExternalInterface.addCallback("jwGetVolume", this.js_getVolume);
  1495. ExternalInterface.addCallback("jwPlay", this.js_play);
  1496. ExternalInterface.addCallback("jwPause", this.js_pause);
  1497. ExternalInterface.addCallback("jwStop", this.js_stop);
  1498. ExternalInterface.addCallback("jwSeek", this.js_seek);
  1499. ExternalInterface.addCallback("jwLoad", this.js_load);
  1500. ExternalInterface.addCallback("jwPlaylistItem", this.js_playlistItem);
  1501. ExternalInterface.addCallback("jwPlaylistNext", this.js_playlistNext);
  1502. ExternalInterface.addCallback("jwPlaylistPrev", this.js_playlistPrev);
  1503. ExternalInterface.addCallback("jwSetMute", this.js_mute);
  1504. ExternalInterface.addCallback("jwSetVolume", this.js_volume);
  1505. ExternalInterface.addCallback("jwSetFullscreen", this.js_fullscreen);
  1506. ExternalInterface.addCallback("jwControlbarShow", this.js_showControlbar);
  1507. ExternalInterface.addCallback("jwControlbarHide", this.js_hideControlbar);
  1508. ExternalInterface.addCallback("jwDisplayShow", this.js_showDisplay);
  1509. ExternalInterface.addCallback("jwDisplayHide", this.js_hideDisplay);
  1510. ExternalInterface.addCallback("jwDockHide", this.js_hideDock);
  1511. ExternalInterface.addCallback("jwDockSetButton", this.js_dockSetButton);
  1512. ExternalInterface.addCallback("jwDockShow", this.js_showDock);
  1513. } catch(e:error) {
  1514. Logger.log(("Could not initialize JavaScript API: " + e.message));
  1515. };
  1516. }
  1517. protected function js_addEventListener(_arg1:string, _arg2:string):void{
  1518. if (!this._listeners[_arg1]){
  1519. this._listeners[_arg1] = [];
  1520. this._player.addEventListener(_arg1, this.listenerCallback);
  1521. };
  1522. (this._listeners[_arg1] as array).push(_arg2);
  1523. }
  1524. protected function js_removeEventListener(_arg1:string, _arg2:string):void{
  1525. var _local4:number;
  1526. var _local3:array = this._listeners[_arg1];
  1527. if (_local3){
  1528. _local4 = _local3.indexof(_arg2);
  1529. if (_local4 > -1){
  1530. _local3.splice(_local4, 1);
  1531. };
  1532. };
  1533. }
  1534. protected function listenerCallback(_arg1:Event):void{
  1535. var args:* = null;
  1536. var call:* = null;
  1537. var evt:* = _arg1;
  1538. args = {};
  1539. if ((evt is MediaEvent)){
  1540. args = this.listenerCallbackMedia((evt as MediaEvent));
  1541. } else {
  1542. if ((evt is PlayerStateEvent)){
  1543. args = this.listenerCallbackState((evt as PlayerStateEvent));
  1544. } else {
  1545. if ((evt is PlaylistEvent)){
  1546. args = this.listenerCallbackPlaylist((evt as PlaylistEvent));
  1547. } else {
  1548. if ((evt is ComponentEvent)){
  1549. args = this.listenerCallbackComponent((evt as ComponentEvent));
  1550. } else {
  1551. if ((((evt is ViewEvent)) && (!(((evt as ViewEvent).data == null))))){
  1552. args = {data:JavascriptSerialization.stripDots((evt as ViewEvent).data)};
  1553. } else {
  1554. if ((evt is PlayerEvent)){
  1555. args = {message:(evt as PlayerEvent).message};
  1556. };
  1557. };
  1558. };
  1559. };
  1560. };
  1561. };
  1562. args.type = evt.type;
  1563. var callbacks:* = (this._listeners[evt.type] as array);
  1564. if (callbacks){
  1565. for each (call in callbacks) {
  1566. if (evt.type == MediaEvent.JWPLAYER_MEDIA_COMPLETE){
  1567. ExternalInterface.call(call, args);
  1568. } else {
  1569. setTimeout(function ():void{
  1570. ExternalInterface.call(call, args);
  1571. }, 0);
  1572. };
  1573. };
  1574. };
  1575. }
  1576. protected function merge(_arg1:object, _arg2:object):object{
  1577. var _local4:string;
  1578. var _local3:object = {};
  1579. for (_local4 in _arg1) {
  1580. _local3[_local4] = _arg1[_local4];
  1581. };
  1582. for (_local4 in _arg2) {
  1583. _local3[_local4] = _arg2[_local4];
  1584. };
  1585. return (_local3);
  1586. }
  1587. protected function listenerCallbackMedia(_arg1:MediaEvent):object{
  1588. var _local2:object = {};
  1589. if (_arg1.bufferPercent >= 0){
  1590. _local2.bufferPercent = _arg1.bufferPercent;
  1591. };
  1592. if (_arg1.duration >= 0){
  1593. _local2.duration = _arg1.duration;
  1594. };
  1595. if (_arg1.message){
  1596. _local2.message = _arg1.message;
  1597. };
  1598. if (_arg1.metadata != null){
  1599. _local2.metadata = JavascriptSerialization.stripDots(_arg1.metadata);
  1600. };
  1601. if (_arg1.offset > 0){
  1602. _local2.offset = _arg1.offset;
  1603. };
  1604. if (_arg1.position >= 0){
  1605. _local2.position = _arg1.position;
  1606. };
  1607. if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_MUTE){
  1608. _local2.mute = _arg1.mute;
  1609. };
  1610. if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_VOLUME){
  1611. _local2.volume = _arg1.volume;
  1612. };
  1613. return (_local2);
  1614. }
  1615. protected function listenerCallbackState(_arg1:PlayerStateEvent):object{
  1616. if (_arg1.type == PlayerStateEvent.JWPLAYER_PLAYER_STATE){
  1617. return ({
  1618. newstate:_arg1.newstate,
  1619. oldstate:_arg1.oldstate
  1620. });
  1621. };
  1622. return ({});
  1623. }
  1624. protected function listenerCallbackPlaylist(_arg1:PlaylistEvent):object{
  1625. var _local2:array;
  1626. if (_arg1.type == PlaylistEvent.JWPLAYER_PLAYLIST_LOADED){
  1627. _local2 = JavascriptSerialization.playlistToArray(this._player.playlist);
  1628. _local2 = (JavascriptSerialization.stripDots(_local2) as array);
  1629. return ({playlist:_local2});
  1630. };
  1631. if (_arg1.type == PlaylistEvent.JWPLAYER_PLAYLIST_ITEM){
  1632. return ({index:this._player.playlist.currentIndex});
  1633. };
  1634. return ({});
  1635. }
  1636. protected function listenerCallbackComponent(_arg1:ComponentEvent):object{
  1637. var _local2:object = {};
  1638. if ((_arg1.component is IControlbarComponent)){
  1639. _local2.component = "controlbar";
  1640. } else {
  1641. if ((_arg1.component is IPlaylistComponent)){
  1642. _local2.component = "playlist";
  1643. } else {
  1644. if ((_arg1.component is IDisplayComponent)){
  1645. _local2.component = "display";
  1646. } else {
  1647. if ((_arg1.component is IDockComponent)){
  1648. _local2.component = "dock";
  1649. };
  1650. };
  1651. };
  1652. };
  1653. _local2.boundingRect = {
  1654. x:_arg1.boundingRect.x,
  1655. y:_arg1.boundingRect.y,
  1656. width:_arg1.boundingRect.width,
  1657. height:_arg1.boundingRect.height
  1658. };
  1659. return (_local2);
  1660. }
  1661. protected function js_getBandwidth():number{
  1662. return (this._player.config.bandwidth);
  1663. }
  1664. protected function js_getBuffer():number{
  1665. return (this._playerBuffer);
  1666. }
  1667. protected function js_getDuration():number{
  1668. return (((this._player.playlist.currentItem) ? this._player.playlist.currentItem.duration : 0));
  1669. }
  1670. protected function js_getFullscreen():boolean{
  1671. return (this._player.config.fullscreen);
  1672. }
  1673. protected function js_getHeight():number{
  1674. return (RootReference.stage.stageHeight);
  1675. }
  1676. protected function js_getLevel():number{
  1677. return (((this._player.playlist.currentItem) ? this._player.playlist.currentItem.currentLevel : 0));
  1678. }
  1679. protected function js_getLockState():boolean{
  1680. return (this._player.locked);
  1681. }
  1682. protected function js_getMute():boolean{
  1683. return (this._player.config.mute);
  1684. }
  1685. protected function js_getPlaylist():array{
  1686. var _local1:array = JavascriptSerialization.playlistToArray(this._player.playlist);
  1687. var _local2:number = 0;
  1688. while (_local2 < _local1.length) {
  1689. _local1[_local2] = JavascriptSerialization.stripDots(_local1[_local2]);
  1690. _local2++;
  1691. };
  1692. return (_local1);
  1693. }
  1694. protected function js_getPlaylistIndex():number{
  1695. return (this._player.playlist.currentIndex);
  1696. }
  1697. protected function js_getPosition():number{
  1698. return (this._playerPosition);
  1699. }
  1700. protected function js_getState():string{
  1701. return (this._player.state);
  1702. }
  1703. protected function js_getWidth():number{
  1704. return (RootReference.stage.stageWidth);
  1705. }
  1706. protected function js_getVersion():string{
  1707. return (this._player.version);
  1708. }
  1709. protected function js_getVolume():number{
  1710. return (this._player.config.volume);
  1711. }
  1712. protected function js_dockSetButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void{
  1713. this._player.controls.dock.setButton(_arg1, _arg2, _arg3, _arg4);
  1714. }
  1715. protected function js_play(_arg1=null):void{
  1716. if (_arg1 == null){
  1717. this.playToggle();
  1718. } else {
  1719. if (string(_arg1).tolowercase() == "true"){
  1720. this._player.play();
  1721. } else {
  1722. this._player.pause();
  1723. };
  1724. };
  1725. }
  1726. protected function js_pause(_arg1=null):void{
  1727. if (_arg1 == null){
  1728. this.playToggle();
  1729. } else {
  1730. if (string(_arg1).tolowercase() == "true"){
  1731. this._player.pause();
  1732. } else {
  1733. this._player.play();
  1734. };
  1735. };
  1736. }
  1737. protected function playToggle():void{
  1738. if ((((this._player.state == PlayerState.IDLE)) || ((this._player.state == PlayerState.PAUSED)))){
  1739. this._player.play();
  1740. } else {
  1741. this._player.pause();
  1742. };
  1743. }
  1744. protected function js_stop():void{
  1745. this._player.stop();
  1746. }
  1747. protected function js_seek(_arg1:number=0):void{
  1748. this._player.seek(_arg1);
  1749. }
  1750. protected function js_load(_arg1):void{
  1751. this._player.load(_arg1);
  1752. }
  1753. protected function js_playlistItem(_arg1:number):void{
  1754. this._player.playlistItem(_arg1);
  1755. }
  1756. protected function js_playlistNext():void{
  1757. this._player.playlistNext();
  1758. }
  1759. protected function js_playlistPrev():void{
  1760. this._player.playlistPrev();
  1761. }
  1762. protected function js_mute(_arg1=null):void{
  1763. if (_arg1 == null){
  1764. this._player.mute(!(this._player.config.mute));
  1765. } else {
  1766. if (string(_arg1).tolowercase() == "true"){
  1767. this._player.mute(true);
  1768. } else {
  1769. this._player.mute(false);
  1770. };
  1771. };
  1772. }
  1773. protected function js_volume(_arg1:number):void{
  1774. this._player.volume(_arg1);
  1775. }
  1776. protected function js_fullscreen(_arg1=null):void{
  1777. if (_arg1 == null){
  1778. this._player.fullscreen(!(this._player.config.fullscreen));
  1779. } else {
  1780. if (string(_arg1).tolowercase() == "true"){
  1781. this._player.fullscreen(true);
  1782. } else {
  1783. this._player.fullscreen(false);
  1784. };
  1785. };
  1786. }
  1787. protected function setComponentVisibility(_arg1:IPlayerComponent, _arg2:boolean):void{
  1788. if (_arg2){
  1789. _arg1.show();
  1790. } else {
  1791. _arg1.hide();
  1792. };
  1793. }
  1794. protected function js_showControlbar():void{
  1795. this.setComponentVisibility(this._player.controls.controlbar, true);
  1796. }
  1797. protected function js_hideControlbar():void{
  1798. this.setComponentVisibility(this._player.controls.controlbar, false);
  1799. }
  1800. protected function js_showDock():void{
  1801. this.setComponentVisibility(this._player.controls.dock, true);
  1802. }
  1803. protected function js_hideDock():void{
  1804. this.setComponentVisibility(this._player.controls.dock, false);
  1805. }
  1806. protected function js_showDisplay():void{
  1807. this.setComponentVisibility(this._player.controls.display, true);
  1808. }
  1809. protected function js_hideDisplay():void{
  1810. this.setComponentVisibility(this._player.controls.display, false);
  1811. }
  1812.  
  1813. }
  1814. }//package com.longtailvideo.jwplayer.player
  1815. package com.longtailvideo.jwplayer.player {
  1816. import com.longtailvideo.jwplayer.view.interfaces.*;
  1817. import com.longtailvideo.jwplayer.plugins.*;
  1818. import flash.events.*;
  1819. import com.longtailvideo.jwplayer.events.*;
  1820. import flash.display.*;
  1821. import com.jeroenwijering.events.*;
  1822. import flash.utils.*;
  1823. import flash.net.*;
  1824. import com.longtailvideo.jwplayer.utils.*;
  1825.  
  1826. public class PlayerV4Emulation extends AbstractView {
  1827.  
  1828. private static var instance:PlayerV4Emulation;
  1829.  
  1830. private var _player:IPlayer;
  1831. private var viewEventDispatcher:EventDispatcher;
  1832. private var modelEventDispatcher:EventDispatcher;
  1833. private var controllerEventDispatcher:EventDispatcher;
  1834. private var id:string;
  1835. private var client:string;
  1836. private var version:string;
  1837.  
  1838. public function PlayerV4Emulation(_arg1:IPlayer){
  1839. this.viewEventDispatcher = new EventDispatcher();
  1840. this.modelEventDispatcher = new EventDispatcher();
  1841. this.controllerEventDispatcher = new EventDispatcher();
  1842. this._player = _arg1;
  1843. this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
  1844. }
  1845. public static function getInstance(_arg1:IPlayer):PlayerV4Emulation{
  1846. if (!instance){
  1847. instance = new PlayerV4Emulation(_arg1);
  1848. };
  1849. return (instance);
  1850. }
  1851.  
  1852. private function playerReady(_arg1:PlayerEvent):void{
  1853. this.id = _arg1.id;
  1854. this.client = _arg1.client;
  1855. this.version = _arg1.version;
  1856. dispatchEvent(new PlayerEvent(PlayerEvent.READY));
  1857. this.setupListeners();
  1858. }
  1859. private function setupListeners():void{
  1860. this._player.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.errorHandler);
  1861. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.mediaBuffer);
  1862. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_ERROR, this.mediaError);
  1863. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_LOADED, this.mediaLoaded);
  1864. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.mediaTime);
  1865. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.mediaVolume);
  1866. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.mediaMute);
  1867. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_META, this.mediaMeta);
  1868. this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_COMPLETE, this.mediaComplete);
  1869. this._player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  1870. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this.viewFullscreen);
  1871. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_ITEM, this.viewItem);
  1872. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_LOAD, this.viewLoad);
  1873. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_MUTE, this.viewMute);
  1874. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_NEXT, this.viewNext);
  1875. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PAUSE, this.viewPause);
  1876. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PLAY, this.viewPlay);
  1877. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PREV, this.viewPrev);
  1878. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_SEEK, this.viewSeek);
  1879. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_STOP, this.viewStop);
  1880. this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_VOLUME, this.viewVolume);
  1881. this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistItem);
  1882. this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistLoad);
  1883. }
  1884. private function errorHandler(_arg1:PlayerEvent):void{
  1885. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.error, {
  1886. message:_arg1.message,
  1887. id:this.id,
  1888. client:this.client,
  1889. version:this.version
  1890. }));
  1891. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.error, {
  1892. message:_arg1.message,
  1893. id:this.id,
  1894. client:this.client,
  1895. version:this.version
  1896. }));
  1897. }
  1898. private function mediaBuffer(_arg1:MediaEvent):void{
  1899. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.BUFFER, {
  1900. percentage:_arg1.bufferPercent,
  1901. id:this.id,
  1902. client:this.client,
  1903. version:this.version
  1904. }));
  1905. }
  1906. private function mediaError(_arg1:MediaEvent):void{
  1907. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.error, {
  1908. message:_arg1.message,
  1909. id:this.id,
  1910. client:this.client,
  1911. version:this.version
  1912. }));
  1913. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.error, {
  1914. message:_arg1.message,
  1915. id:this.id,
  1916. client:this.client,
  1917. version:this.version
  1918. }));
  1919. }
  1920. private function mediaLoaded(_arg1:MediaEvent):void{
  1921. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.loaded, {
  1922. loaded:0,
  1923. total:0,
  1924. offset:0,
  1925. id:this.id,
  1926. client:this.client,
  1927. version:this.version
  1928. }));
  1929. }
  1930. private function mediaTime(_arg1:MediaEvent):void{
  1931. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.time, {
  1932. duration:_arg1.duration,
  1933. position:_arg1.position,
  1934. id:this.id,
  1935. client:this.client,
  1936. version:this.version
  1937. }));
  1938. }
  1939. private function mediaVolume(_arg1:MediaEvent):void{
  1940. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME, {
  1941. percentage:_arg1.volume,
  1942. id:this.id,
  1943. client:this.client,
  1944. version:this.version
  1945. }));
  1946. }
  1947. private function mediaMute(_arg1:MediaEvent):void{
  1948. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.MUTE, {
  1949. state:_arg1.mute,
  1950. id:this.id,
  1951. client:this.client,
  1952. version:this.version
  1953. }));
  1954. }
  1955. private function mediaMeta(_arg1:MediaEvent):void{
  1956. _arg1.metadata["id"] = this.id;
  1957. _arg1.metadata["client"] = this.client;
  1958. _arg1.metadata["version"] = this.version;
  1959. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.META, _arg1.metadata));
  1960. }
  1961. private function mediaComplete(_arg1:MediaEvent):void{
  1962. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.STATE, {
  1963. id:this.id,
  1964. oldstate:this._player.state,
  1965. newstate:ModelStates.COMPLETED
  1966. }));
  1967. }
  1968. private function stateHandler(_arg1:PlayerStateEvent):void{
  1969. if ((((_arg1.newstate == PlayerState.IDLE)) && ((((_arg1.oldstate == PlayerState.BUFFERING)) || ((_arg1.oldstate == PlayerState.PLAYING)))))){
  1970. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.stop, {
  1971. id:this.id,
  1972. client:this.client,
  1973. version:this.version
  1974. }));
  1975. };
  1976. this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.STATE, {
  1977. id:this.id,
  1978. oldstate:_arg1.oldstate,
  1979. newstate:_arg1.newstate
  1980. }));
  1981. }
  1982. private function viewFullscreen(_arg1:ViewEvent):void{
  1983. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.FULLSCREEN, {
  1984. state:_arg1.data,
  1985. id:this.id,
  1986. client:this.client,
  1987. version:this.version
  1988. }));
  1989. }
  1990. private function viewItem(_arg1:ViewEvent):void{
  1991. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.ITEM, {
  1992. index:_arg1.data,
  1993. id:this.id,
  1994. client:this.client,
  1995. version:this.version
  1996. }));
  1997. }
  1998. private function viewLoad(_arg1:ViewEvent):void{
  1999. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.load, {
  2000. object:_arg1.data,
  2001. id:this.id,
  2002. client:this.client,
  2003. version:this.version
  2004. }));
  2005. }
  2006. private function viewMute(_arg1:ViewEvent):void{
  2007. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.MUTE, {
  2008. state:_arg1.data,
  2009. id:this.id,
  2010. client:this.client,
  2011. version:this.version
  2012. }));
  2013. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.MUTE, {
  2014. state:_arg1.data,
  2015. id:this.id,
  2016. client:this.client,
  2017. version:this.version
  2018. }));
  2019. }
  2020. private function viewNext(_arg1:ViewEvent):void{
  2021. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.NEXT, {
  2022. id:this.id,
  2023. client:this.client,
  2024. version:this.version
  2025. }));
  2026. }
  2027. private function viewPause(_arg1:ViewEvent):void{
  2028. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.play, {
  2029. state:false,
  2030. id:this.id,
  2031. client:this.client,
  2032. version:this.version
  2033. }));
  2034. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.play, {
  2035. state:false,
  2036. id:this.id,
  2037. client:this.client,
  2038. version:this.version
  2039. }));
  2040. }
  2041. private function viewPlay(_arg1:ViewEvent):void{
  2042. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.play, {
  2043. state:true,
  2044. id:this.id,
  2045. client:this.client,
  2046. version:this.version
  2047. }));
  2048. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.play, {
  2049. state:true,
  2050. id:this.id,
  2051. client:this.client,
  2052. version:this.version
  2053. }));
  2054. }
  2055. private function viewPrev(_arg1:ViewEvent):void{
  2056. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.PREV, {
  2057. id:this.id,
  2058. client:this.client,
  2059. version:this.version
  2060. }));
  2061. }
  2062. private function viewRedraw(_arg1:number, _arg2:number):void{
  2063. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.REDRAW, {
  2064. id:this.id,
  2065. client:this.client,
  2066. version:this.version
  2067. }));
  2068. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.RESIZE, {
  2069. width:_arg1,
  2070. height:_arg2,
  2071. fullscreen:this._player.config.fullscreen,
  2072. client:this.client,
  2073. version:this.version
  2074. }));
  2075. }
  2076. private function viewSeek(_arg1:ViewEvent):void{
  2077. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.seek, {
  2078. position:_arg1.data,
  2079. id:this.id,
  2080. client:this.client,
  2081. version:this.version
  2082. }));
  2083. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.seek, {
  2084. position:_arg1.data,
  2085. id:this.id,
  2086. client:this.client,
  2087. version:this.version
  2088. }));
  2089. }
  2090. private function viewStop(_arg1:ViewEvent):void{
  2091. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.stop, {
  2092. id:this.id,
  2093. client:this.client,
  2094. version:this.version
  2095. }));
  2096. }
  2097. private function viewVolume(_arg1:ViewEvent):void{
  2098. this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.VOLUME, {
  2099. state:_arg1.data,
  2100. id:this.id,
  2101. client:this.client,
  2102. version:this.version
  2103. }));
  2104. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME, {
  2105. percentage:_arg1.data,
  2106. id:this.id,
  2107. client:this.client,
  2108. version:this.version
  2109. }));
  2110. }
  2111. private function playlistItem(_arg1:PlaylistEvent):void{
  2112. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.ITEM, {
  2113. index:this._player.playlist.currentIndex,
  2114. id:this.id,
  2115. client:this.client,
  2116. version:this.version
  2117. }));
  2118. }
  2119. private function playlistLoad(_arg1:PlaylistEvent):void{
  2120. this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.PLAYLIST, {
  2121. playlist:JavascriptSerialization.playlistToArray(this._player.playlist),
  2122. id:this.id,
  2123. client:this.client,
  2124. version:this.version
  2125. }));
  2126. }
  2127. override public function addModelListener(_arg1:string, _arg2:function):void{
  2128. this.modelEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
  2129. }
  2130. override public function removeModelListener(_arg1:string, _arg2:function):void{
  2131. this.modelEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
  2132. }
  2133. override public function addViewListener(_arg1:string, _arg2:function):void{
  2134. this.viewEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
  2135. }
  2136. override public function removeViewListener(_arg1:string, _arg2:function):void{
  2137. this.viewEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
  2138. }
  2139. override public function addControllerListener(_arg1:string, _arg2:function):void{
  2140. this.controllerEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
  2141. }
  2142. override public function removeControllerListener(_arg1:string, _arg2:function):void{
  2143. this.controllerEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
  2144. }
  2145. override public function sendEvent(_arg1:string, _arg2:object=undefined):void{
  2146. Logger.log(((("V4 emulator sending event: " + _arg1) + " ") + Strings.print_r(_arg2)));
  2147. switch (_arg1){
  2148. case ViewEvent.FULLSCREEN:
  2149. this._player.fullscreen(_arg2);
  2150. break;
  2151. case ViewEvent.ITEM:
  2152. this._player.playlistItem(number(_arg2));
  2153. break;
  2154. case ViewEvent.LINK:
  2155. this.link(number(_arg2));
  2156. break;
  2157. case ViewEvent.load:
  2158. this._player.load(_arg2);
  2159. break;
  2160. case ViewEvent.MUTE:
  2161. if (((!((_arg2 === null))) && (!((_arg2 === ""))))){
  2162. this._player.mute(((!((_arg2 === "false"))) && (!((_arg2 === 0)))));
  2163. } else {
  2164. this._player.mute(!(this._player.config.mute));
  2165. };
  2166. break;
  2167. case ViewEvent.NEXT:
  2168. this._player.playlistNext();
  2169. break;
  2170. case ViewEvent.play:
  2171. if ((((_arg2 === null)) || ((_arg2 === "")))){
  2172. if ((((this._player.state == PlayerState.PAUSED)) || ((this._player.state == PlayerState.IDLE)))){
  2173. _arg2 = "true";
  2174. } else {
  2175. _arg2 = "false";
  2176. };
  2177. };
  2178. if (((!((_arg2 === null))) && ((Strings.serialize(_arg2.tostring()) == false)))){
  2179. this._player.pause();
  2180. } else {
  2181. this._player.play();
  2182. };
  2183. break;
  2184. case ViewEvent.PREV:
  2185. this._player.playlistPrev();
  2186. break;
  2187. case ViewEvent.REDRAW:
  2188. this._player.redraw();
  2189. break;
  2190. case ViewEvent.seek:
  2191. this._player.seek(number(_arg2));
  2192. break;
  2193. case ViewEvent.stop:
  2194. this._player.stop();
  2195. break;
  2196. case ViewEvent.trace:
  2197. Logger.log(_arg2);
  2198. break;
  2199. case ViewEvent.VOLUME:
  2200. this._player.volume(number(_arg2));
  2201. break;
  2202. };
  2203. }
  2204. override public function get config():object{
  2205. var _local3:string;
  2206. var _local4:string;
  2207. var _local5:PluginConfig;
  2208. var _local6:string;
  2209. var _local1:object = {};
  2210. var _local2:xml = describeType(this._player.config);
  2211. for each (_local3 in _local2.accessor.@name) {
  2212. if (this._player.config[_local3] != null){
  2213. _local1[_local3] = Strings.serialize(this._player.config[_local3].tostring());
  2214. };
  2215. };
  2216. for each (_local4 in this._player.config.pluginIds) {
  2217. _local5 = this._player.config.pluginConfig(_local4);
  2218. for (_local6 in _local5) {
  2219. _local1[((_local4 + ".") + _local6)] = _local5[_local6];
  2220. };
  2221. };
  2222. switch (this._player.state){
  2223. case PlayerState.BUFFERING:
  2224. _local1["state"] = ModelStates.BUFFERING;
  2225. break;
  2226. case PlayerState.PLAYING:
  2227. _local1["state"] = ModelStates.PLAYING;
  2228. break;
  2229. case PlayerState.PAUSED:
  2230. _local1["state"] = ModelStates.PAUSED;
  2231. break;
  2232. case PlayerState.IDLE:
  2233. if ((((this._player.playlist.currentIndex > 0)) && ((this._player.playlist.currentIndex == (this._player.playlist.length - 1))))){
  2234. _local1["state"] = ModelStates.COMPLETED;
  2235. } else {
  2236. _local1["state"] = ModelStates.IDLE;
  2237. };
  2238. break;
  2239. };
  2240. _local1["fullscreen"] = this._player.config.fullscreen;
  2241. _local1["version"] = this._player.version;
  2242. _local1["item"] = this._player.playlist.currentIndex;
  2243. _local1["level"] = ((this._player.playlist.currentItem) ? this._player.playlist.currentItem.currentLevel : 0);
  2244. return (_local1);
  2245. }
  2246. override public function get playlist():array{
  2247. return (JavascriptSerialization.playlistToArray(this._player.playlist));
  2248. }
  2249. override public function getPluginConfig(_arg1:object):object{
  2250. if ((_arg1 is IPlugin)){
  2251. return (this._player.config.pluginConfig((_arg1 as IPlugin).id));
  2252. };
  2253. if ((_arg1 is V4Plugin)){
  2254. return (this._player.config.pluginConfig((_arg1 as V4Plugin).pluginId));
  2255. };
  2256. if (((_arg1 as DisplayObject).parent is V4Plugin)){
  2257. return (this._player.config.pluginConfig((_arg1.parent as V4Plugin).pluginId));
  2258. };
  2259. if ((_arg1 is IDockComponent)){
  2260. return (this._player.config.pluginConfig("dock"));
  2261. };
  2262. if ((_arg1 is IDisplayComponent)){
  2263. return (this._player.config.pluginConfig("display"));
  2264. };
  2265. if ((_arg1 is IControlbarComponent)){
  2266. return (this._player.config.pluginConfig("controlbar"));
  2267. };
  2268. if ((_arg1 is IPlaylistComponent)){
  2269. return (this._player.config.pluginConfig("playlist"));
  2270. };
  2271. return (new PluginConfig(""));
  2272. }
  2273. public function resize(_arg1:number, _arg2:number):void{
  2274. this.viewRedraw(_arg1, _arg2);
  2275. }
  2276. override public function getPlugin(_arg1:string):object{
  2277. var _local2:object;
  2278. switch (_arg1){
  2279. case "dock":
  2280. _local2 = (this._player.controls.dock as object);
  2281. break;
  2282. case "controlbar":
  2283. _local2 = (this._player.controls.controlbar as object);
  2284. break;
  2285. case "display":
  2286. _local2 = (this._player.controls.display as object);
  2287. break;
  2288. case "playlist":
  2289. _local2 = (this._player.controls.playlist as object);
  2290. break;
  2291. default:
  2292. try {
  2293. _local2 = (this._player as object).getPlugin(_arg1);
  2294. } catch(e:error) {
  2295. };
  2296. };
  2297. return (_local2);
  2298. }
  2299. private function link(_arg1:number):void{
  2300. if (isnan(_arg1)){
  2301. _arg1 = this._player.playlist.currentIndex;
  2302. };
  2303. if ((((_arg1 >= 0)) && ((_arg1 < this._player.playlist.length)))){
  2304. navigateToURL(new URLRequest(this._player.playlist.getItemAt(_arg1).link), this._player.config.linktarget);
  2305. };
  2306. }
  2307.  
  2308. }
  2309. }//package com.longtailvideo.jwplayer.player
  2310. package com.longtailvideo.jwplayer.player {
  2311.  
  2312. public class PlayerVersion {
  2313.  
  2314. protected static var _version:string = "5.8.2011";
  2315. public static var id:string = "";
  2316.  
  2317. public static function get version():string{
  2318. return (_version);
  2319. }
  2320.  
  2321. }
  2322. }//package com.longtailvideo.jwplayer.player
  2323. package com.longtailvideo.jwplayer.player {
  2324. import com.longtailvideo.jwplayer.events.*;
  2325. import com.jeroenwijering.events.*;
  2326. import flash.utils.*;
  2327. import com.longtailvideo.jwplayer.utils.*;
  2328. import flash.external.*;
  2329.  
  2330. public class JavascriptCompatibilityAPI extends JavascriptAPI {
  2331.  
  2332. private var _emu:PlayerV4Emulation;
  2333. private var controllerCallbacks:object;
  2334. private var modelCallbacks:object;
  2335. private var viewCallbacks:object;
  2336.  
  2337. public function JavascriptCompatibilityAPI(_arg1:IPlayer){
  2338. this.controllerCallbacks = {};
  2339. this.modelCallbacks = {};
  2340. this.viewCallbacks = {};
  2341. this._emu = PlayerV4Emulation.getInstance(_arg1);
  2342. super(_arg1);
  2343. }
  2344. override protected function setupJSListeners():void{
  2345. super.setupJSListeners();
  2346. try {
  2347. ExternalInterface.addCallback("addControllerListener", this.addJSControllerListener);
  2348. ExternalInterface.addCallback("addModelListener", this.addJSModelListener);
  2349. ExternalInterface.addCallback("addViewListener", this.addJSViewListener);
  2350. ExternalInterface.addCallback("removeControllerListener", this.removeJSControllerListener);
  2351. ExternalInterface.addCallback("removeModelListener", this.removeJSModelListener);
  2352. ExternalInterface.addCallback("removeViewListener", this.removeJSViewListener);
  2353. ExternalInterface.addCallback("getConfig", this.getConfig);
  2354. ExternalInterface.addCallback("getPlaylist", super.js_getPlaylist);
  2355. ExternalInterface.addCallback("getPluginConfig", this.getJSPluginConfig);
  2356. ExternalInterface.addCallback("loadPlugin", this.loadPlugin);
  2357. ExternalInterface.addCallback("sendEvent", this.sendEvent);
  2358. } catch(e:error) {
  2359. Logger.log(("Could not start up JavasScript API: " + e.message));
  2360. };
  2361. }
  2362. override protected function clearQueuedEvents():void{
  2363. super.clearQueuedEvents();
  2364. var _local1:PlayerEvent = new PlayerEvent("");
  2365. this.forwardControllerEvents(new ControllerEvent(ControllerEvent.PLAYLIST, {
  2366. playlist:JavascriptSerialization.playlistToArray(_player.playlist),
  2367. id:_local1.id,
  2368. client:_local1.client,
  2369. version:_local1.version
  2370. }));
  2371. this.forwardControllerEvents(new ControllerEvent(ControllerEvent.ITEM, {
  2372. index:_player.playlist.currentIndex,
  2373. id:_local1.id,
  2374. client:_local1.client,
  2375. version:_local1.version
  2376. }));
  2377. }
  2378. private function addJSControllerListener(_arg1:string, _arg2:string):boolean{
  2379. _arg1 = _arg1.touppercase();
  2380. if (!this.controllerCallbacks.hasOwnProperty(_arg1)){
  2381. this.controllerCallbacks[_arg1] = [];
  2382. };
  2383. if ((this.controllerCallbacks[_arg1] as array).indexof(_arg2) < 0){
  2384. (this.controllerCallbacks[_arg1] as array).push(_arg2);
  2385. this._emu.addControllerListener(_arg1, this.forwardControllerEvents);
  2386. };
  2387. return (true);
  2388. }
  2389. private function removeJSControllerListener(_arg1:string, _arg2:string):boolean{
  2390. _arg1 = _arg1.touppercase();
  2391. var _local3:array = (this.controllerCallbacks[_arg1] as array);
  2392. var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
  2393. if (_local4 >= 0){
  2394. _local3.splice(_local4, 1);
  2395. this._emu.removeControllerListener(_arg1.touppercase(), this.forwardControllerEvents);
  2396. return (true);
  2397. };
  2398. return (false);
  2399. }
  2400. private function addJSModelListener(_arg1:string, _arg2:string):boolean{
  2401. _arg1 = _arg1.touppercase();
  2402. if (!this.modelCallbacks.hasOwnProperty(_arg1)){
  2403. this.modelCallbacks[_arg1] = [];
  2404. };
  2405. if ((this.modelCallbacks[_arg1] as array).indexof(_arg2) < 0){
  2406. (this.modelCallbacks[_arg1] as array).push(_arg2);
  2407. this._emu.addModelListener(_arg1, this.forwardModelEvents);
  2408. };
  2409. return (true);
  2410. }
  2411. private function removeJSModelListener(_arg1:string, _arg2:string):boolean{
  2412. _arg1 = _arg1.touppercase();
  2413. var _local3:array = (this.modelCallbacks[_arg1] as array);
  2414. var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
  2415. if (_local4 >= 0){
  2416. _local3.splice(_local4, 1);
  2417. this._emu.removeModelListener(_arg1.touppercase(), this.forwardModelEvents);
  2418. return (true);
  2419. };
  2420. return (false);
  2421. }
  2422. private function addJSViewListener(_arg1:string, _arg2:string):boolean{
  2423. _arg1 = _arg1.touppercase();
  2424. if (!this.viewCallbacks.hasOwnProperty(_arg1)){
  2425. this.viewCallbacks[_arg1] = [];
  2426. };
  2427. if ((this.viewCallbacks[_arg1] as array).indexof(_arg2) < 0){
  2428. (this.viewCallbacks[_arg1] as array).push(_arg2);
  2429. this._emu.addViewListener(_arg1.touppercase(), this.forwardViewEvents);
  2430. };
  2431. return (true);
  2432. }
  2433. private function removeJSViewListener(_arg1:string, _arg2:string):boolean{
  2434. _arg1 = _arg1.touppercase();
  2435. var _local3:array = (this.viewCallbacks[_arg1] as array);
  2436. var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
  2437. if (_local4 >= 0){
  2438. _local3.splice(_local4, 1);
  2439. this._emu.removeViewListener(_arg1.touppercase(), this.forwardViewEvents);
  2440. return (true);
  2441. };
  2442. return (false);
  2443. }
  2444. private function getConfig():object{
  2445. return (JavascriptSerialization.stripDots(this._emu.config));
  2446. }
  2447. private function getJSPluginConfig(_arg1:string):object{
  2448. return (JavascriptSerialization.stripDots(_player.config.pluginConfig(_arg1)));
  2449. }
  2450. private function loadPlugin(_arg1:string):object{
  2451. return ({error:"This function is no longer supported."});
  2452. }
  2453. private function sendEvent(_arg1:string, _arg2:object=null):void{
  2454. this._emu.sendEvent(_arg1.touppercase(), _arg2);
  2455. }
  2456. private function forwardControllerEvents(_arg1:ControllerEvent):void{
  2457. var evt:* = _arg1;
  2458. setTimeout(function ():void{
  2459. var _local1:string;
  2460. if (controllerCallbacks.hasOwnProperty(evt.type)){
  2461. for each (_local1 in controllerCallbacks[evt.type]) {
  2462. if (ExternalInterface.available){
  2463. ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
  2464. };
  2465. };
  2466. };
  2467. }, 1);
  2468. }
  2469. private function forwardModelEvents(_arg1:ModelEvent):void{
  2470. var evt:* = _arg1;
  2471. setTimeout(function ():void{
  2472. var _local1:string;
  2473. if (modelCallbacks.hasOwnProperty(evt.type)){
  2474. for each (_local1 in modelCallbacks[evt.type]) {
  2475. if (ExternalInterface.available){
  2476. ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
  2477. };
  2478. };
  2479. };
  2480. }, 1);
  2481. }
  2482. private function forwardViewEvents(_arg1:ViewEvent):void{
  2483. var evt:* = _arg1;
  2484. setTimeout(function ():void{
  2485. var _local1:string;
  2486. if (viewCallbacks.hasOwnProperty(evt.type)){
  2487. for each (_local1 in viewCallbacks[evt.type]) {
  2488. if (ExternalInterface.available){
  2489. ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
  2490. };
  2491. };
  2492. };
  2493. }, 1);
  2494. }
  2495.  
  2496. }
  2497. }//package com.longtailvideo.jwplayer.player
  2498. package com.longtailvideo.jwplayer.player {
  2499. import com.longtailvideo.jwplayer.model.*;
  2500. import com.longtailvideo.jwplayer.view.interfaces.*;
  2501. import com.longtailvideo.jwplayer.plugins.*;
  2502. import com.longtailvideo.jwplayer.view.*;
  2503. import flash.events.*;
  2504. import com.longtailvideo.jwplayer.controller.*;
  2505. import com.longtailvideo.jwplayer.events.*;
  2506. import flash.display.*;
  2507. import com.longtailvideo.jwplayer.utils.*;
  2508.  
  2509. public class Player extends Sprite implements IPlayer, IGlobalEventDispatcher {
  2510.  
  2511. protected var model:Model;
  2512. protected var view:View;
  2513. protected var controller:Controller;
  2514. protected var _dispatcher:GlobalEventDispatcher;
  2515.  
  2516. public function Player(){
  2517. super();
  2518. try {
  2519. this.addEventListener(Event.ADDED_TO_STAGE, this.setupPlayer);
  2520. } catch(err:error) {
  2521. setupPlayer();
  2522. };
  2523. }
  2524. protected function setupPlayer(_arg1:Event=null):void{
  2525. try {
  2526. this.removeEventListener(Event.ADDED_TO_STAGE, this.setupPlayer);
  2527. } catch(err:error) {
  2528. };
  2529. new RootReference(this);
  2530. this._dispatcher = new GlobalEventDispatcher();
  2531. this.model = this.newModel();
  2532. this.view = this.newView(this.model);
  2533. this.controller = this.newController(this.model, this.view);
  2534. this.controller.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady, false, -1);
  2535. this.controller.setupPlayer();
  2536. }
  2537. protected function newModel():Model{
  2538. return (new Model());
  2539. }
  2540. protected function newView(_arg1:Model):View{
  2541. return (new View(this, _arg1));
  2542. }
  2543. protected function newController(_arg1:Model, _arg2:View):Controller{
  2544. return (new Controller(this, _arg1, _arg2));
  2545. }
  2546. protected function playerReady(_arg1:PlayerEvent):void{
  2547. this.controller.removeEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
  2548. var _local2:JavascriptAPI = new JavascriptCompatibilityAPI(this);
  2549. this.model.addGlobalListener(this.forward);
  2550. this.view.addGlobalListener(this.forward);
  2551. this.controller.addGlobalListener(this.forward);
  2552. this.forward(_arg1);
  2553. }
  2554. protected function forward(_arg1:PlayerEvent):void{
  2555. Logger.log(_arg1.tostring(), _arg1.type);
  2556. this.dispatchEvent(_arg1);
  2557. }
  2558. public function get config():PlayerConfig{
  2559. return (this.model.config);
  2560. }
  2561. public function get version():string{
  2562. return (PlayerVersion.version);
  2563. }
  2564. public function get skin():ISkin{
  2565. return (this.view.skin);
  2566. }
  2567. public function get state():string{
  2568. return (this.model.state);
  2569. }
  2570. public function get playlist():IPlaylist{
  2571. return (this.model.playlist);
  2572. }
  2573. public function get locked():boolean{
  2574. return (this.controller.locking);
  2575. }
  2576. public function lock(_arg1:IPlugin, _arg2:function):void{
  2577. this.controller.lockPlayback(_arg1, _arg2);
  2578. }
  2579. public function unlock(_arg1:IPlugin):boolean{
  2580. return (this.controller.unlockPlayback(_arg1));
  2581. }
  2582. public function volume(_arg1:number):boolean{
  2583. return (this.controller.setvolume(_arg1));
  2584. }
  2585. public function mute(_arg1:boolean):void{
  2586. this.controller.mute(_arg1);
  2587. }
  2588. public function play():boolean{
  2589. return (this.controller.play());
  2590. }
  2591. public function pause():boolean{
  2592. return (this.controller.pause());
  2593. }
  2594. public function stop():boolean{
  2595. return (this.controller.stop());
  2596. }
  2597. public function seek(_arg1:number):boolean{
  2598. return (this.controller.seek(_arg1));
  2599. }
  2600. public function load(_arg1):boolean{
  2601. return (this.controller.load(_arg1));
  2602. }
  2603. public function playlistItem(_arg1:number):boolean{
  2604. return (this.controller.setPlaylistIndex(_arg1));
  2605. }
  2606. public function playlistNext():boolean{
  2607. return (this.controller.next());
  2608. }
  2609. public function playlistPrev():boolean{
  2610. return (this.controller.previous());
  2611. }
  2612. public function redraw():boolean{
  2613. return (this.controller.redraw());
  2614. }
  2615. public function fullscreen(_arg1:boolean):void{
  2616. this.controller.fullscreen(_arg1);
  2617. }
  2618. public function get controls():IPlayerComponents{
  2619. return (this.view.components);
  2620. }
  2621. public function overrideComponent(_arg1:IPlayerComponent):void{
  2622. this.view.overrideComponent(_arg1);
  2623. }
  2624. public function getPlugin(_arg1:string):object{
  2625. return (this.view.getPlugin(_arg1));
  2626. }
  2627. override public function addChild(_arg1:DisplayObject):DisplayObject{
  2628. return (null);
  2629. }
  2630. override public function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject{
  2631. return (null);
  2632. }
  2633. override public function removeChild(_arg1:DisplayObject):DisplayObject{
  2634. return (null);
  2635. }
  2636. override public function removeChildAt(_arg1:int):DisplayObject{
  2637. return (null);
  2638. }
  2639. public function addGlobalListener(_arg1:function):void{
  2640. this._dispatcher.addGlobalListener(_arg1);
  2641. }
  2642. public function removeGlobalListener(_arg1:function):void{
  2643. this._dispatcher.removeGlobalListener(_arg1);
  2644. }
  2645. override public function dispatchEvent(_arg1:Event):boolean{
  2646. this._dispatcher.dispatchEvent(_arg1);
  2647. return (super.dispatchEvent(_arg1));
  2648. }
  2649.  
  2650. }
  2651. }//package com.longtailvideo.jwplayer.player
  2652. package com.longtailvideo.jwplayer.view {
  2653. import mx.core.*;
  2654. import flash.utils.*;
  2655.  
  2656. public class View_ErrorScreen extends MovieClipLoaderAsset {
  2657.  
  2658. private static var bytes:ByteArray = null;
  2659.  
  2660. public var dataClass:class;
  2661.  
  2662. public function View_ErrorScreen(){
  2663. this.dataClass = View_ErrorScreen_dataClass;
  2664. super();
  2665. initialWidth = (680 / 20);
  2666. initialHeight = (680 / 20);
  2667. }
  2668. override public function get movieClipData():ByteArray{
  2669. if (bytes == null){
  2670. bytes = ByteArray(new this.dataClass());
  2671. };
  2672. return (bytes);
  2673. }
  2674.  
  2675. }
  2676. }//package com.longtailvideo.jwplayer.view
  2677. package com.longtailvideo.jwplayer.view {
  2678. import com.longtailvideo.jwplayer.view.interfaces.*;
  2679.  
  2680. public interface IPlayerComponents {
  2681.  
  2682. function get controlbar():IControlbarComponent;
  2683. function get display():IDisplayComponent;
  2684. function get dock():IDockComponent;
  2685. function get playlist():IPlaylistComponent;
  2686. function resize(_arg1:number, _arg2:number):void;
  2687.  
  2688. }
  2689. }//package com.longtailvideo.jwplayer.view
  2690. package com.longtailvideo.jwplayer.view.skins {
  2691. import mx.core.*;
  2692.  
  2693. public class DefaultSkin_EmbeddedSkin_dataClass extends ByteArrayAsset {
  2694.  
  2695. }
  2696. }//package com.longtailvideo.jwplayer.view.skins
  2697. package com.longtailvideo.jwplayer.view.skins {
  2698. import com.longtailvideo.jwplayer.view.interfaces.*;
  2699. import flash.events.*;
  2700. import flash.display.*;
  2701.  
  2702. public class SkinBase extends EventDispatcher implements ISkin {
  2703.  
  2704. protected var _skin:Sprite;
  2705.  
  2706. public function SkinBase(){
  2707. this._skin = new Sprite();
  2708. }
  2709. public function load(_arg1:string=null):void{
  2710. dispatchEvent(new Event(Event.COMPLETE));
  2711. }
  2712. public function hasComponent(_arg1:string):boolean{
  2713. return ((this._skin.getChildByName(_arg1) is DisplayObjectContainer));
  2714. }
  2715. public function componentChildren(_arg1:string):object{
  2716. var _local5:DisplayObject;
  2717. var _local2:object = {};
  2718. var _local3:DisplayObjectContainer = DisplayObjectContainer(this._skin.getChildByName(_arg1));
  2719. if (!_local3){
  2720. return (_local2);
  2721. };
  2722. var _local4:number = 0;
  2723. while (_local4 < this._skin.numChildren) {
  2724. _local5 = this._skin.getChildAt(_local4);
  2725. _local2[_local5.name] = _local5;
  2726. _local4++;
  2727. };
  2728. return (_local2);
  2729. }
  2730. public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
  2731. var _local3:DisplayObject;
  2732. var _local4:DisplayObjectContainer = (this._skin.getChildByName(_arg1) as DisplayObjectContainer);
  2733. if (_local4){
  2734. _local3 = _local4.getChildByName(_arg2);
  2735. };
  2736. return (_local3);
  2737. }
  2738. public function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void{
  2739. if (_arg2){
  2740. _arg3.name = _arg2;
  2741. };
  2742. var _local4:DisplayObjectContainer = (this._skin.getChildByName(_arg1) as DisplayObjectContainer);
  2743. if (!_local4){
  2744. _local4 = new Sprite();
  2745. _local4.name = _arg1;
  2746. this._skin.addChild(_local4);
  2747. };
  2748. if (_local4.getChildByName(_arg3.name)){
  2749. _local4.removeChild(_local4.getChildByName(_arg3.name));
  2750. };
  2751. _local4.addChild(_arg3);
  2752. }
  2753. public function getSkinProperties():SkinProperties{
  2754. return (new SkinProperties());
  2755. }
  2756. protected function sendError(_arg1:string):void{
  2757. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1));
  2758. }
  2759. public function getSWFSkin():Sprite{
  2760. return (null);
  2761. }
  2762.  
  2763. }
  2764. }//package com.longtailvideo.jwplayer.view.skins
  2765. package com.longtailvideo.jwplayer.view.skins {
  2766.  
  2767. public dynamic class SkinProperties {
  2768.  
  2769. public var layout:object;
  2770. public var version:string = "";
  2771. public var name:string = "";
  2772. public var author:string = "";
  2773.  
  2774. public function SkinProperties(){
  2775. this.layout = {};
  2776. super();
  2777. this["backcolor"] = undefined;
  2778. this["frontcolor"] = undefined;
  2779. this["screencolor"] = undefined;
  2780. this["lightcolor"] = undefined;
  2781. }
  2782. }
  2783. }//package com.longtailvideo.jwplayer.view.skins
  2784. package com.longtailvideo.jwplayer.view.skins {
  2785. import com.longtailvideo.jwplayer.view.interfaces.*;
  2786. import flash.events.*;
  2787. import flash.display.*;
  2788. import flash.utils.*;
  2789. import com.longtailvideo.jwplayer.utils.*;
  2790.  
  2791. public class PNGSkin extends SkinBase implements ISkin {
  2792.  
  2793. public namespace skinNS = "http://developer.longtailvideo.com/trac/wiki/Skinning";
  2794.  
  2795. protected var _urlPrefix:string;
  2796. protected var _skinXML:xml;
  2797. protected var _props:SkinProperties;
  2798. protected var _loaders:Dictionary;
  2799. protected var _components:object;
  2800. protected var _errorState:boolean = false;
  2801.  
  2802. public function PNGSkin(){
  2803. this._props = new SkinProperties();
  2804. this._loaders = new Dictionary();
  2805. this._components = {};
  2806. super();
  2807. }
  2808. override public function load(_arg1:string=null):void{
  2809. var _local2:AssetLoader;
  2810. if (Strings.extension(_arg1) == "xml"){
  2811. this._urlPrefix = _arg1.substring(0, (_arg1.lastindexof("/") + 1));
  2812. _local2 = new AssetLoader();
  2813. _local2.addEventListener(Event.COMPLETE, this.loadComplete);
  2814. _local2.addEventListener(ErrorEvent.error, this.loadError);
  2815. _local2.load(_arg1);
  2816. } else {
  2817. if (_skin.numChildren == 0){
  2818. sendError("PNG skin descriptor file must have a .xml extension");
  2819. };
  2820. };
  2821. }
  2822. protected function loadError(_arg1:ErrorEvent):void{
  2823. sendError(_arg1.text);
  2824. }
  2825. protected function loadComplete(_arg1:Event):void{
  2826. var evt:* = _arg1;
  2827. var loader:* = AssetLoader(evt.target);
  2828. try {
  2829. this._skinXML = xml(loader.loadedObject);
  2830. this.parseSkin();
  2831. } catch(e:error) {
  2832. sendError(e.message);
  2833. };
  2834. }
  2835. protected function parseSkin():void{
  2836. var attrib:* = null;
  2837. var comp:* = null;
  2838. var cbLayout:* = null;
  2839. if (this._skinXML.localName() != "skin"){
  2840. sendError("PNG skin descriptor file not correctly formatted");
  2841. return;
  2842. };
  2843. for each (attrib in this._skinXML.attributes()) {
  2844. this._props[attrib.localName()] = attrib.tostring();
  2845. };
  2846. this.parseConfig(this._skinXML.settings);
  2847. for each (comp in this._skinXML.components.component) {
  2848. this.parseConfig(comp.settings, [email protected]());
  2849. this.loadElements([email protected](), comp..element);
  2850. };
  2851. cbLayout = ((this._skinXML.components.component.(@name == "controlbar").layout as XMLList)[0] as xml);
  2852. if (cbLayout){
  2853. this.parseControlbarLayout(cbLayout);
  2854. };
  2855. }
  2856. protected function parseControlbarLayout(_arg1:xml):void{
  2857. var _local2:xml;
  2858. var _local3:array;
  2859. var _local4:xml;
  2860. this._props.layout["controlbar"] = {};
  2861. for each (_local2 in _arg1.group) {
  2862. _local3 = new array();
  2863. for each (_local4 in _local2.*) {
  2864. _local3.push({
  2865. type:_local4.localName(),
  2866. element:[email protected](),
  2867. width:(((_local4.localName() == "divider")) ? number([email protected]()) : null)
  2868. });
  2869. };
  2870. this._props.layout["controlbar"][[email protected]().tolowercase()] = _local3;
  2871. };
  2872. }
  2873. protected function parseConfig(_arg1:XMLList, _arg2:string=""):void{
  2874. var _local3:xml;
  2875. for each (_local3 in _arg1.setting) {
  2876. if (_arg2){
  2877. this._props[((_arg2 + ".") + [email protected]())] = [email protected]();
  2878. } else {
  2879. if (this._props.hasOwnProperty([email protected]())){
  2880. };
  2881. };
  2882. };
  2883. }
  2884. protected function loadElements(_arg1:string, _arg2:XMLList):void{
  2885. var _local3:xml;
  2886. var _local4:AssetLoader;
  2887. if (!_arg1){
  2888. return;
  2889. };
  2890. for each (_local3 in _arg2) {
  2891. _local4 = new AssetLoader();
  2892. this._loaders[_local4] = {
  2893. componentName:_arg1,
  2894. elementName:[email protected]()
  2895. };
  2896. _local4.addEventListener(Event.COMPLETE, this.elementHandler);
  2897. _local4.addEventListener(ErrorEvent.error, this.elementError);
  2898. _local4.load((((this._urlPrefix + _arg1) + "/") + [email protected]()));
  2899. };
  2900. }
  2901. protected function elementHandler(_arg1:Event):void{
  2902. var elementInfo:* = null;
  2903. var loader:* = null;
  2904. var bitmap:* = null;
  2905. var clip:* = null;
  2906. var evt:* = _arg1;
  2907. try {
  2908. elementInfo = this._loaders[evt.target];
  2909. loader = (evt.target as AssetLoader);
  2910. bitmap = (loader.loadedObject as Bitmap);
  2911. if ((loader.loadedObject is Bitmap)){
  2912. this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], (loader.loadedObject as Bitmap));
  2913. } else {
  2914. if ((loader.loadedObject is movieclip)){
  2915. clip = (loader.loadedObject as movieclip);
  2916. if ((((((((clip.totalFrames == 1)) && ((clip.numChildren == 1)))) && ((clip.getChildAt(0) is movieclip)))) && (((clip.getChildAt(0) as movieclip).totalFrames > 1)))){
  2917. this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], (clip.getChildAt(0) as movieclip));
  2918. } else {
  2919. this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], clip);
  2920. };
  2921. };
  2922. };
  2923. delete this._loaders[evt.target];
  2924. } catch(e:error) {
  2925. if (_loaders[evt.target]){
  2926. delete _loaders[evt.target];
  2927. };
  2928. };
  2929. this.checkComplete();
  2930. }
  2931. protected function elementError(_arg1:ErrorEvent):void{
  2932. if (this._loaders[_arg1.target]){
  2933. delete this._loaders[_arg1.target];
  2934. Logger.log(("Skin element not loaded: " + _arg1.text));
  2935. this.checkComplete();
  2936. } else {
  2937. if (!this._errorState){
  2938. this._errorState = true;
  2939. sendError(_arg1.text);
  2940. };
  2941. };
  2942. }
  2943. protected function checkComplete():void{
  2944. var _local2:object;
  2945. if (this._errorState){
  2946. return;
  2947. };
  2948. var _local1:number = 0;
  2949. for each (_local2 in this._loaders) {
  2950. _local1++;
  2951. };
  2952. if (_local1 > 0){
  2953. return;
  2954. };
  2955. dispatchEvent(new Event(Event.COMPLETE));
  2956. }
  2957. override public function getSkinProperties():SkinProperties{
  2958. return (this._props);
  2959. }
  2960. override public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
  2961. var _local3:Sprite;
  2962. var _local4:Bitmap;
  2963. var _local5:Sprite;
  2964. if (((this._components[_arg1]) && (this._components[_arg1][_arg2]))){
  2965. _local3 = (this._components[_arg1][_arg2] as Sprite);
  2966. if ((_local3.getChildAt(0) is Bitmap)){
  2967. _local4 = new Bitmap((_local3.getChildAt(0) as Bitmap).bitmapData);
  2968. _local5 = new Sprite();
  2969. _local5.addChild(_local4);
  2970. _local4.name = "bitmap";
  2971. return (_local5);
  2972. };
  2973. return (_local3);
  2974. };
  2975. return (null);
  2976. }
  2977. override public function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void{
  2978. var _local4:Sprite;
  2979. if (!this._components[_arg1]){
  2980. this._components[_arg1] = {};
  2981. };
  2982. if ((_arg3 is movieclip)){
  2983. this._components[_arg1][_arg2] = _arg3;
  2984. } else {
  2985. _local4 = new Sprite();
  2986. _local4.addChild(_arg3);
  2987. this._components[_arg1][_arg2] = _local4;
  2988. };
  2989. }
  2990. override public function hasComponent(_arg1:string):boolean{
  2991. return (this._components.hasOwnProperty(_arg1));
  2992. }
  2993.  
  2994. }
  2995. }//package com.longtailvideo.jwplayer.view.skins
  2996. package com.longtailvideo.jwplayer.view.skins {
  2997. import flash.events.*;
  2998. import flash.display.*;
  2999. import mx.core.*;
  3000.  
  3001. public class DefaultSkin extends SWFSkin {
  3002.  
  3003. private var EmbeddedSkin:class;
  3004.  
  3005. public function DefaultSkin(){
  3006. this.EmbeddedSkin = DefaultSkin_EmbeddedSkin;
  3007. super();
  3008. }
  3009. override public function load(_arg1:string=""):void{
  3010. var embeddedLoader:* = null;
  3011. var notUsed:string = _arg1;
  3012. var skinObj:* = (new this.EmbeddedSkin() as MovieClipLoaderAsset);
  3013. try {
  3014. embeddedLoader = Loader(skinObj.getChildAt(0));
  3015. embeddedLoader.contentLoaderInfo.addEventListener(Event.INIT, this.loadComplete);
  3016. embeddedLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
  3017. } catch(e:error) {
  3018. sendError(e.message);
  3019. };
  3020. }
  3021. override protected function loadComplete(_arg1:Event):void{
  3022. var loader:* = null;
  3023. var skinClip:* = null;
  3024. var evt:* = _arg1;
  3025. try {
  3026. loader = LoaderInfo(evt.target);
  3027. skinClip = movieclip(loader.content);
  3028. overwriteSkin(skinClip.getChildByName("player"));
  3029. loader.removeEventListener(Event.INIT, this.loadComplete);
  3030. loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loadError);
  3031. dispatchEvent(new Event(Event.COMPLETE));
  3032. } catch(e:error) {
  3033. sendError(("DefaultSkin: " + e.message));
  3034. };
  3035. }
  3036. override protected function loadError(_arg1:ErrorEvent):void{
  3037. sendError(("DefaultSkin: " + _arg1.text));
  3038. }
  3039.  
  3040. }
  3041. }//package com.longtailvideo.jwplayer.view.skins
  3042. package com.longtailvideo.jwplayer.view.skins {
  3043. import com.longtailvideo.jwplayer.view.interfaces.*;
  3044. import flash.events.*;
  3045. import flash.display.*;
  3046. import flash.text.*;
  3047. import com.longtailvideo.jwplayer.utils.*;
  3048.  
  3049. public class SWFSkin extends SkinBase implements ISkin {
  3050.  
  3051. private var props:SkinProperties;
  3052.  
  3053. public function SWFSkin(_arg1:DisplayObject=null){
  3054. this.props = new SkinProperties();
  3055. if (_arg1){
  3056. this.overwriteSkin(_arg1);
  3057. };
  3058. }
  3059. protected function overwriteSkin(_arg1:DisplayObject):void{
  3060. var newSkin:* = _arg1;
  3061. if ((newSkin is Sprite)){
  3062. _skin = (newSkin as Sprite);
  3063. } else {
  3064. if (newSkin != null){
  3065. _skin = new Sprite();
  3066. _skin.addChild(newSkin);
  3067. };
  3068. };
  3069. if (_skin.getChildByName("controlbar")){
  3070. this.props["controlbar.size"] = _skin.getChildByName("controlbar").height;
  3071. try {
  3072. this.props["controlbar.margin"] = (((_skin.getChildByName("display") as DisplayObjectContainer).getChildByName("back").width - _skin.getChildByName("controlbar").width) / 2);
  3073. } catch(e:error) {
  3074. props["controlbar.margin"] = 0;
  3075. };
  3076. };
  3077. }
  3078. override public function load(_arg1:string=null):void{
  3079. var _local2:AssetLoader;
  3080. if (_arg1){
  3081. _local2 = new AssetLoader();
  3082. _local2.addEventListener(Event.COMPLETE, this.loadComplete);
  3083. _local2.addEventListener(ErrorEvent.error, this.loadError);
  3084. _local2.load(_arg1, DisplayObject);
  3085. } else {
  3086. if (_skin.numChildren == 0){
  3087. sendError("Skin must load from URL if skin is empty.");
  3088. };
  3089. };
  3090. }
  3091. protected function loadComplete(_arg1:Event):void{
  3092. var _local2:AssetLoader = AssetLoader(_arg1.target);
  3093. this.overwriteSkin(DisplayObjectContainer(_local2.loadedObject).getChildByName("player"));
  3094. dispatchEvent(new Event(Event.COMPLETE));
  3095. }
  3096. protected function loadError(_arg1:ErrorEvent):void{
  3097. sendError(_arg1.text);
  3098. }
  3099. override public function getSkinProperties():SkinProperties{
  3100. return (this.props);
  3101. }
  3102. override public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
  3103. var _local4:class;
  3104. var _local5:*;
  3105. var _local6:DisplayObjectContainer;
  3106. if (_arg1 == "dock"){
  3107. try {
  3108. _local4 = (_skin.loaderInfo.applicationDomain.getDefinition("dockbutton") as class);
  3109. _local5 = new (_local4)();
  3110. _local5.transform = _skin.transform;
  3111. _local5.filters = _skin.filters;
  3112. _local5.cacheAsBitmap = _skin.cacheAsBitmap;
  3113. _local5.opaqueBackground = _skin.opaqueBackground;
  3114. return (((_local5 as Sprite).getChildByName("back") as Sprite));
  3115. } catch(e:error) {
  3116. };
  3117. } else {
  3118. if (_arg1 == "playlist"){
  3119. if ((((_arg2 == "masker")) || ((_arg2 == "background")))){
  3120. if (_arg2 == "background"){
  3121. _arg2 = "back";
  3122. };
  3123. _local6 = (_skin.getChildByName(_arg1) as DisplayObjectContainer);
  3124. if (_local6){
  3125. return (_local6.getChildByName(_arg2));
  3126. };
  3127. };
  3128. };
  3129. };
  3130. var _local3:DisplayObject = super.getSkinElement(_arg1, _arg2);
  3131. if (((_local3) && (!((_local3 is textfield))))){
  3132. _local3 = Draw.clone((_local3 as Sprite));
  3133. };
  3134. return (_local3);
  3135. }
  3136. public function getTranslatedSkinElement(_arg1:string, _arg2:string):DisplayObject{
  3137. var _local4:number;
  3138. var _local5:number;
  3139. var _local6:string;
  3140. var _local7:string;
  3141. var _local8:movieclip;
  3142. var _local9:string;
  3143. var _local10:string;
  3144. var _local3:DisplayObject = super.getSkinElement(_arg1, _arg2);
  3145. switch (_arg1){
  3146. case "controlbar":
  3147. _local4 = _arg2.indexof("Button");
  3148. _local5 = _arg2.indexof("Slider");
  3149. if (_local4 > 0){
  3150. _local6 = _arg2.substr(_local4, _arg2.length);
  3151. _local7 = _arg2.substr(0, (_local4 + 6));
  3152. switch (_local6){
  3153. case "Button":
  3154. _local3 = this.getSubElement("icon", _local3);
  3155. break;
  3156. case "ButtonBack":
  3157. _local8 = (super.getSkinElement(_arg1, _local7) as movieclip);
  3158. if (_local8){
  3159. (_local8.getChildByName("icon") as DisplayObject).alpha = 0;
  3160. _local3 = _local8;
  3161. };
  3162. break;
  3163. };
  3164. } else {
  3165. if (_local5 > 0){
  3166. _local9 = _arg2.substr(_local5, _arg2.length);
  3167. _local10 = _arg2.substr(0, (_local5 + 6));
  3168. _local3 = super.getSkinElement(_arg1, _local10);
  3169. switch (_local9){
  3170. case "SliderRail":
  3171. _local3 = this.getSubElement("rail", _local3);
  3172. break;
  3173. case "SliderBuffer":
  3174. if (_arg2 == "volumeSliderBuffer"){
  3175. _local3 = null;
  3176. } else {
  3177. _local3 = this.getSubElement("mark", _local3);
  3178. };
  3179. break;
  3180. case "SliderProgress":
  3181. if (_arg2 == "volumeSliderProgress"){
  3182. _local3 = null;
  3183. } else {
  3184. _local3 = this.getSubElement("done", _local3);
  3185. };
  3186. break;
  3187. case "SliderThumb":
  3188. _local3 = this.getSubElement("icon", _local3);
  3189. break;
  3190. };
  3191. } else {
  3192. if ((((_arg2 == "back")) || ((_arg2 == "shade")))){
  3193. super.getSkinElement(_arg1, _arg2);
  3194. };
  3195. };
  3196. };
  3197. break;
  3198. case "display":
  3199. switch (_arg2){
  3200. case "errorIcon":
  3201. if (_local3["icn"]){
  3202. _local3 = _local3["icn"];
  3203. };
  3204. break;
  3205. };
  3206. };
  3207. return (_local3);
  3208. }
  3209. private function getSubElement(_arg1:string, _arg2:DisplayObject):DisplayObject{
  3210. var _local3:DisplayObject;
  3211. if (_arg2){
  3212. _local3 = _arg2[_arg1];
  3213. };
  3214. return (_local3);
  3215. }
  3216. override public function getSWFSkin():Sprite{
  3217. return (_skin);
  3218. }
  3219.  
  3220. }
  3221. }//package com.longtailvideo.jwplayer.view.skins
  3222. package com.longtailvideo.jwplayer.view.skins {
  3223. import mx.core.*;
  3224. import flash.utils.*;
  3225.  
  3226. public class DefaultSkin_EmbeddedSkin extends MovieClipLoaderAsset {
  3227.  
  3228. private static var bytes:ByteArray = null;
  3229.  
  3230. public var dataClass:class;
  3231.  
  3232. public function DefaultSkin_EmbeddedSkin(){
  3233. this.dataClass = DefaultSkin_EmbeddedSkin_dataClass;
  3234. super();
  3235. initialWidth = (8800 / 20);
  3236. initialHeight = (6000 / 20);
  3237. }
  3238. override public function get movieClipData():ByteArray{
  3239. if (bytes == null){
  3240. bytes = ByteArray(new this.dataClass());
  3241. };
  3242. return (bytes);
  3243. }
  3244.  
  3245. }
  3246. }//package com.longtailvideo.jwplayer.view.skins
  3247. package com.longtailvideo.jwplayer.view.skins {
  3248. import flash.events.*;
  3249. import flash.utils.*;
  3250. import flash.net.*;
  3251. import com.nochump.util.zip.*;
  3252. import com.longtailvideo.jwplayer.utils.*;
  3253.  
  3254. public class ZIPSkin extends PNGSkin {
  3255.  
  3256. private var _zipFile:ZipFile;
  3257.  
  3258. override public function load(_arg1:string=null):void{
  3259. var _local2:URLLoader;
  3260. if (Strings.extension(_arg1) == "zip"){
  3261. _urlPrefix = _arg1.substring((_arg1.lastindexof("/") + 1), _arg1.lastindexof("."));
  3262. _local2 = new URLLoader();
  3263. _local2.dataFormat = URLLoaderDataFormat.BINARY;
  3264. _local2.addEventListener(Event.COMPLETE, this.loadComplete);
  3265. _local2.addEventListener(IOErrorEvent.IO_ERROR, loadError);
  3266. _local2.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadError);
  3267. _local2.load(new URLRequest(_arg1));
  3268. } else {
  3269. if (_skin.numChildren == 0){
  3270. sendError("ZIP skin descriptor file must have a .zip extension");
  3271. };
  3272. };
  3273. }
  3274. override protected function loadComplete(_arg1:Event):void{
  3275. var data:* = null;
  3276. var zipEntry:* = null;
  3277. var evt:* = _arg1;
  3278. try {
  3279. data = ((evt.target as URLLoader).data as ByteArray);
  3280. this._zipFile = new ZipFile(data);
  3281. zipEntry = this.getXMLEntry(this._zipFile, _urlPrefix);
  3282. if (!zipEntry){
  3283. sendError("No XML file found in skin ZIP");
  3284. return;
  3285. };
  3286. _urlPrefix = zipEntry.name.substring(0, zipEntry.name.lastindexof("/"));
  3287. _skinXML = xml(string(this._zipFile.getInput(zipEntry)));
  3288. parseSkin();
  3289. } catch(e:error) {
  3290. sendError(e.message);
  3291. };
  3292. }
  3293. protected function getXMLEntry(_arg1:ZipFile, _arg2:string=""):ZipEntry{
  3294. var _local3:ZipEntry = _arg1.getEntry((_arg2 + ".xml"));
  3295. if (_local3){
  3296. return (_local3);
  3297. };
  3298. _local3 = _arg1.getEntry((((_arg2 + "/") + _arg2) + ".xml"));
  3299. if (_local3){
  3300. return (_local3);
  3301. };
  3302. for each (_local3 in _arg1.entries) {
  3303. if (Strings.extension(_local3.name) == "xml"){
  3304. if (xml(string(_arg1.getInput(_local3))).localName() == "skin"){
  3305. return (_local3);
  3306. };
  3307. };
  3308. };
  3309. return (null);
  3310. }
  3311. override protected function loadElements(_arg1:string, _arg2:XMLList):void{
  3312. var element:* = null;
  3313. var file:* = null;
  3314. var zipEntry:* = null;
  3315. var newLoader:* = null;
  3316. var component:* = _arg1;
  3317. var elements:* = _arg2;
  3318. if (!component){
  3319. return;
  3320. };
  3321. for each (element in elements) {
  3322. file = ((component + "/") + [email protected]());
  3323. if (_urlPrefix){
  3324. file = ((_urlPrefix + "/") + file);
  3325. };
  3326. zipEntry = this._zipFile.getEntry(file);
  3327. if (zipEntry){
  3328. try {
  3329. newLoader = new AssetLoader();
  3330. _loaders[newLoader] = {
  3331. componentName:component,
  3332. elementName:[email protected]()
  3333. };
  3334. newLoader.addEventListener(Event.COMPLETE, elementHandler);
  3335. newLoader.addEventListener(ErrorEvent.error, elementError);
  3336. newLoader.loadBytes(this._zipFile.getInput(zipEntry));
  3337. } catch(err:error) {
  3338. sendError(((((("Error loading ZIP skin " + component) + "'s ") + element.tostring()) + ": ") + err.message));
  3339. };
  3340. };
  3341. };
  3342. }
  3343.  
  3344. }
  3345. }//package com.longtailvideo.jwplayer.view.skins
  3346. package com.longtailvideo.jwplayer.view {
  3347. import mx.core.*;
  3348. import flash.utils.*;
  3349.  
  3350. public class View_LoadingScreen extends MovieClipLoaderAsset {
  3351.  
  3352. private static var bytes:ByteArray = null;
  3353.  
  3354. public var dataClass:class;
  3355.  
  3356. public function View_LoadingScreen(){
  3357. this.dataClass = View_LoadingScreen_dataClass;
  3358. super();
  3359. initialWidth = (2000 / 20);
  3360. initialHeight = (300 / 20);
  3361. }
  3362. override public function get movieClipData():ByteArray{
  3363. if (bytes == null){
  3364. bytes = ByteArray(new this.dataClass());
  3365. };
  3366. return (bytes);
  3367. }
  3368.  
  3369. }
  3370. }//package com.longtailvideo.jwplayer.view
  3371. package com.longtailvideo.jwplayer.view {
  3372. import flash.events.*;
  3373. import com.longtailvideo.jwplayer.events.*;
  3374. import flash.display.*;
  3375. import com.longtailvideo.jwplayer.player.*;
  3376. import flash.utils.*;
  3377. import flash.net.*;
  3378. import com.longtailvideo.jwplayer.utils.*;
  3379.  
  3380. public class Logo extends movieclip {
  3381.  
  3382. protected var defaults:object;
  3383. protected var _player:IPlayer;
  3384. protected var timeout:uint;
  3385. protected var loader:Loader;
  3386. protected var animations:Animations;
  3387. protected var _alreadyShown:boolean = false;
  3388. protected var _width:number;
  3389. protected var _height:number;
  3390.  
  3391. public function Logo(_arg1:IPlayer){
  3392. this.defaults = {
  3393. prefix:"http://l.longtailvideo.com/",
  3394. file:"logo.png",
  3395. link:"http://www.longtailvideo.com/players/jw-flv-player/",
  3396. linktarget:"_blank",
  3397. margin:8,
  3398. out:0.5,
  3399. over:1,
  3400. timeout:5,
  3401. hide:"true",
  3402. position:"bottom-left"
  3403. };
  3404. super();
  3405. this.animations = new Animations(this);
  3406. this._player = _arg1;
  3407. _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  3408. this.setupDefaults();
  3409. this.setupMouseEvents();
  3410. this.loadFile();
  3411. }
  3412. protected function setupDefaults():void{
  3413. }
  3414. protected function setupMouseEvents():void{
  3415. this.mouseChildren = false;
  3416. this.buttonMode = true;
  3417. if (this.getConfigParam("link")){
  3418. addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  3419. addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  3420. addEventListener(MouseEvent.CLICK, this.clickHandler);
  3421. } else {
  3422. this.mouseEnabled = false;
  3423. };
  3424. }
  3425. protected function loadFile():void{
  3426. var _local1:RegExp = /(\d+)\.(\d+)\./;
  3427. var _local2:array = _local1.exec(this._player.version);
  3428. var _local3:string = this.getConfigParam("prefix");
  3429. if (((this.getConfigParam("file")) && (_local3))){
  3430. try {
  3431. if (RootReference.root.loaderInfo.url.indexof("https://") == 0){
  3432. _local3 = _local3.replace("http://", "https://secure");
  3433. };
  3434. } catch(e:error) {
  3435. };
  3436. this.defaults["file"] = (((((_local3 + _local2[1]) + "/") + _local2[2]) + "/") + this.getConfigParam("file"));
  3437. };
  3438. if (((this.getConfigParam("file")) && ((RootReference.root.loaderInfo.url.indexof("http") == 0)))){
  3439. this.loader = new Loader();
  3440. this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
  3441. this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  3442. this.loader.load(new URLRequest(this.getConfigParam("file")));
  3443. };
  3444. }
  3445. protected function loaderHandler(_arg1:Event):void{
  3446. if ((((this.getConfigParam("hide").tostring() == "true")) && (!((((this._player.state == PlayerState.BUFFERING)) || ((this._player.state == PlayerState.PLAYING))))))){
  3447. visible = false;
  3448. };
  3449. if ((this.loader is DisplayObject)){
  3450. addChild(this.loader);
  3451. this.resize(this._width, this._height);
  3452. this.outHandler();
  3453. } else {
  3454. Logger.log("Logo was not a display object");
  3455. };
  3456. }
  3457. protected function errorHandler(_arg1:ErrorEvent):void{
  3458. Logger.log(("Failed to load logo: " + _arg1.text));
  3459. }
  3460. protected function clickHandler(_arg1:MouseEvent):void{
  3461. this._player.pause();
  3462. this._player.fullscreen(false);
  3463. var _local2:string = this.getConfigParam("link");
  3464. if (_local2){
  3465. navigateToURL(new URLRequest(Strings.cleanLink(_local2)), this.getConfigParam("linktarget"));
  3466. };
  3467. }
  3468. protected function outHandler(_arg1:MouseEvent=null):void{
  3469. alpha = this.getConfigParam("out");
  3470. }
  3471. protected function overHandler(_arg1:MouseEvent):void{
  3472. if (this.getConfigParam("link")){
  3473. alpha = this.getConfigParam("over");
  3474. };
  3475. }
  3476. protected function stateHandler(_arg1:PlayerStateEvent):void{
  3477. switch (this._player.state){
  3478. case PlayerState.BUFFERING:
  3479. if (!this._alreadyShown){
  3480. clearTimeout(this.timeout);
  3481. this._alreadyShown = true;
  3482. this.show();
  3483. };
  3484. break;
  3485. case PlayerState.IDLE:
  3486. this._alreadyShown = false;
  3487. break;
  3488. };
  3489. }
  3490. protected function show():void{
  3491. if (this.getConfigParam("hide").tostring() == "true"){
  3492. visible = true;
  3493. alpha = 0;
  3494. this.animations.fade(this.getConfigParam("out"), 0.1);
  3495. this.timeout = setTimeout(this.hide, (this.getConfigParam("timeout") * 1000));
  3496. mouseEnabled = true;
  3497. };
  3498. }
  3499. protected function hide():void{
  3500. if (this.getConfigParam("hide").tostring() == "true"){
  3501. mouseEnabled = false;
  3502. this.animations.fade(0, 0.1);
  3503. };
  3504. }
  3505. public function resize(_arg1:number, _arg2:number):void{
  3506. this._width = _arg1;
  3507. this._height = _arg2;
  3508. var _local3:DisplayObject = ((this.loader) ? this.loader : null);
  3509. var _local4:number = this.getConfigParam("margin");
  3510. var _local5:string = (this.getConfigParam("position") as string).tolowercase();
  3511. if (_local3){
  3512. if (_local5.indexof("right") >= 0){
  3513. _local3.x = ((this._width - _local3.width) - _local4);
  3514. } else {
  3515. _local3.x = _local4;
  3516. };
  3517. if (_local5.indexof("bottom") >= 0){
  3518. _local3.y = ((this._height - _local3.height) - _local4);
  3519. } else {
  3520. _local3.y = _local4;
  3521. };
  3522. };
  3523. }
  3524. protected function getConfigParam(_arg1:string){
  3525. return (this.defaults[_arg1]);
  3526. }
  3527.  
  3528. }
  3529. }//package com.longtailvideo.jwplayer.view
  3530. package com.longtailvideo.jwplayer.view.components {
  3531. import com.longtailvideo.jwplayer.view.interfaces.*;
  3532. import flash.events.*;
  3533. import com.longtailvideo.jwplayer.events.*;
  3534. import flash.display.*;
  3535. import com.longtailvideo.jwplayer.view.skins.*;
  3536. import com.longtailvideo.jwplayer.player.*;
  3537. import flash.geom.*;
  3538. import flash.accessibility.*;
  3539. import flash.utils.*;
  3540. import com.longtailvideo.jwplayer.utils.*;
  3541.  
  3542. public class DockComponent extends CoreComponent implements IDockComponent {
  3543.  
  3544. public var defaults:object;
  3545. private var buttons:array;
  3546. private var timeout:number;
  3547. private var animations:Animations;
  3548. private var currentTab:number = 400;
  3549. private var dimensions:Rectangle;
  3550.  
  3551. public function DockComponent(_arg1:IPlayer){
  3552. this.defaults = {align:"right"};
  3553. super(_arg1, "dock");
  3554. this.animations = new Animations(this);
  3555. this.buttons = new array();
  3556. if (_arg1.config.dock){
  3557. _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  3558. RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
  3559. RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
  3560. RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
  3561. if (this.hideOnIdle){
  3562. alpha = 0;
  3563. };
  3564. } else {
  3565. visible = false;
  3566. };
  3567. }
  3568. public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function, _arg4:string=null):movieclip{
  3569. var _local5:DockButton = new DockButton();
  3570. if (_arg4){
  3571. _local5.name = _arg4;
  3572. };
  3573. if ((_player.skin is SWFSkin)){
  3574. _local5.colorize = true;
  3575. };
  3576. var _local6:AccessibilityProperties = new AccessibilityProperties();
  3577. _local6.name = ((_arg4) ? _arg4 : _arg1.name);
  3578. _local5.accessibilityProperties = _local6;
  3579. _local5.tabenabled = true;
  3580. _local5.tabchildren = false;
  3581. _local5.tabindex = this.currentTab++;
  3582. _local5.setOutIcon(_arg1);
  3583. _local5.outBackground = (getSkinElement("button") as Sprite);
  3584. _local5.overBackground = (getSkinElement("buttonOver") as Sprite);
  3585. _local5.assetColor = ((fontColor) ? fontColor : player.config.backcolor);
  3586. _local5.outColor = player.config.frontcolor;
  3587. _local5.overColor = player.config.lightcolor;
  3588. _local5.clickFunction = _arg3;
  3589. _local5.init();
  3590. _local5.text = _arg2;
  3591. addChild(_local5);
  3592. this.buttons.push(_local5);
  3593. this.resize(getConfigParam("width"), getConfigParam("height"));
  3594. return (_local5);
  3595. }
  3596. public function removeButton(_arg1:string):void{
  3597. var _local2:number = 0;
  3598. while (_local2 < this.buttons.length) {
  3599. if (this.buttons[_local2].name == _arg1){
  3600. this.buttons.splice(_local2, 1);
  3601. removeChild(getChildAt(_local2));
  3602. break;
  3603. };
  3604. _local2++;
  3605. };
  3606. }
  3607. override public function resize(_arg1:number, _arg2:number):void{
  3608. var _local3:Rectangle;
  3609. var _local4:Rectangle;
  3610. var _local5:number;
  3611. var _local6:number;
  3612. var _local7:number;
  3613. var _local8:number;
  3614. var _local9:number;
  3615. var _local10:number;
  3616. var _local11:DisplayObject;
  3617. if (this.buttons.length > 0){
  3618. _local5 = 10;
  3619. _local6 = ((_arg1 - this.buttons[0].width) - _local5);
  3620. _local7 = _local5;
  3621. _local8 = -1;
  3622. if (getConfigParam("position") == "left"){
  3623. _local8 = 1;
  3624. _local6 = _local5;
  3625. };
  3626. _local9 = 0;
  3627. while (_local9 < this.buttons.length) {
  3628. _local10 = math.floor((_local7 / _arg2));
  3629. _local11 = (this.buttons[_local9] as DisplayObject);
  3630. if (((_local7 + _local11.height) + _local5) > ((_local10 + 1) * _arg2)){
  3631. _local7 = (((_local10 + 1) * _arg2) + _local5);
  3632. _local10 = math.floor((_local7 / _arg2));
  3633. };
  3634. _local11.y = (_local7 % _arg2);
  3635. _local11.x = (_local6 + (((_local11.width + _local5) * _local10) * _local8));
  3636. if (((!(_local3)) || ((((_local11.x <= _local3.x)) && ((_local11.y <= _local3.y)))))){
  3637. _local3 = new Rectangle(_local11.x, _local11.y, _local11.width, _local11.height);
  3638. };
  3639. if (((!(_local4)) || ((((_local11.x >= _local4.x)) && ((_local11.y >= _local4.y)))))){
  3640. _local4 = new Rectangle(_local11.x, _local11.y, _local11.width, _local11.height);
  3641. };
  3642. _local7 = (_local7 + (_local11.height + _local5));
  3643. if ((_local11 is DockButton)){
  3644. (_local11 as DockButton).centerText();
  3645. };
  3646. _local9++;
  3647. };
  3648. };
  3649. if (((_local3) && (_local4))){
  3650. this.dimensions = new Rectangle(_local3.x, _local3.y, ((_local4.x - _local3.x) + _local4.width), ((_local4.y - _local3.y) + _local4.height));
  3651. } else {
  3652. this.dimensions = new Rectangle();
  3653. };
  3654. if (_fullscreen != _player.config.fullscreen){
  3655. _fullscreen = _player.config.fullscreen;
  3656. _sentShow = false;
  3657. };
  3658. this.stateHandler();
  3659. }
  3660. private function get hideOnIdle():boolean{
  3661. return ((string(_player.config.pluginConfig("controlbar")["idlehide"]) == "true"));
  3662. }
  3663. private function startFader():void{
  3664. if (!isnan(this.timeout)){
  3665. clearTimeout(this.timeout);
  3666. };
  3667. this.timeout = setTimeout(this.moveTimeout, 2000);
  3668. }
  3669. private function mouseLeftStage(_arg1:Event=null):void{
  3670. this.moveTimeout();
  3671. }
  3672. private function moveHandler(_arg1:Event=null):void{
  3673. clearTimeout(this.timeout);
  3674. if (hidden){
  3675. return;
  3676. };
  3677. if ((((((player.state == PlayerState.BUFFERING)) || ((player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  3678. this.startFader();
  3679. if (alpha < 1){
  3680. sendShow();
  3681. this.animations.fade(1);
  3682. };
  3683. };
  3684. }
  3685. private function moveTimeout():void{
  3686. if (hidden){
  3687. return;
  3688. };
  3689. if ((((((player.state == PlayerState.BUFFERING)) || ((player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  3690. sendHide();
  3691. this.animations.fade(0);
  3692. };
  3693. }
  3694. public function setButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void{
  3695. var _local7:DisplayObject;
  3696. var _local8:DockJSButton;
  3697. var _local5:number = -1;
  3698. var _local6:number = 0;
  3699. while (_local6 < this.buttons.length) {
  3700. if (this.buttons[_local6].name == _arg1){
  3701. _local5 = _local6;
  3702. break;
  3703. };
  3704. _local6++;
  3705. };
  3706. if (_local5 == -1){
  3707. if (!_arg3){
  3708. return;
  3709. };
  3710. _local7 = (getSkinElement("button") as DisplayObject);
  3711. this.currentTab++;
  3712. _local8 = new DockJSButton(_arg1, _local7, this.currentTab);
  3713. _local8.setClickFunction(_arg2);
  3714. _local8.loadOutIcon(_arg3);
  3715. if (_arg4){
  3716. _local8.loadOverIcon(_arg4);
  3717. };
  3718. addChild(_local8);
  3719. this.buttons.push(_local8);
  3720. this.resize(getConfigParam("width"), getConfigParam("height"));
  3721. } else {
  3722. if (_arg2){
  3723. this.buttons[_local5].setClickFunction(_arg2);
  3724. if (_arg3){
  3725. this.buttons[_local5].loadOutIcon(_arg3);
  3726. };
  3727. if (_arg4){
  3728. this.buttons[_local5].loadOverIcon(_arg4);
  3729. };
  3730. } else {
  3731. removeChild(getChildAt(_local5));
  3732. this.buttons.splice(_local5, 1);
  3733. };
  3734. };
  3735. }
  3736. private function stateHandler(_arg1:PlayerStateEvent=undefined):void{
  3737. switch (player.state){
  3738. case PlayerState.PLAYING:
  3739. case PlayerState.BUFFERING:
  3740. this.startFader();
  3741. break;
  3742. default:
  3743. clearTimeout(this.timeout);
  3744. if (!hidden){
  3745. if (this.hideOnIdle){
  3746. this.moveTimeout();
  3747. } else {
  3748. sendShow();
  3749. this.animations.fade(1);
  3750. };
  3751. };
  3752. };
  3753. }
  3754. override public function show():void{
  3755. if (((player.config.dock) && (hidden))){
  3756. _hiding = false;
  3757. this.visible = true;
  3758. sendShow();
  3759. };
  3760. }
  3761. override public function hide():void{
  3762. if (((player.config.dock) && (!(hidden)))){
  3763. _hiding = true;
  3764. this.visible = false;
  3765. sendHide();
  3766. };
  3767. }
  3768. override protected function get displayRect():Rectangle{
  3769. if (this.dimensions){
  3770. return (this.dimensions);
  3771. };
  3772. return (super.displayRect);
  3773. }
  3774.  
  3775. }
  3776. }//package com.longtailvideo.jwplayer.view.components
  3777. package com.longtailvideo.jwplayer.view.components {
  3778. import com.longtailvideo.jwplayer.model.*;
  3779. import com.longtailvideo.jwplayer.view.interfaces.*;
  3780. import com.longtailvideo.jwplayer.view.*;
  3781. import flash.events.*;
  3782. import com.longtailvideo.jwplayer.events.*;
  3783. import flash.display.*;
  3784. import com.longtailvideo.jwplayer.view.skins.*;
  3785. import com.longtailvideo.jwplayer.player.*;
  3786. import flash.geom.*;
  3787. import flash.accessibility.*;
  3788. import flash.utils.*;
  3789. import flash.net.*;
  3790. import flash.text.*;
  3791. import com.longtailvideo.jwplayer.utils.*;
  3792. import flash.system.*;
  3793.  
  3794. public class PlaylistComponent extends CoreComponent implements IPlaylistComponent {
  3795.  
  3796. private var buttons:array;
  3797. private var buttonheight:number;
  3798. private var active:number;
  3799. private var proportion:number;
  3800. private var scrollInterval:number;
  3801. private var image:array;
  3802. private var back:ColorTransform;
  3803. private var front:ColorTransform;
  3804. private var light:ColorTransform;
  3805. private var list:Sprite;
  3806. private var button:Sprite;
  3807. private var listmask:Sprite;
  3808. private var slider:Sprite;
  3809. private var background:Sprite;
  3810. private var skin:ISkin;
  3811. private var skinLoaded:boolean = false;
  3812. private var pendingResize:Rectangle;
  3813. private var pendingBuild:boolean = false;
  3814. private var imageLoaderMap:Dictionary;
  3815. private var colorizableFields:array;
  3816.  
  3817. public function PlaylistComponent(_arg1:IPlayer){
  3818. var _local2:DefaultSkin;
  3819. this.colorizableFields = ["title", "duration", "description", "author", "tags"];
  3820. super(_arg1, "playlist");
  3821. this.imageLoaderMap = new Dictionary();
  3822. this.buttons = [];
  3823. _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
  3824. _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistHandler);
  3825. _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.playlistHandler);
  3826. _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  3827. if ((((_player.skin is SWFSkin)) && (!(_player.skin.hasComponent("playlist"))))){
  3828. _local2 = new DefaultSkin();
  3829. _local2.addEventListener(Event.COMPLETE, this.continueSetup);
  3830. this.skin = _local2;
  3831. _local2.load();
  3832. } else {
  3833. this.skinLoaded = true;
  3834. this.skin = _player.skin;
  3835. this.continueSetup();
  3836. };
  3837. }
  3838. protected function continueSetup(_arg1:Event=null):void{
  3839. var _local3:Sprite;
  3840. this.skinLoaded = true;
  3841. this.background = new Sprite();
  3842. this.background.graphics.beginfill(0, 0);
  3843. this.background.graphics.drawRect(0, 0, 1, 1);
  3844. var _local2:DisplayObject = (this.getSkinElement("background") as Sprite);
  3845. if (_local2){
  3846. this.background.addChild(_local2);
  3847. };
  3848. if (backgroundcolor){
  3849. _local3 = new Sprite();
  3850. _local3.graphics.beginfill(backgroundcolor.color, 1);
  3851. _local3.graphics.drawRect(0, 0, ((_local2) ? _local2.width : 1), ((_local2) ? _local2.height : 1));
  3852. _local3.graphics.endfill();
  3853. this.background.addChildAt(_local3, 0);
  3854. };
  3855. this.background.name = "background";
  3856. this.addElement(this.background);
  3857. this.slider = this.buildSlider();
  3858. this.slider.buttonMode = true;
  3859. this.slider.mouseChildren = false;
  3860. this.slider.addEventListener(MouseEvent.MOUSE_DOWN, this.sdownHandler);
  3861. this.slider.addEventListener(MouseEvent.MOUSE_OVER, this.soverHandler);
  3862. this.slider.addEventListener(MouseEvent.MOUSE_OUT, this.soutHandler);
  3863. this.slider.visible = false;
  3864. this.addElement(this.slider);
  3865. this.listmask = (this.getSkinElement("masker") as Sprite);
  3866. if (!this.listmask){
  3867. this.listmask = new Sprite();
  3868. this.listmask.graphics.beginfill(0xFF0000, 1);
  3869. this.listmask.graphics.drawRect(0, 0, 1, 1);
  3870. this.listmask.graphics.endfill();
  3871. };
  3872. this.addElement(this.listmask);
  3873. this.list = (this.getSkinElement("list") as Sprite);
  3874. if (!this.list){
  3875. this.list = new Sprite();
  3876. this.button = (this.buildButton() as Sprite);
  3877. this.addElement(this.button, this.list);
  3878. } else {
  3879. this.button = (this.list.getChildByName("button") as Sprite);
  3880. };
  3881. this.buttonheight = this.button.height;
  3882. this.button.visible = false;
  3883. this.list.mask = this.listmask;
  3884. this.list.addEventListener(MouseEvent.CLICK, this.clickHandler);
  3885. this.list.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  3886. this.list.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  3887. this.addElement(this.list);
  3888. this.addEventListener(MouseEvent.MOUSE_WHEEL, this.wheelHandler);
  3889. try {
  3890. this.image = new array(this.button.getChildByName("image").width, this.button.getChildByName("image").height);
  3891. } catch(err:error) {
  3892. };
  3893. if (this.button.getChildByName("back")){
  3894. this.setColors();
  3895. };
  3896. if (this.pendingBuild){
  3897. this.buildPlaylist(true);
  3898. };
  3899. if (this.pendingResize){
  3900. this.resize(this.pendingResize.width, this.pendingResize.height);
  3901. };
  3902. }
  3903. private function buildSlider():Sprite{
  3904. var _local4:Sprite;
  3905. var _local5:Sprite;
  3906. var _local6:Sprite;
  3907. var _local1:Sprite = (this.getSkinElement("slider") as Sprite);
  3908. if (!_local1){
  3909. _local1 = new Sprite();
  3910. _local4 = this.buildSliderElement("back", "sliderBackground");
  3911. this.addElement(_local4, _local1);
  3912. _local5 = this.buildSliderElement("rail", "sliderRail", 7, 22);
  3913. this.addElement(_local5, _local1);
  3914. _local6 = this.buildSliderElement("icon", "sliderThumb", 5, 54);
  3915. this.addElement(_local6, _local1, ((_local5.width - _local6.width) / 2));
  3916. };
  3917. var _local2:Sprite = this.buildSliderElement("captop", "sliderCapTop");
  3918. this.addElement(_local2, _local1);
  3919. var _local3:Sprite = this.buildSliderElement("capbottom", "sliderCapBottom");
  3920. this.addElement(_local3, _local1);
  3921. return (_local1);
  3922. }
  3923. private function buildSliderElement(_arg1:string, _arg2:string, _arg3:number=0, _arg4:number=0):Sprite{
  3924. var _local5:Sprite = (this.getSkinElement(_arg2) as Sprite);
  3925. if (!_local5){
  3926. _local5 = new Sprite();
  3927. if ((_arg3 * _arg4) > 0){
  3928. _local5.graphics.beginfill(0, 1);
  3929. _local5.graphics.drawRect(0, 0, _arg3, _arg4);
  3930. _local5.graphics.endfill();
  3931. };
  3932. };
  3933. try {
  3934. _local5.name = _arg1;
  3935. } catch(e:error) {
  3936. };
  3937. return (_local5);
  3938. }
  3939. private function buildButton():movieclip{
  3940. var _local1:movieclip = new movieclip();
  3941. var _local2:Sprite = (this.getSkinElement("itemActive") as Sprite);
  3942. if (_local2){
  3943. _local2.name = "backActive";
  3944. _local2.visible = false;
  3945. this.addElement(_local2, _local1, 0, 0);
  3946. };
  3947. var _local3:Sprite = (this.getSkinElement("itemOver") as Sprite);
  3948. if (_local3){
  3949. _local3.name = "backOver";
  3950. _local3.visible = false;
  3951. this.addElement(_local3, _local1, 0, 0);
  3952. };
  3953. var _local4:Sprite = (this.getSkinElement("item") as Sprite);
  3954. if (!_local4){
  3955. _local4 = new Sprite();
  3956. _local4.graphics.beginfill(0, 1);
  3957. _local4.graphics.drawRect(0, 0, 470, 100);
  3958. _local4.graphics.endfill();
  3959. };
  3960. _local4.name = "back";
  3961. this.addElement(_local4, _local1, 0, 0);
  3962. var _local5:movieclip = new movieclip();
  3963. var _local6:Sprite = (this.getSkinElement("itemImage") as Sprite);
  3964. var _local7:number = 5;
  3965. _local5.name = "image";
  3966. _local5.graphics.beginfill(0, 0);
  3967. if (_local6){
  3968. _local6.name = "imageBackground";
  3969. _local5.addChild(_local6);
  3970. _local6.x = (_local6.y = ((_local4.height - _local6.height) / 2));
  3971. _local5.graphics.drawRect(0, 0, (_local6.width + (2 * _local6.x)), _local4.height);
  3972. _local7 = 0;
  3973. } else {
  3974. _local5.graphics.drawRect(0, 0, ((4 * _local4.height) / 3), _local4.height);
  3975. };
  3976. _local5.graphics.endfill();
  3977. _local5["stacker.noresize"] = true;
  3978. this.addElement(_local5, _local1, 0, 0);
  3979. var _local8:textformat = new textformat();
  3980. _local8.size = ((fontSize) ? fontSize : 13);
  3981. _local8.font = ((fontFace) ? fontFace : "_sans");
  3982. _local8.bold = ((!(fontWeight)) || ((fontWeight == "bold")));
  3983. _local8.italic = (fontStyle == "italic");
  3984. var _local9:textfield = new textfield();
  3985. _local9.name = "title";
  3986. _local9.defaultTextFormat = _local8;
  3987. _local9.wordwrap = true;
  3988. _local9.multiline = true;
  3989. _local9.width = 300;
  3990. _local9.height = 20;
  3991. this.addElement(_local9, _local1, (_local5.width + _local7), 3);
  3992. var _local10:textformat = new textformat();
  3993. _local10.size = ((fontSize) ? (fontSize - 2) : 11);
  3994. _local10.leading = 1;
  3995. _local10.font = ((fontFace) ? fontFace : "_sans");
  3996. _local10.bold = (fontWeight == "bold");
  3997. _local10.italic = (fontStyle == "italic");
  3998. var _local11:textfield = new textfield();
  3999. _local11.name = "description";
  4000. _local11.wordwrap = true;
  4001. _local11.multiline = true;
  4002. _local11.width = 335;
  4003. _local11.height = (_local4.height - 22);
  4004. _local11.defaultTextFormat = _local10;
  4005. if (_local4.height > 40){
  4006. this.addElement(_local11, _local1, ((_local5.width + _local7) + 1), 22);
  4007. };
  4008. var _local12:textfield = new textfield();
  4009. _local12.name = "duration";
  4010. _local12.width = 40;
  4011. _local12.height = 20;
  4012. _local8.align = TextFormatAlign.right;
  4013. _local8.size = ((fontSize) ? (fontSize - 1) : 11);
  4014. _local8.rightmargin = 5;
  4015. _local12.defaultTextFormat = _local8;
  4016. this.addElement(_local12, _local1, ((_local9.x + _local9.width) - 2), 4);
  4017. _local4.width = _local1.width;
  4018. if (_local3){
  4019. _local3.width = _local1.width;
  4020. };
  4021. if (_local2){
  4022. _local2.width = _local1.width;
  4023. };
  4024. return (_local1);
  4025. }
  4026. private function addElement(_arg1:DisplayObject, _arg2:DisplayObjectContainer=null, _arg3:number=0, _arg4:number=0):void{
  4027. if (!_arg2){
  4028. _arg2 = this;
  4029. };
  4030. _arg1.x = _arg3;
  4031. _arg2.addChild(_arg1);
  4032. _arg1.y = _arg4;
  4033. }
  4034. private function get overColor():color{
  4035. return (((getConfigParam("overcolor")) ? new color(string(getConfigParam("overcolor"))) : null));
  4036. }
  4037. private function get activeColor():color{
  4038. return (((getConfigParam("activecolor")) ? new color(string(getConfigParam("activecolor"))) : null));
  4039. }
  4040. private function overHandler(_arg1:MouseEvent):void{
  4041. var _local6:string;
  4042. var _local2:number = number(_arg1.target.name);
  4043. if (((fontColor) && (this.overColor))){
  4044. for each (_local6 in this.colorizableFields) {
  4045. if (((this.getButton(_local2).getChildByName(_local6)) && ((this.getButton(_local2).getChildByName(_local6) is textfield)))){
  4046. (this.getButton(_local2).getChildByName(_local6) as textfield).textcolor = this.overColor.color;
  4047. };
  4048. };
  4049. } else {
  4050. if (((this.front) && (this.back))){
  4051. for each (_local6 in this.colorizableFields) {
  4052. if (((this.getButton(_local2).getChildByName(_local6)) && ((this.getButton(_local2).getChildByName(_local6) is textfield)))){
  4053. (this.getButton(_local2).getChildByName(_local6) as textfield).textcolor = this.back.color;
  4054. };
  4055. };
  4056. };
  4057. };
  4058. var _local3:DisplayObject = this.getButton(_local2).getChildByName("backOver");
  4059. var _local4:DisplayObject = this.getButton(_local2).getChildByName("back");
  4060. var _local5:DisplayObject = this.getButton(_local2).getChildByName("backActive");
  4061. if (this.swfSkinned){
  4062. if (((this.front) && (this.back))){
  4063. _local4.transform.colorTransform = this.light;
  4064. };
  4065. } else {
  4066. if (_local3){
  4067. _local3.visible = true;
  4068. _local4.visible = false;
  4069. if (_local5){
  4070. _local5.visible = false;
  4071. };
  4072. };
  4073. };
  4074. }
  4075. private function outHandler(_arg1:MouseEvent):void{
  4076. var _local3:string;
  4077. var _local4:Sprite;
  4078. var _local5:textfield;
  4079. var _local6:DisplayObject;
  4080. var _local7:DisplayObject;
  4081. var _local8:DisplayObject;
  4082. var _local2:number = number(_arg1.target.name);
  4083. for each (_local3 in this.colorizableFields) {
  4084. _local4 = this.getButton(_local2);
  4085. if (((_local4) && (_local4.getChildByName(_local3)))){
  4086. _local5 = (this.getButton(_local2).getChildByName(_local3) as textfield);
  4087. if (_local5){
  4088. if ((((_local2 == this.active)) && (((this.activeColor) || (((this.light) && (this.swfSkinned))))))){
  4089. _local5.textcolor = ((this.activeColor) ? this.activeColor.color : ((fontColor) ? fontColor.color : this.light.color));
  4090. } else {
  4091. if (((fontColor) && (this.overColor))){
  4092. _local5.textcolor = fontColor.color;
  4093. } else {
  4094. if (((this.front) && (this.back))){
  4095. _local5.textcolor = this.front.color;
  4096. };
  4097. };
  4098. };
  4099. };
  4100. _local6 = this.getButton(_local2).getChildByName("backOver");
  4101. _local7 = this.getButton(_local2).getChildByName("back");
  4102. _local8 = this.getButton(_local2).getChildByName("backActive");
  4103. if (this.swfSkinned){
  4104. if (((this.front) && (this.back))){
  4105. _local7.transform.colorTransform = this.back;
  4106. };
  4107. } else {
  4108. if (_local6){
  4109. _local6.visible = false;
  4110. if (_local8){
  4111. _local7.visible = !((_local2 == this.active));
  4112. _local8.visible = (_local2 == this.active);
  4113. } else {
  4114. _local7.visible = true;
  4115. };
  4116. };
  4117. };
  4118. };
  4119. };
  4120. }
  4121. private function get _playlist():array{
  4122. var _local1:array = [];
  4123. var _local2:number = 0;
  4124. while (_local2 < _player.playlist.length) {
  4125. if (_player.playlist.getItemAt(_local2)["ova.hidden"]){
  4126. } else {
  4127. _local1.push(_player.playlist.getItemAt(_local2));
  4128. };
  4129. _local2++;
  4130. };
  4131. return (_local1);
  4132. }
  4133. private function translateUIToModelPlaylistIndex(_arg1:number):number{
  4134. var _local2:number = 0;
  4135. while (_local2 < _player.playlist.length) {
  4136. if (_player.playlist.getItemAt(_local2).hasOwnProperty("ova.hidden")){
  4137. } else {
  4138. if (_arg1 == 0){
  4139. return (_local2);
  4140. };
  4141. _arg1--;
  4142. };
  4143. _local2++;
  4144. };
  4145. return (0);
  4146. }
  4147. private function translateModelToUIPlaylistIndex(_arg1:number):number{
  4148. var _local2:number = _arg1;
  4149. var _local3:number = 0;
  4150. while (_local3 < _arg1) {
  4151. if (_player.playlist.getItemAt(_local3).hasOwnProperty("ova.hidden")){
  4152. _local2--;
  4153. };
  4154. _local3++;
  4155. };
  4156. return (_local2);
  4157. }
  4158. private function buildPlaylist(_arg1:boolean):void{
  4159. var _local6:number;
  4160. var _local7:movieclip;
  4161. var _local8:Stacker;
  4162. if (!this.skinLoaded){
  4163. this.pendingBuild = true;
  4164. return;
  4165. };
  4166. var _local2:number = getConfigParam("width");
  4167. var _local3:number = getConfigParam("height");
  4168. this.listmask.height = _local3;
  4169. this.listmask.width = _local2;
  4170. this.proportion = ((this._playlist.length * this.buttonheight) / _local3);
  4171. if (this.proportion > 1.01){
  4172. _local2 = (_local2 - this.slider.width);
  4173. this.layoutSlider();
  4174. } else {
  4175. this.slider.visible = false;
  4176. };
  4177. if (_arg1){
  4178. this.list.y = this.listmask.y;
  4179. _local6 = 0;
  4180. while (_local6 < this.buttons.length) {
  4181. this.list.removeChild(this.getButton(_local6));
  4182. _local6++;
  4183. };
  4184. this.buttons = [];
  4185. this.imageLoaderMap = new Dictionary();
  4186. } else {
  4187. if (this.proportion > 1){
  4188. this.scrollEase();
  4189. };
  4190. };
  4191. var _local4:number = 500;
  4192. var _local5:number = 0;
  4193. while (_local5 < this._playlist.length) {
  4194. if (((_arg1) || ((this.buttons.length == 0)))){
  4195. if (this.swfSkinned){
  4196. _local7 = (Draw.clone(this.button, true) as movieclip);
  4197. } else {
  4198. _local7 = this.buildButton();
  4199. this.list.addChild(_local7);
  4200. };
  4201. _local7.tabenabled = true;
  4202. _local7.tabchildren = false;
  4203. var _temp1 = _local4;
  4204. _local4 = (_local4 + 1);
  4205. _local7.tabindex = _temp1;
  4206. _local8 = new Stacker(_local7);
  4207. _local7.y = (_local5 * this.buttonheight);
  4208. _local7.buttonMode = true;
  4209. _local7.mouseChildren = false;
  4210. _local7.name = _local5.tostring();
  4211. this.buttons.push({
  4212. c:_local7,
  4213. s:_local8
  4214. });
  4215. this.setContents(_local5);
  4216. };
  4217. if (this.buttons[_local5]){
  4218. (this.buttons[_local5].s as Stacker).rearrange(_local2);
  4219. };
  4220. _local5++;
  4221. };
  4222. }
  4223. private function layoutSlider():void{
  4224. var _local1:DisplayObject;
  4225. var _local2:DisplayObject;
  4226. var _local3:number;
  4227. this.slider.visible = true;
  4228. this.slider.x = (getConfigParam("width") - this.slider.width);
  4229. if ((player.skin is PNGSkin)){
  4230. _local1 = this.slider.getChildByName("captop");
  4231. _local2 = this.slider.getChildByName("capbottom");
  4232. this.slider.getChildByName("back").y = _local1.height;
  4233. this.slider.getChildByName("rail").y = _local1.height;
  4234. this.slider.getChildByName("icon").y = _local1.height;
  4235. this.slider.getChildByName("back").height = ((getConfigParam("height") - _local2.height) - _local1.height);
  4236. this.slider.getChildByName("rail").height = ((getConfigParam("height") - _local2.height) - _local1.height);
  4237. this.slider.getChildByName("icon").height = math.round((this.slider.getChildByName("rail").height / this.proportion));
  4238. _local2.y = (getConfigParam("height") - _local2.height);
  4239. } else {
  4240. _local3 = ((getConfigParam("height") - this.slider.height) - this.slider.y);
  4241. this.slider.getChildByName("back").height = (this.slider.getChildByName("back").height + _local3);
  4242. this.slider.getChildByName("rail").height = (this.slider.getChildByName("rail").height + _local3);
  4243. this.slider.getChildByName("icon").height = math.round((this.slider.getChildByName("rail").height / this.proportion));
  4244. };
  4245. }
  4246. private function scrollEase(_arg1:number=-1, _arg2:number=-1):void{
  4247. if (_arg1 != -1){
  4248. this.slider.getChildByName("icon").y = math.round((_arg1 - ((_arg1 - this.slider.getChildByName("icon").y) / 1.5)));
  4249. this.list.y = math.round((_arg2 - ((_arg2 - this.list.y) / 1.5)));
  4250. };
  4251. if ((((this.list.y > 0)) || ((this.slider.getChildByName("icon").y < this.slider.getChildByName("rail").y)))){
  4252. this.list.y = this.listmask.y;
  4253. this.slider.getChildByName("icon").y = this.slider.getChildByName("rail").y;
  4254. } else {
  4255. if ((((this.list.y < (this.listmask.height - this.list.height))) || ((this.slider.getChildByName("icon").y > ((this.slider.getChildByName("rail").y + this.slider.getChildByName("rail").height) - this.slider.getChildByName("icon").height))))){
  4256. this.slider.getChildByName("icon").y = ((this.slider.getChildByName("rail").y + this.slider.getChildByName("rail").height) - this.slider.getChildByName("icon").height);
  4257. this.list.y = ((this.listmask.y + this.listmask.height) - this.list.height);
  4258. };
  4259. };
  4260. }
  4261. private function scrollHandler():void{
  4262. var _local1:number = (this.slider.mouseY - this.slider.getChildByName("rail").y);
  4263. var _local2:number = (_local1 - (this.slider.getChildByName("icon").height / 2));
  4264. var _local3:number = ((this.listmask.y + (this.listmask.height / 2)) - (this.proportion * _local1));
  4265. this.scrollEase(_local2, _local3);
  4266. }
  4267. private function setColors():void{
  4268. if (_player.config.backcolor){
  4269. this.back = new ColorTransform();
  4270. this.back.color = _player.config.backcolor.color;
  4271. if (this.swfSkinned){
  4272. this.background.transform.colorTransform = this.back;
  4273. this.slider.getChildByName("back").transform.colorTransform = this.back;
  4274. };
  4275. };
  4276. if (_player.config.frontcolor){
  4277. this.front = new ColorTransform();
  4278. this.front.color = _player.config.frontcolor.color;
  4279. try {
  4280. if (this.swfSkinned){
  4281. this.slider.getChildByName("icon").transform.colorTransform = this.front;
  4282. this.slider.getChildByName("rail").transform.colorTransform = this.front;
  4283. };
  4284. } catch(err:error) {
  4285. };
  4286. if (this.swfSkinned){
  4287. if (_player.config.lightcolor){
  4288. this.light = new ColorTransform();
  4289. this.light.color = _player.config.lightcolor.color;
  4290. } else {
  4291. this.light = this.front;
  4292. };
  4293. };
  4294. };
  4295. }
  4296. private function setContents(_arg1:number):void{
  4297. var _local9:string;
  4298. var _local10:Sprite;
  4299. var _local11:Loader;
  4300. var _local12:AccessibilityProperties;
  4301. var _local2:PlaylistItem = this._playlist[_arg1];
  4302. var _local3:Sprite = this.getButton(_arg1);
  4303. var _local4:textfield = (_local3.getChildByName("title") as textfield);
  4304. var _local5:textfield = (_local3.getChildByName("description") as textfield);
  4305. var _local6:textfield = (_local3.getChildByName("duration") as textfield);
  4306. var _local7:textfield = (_local3.getChildByName("author") as textfield);
  4307. var _local8:textfield = (_local3.getChildByName("tags") as textfield);
  4308. if (((_local2.image) || (_local2["playlist.image"]))){
  4309. _local9 = ((_local2["playlist.image"]) ? _local2["playlist.image"] : _local2.image);
  4310. if (((!((getConfigParam("thumbs") == false))) && (!((_player.config.playlist == "none"))))){
  4311. _local10 = (_local3.getChildByName("image") as Sprite);
  4312. if (_local10){
  4313. _local10.alpha = 0;
  4314. _local11 = new Loader();
  4315. this.imageLoaderMap[_local11] = _arg1;
  4316. _local11.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
  4317. _local11.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  4318. _local11.load(new URLRequest(_local9), new LoaderContext(true));
  4319. };
  4320. };
  4321. };
  4322. if (((_local6) && (_local2.duration))){
  4323. if (_local2.duration > 0){
  4324. _local6.htmltext = (("<b>" + Strings.digits(_local2.duration)) + "</b>");
  4325. if (fontColor){
  4326. _local6.textcolor = fontColor.color;
  4327. } else {
  4328. if (this.front){
  4329. _local6.textcolor = this.front.color;
  4330. };
  4331. };
  4332. } else {
  4333. _local6.visible = false;
  4334. };
  4335. };
  4336. try {
  4337. _local12 = new AccessibilityProperties();
  4338. _local12.name = _local2.title;
  4339. _local12.description = _local2.description;
  4340. _local3.accessibilityProperties = _local12;
  4341. if (_local5){
  4342. _local5.htmltext = _local2.description;
  4343. };
  4344. if (_local4){
  4345. _local4.htmltext = (("<b>" + _local2.title) + "</b>");
  4346. };
  4347. if (_local7){
  4348. _local7.htmltext = _local2.author;
  4349. };
  4350. if (_local8){
  4351. _local8.htmltext = _local2.tags;
  4352. };
  4353. if (fontColor){
  4354. if (_local5){
  4355. _local5.textcolor = fontColor.color;
  4356. };
  4357. if (_local4){
  4358. _local4.textcolor = fontColor.color;
  4359. };
  4360. if (_local7){
  4361. _local7.textcolor = fontColor.color;
  4362. };
  4363. if (_local8){
  4364. _local8.textcolor = fontColor.color;
  4365. };
  4366. } else {
  4367. if (this.front){
  4368. if (_local5){
  4369. _local5.textcolor = this.front.color;
  4370. };
  4371. if (_local4){
  4372. _local4.textcolor = this.front.color;
  4373. };
  4374. if (_local7){
  4375. _local7.textcolor = this.front.color;
  4376. };
  4377. if (_local8){
  4378. _local8.textcolor = this.front.color;
  4379. };
  4380. };
  4381. };
  4382. } catch(e:error) {
  4383. };
  4384. _local10 = (_local3.getChildByName("image") as movieclip);
  4385. if (((_local10) && (((!(((_local2.image) || (_local2["playlist.image"])))) || ((getConfigParam("thumbs") == false)))))){
  4386. if (!_local10.getChildByName("imageBackground")){
  4387. _local3.getChildByName("image").visible = false;
  4388. };
  4389. };
  4390. if (((this.back) && (this.swfSkinned))){
  4391. _local3.getChildByName("back").transform.colorTransform = this.back;
  4392. };
  4393. }
  4394. private function loaderHandler(_arg1:Event):void{
  4395. var ldr:* = null;
  4396. var button:* = null;
  4397. var img:* = null;
  4398. var bg:* = null;
  4399. var msk:* = null;
  4400. var evt:* = _arg1;
  4401. try {
  4402. ldr = (evt.target as LoaderInfo).loader;
  4403. if ((ldr in this.imageLoaderMap)){
  4404. button = this.getButton(this.imageLoaderMap[ldr]);
  4405. delete this.imageLoaderMap[ldr];
  4406. img = (button.getChildByName("image") as Sprite);
  4407. bg = (img.getChildByName("imageBackground") as Sprite);
  4408. img.alpha = 1;
  4409. if (bg){
  4410. msk = this.getSkinElement("itemImage");
  4411. msk.x = bg.x;
  4412. msk.y = bg.y;
  4413. msk.cacheAsBitmap = true;
  4414. button.addChild(msk);
  4415. ldr.x = bg.x;
  4416. ldr.y = bg.y;
  4417. } else {
  4418. msk = Draw.rect(button, "0xFF0000", img.width, img.height, img.x, img.y);
  4419. };
  4420. img.addChild(ldr);
  4421. img.cacheAsBitmap = true;
  4422. img.mask = msk;
  4423. try {
  4424. Draw.smooth((ldr.content as Bitmap));
  4425. } catch(e:error) {
  4426. Logger.log(("Could not smooth thumbnail image: " + e.message));
  4427. };
  4428. Stretcher.stretch(ldr, this.image[0], this.image[1], Stretcher.FILL);
  4429. };
  4430. } catch(err:error) {
  4431. Logger.log(("Error loading playlist image: " + err.message));
  4432. };
  4433. }
  4434. private function errorHandler(_arg1:Event):void{
  4435. var ldr:* = null;
  4436. var button:* = null;
  4437. var img:* = null;
  4438. var evt:* = _arg1;
  4439. try {
  4440. ldr = (evt.target as LoaderInfo).loader;
  4441. button = this.getButton(this.imageLoaderMap[ldr]);
  4442. if (button){
  4443. img = (button.getChildByName("image") as Sprite);
  4444. if (!img.getChildByName("imageBackground")){
  4445. img.visible = false;
  4446. };
  4447. if (this.proportion > 1.01){
  4448. (this.buttons[this.imageLoaderMap[ldr]].s as Stacker).rearrange((getConfigParam("width") - this.slider.width));
  4449. } else {
  4450. (this.buttons[this.imageLoaderMap[ldr]].s as Stacker).rearrange(getConfigParam("width"));
  4451. };
  4452. };
  4453. } catch(err:error) {
  4454. Logger.log(((("Error loading playlist image " + ldr.contentLoaderInfo.url) + ": ") + err.message));
  4455. };
  4456. }
  4457. private function wheelHandler(_arg1:MouseEvent):void{
  4458. }
  4459. private function sdownHandler(_arg1:MouseEvent):void{
  4460. clearinterval(this.scrollInterval);
  4461. RootReference.stage.addEventListener(MouseEvent.MOUSE_UP, this.supHandler);
  4462. this.scrollHandler();
  4463. this.scrollInterval = setinterval(this.scrollHandler, 50);
  4464. }
  4465. private function soutHandler(_arg1:MouseEvent):void{
  4466. if (((this.front) && (this.swfSkinned))){
  4467. this.slider.getChildByName("icon").transform.colorTransform = this.front;
  4468. };
  4469. }
  4470. private function soverHandler(_arg1:MouseEvent):void{
  4471. if (((this.front) && (this.swfSkinned))){
  4472. this.slider.getChildByName("icon").transform.colorTransform = this.light;
  4473. };
  4474. }
  4475. private function supHandler(_arg1:MouseEvent):void{
  4476. clearinterval(this.scrollInterval);
  4477. RootReference.stage.removeEventListener(MouseEvent.MOUSE_UP, this.supHandler);
  4478. }
  4479. private function clickHandler(_arg1:MouseEvent):void{
  4480. var _local2:number = this.translateUIToModelPlaylistIndex(number(_arg1.target.name));
  4481. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_ITEM, _local2));
  4482. _player.playlistItem(_local2);
  4483. }
  4484. override public function resize(_arg1:number, _arg2:number):void{
  4485. if (this.skinLoaded){
  4486. setConfigParam("width", _arg1);
  4487. setConfigParam("height", _arg2);
  4488. this.background.width = _arg1;
  4489. this.background.height = _arg2;
  4490. this.buildPlaylist(false);
  4491. if (PlayerLayoutManager.testPosition(getConfigParam("position"))){
  4492. visible = true;
  4493. } else {
  4494. if (getConfigParam("position") == "over"){
  4495. this.stateHandler();
  4496. } else {
  4497. visible = false;
  4498. };
  4499. };
  4500. if (((visible) && ((getConfigParam("visible") === false)))){
  4501. visible = false;
  4502. };
  4503. } else {
  4504. this.pendingResize = new Rectangle(0, 0, _arg1, _arg2);
  4505. };
  4506. }
  4507. protected function itemHandler(_arg1:PlaylistEvent=null):void{
  4508. var _local3:string;
  4509. var _local4:string;
  4510. var _local5:DisplayObject;
  4511. var _local6:DisplayObject;
  4512. var _local7:DisplayObject;
  4513. var _local8:DisplayObject;
  4514. var _local9:DisplayObject;
  4515. var _local10:DisplayObject;
  4516. if (this._playlist.length == 0){
  4517. return;
  4518. };
  4519. var _local2:number = this.translateModelToUIPlaylistIndex(_player.playlist.currentIndex);
  4520. if (!this.skinLoaded){
  4521. return;
  4522. };
  4523. clearinterval(this.scrollInterval);
  4524. if (this.proportion > 1.01){
  4525. this.scrollInterval = setinterval(this.scrollEase, 50, ((_local2 * this.buttonheight) / this.proportion), ((-(_local2) * this.buttonheight) + this.listmask.y));
  4526. };
  4527. if (((((this.light) && (this.swfSkinned))) || (this.activeColor))){
  4528. for each (_local3 in this.colorizableFields) {
  4529. if (this.getButton(_local2).getChildByName(_local3)){
  4530. try {
  4531. (this.getButton(_local2).getChildByName(_local3) as textfield).textcolor = ((this.swfSkinned) ? this.light.color : this.activeColor.color);
  4532. } catch(err:error) {
  4533. };
  4534. };
  4535. };
  4536. };
  4537. if (!isnan(this.active)){
  4538. if (((this.front) || (fontColor))){
  4539. for each (_local4 in this.colorizableFields) {
  4540. if (this.getButton(this.active).getChildByName(_local4)){
  4541. try {
  4542. (this.getButton(this.active).getChildByName(_local4) as textfield).textcolor = ((fontColor) ? fontColor.color : this.front.color);
  4543. } catch(err:error) {
  4544. };
  4545. };
  4546. };
  4547. };
  4548. if (this.swfSkinned){
  4549. if (this.back){
  4550. this.getButton(_local2).getChildByName("back").transform.colorTransform = this.back;
  4551. };
  4552. } else {
  4553. _local5 = this.getButton(this.active).getChildByName("backOver");
  4554. _local6 = this.getButton(this.active).getChildByName("back");
  4555. _local7 = this.getButton(this.active).getChildByName("backActive");
  4556. _local6.visible = true;
  4557. if (_local5){
  4558. _local5.visible = false;
  4559. };
  4560. if (_local7){
  4561. _local7.visible = false;
  4562. };
  4563. };
  4564. };
  4565. this.active = _local2;
  4566. if (!this.swfSkinned){
  4567. _local8 = this.getButton(_local2).getChildByName("backOver");
  4568. _local9 = this.getButton(_local2).getChildByName("back");
  4569. _local10 = this.getButton(_local2).getChildByName("backActive");
  4570. if (_local10){
  4571. _local10.visible = true;
  4572. _local9.visible = false;
  4573. if (_local8){
  4574. _local8.visible = false;
  4575. };
  4576. };
  4577. };
  4578. }
  4579. protected function playlistHandler(_arg1:PlaylistEvent=null):void{
  4580. clearinterval(this.scrollInterval);
  4581. this.active = undefined;
  4582. this.buildPlaylist(true);
  4583. if (this.background){
  4584. this.resize(this.background.width, this.background.height);
  4585. };
  4586. }
  4587. protected function stateHandler(_arg1:PlayerStateEvent=null):void{
  4588. if (getConfigParam("position") == "over"){
  4589. if ((((((player.state == PlayerState.PLAYING)) || ((player.state == PlayerState.PAUSED)))) || ((player.state == PlayerState.BUFFERING)))){
  4590. visible = false;
  4591. } else {
  4592. visible = true;
  4593. };
  4594. };
  4595. }
  4596. private function getButton(_arg1:number):Sprite{
  4597. if (this.buttons[_arg1]){
  4598. return ((this.buttons[_arg1].c as Sprite));
  4599. };
  4600. return (new Sprite());
  4601. }
  4602. private function get swfSkinned():boolean{
  4603. if ((this.skin is SWFSkin)){
  4604. return (this.skin.hasComponent("playlist"));
  4605. };
  4606. return (false);
  4607. }
  4608. override protected function getSkinElement(_arg1:string):DisplayObject{
  4609. return (this.skin.getSkinElement(_name, _arg1));
  4610. }
  4611.  
  4612. }
  4613. }//package com.longtailvideo.jwplayer.view.components
  4614. package com.longtailvideo.jwplayer.view.components {
  4615. import com.longtailvideo.jwplayer.model.*;
  4616. import flash.events.*;
  4617. import flash.display.*;
  4618. import flash.geom.*;
  4619. import flash.text.*;
  4620.  
  4621. public class DockButton extends ComponentButton {
  4622.  
  4623. protected var _assetColor:color;
  4624. protected var _text:textfield;
  4625. private var _colorize:boolean;
  4626. private var _outBackground:Sprite;
  4627. private var _overBackground:Sprite;
  4628.  
  4629. public function DockButton():void{
  4630. var _local1:textformat = new textformat();
  4631. _local1.align = TextFormatAlign.CENTER;
  4632. _local1.font = "_sans";
  4633. _local1.size = 11;
  4634. this._text = new textfield();
  4635. this._text.defaultTextFormat = _local1;
  4636. this._text.x = 0;
  4637. this._text.y = 30;
  4638. this._text.width = 50;
  4639. this._text.height = 20;
  4640. }
  4641. override public function init():void{
  4642. var _local1:Sprite;
  4643. if (((!(this._overBackground)) && (!(this._outBackground)))){
  4644. this.setupBackground();
  4645. setBackground(this._outBackground);
  4646. } else {
  4647. if (this._outBackground){
  4648. if (((this._colorize) && (_outColor))){
  4649. this._outBackground.transform.colorTransform = this.createColorTransform(_outColor);
  4650. };
  4651. setBackground(this._outBackground);
  4652. } else {
  4653. if (!_background){
  4654. _local1 = new Sprite();
  4655. _local1.graphics.clear();
  4656. _local1.graphics.beginfill(((_outColor) ? _outColor.color : 0), 0.55);
  4657. _local1.graphics.drawRect(0, 0, 50, 50);
  4658. _local1.graphics.endfill();
  4659. setBackground(_local1);
  4660. };
  4661. };
  4662. };
  4663. super.init();
  4664. _imageLayer.addChild(this._text);
  4665. if (this._assetColor){
  4666. this._text.textcolor = this._assetColor.color;
  4667. } else {
  4668. this._text.textcolor = 0xFFFFFF;
  4669. };
  4670. mouseChildren = false;
  4671. buttonMode = true;
  4672. }
  4673. protected function createColorTransform(_arg1:color):ColorTransform{
  4674. var _local2:ColorTransform = new ColorTransform();
  4675. if (_arg1){
  4676. _local2.color = _arg1.color;
  4677. };
  4678. return (_local2);
  4679. }
  4680. private function setupBackground():void{
  4681. this._outBackground = new Sprite();
  4682. this._outBackground.graphics.clear();
  4683. this._outBackground.graphics.beginfill(((_outColor) ? _outColor.color : 0), 0.55);
  4684. this._outBackground.graphics.drawRect(0, 0, 50, 50);
  4685. this._outBackground.graphics.endfill();
  4686. this._overBackground = new Sprite();
  4687. this._overBackground.graphics.clear();
  4688. this._overBackground.graphics.beginfill(((_overColor) ? _overColor.color : 0), 0.55);
  4689. this._overBackground.graphics.drawRect(0, 0, 50, 50);
  4690. this._overBackground.graphics.endfill();
  4691. }
  4692. public function centerText():void{
  4693. this._text.width = _background.width;
  4694. this._text.y = ((_background.height / 2) + (((_background.height / 2) - this._text.height) / 2));
  4695. }
  4696. override protected function centerIcon(_arg1:DisplayObject):void{
  4697. if (_arg1){
  4698. if (_background){
  4699. _arg1.x = ((_background.width - _arg1.width) / 2);
  4700. _arg1.y = ((_background.height - (_arg1.height * 1.5)) / 2);
  4701. } else {
  4702. _arg1.x = 0;
  4703. _arg1.y = 0;
  4704. };
  4705. };
  4706. }
  4707. override protected function outHandler(_arg1:MouseEvent):void{
  4708. if (this._outBackground){
  4709. setBackground(this._outBackground);
  4710. } else {
  4711. if (this._colorize){
  4712. _background.transform.colorTransform = this.createColorTransform(_outColor);
  4713. };
  4714. };
  4715. }
  4716. override protected function overHandler(_arg1:MouseEvent):void{
  4717. if (this._overBackground){
  4718. setBackground(this._overBackground);
  4719. } else {
  4720. if (this._colorize){
  4721. _background.transform.colorTransform = this.createColorTransform(_overColor);
  4722. };
  4723. };
  4724. }
  4725. override protected function clickHandler(_arg1:MouseEvent):void{
  4726. super.clickHandler(_arg1);
  4727. }
  4728. public function set assetColor(_arg1:color):void{
  4729. this._assetColor = _arg1;
  4730. }
  4731. public function set colorize(_arg1:boolean):void{
  4732. this._colorize = _arg1;
  4733. }
  4734. public function set outBackground(_arg1:Sprite):void{
  4735. this._outBackground = _arg1;
  4736. }
  4737. public function set overBackground(_arg1:Sprite):void{
  4738. this._overBackground = _arg1;
  4739. }
  4740. public function set text(_arg1:string):void{
  4741. this._text.text = _arg1;
  4742. this.centerText();
  4743. }
  4744. public function get field():textfield{
  4745. return (this._text);
  4746. }
  4747.  
  4748. }
  4749. }//package com.longtailvideo.jwplayer.view.components
  4750. package com.longtailvideo.jwplayer.view.components {
  4751. import flash.events.*;
  4752. import flash.display.*;
  4753. import flash.net.*;
  4754. import com.longtailvideo.jwplayer.utils.*;
  4755. import flash.external.*;
  4756.  
  4757. public class DockJSButton extends ComponentButton {
  4758.  
  4759. private var _click:string;
  4760. private var _overLoader:Loader;
  4761. private var _outLoader:Loader;
  4762. private var _lastOver:string;
  4763. private var _lastOut:string;
  4764.  
  4765. public function DockJSButton(_arg1:string, _arg2:DisplayObject, _arg3:number):void{
  4766. this.name = _arg1;
  4767. setBackground(_arg2);
  4768. this.tabenabled = true;
  4769. this.tabchildren = false;
  4770. this.tabindex = _arg3;
  4771. this.buttonMode = true;
  4772. this._outLoader = new Loader();
  4773. this._outLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this._loadOutHandler);
  4774. this._outLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  4775. this._overLoader = new Loader();
  4776. this._overLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this._loadOverHandler);
  4777. this._overLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  4778. }
  4779. private function errorHandler(_arg1:ErrorEvent):void{
  4780. Logger.log(("Dock image could not be loaded: " + _arg1.text));
  4781. }
  4782. public function loadOutIcon(_arg1:string):void{
  4783. if ((((((this._lastOut == _arg1)) && (this._outLoader))) && ((this._outLoader.contentLoaderInfo.bytesloaded == this._outLoader.contentLoaderInfo.bytestotal)))){
  4784. this._loadOutHandler();
  4785. } else {
  4786. this._lastOut = _arg1;
  4787. this._outLoader.load(new URLRequest(_arg1));
  4788. };
  4789. }
  4790. private function _loadOutHandler(_arg1:Event=null):void{
  4791. setOutIcon(this._outLoader);
  4792. init();
  4793. }
  4794. public function loadOverIcon(_arg1:string):void{
  4795. if ((((((this._lastOver == _arg1)) && (this._overLoader))) && ((this._overLoader.contentLoaderInfo.bytesloaded == this._overLoader.contentLoaderInfo.bytestotal)))){
  4796. this._loadOutHandler();
  4797. } else {
  4798. this._lastOver = _arg1;
  4799. this._overLoader.load(new URLRequest(_arg1));
  4800. };
  4801. }
  4802. private function _loadOverHandler(_arg1:Event=null):void{
  4803. setOverIcon(this._overLoader);
  4804. }
  4805. private function _onClick(_arg1:MouseEvent):void{
  4806. ExternalInterface.call(this._click, name);
  4807. }
  4808. public function setClickFunction(_arg1:string):void{
  4809. this._click = _arg1;
  4810. clickFunction = this._onClick;
  4811. }
  4812.  
  4813. }
  4814. }//package com.longtailvideo.jwplayer.view.components
  4815. package com.longtailvideo.jwplayer.view.components {
  4816. import com.longtailvideo.jwplayer.view.interfaces.*;
  4817. import flash.events.*;
  4818. import com.longtailvideo.jwplayer.events.*;
  4819. import flash.display.*;
  4820. import com.longtailvideo.jwplayer.view.skins.*;
  4821. import com.longtailvideo.jwplayer.player.*;
  4822. import flash.geom.*;
  4823. import flash.utils.*;
  4824. import flash.net.*;
  4825. import flash.text.*;
  4826. import com.longtailvideo.jwplayer.utils.*;
  4827.  
  4828. public class DisplayComponent extends CoreComponent implements IDisplayComponent {
  4829.  
  4830. protected var _icon:DisplayObject;
  4831. protected var _iconArea:Rectangle;
  4832. protected var _background:movieclip;
  4833. protected var _overlay:Sprite;
  4834. protected var _text:textfield;
  4835. protected var _textBack:Sprite;
  4836. protected var _icons:object;
  4837. protected var _rotateInterval:number;
  4838. protected var _bufferIcon:Sprite;
  4839. protected var _rotate:boolean = true;
  4840. protected var _youtubeMask:movieclip;
  4841. protected var _bufferRotationTime:number = 100;
  4842. protected var _bufferRotationAngle:number = 15;
  4843. protected var _bufferStateTimer:Timer;
  4844. protected var _playStateTimer:Timer;
  4845. protected var _previousState:string;
  4846.  
  4847. public function DisplayComponent(_arg1:IPlayer){
  4848. super(_arg1, "display");
  4849. this.addListeners();
  4850. this.setupDisplayObjects();
  4851. this.setupIcons();
  4852. if (!isnan(getConfigParam("bufferrotation"))){
  4853. this._bufferRotationAngle = number(getConfigParam("bufferrotation"));
  4854. };
  4855. if (!isnan(getConfigParam("bufferinterval"))){
  4856. this._bufferRotationTime = number(getConfigParam("bufferinterval"));
  4857. };
  4858. this._bufferStateTimer = new Timer(50, 1);
  4859. this._bufferStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.showBufferIcon);
  4860. this._playStateTimer = new Timer(50, 1);
  4861. this._playStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.showPlayIcon);
  4862. }
  4863. private function itemHandler(_arg1:PlaylistEvent):void{
  4864. this._playStateTimer.delay = ((this._icon) ? 10 : 50);
  4865. this._playStateTimer.start();
  4866. if (this.background){
  4867. if (((_player.playlist.currentItem) && ((_player.playlist.currentItem.provider == "youtube")))){
  4868. this.background.mask = this._youtubeMask;
  4869. } else {
  4870. this.background.mask = null;
  4871. };
  4872. };
  4873. }
  4874. private function addListeners():void{
  4875. player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.stateHandler);
  4876. player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  4877. player.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.errorHandler);
  4878. player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
  4879. addEventListener(MouseEvent.CLICK, this.clickHandler);
  4880. this.buttonMode = true;
  4881. }
  4882. private function setupDisplayObjects():void{
  4883. this._background = new movieclip();
  4884. this.background.name = "background";
  4885. addChildAt(this.background, 0);
  4886. this.background.graphics.beginfill(0, 0);
  4887. this.background.graphics.drawRect(0, 0, 1, 1);
  4888. this.background.graphics.endfill();
  4889. this._overlay = new Sprite();
  4890. this._overlay.name = "overlay";
  4891. addChildAt(this._overlay, 1);
  4892. this._textBack = new Sprite();
  4893. this._textBack.name = "textBackground";
  4894. this._textBack.graphics.beginfill(0, 0.8);
  4895. this._textBack.graphics.drawRect(0, 0, 1, 1);
  4896. this._textBack.visible = false;
  4897. this._overlay.addChild(this._textBack);
  4898. this._text = new textfield();
  4899. this.text.gridFitType = GridFitType.NONE;
  4900. this.text.defaultTextFormat = new textformat("_sans", null, 0xFFFFFF);
  4901. this._overlay.addChild(this.text);
  4902. this._youtubeMask = new movieclip();
  4903. }
  4904. protected function setupIcons():void{
  4905. this._icons = {};
  4906. this.setupIcon("buffer");
  4907. this.setupIcon("play");
  4908. this.setupIcon("mute");
  4909. }
  4910. protected function centerIcon(_arg1:Sprite):void{
  4911. var _local2:number;
  4912. if (_arg1){
  4913. _local2 = 0;
  4914. while (_local2 < _arg1.numChildren) {
  4915. _arg1.getChildAt(_local2).x = (-(math.round(_arg1.getChildAt(_local2).width)) / 2);
  4916. _arg1.getChildAt(_local2).y = (-(math.round(_arg1.getChildAt(_local2).height)) / 2);
  4917. _local2++;
  4918. };
  4919. };
  4920. }
  4921. protected function setupIcon(_arg1:string):void{
  4922. var bufferBitmap:* = null;
  4923. var name:* = _arg1;
  4924. var iconElement:* = (getSkinElement((name + "Icon")) as Sprite);
  4925. var iconOver:* = (getSkinElement((name + "IconOver")) as Sprite);
  4926. if (!iconElement){
  4927. return;
  4928. };
  4929. if ((_player.skin is PNGSkin)){
  4930. if (iconElement.getChildByName("bitmap")){
  4931. this.centerIcon(iconElement);
  4932. iconElement.name = "out";
  4933. };
  4934. if (((iconOver) && (iconOver.getChildByName("bitmap")))){
  4935. this.centerIcon(iconOver);
  4936. iconOver.name = "over";
  4937. };
  4938. };
  4939. if (name == "buffer"){
  4940. if ((player.skin is PNGSkin)){
  4941. if ((((iconElement is movieclip)) && (((iconElement as movieclip).totalFrames > 1)))){
  4942. this._rotate = false;
  4943. } else {
  4944. try {
  4945. this._bufferIcon = iconElement;
  4946. bufferBitmap = (this._bufferIcon.getChildByName("bitmap") as Bitmap);
  4947. if (bufferBitmap){
  4948. Draw.smooth(bufferBitmap);
  4949. } else {
  4950. this.centerIcon(iconElement);
  4951. };
  4952. } catch(e:error) {
  4953. _rotate = false;
  4954. };
  4955. };
  4956. } else {
  4957. this._rotate = false;
  4958. };
  4959. };
  4960. var back:* = (getSkinElement("background") as Sprite);
  4961. if (back){
  4962. if ((_player.skin is PNGSkin)){
  4963. this.centerIcon(back);
  4964. };
  4965. } else {
  4966. back = new Sprite();
  4967. };
  4968. if (((((iconOver) && ((player.skin is PNGSkin)))) && (!((name == "buffer"))))){
  4969. iconOver.visible = false;
  4970. back.addChild(iconOver);
  4971. back.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  4972. back.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  4973. };
  4974. back.addChild(iconElement);
  4975. if ((((player.skin is PNGSkin)) && (!(iconElement.getChildByName("bitmap"))))){
  4976. if (((!((name == "buffer"))) || (!(this._rotate)))){
  4977. this.centerIcon(back);
  4978. };
  4979. } else {
  4980. back.x = (back.y = (iconElement.x = (iconElement.y = 0)));
  4981. };
  4982. this._icons[name] = back;
  4983. }
  4984. protected function overHandler(_arg1:MouseEvent):void{
  4985. var _local2:Sprite = (this._icon as Sprite);
  4986. if (_local2){
  4987. this.setIconHover(_local2, true);
  4988. };
  4989. }
  4990. protected function outHandler(_arg1:MouseEvent):void{
  4991. var _local2:Sprite = (this._icon as Sprite);
  4992. if (_local2){
  4993. this.setIconHover(_local2, false);
  4994. };
  4995. }
  4996. protected function setIconHover(_arg1:Sprite, _arg2:boolean):void{
  4997. var _local3:DisplayObject = _arg1.getChildByName("over");
  4998. var _local4:DisplayObject = _arg1.getChildByName("out");
  4999. if (((_local3) && (_local4))){
  5000. _local3.visible = _arg2;
  5001. _local4.visible = !(_arg2);
  5002. };
  5003. }
  5004. override public function resize(_arg1:number, _arg2:number):void{
  5005. this._background.width = _arg1;
  5006. this._background.height = _arg2;
  5007. this._youtubeMask.graphics.clear();
  5008. this._youtubeMask.graphics.beginfill(0xAA00, 0.3);
  5009. this._youtubeMask.graphics.drawRect(0, 0, _arg1, (_arg2 - 100));
  5010. this._youtubeMask.graphics.endfill();
  5011. this.positionIcon();
  5012. this.positionText();
  5013. this.stateHandler();
  5014. }
  5015. public function setIcon(_arg1:DisplayObject):void{
  5016. var _local2:boolean;
  5017. var _local3:boolean;
  5018. try {
  5019. if (((this._icon) && ((this._icon.parent == this._overlay)))){
  5020. this._overlay.removeChild(this._icon);
  5021. this._icon = null;
  5022. _local3 = !(_hiding);
  5023. } else {
  5024. _local2 = !(_hiding);
  5025. };
  5026. } catch(err:error) {
  5027. };
  5028. if (_fullscreen != _player.config.fullscreen){
  5029. _fullscreen = _player.config.fullscreen;
  5030. _local2 = true;
  5031. };
  5032. if (((((_arg1) && (_player.config.icons))) && ((((getConfigParam("icons") === true)) || ((typeof(getConfigParam("icons")) == "undefined")))))){
  5033. if ((_arg1 is Sprite)){
  5034. this.setIconHover((_arg1 as Sprite), false);
  5035. };
  5036. this._icon = _arg1;
  5037. this._overlay.addChild(this._icon);
  5038. this.positionIcon();
  5039. this._iconArea = this._icon.getRect(this._overlay);
  5040. if (_local2){
  5041. sendShow();
  5042. };
  5043. } else {
  5044. if (_local3){
  5045. sendHide();
  5046. };
  5047. this._iconArea = null;
  5048. };
  5049. }
  5050. private function positionIcon():void{
  5051. if (this._icon){
  5052. this._icon.x = (this.background.scaleX / 2);
  5053. this._icon.y = (this.background.scaleY / 2);
  5054. };
  5055. }
  5056. public function setText(_arg1:string):void{
  5057. if ((((this._icon is Sprite)) && (((this._icon as Sprite).getChildByName("txt") is textfield)))){
  5058. ((this._icon as Sprite).getChildByName("txt") as textfield).text = ((_arg1) ? _arg1 : "");
  5059. this.text.text = "";
  5060. } else {
  5061. this.text.text = ((_arg1) ? _arg1 : "");
  5062. };
  5063. this.positionText();
  5064. }
  5065. private function positionText():void{
  5066. if (this.text.text){
  5067. this.text.visible = true;
  5068. this._textBack.visible = true;
  5069. if (this.text.width > (this.background.scaleX * 0.75)){
  5070. this.text.width = (this.background.scaleX * 0.75);
  5071. this.text.wordwrap = true;
  5072. } else {
  5073. this.text.autosize = TextFormatAlign.CENTER;
  5074. };
  5075. this.text.x = ((this.background.scaleX - this.text.textwidth) / 2);
  5076. if (((this._icon) && (contains(this._icon)))){
  5077. this.text.y = ((this._icon.y + (this._icon.height / 2)) + 10);
  5078. } else {
  5079. this.text.y = ((this.background.scaleY - this.text.textheight) / 2);
  5080. };
  5081. this._textBack.y = (this.text.y - 2);
  5082. this._textBack.width = getConfigParam("width");
  5083. this._textBack.height = (this.text.height + 4);
  5084. } else {
  5085. this.text.visible = false;
  5086. this._textBack.visible = false;
  5087. };
  5088. }
  5089. protected function setDisplay(_arg1:DisplayObject, _arg2:string=null):void{
  5090. this.setIcon(_arg1);
  5091. this.setText(((_arg2)!=null) ? _arg2 : this.text.text);
  5092. }
  5093. protected function clearDisplay():void{
  5094. this.setDisplay(null, "");
  5095. }
  5096. protected function stateHandler(_arg1:PlayerEvent=null):void{
  5097. if (((!((this._previousState == player.state))) || (!((_arg1 is PlayerStateEvent))))){
  5098. this.clearRotation();
  5099. this._bufferStateTimer.reset();
  5100. this._playStateTimer.reset();
  5101. this._bufferStateTimer.delay = ((this._icon) ? 10 : 200);
  5102. this._playStateTimer.delay = ((this._icon) ? 10 : 10);
  5103. switch (player.state){
  5104. case PlayerState.BUFFERING:
  5105. this._bufferStateTimer.start();
  5106. break;
  5107. case PlayerState.PAUSED:
  5108. case PlayerState.IDLE:
  5109. this._playStateTimer.start();
  5110. break;
  5111. default:
  5112. if (((player.config.mute) && (getConfigParam("showmute")))){
  5113. this.setDisplay(this._icons["mute"]);
  5114. } else {
  5115. this.clearDisplay();
  5116. };
  5117. };
  5118. };
  5119. }
  5120. protected function showBufferIcon(_arg1:TimerEvent):void{
  5121. this.setDisplay(this._icons["buffer"], "");
  5122. if (this._rotate){
  5123. this.startRotation();
  5124. };
  5125. }
  5126. protected function showPlayIcon(_arg1:TimerEvent):void{
  5127. this.setDisplay(this._icons["play"]);
  5128. }
  5129. protected function startRotation():void{
  5130. if (((!(this._rotateInterval)) && (!(((this._bufferRotationAngle % 360) == 0))))){
  5131. this._rotateInterval = setinterval(this.updateRotation, this._bufferRotationTime);
  5132. };
  5133. }
  5134. protected function updateRotation():void{
  5135. if (this._bufferIcon){
  5136. this._bufferIcon.rotation = (this._bufferIcon.rotation + this._bufferRotationAngle);
  5137. };
  5138. }
  5139. protected function clearRotation():void{
  5140. if (this._bufferIcon){
  5141. this._bufferIcon.rotation = 0;
  5142. };
  5143. if (this._rotateInterval){
  5144. clearinterval(this._rotateInterval);
  5145. this._rotateInterval = undefined;
  5146. };
  5147. }
  5148. protected function errorHandler(_arg1:PlayerEvent):void{
  5149. this.setDisplay(null, _arg1.message);
  5150. }
  5151. protected function clickHandler(_arg1:MouseEvent):void{
  5152. var _local2:string;
  5153. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_CLICK));
  5154. if (_player.config.displayclick == "link"){
  5155. _local2 = _player.playlist.currentItem.link;
  5156. if (_local2){
  5157. navigateToURL(new URLRequest(Strings.cleanLink(_local2)), _player.config.linktarget);
  5158. };
  5159. } else {
  5160. if ((((player.state == PlayerState.PLAYING)) || ((player.state == PlayerState.BUFFERING)))){
  5161. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_PAUSE));
  5162. } else {
  5163. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_PLAY));
  5164. };
  5165. };
  5166. }
  5167. protected function get text():textfield{
  5168. return (this._text);
  5169. }
  5170. protected function get background():movieclip{
  5171. return (this._background);
  5172. }
  5173. override public function hide():void{
  5174. if (this._overlay){
  5175. this._overlay.visible = false;
  5176. };
  5177. if (!_hiding){
  5178. if (this._icon){
  5179. sendShow();
  5180. };
  5181. _hiding = true;
  5182. };
  5183. }
  5184. override public function show():void{
  5185. if (this._overlay){
  5186. this._overlay.visible = true;
  5187. };
  5188. if (_hiding){
  5189. if (this._icon){
  5190. sendHide();
  5191. };
  5192. _hiding = false;
  5193. };
  5194. }
  5195. override protected function get displayRect():Rectangle{
  5196. return (((this._iconArea) ? this._iconArea : super.displayRect));
  5197. }
  5198.  
  5199. }
  5200. }//package com.longtailvideo.jwplayer.view.components
  5201. package com.longtailvideo.jwplayer.view.components {
  5202. import flash.display.*;
  5203. import flash.text.*;
  5204.  
  5205. public class ControlbarLayoutManager {
  5206.  
  5207. protected var _controlbar:ControlbarComponent;
  5208. protected var _currentLeft:number;
  5209. protected var _currentRight:number;
  5210. protected var _height:number;
  5211. protected var _tabLeft:number;
  5212. protected var _tabRight:number;
  5213.  
  5214. public function ControlbarLayoutManager(_arg1:ControlbarComponent){
  5215. this._controlbar = _arg1;
  5216. }
  5217. public function resize(_arg1:number, _arg2:number):void{
  5218. var _local3:RegExp;
  5219. var _local4:object;
  5220. if (((_arg1) && (_arg2))){
  5221. this._height = _arg2;
  5222. this._currentLeft = 0;
  5223. if (this._controlbar.getButton("capLeft")){
  5224. this._currentLeft = (this._currentLeft + this._controlbar.getButton("capLeft").width);
  5225. };
  5226. this._currentRight = _arg1;
  5227. if (this._controlbar.getButton("capRight")){
  5228. this._currentRight = (this._currentRight - this._controlbar.getButton("capRight").width);
  5229. };
  5230. _local3 = /\[(.*)\]\[(.*)\]\[(.*)\]/;
  5231. _local4 = _local3.exec(this._controlbar.layout);
  5232. this._tabLeft = 300;
  5233. this._tabRight = 399;
  5234. this.position(_local4[1], "left");
  5235. this.position(_local4[3], "right");
  5236. this.positionCenter(_local4[2]);
  5237. };
  5238. }
  5239. private function position(_arg1:string, _arg2:string):void{
  5240. var _local5:string;
  5241. var _local6:array;
  5242. var _local7:number;
  5243. var _local8:array;
  5244. var _local9:number;
  5245. var _local10:string;
  5246. var _local11:DisplayObject;
  5247. var _local3:array = _arg1.split(/(<[^>]*>)/);
  5248. if (_arg2 == "right"){
  5249. _local3 = _local3.reverse();
  5250. };
  5251. var _local4:number = 0;
  5252. while (_local4 < _local3.length) {
  5253. _local5 = _local3[_local4];
  5254. if (_local5){
  5255. _local6 = /<(.*)>/.exec(_local5);
  5256. if (_local6){
  5257. if (isnan(_local6[1])){
  5258. this.place(this._controlbar.getButton(_local6[1]), _arg2);
  5259. } else {
  5260. _local7 = number(_local6[1]);
  5261. if (_arg2 == "left"){
  5262. this._currentLeft = (this._currentLeft + _local7);
  5263. } else {
  5264. if (_arg2 == "right"){
  5265. this._currentRight = (this._currentRight - _local7);
  5266. };
  5267. };
  5268. };
  5269. } else {
  5270. _local8 = _local5.split(" ");
  5271. if (_arg2 == "right"){
  5272. _local8 = _local8.reverse();
  5273. };
  5274. _local9 = 0;
  5275. while (_local9 < _local8.length) {
  5276. _local10 = _local8[_local9];
  5277. _local11 = this._controlbar.getButton(_local8[_local9]);
  5278. this.place(this._controlbar.getButton(_local8[_local9]), _arg2);
  5279. _local9++;
  5280. };
  5281. };
  5282. };
  5283. _local4++;
  5284. };
  5285. }
  5286. private function place(_arg1:DisplayObject, _arg2:string):void{
  5287. var _local3:Sprite = (_arg1 as Sprite);
  5288. if (_arg2 == "left"){
  5289. if (((_local3) && (_local3.buttonMode))){
  5290. _local3.tabindex = this._tabLeft++;
  5291. };
  5292. this.placeLeft(_arg1);
  5293. } else {
  5294. if (_arg2 == "right"){
  5295. if (((_local3) && (_local3.buttonMode))){
  5296. _local3.tabindex = this._tabRight--;
  5297. };
  5298. this.placeRight(_arg1);
  5299. };
  5300. };
  5301. }
  5302. private function placeLeft(_arg1:DisplayObject):void{
  5303. var _local2:DisplayObjectContainer;
  5304. if (_arg1){
  5305. _arg1.visible = true;
  5306. if (!this._controlbar.contains(_arg1)){
  5307. this._controlbar.addChild(_arg1);
  5308. };
  5309. _local2 = (_arg1 as DisplayObjectContainer);
  5310. if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
  5311. this._currentLeft = (this._currentLeft + 5);
  5312. } else {
  5313. if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
  5314. this._currentLeft = (this._currentLeft + 5);
  5315. };
  5316. };
  5317. _arg1.x = this._currentLeft;
  5318. _arg1.y = ((this._height - _arg1.height) / 2);
  5319. this._currentLeft = (this._currentLeft + _arg1.width);
  5320. if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
  5321. this._currentLeft = (this._currentLeft + 5);
  5322. } else {
  5323. if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
  5324. this._currentLeft = (this._currentLeft + 5);
  5325. };
  5326. };
  5327. };
  5328. }
  5329. private function placeRight(_arg1:DisplayObject):void{
  5330. var _local2:DisplayObjectContainer;
  5331. if (_arg1){
  5332. _arg1.visible = true;
  5333. if (!this._controlbar.contains(_arg1)){
  5334. this._controlbar.addChild(_arg1);
  5335. };
  5336. _local2 = (_arg1 as DisplayObjectContainer);
  5337. if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
  5338. this._currentRight = (this._currentRight - 5);
  5339. } else {
  5340. if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
  5341. this._currentRight = (this._currentRight - 5);
  5342. };
  5343. };
  5344. this._currentRight = (this._currentRight - _arg1.width);
  5345. _arg1.x = this._currentRight;
  5346. _arg1.y = ((this._height - _arg1.height) / 2);
  5347. if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
  5348. this._currentRight = (this._currentRight - 5);
  5349. } else {
  5350. if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
  5351. this._currentRight = (this._currentRight - 5);
  5352. };
  5353. };
  5354. };
  5355. }
  5356. private function positionCenter(_arg1:string):void{
  5357. var _local9:array;
  5358. var _local10:number;
  5359. var _local11:DisplayObject;
  5360. var _local2:RegExp = /\W/;
  5361. var _local3:array = _arg1.split(_local2);
  5362. var _local4:array = _arg1.split(/<[^\>]*>/);
  5363. var _local5:DisplayObject = this._controlbar.getButton("divider");
  5364. var _local6:number = 0;
  5365. if (_local5){
  5366. _local6 = (_local5.width * (_local4.length - 1));
  5367. };
  5368. var _local7:number = (((this._currentRight - this._currentLeft) - _local6) / _local3.length);
  5369. var _local8:number = 0;
  5370. while (_local8 < _local4.length) {
  5371. if (_local8 > 0){
  5372. this.placeLeft(_local5);
  5373. };
  5374. _local9 = (_local4[_local8] as string).split(" ");
  5375. _local10 = 0;
  5376. while (_local10 < _local9.length) {
  5377. _local11 = this._controlbar.getButton(_local9[_local10]);
  5378. if (_local11){
  5379. if ((_local11 is ComponentButton)){
  5380. (_local11 as ComponentButton).resize(_local7, _local11.height);
  5381. } else {
  5382. if ((_local11 is Slider)){
  5383. (_local11 as Slider).resize(_local7, _local11.height);
  5384. };
  5385. };
  5386. _local11.visible = true;
  5387. if (!this._controlbar.contains(_local11)){
  5388. this._controlbar.addChild(_local11);
  5389. };
  5390. _local11.x = this._currentLeft;
  5391. _local11.y = ((this._height - _local11.height) / 2);
  5392. };
  5393. _local10++;
  5394. };
  5395. _local8++;
  5396. };
  5397. }
  5398.  
  5399. }
  5400. }//package com.longtailvideo.jwplayer.view.components
  5401. package com.longtailvideo.jwplayer.view.components {
  5402. import flash.events.*;
  5403. import com.longtailvideo.jwplayer.events.*;
  5404. import flash.display.*;
  5405. import flash.geom.*;
  5406. import com.longtailvideo.jwplayer.utils.*;
  5407.  
  5408. public class Slider extends Sprite {
  5409.  
  5410. protected var _rail:Sprite;
  5411. protected var _buffer:Sprite;
  5412. protected var _progress:Sprite;
  5413. protected var _thumb:Sprite;
  5414. protected var _capLeft:Sprite;
  5415. protected var _capRight:Sprite;
  5416. protected var _clickArea:Sprite;
  5417. protected var _currentThumb:number = 0;
  5418. protected var _currentProgress:number = 0;
  5419. protected var _currentBuffer:number = 0;
  5420. protected var _front:ColorTransform;
  5421. protected var _light:ColorTransform;
  5422. protected var _width:number;
  5423. protected var _height:number;
  5424. protected var _dragging:boolean;
  5425. protected var _lock:boolean;
  5426. protected var _bufferOffset:number = 0;
  5427.  
  5428. public function Slider(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObject, _arg4:DisplayObject, _arg5:DisplayObject=null, _arg6:DisplayObject=null){
  5429. if (((!(_arg1)) || (!(_arg3)))){
  5430. throw (new ArgumentError("Required slider elements missing"));
  5431. };
  5432. this.buttonMode = true;
  5433. this.mouseChildren = true;
  5434. this._rail = this.addElement(_arg1, "rail", true);
  5435. this._buffer = this.addElement(_arg2, "buffer");
  5436. this._progress = this.addElement(_arg3, "progress");
  5437. this._thumb = this.addElement(_arg4, "thumb");
  5438. this._capLeft = this.addElement(_arg5, "capleft", true);
  5439. this._capRight = this.addElement(_arg6, "capright", true);
  5440. this._clickArea = this.addElement(null, "clickarea", true);
  5441. this._clickArea.addEventListener(MouseEvent.MOUSE_DOWN, this.downHandler);
  5442. this._clickArea.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  5443. this._clickArea.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  5444. }
  5445. private function addElement(_arg1:DisplayObject, _arg2:string, _arg3:boolean=false):Sprite{
  5446. if (!_arg1){
  5447. _arg1 = new Sprite();
  5448. };
  5449. _arg1.visible = _arg3;
  5450. addChild(_arg1);
  5451. _arg1.name = _arg2;
  5452. return ((_arg1 as Sprite));
  5453. }
  5454. protected function setThumb(_arg1:number):void{
  5455. this._currentThumb = _arg1;
  5456. }
  5457. public function setProgress(_arg1:number):void{
  5458. if (isnan(_arg1)){
  5459. _arg1 = 0;
  5460. };
  5461. this._currentProgress = _arg1;
  5462. if (this._progress){
  5463. this._progress.visible = true;
  5464. };
  5465. this.setThumb(_arg1);
  5466. this.resize(this.width, this.height);
  5467. }
  5468. public function setBuffer(_arg1:number, _arg2:number=nan):void{
  5469. if (!isnan(_arg1)){
  5470. this._currentBuffer = math.min(math.max(_arg1, 0), 100);
  5471. };
  5472. if (!isnan(_arg2)){
  5473. this._bufferOffset = math.min(math.max(_arg2, 0), 100);
  5474. };
  5475. if (this._buffer){
  5476. this._buffer.visible = (this._currentBuffer > 0);
  5477. };
  5478. this.resize(this.width, this.height);
  5479. }
  5480. public function resize(_arg1:number, _arg2:number):void{
  5481. var _local3:number = this.scaleX;
  5482. this.scaleX = 1;
  5483. this._width = (((_arg1 * _local3) - this._capLeft.width) - this._capRight.width);
  5484. this._height = _arg2;
  5485. this._capLeft.x = 0;
  5486. this._capRight.x = (_arg1 - this._capRight.width);
  5487. var _local4:DisplayObject = this._rail.getChildByName("bitmap");
  5488. if (_local4){
  5489. _local4.width = this._width;
  5490. _local4.x = this._capLeft.width;
  5491. this.resizeElement(_local4);
  5492. };
  5493. var _local5:DisplayObject = this._buffer.getChildByName("bitmap");
  5494. if (_local5){
  5495. _local5.width = (this._width * (1 - (this._bufferOffset / 100)));
  5496. _local5.x = (this._capLeft.width + ((this._width * this._bufferOffset) / 100));
  5497. this.resizeElement(_local5, this._currentBuffer);
  5498. };
  5499. var _local6:DisplayObject = this._progress.getChildByName("bitmap");
  5500. if (((_local6) && (!(this._dragging)))){
  5501. _local6.width = this._width;
  5502. _local6.x = this._capLeft.width;
  5503. this.resizeElement(_local6, this._currentProgress);
  5504. };
  5505. if (((this._thumb) && (!(this._dragging)))){
  5506. this._thumb.x = (this._capLeft.width + (((this._width - this._thumb.width) * this._currentThumb) / 100));
  5507. };
  5508. this._clickArea.graphics.clear();
  5509. this._clickArea.graphics.beginfill(0, 0);
  5510. this._clickArea.graphics.drawRect(this._capLeft.width, 0, this._width, _arg2);
  5511. this.verticalCenter();
  5512. }
  5513. private function resizeElement(_arg1:DisplayObject, _arg2:number=100):void{
  5514. var _local3:Sprite;
  5515. if (_arg1){
  5516. if (((this._width) && (this._height))){
  5517. if (_arg1.mask){
  5518. _local3 = (_arg1.mask as Sprite);
  5519. } else {
  5520. _local3 = new Sprite();
  5521. _local3.name = "mask";
  5522. addChild(_local3);
  5523. _arg1.mask = _local3;
  5524. };
  5525. _local3.x = _arg1.x;
  5526. _local3.graphics.clear();
  5527. _local3.graphics.beginfill(0xFF, 0);
  5528. _local3.graphics.drawRect(0, 0, ((_arg1.width * _arg2) / 100), _arg1.height);
  5529. _local3.graphics.endfill();
  5530. };
  5531. };
  5532. }
  5533. private function verticalCenter():void{
  5534. var _local2:DisplayObject;
  5535. var _local1:number = 0;
  5536. var _local3:number = 0;
  5537. while (_local3 < numChildren) {
  5538. _local2 = getChildAt(_local3);
  5539. if (_local2.height > _local1){
  5540. _local1 = _local2.height;
  5541. };
  5542. _local3++;
  5543. };
  5544. _local3 = 0;
  5545. while (_local3 < numChildren) {
  5546. _local2 = getChildAt(_local3);
  5547. _local2.y = ((_local1 - _local2.height) / 2);
  5548. _local3++;
  5549. };
  5550. }
  5551. private function downHandler(_arg1:MouseEvent):void{
  5552. var _local2:Rectangle;
  5553. if (((this._thumb) && (!(this._lock)))){
  5554. _local2 = new Rectangle(this._capLeft.width, this._thumb.y, (this._rail.width - this._thumb.width), 0);
  5555. this._thumb.startdrag(true, _local2);
  5556. this._dragging = true;
  5557. RootReference.stage.addEventListener(MouseEvent.MOUSE_UP, this.upHandler);
  5558. };
  5559. }
  5560. private function upHandler(_arg1:MouseEvent):void{
  5561. RootReference.stage.removeEventListener(MouseEvent.MOUSE_UP, this.upHandler);
  5562. this._thumb.stopdrag();
  5563. this._dragging = false;
  5564. var _local2:number = ((this._thumb.x - this._capLeft.width) / (this._rail.width - this._thumb.width));
  5565. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_CLICK, _local2));
  5566. this.setThumb((_local2 * 100));
  5567. }
  5568. private function outHandler(_arg1:MouseEvent):void{
  5569. }
  5570. private function overHandler(_arg1:MouseEvent):void{
  5571. }
  5572. public function reset():void{
  5573. this.setBuffer(0);
  5574. this.setProgress(0);
  5575. }
  5576. public function lock():void{
  5577. this._lock = true;
  5578. }
  5579. public function unlock():void{
  5580. this._lock = false;
  5581. }
  5582. public function get thumbVisible():boolean{
  5583. return (this._thumb.visible);
  5584. }
  5585. public function set thumbVisible(_arg1:boolean):void{
  5586. this._thumb.visible = _arg1;
  5587. }
  5588. public function get capsWidth():number{
  5589. return ((this._capLeft.width + this._capRight.width));
  5590. }
  5591.  
  5592. }
  5593. }//package com.longtailvideo.jwplayer.view.components
  5594. package com.longtailvideo.jwplayer.view.components {
  5595. import com.longtailvideo.jwplayer.model.*;
  5596. import com.longtailvideo.jwplayer.view.interfaces.*;
  5597. import flash.events.*;
  5598. import com.longtailvideo.jwplayer.events.*;
  5599. import flash.display.*;
  5600. import com.longtailvideo.jwplayer.player.*;
  5601. import flash.geom.*;
  5602.  
  5603. public class CoreComponent extends movieclip implements IGlobalEventDispatcher, IPlayerComponent {
  5604.  
  5605. private var _dispatcher:IGlobalEventDispatcher;
  5606. protected var _player:IPlayer;
  5607. protected var _name:string;
  5608. protected var _hiding:boolean = false;
  5609. protected var _fullscreen:boolean = false;
  5610. protected var _sentShow:boolean = false;
  5611. protected var _sentHide:boolean = false;
  5612. protected var _playerReady:boolean = false;
  5613. protected var _showOnReady:boolean = false;
  5614.  
  5615. public function CoreComponent(_arg1:IPlayer, _arg2:string){
  5616. this._dispatcher = new GlobalEventDispatcher();
  5617. this._player = _arg1;
  5618. this._name = _arg2;
  5619. super();
  5620. this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.readyHandler);
  5621. }
  5622. protected function readyHandler(_arg1:PlayerEvent):void{
  5623. this._playerReady = true;
  5624. if (this._showOnReady){
  5625. this.sendShow();
  5626. };
  5627. }
  5628. public function hide():void{
  5629. if (!this._hiding){
  5630. this._hiding = true;
  5631. this.visible = false;
  5632. this.sendHide();
  5633. };
  5634. }
  5635. public function show():void{
  5636. if (this._hiding){
  5637. this._hiding = false;
  5638. this.visible = true;
  5639. this.sendShow();
  5640. };
  5641. }
  5642. protected function sendShow():void{
  5643. if (!this._sentShow){
  5644. if (this._playerReady){
  5645. this.dispatchEvent(new ComponentEvent(ComponentEvent.JWPLAYER_COMPONENT_SHOW, this, this.displayRect));
  5646. this._sentShow = true;
  5647. this._sentHide = false;
  5648. } else {
  5649. this._showOnReady = true;
  5650. };
  5651. };
  5652. }
  5653. protected function sendHide():void{
  5654. if (!this._sentHide){
  5655. this.dispatchEvent(new ComponentEvent(ComponentEvent.JWPLAYER_COMPONENT_HIDE, this, this.displayRect));
  5656. this._sentShow = false;
  5657. this._sentHide = true;
  5658. };
  5659. }
  5660. public function resize(_arg1:number, _arg2:number):void{
  5661. this._fullscreen = this._player.config.fullscreen;
  5662. }
  5663. protected function get player():IPlayer{
  5664. return (this._player);
  5665. }
  5666. protected function getSkinElement(_arg1:string):DisplayObject{
  5667. return (this.player.skin.getSkinElement(this._name, _arg1));
  5668. }
  5669. protected function getConfigParam(_arg1:string){
  5670. return (this.player.config.pluginConfig(this._name)[_arg1]);
  5671. }
  5672. protected function setConfigParam(_arg1:string, _arg2):void{
  5673. this.player.config.pluginConfig(this._name)[_arg1] = _arg2;
  5674. }
  5675. protected function get backgroundcolor():color{
  5676. return (((this.getConfigParam("backgroundcolor")) ? new color(string(this.getConfigParam("backgroundcolor"))) : null));
  5677. }
  5678. protected function get fontColor():color{
  5679. return (((this.getConfigParam("fontcolor")) ? new color(string(this.getConfigParam("fontcolor"))) : null));
  5680. }
  5681. protected function get fontSize():number{
  5682. return (((this.getConfigParam("fontsize")) ? number(this.getConfigParam("fontsize")) : 0));
  5683. }
  5684. protected function get fontFace():string{
  5685. return (this.getConfigParam("font"));
  5686. }
  5687. protected function get fontWeight():string{
  5688. return (((this.getConfigParam("fontweight")) ? string(this.getConfigParam("fontweight")).tolowercase() : ""));
  5689. }
  5690. protected function get fontStyle():string{
  5691. return (((this.getConfigParam("fontstyle")) ? string(this.getConfigParam("fontstyle")).tolowercase() : ""));
  5692. }
  5693. protected function get hidden():boolean{
  5694. return (this._hiding);
  5695. }
  5696. protected function get displayRect():Rectangle{
  5697. if (this.parent){
  5698. return (this.getbounds(this.parent));
  5699. };
  5700. return (new Rectangle(0, 0, 0, 0));
  5701. }
  5702. public function addGlobalListener(_arg1:function):void{
  5703. this._dispatcher.addGlobalListener(_arg1);
  5704. }
  5705. public function removeGlobalListener(_arg1:function):void{
  5706. this._dispatcher.removeGlobalListener(_arg1);
  5707. }
  5708. override public function dispatchEvent(_arg1:Event):boolean{
  5709. this._dispatcher.dispatchEvent(_arg1);
  5710. return (super.dispatchEvent(_arg1));
  5711. }
  5712.  
  5713. }
  5714. }//package com.longtailvideo.jwplayer.view.components
  5715. package com.longtailvideo.jwplayer.view.components {
  5716. import com.longtailvideo.jwplayer.view.interfaces.*;
  5717. import com.longtailvideo.jwplayer.plugins.*;
  5718. import com.longtailvideo.jwplayer.view.*;
  5719. import flash.events.*;
  5720. import com.longtailvideo.jwplayer.events.*;
  5721. import flash.display.*;
  5722. import com.longtailvideo.jwplayer.player.*;
  5723. import flash.geom.*;
  5724. import flash.ui.*;
  5725. import flash.accessibility.*;
  5726. import flash.utils.*;
  5727. import flash.text.*;
  5728. import com.longtailvideo.jwplayer.utils.*;
  5729.  
  5730. public class ControlbarComponentV4 extends CoreComponent implements IControlbarComponent {
  5731.  
  5732. private var skin:Sprite;
  5733. private var stacker:Stacker;
  5734. private var hiding:number;
  5735. private var scrubber:movieclip;
  5736. private var front:ColorTransform;
  5737. private var light:ColorTransform;
  5738. private var BUTTONS:object;
  5739. private var SLIDERS:object;
  5740. private var clonee:movieclip;
  5741. private var blocking:boolean;
  5742. private var controlbarConfig:PluginConfig;
  5743. private var animations:Animations;
  5744. private var lastInsert:movieclip;
  5745.  
  5746. public function ControlbarComponentV4(_arg1:IPlayer){
  5747. this.SLIDERS = {
  5748. timeSlider:ViewEvent.JWPLAYER_VIEW_SEEK,
  5749. volumeSlider:ViewEvent.JWPLAYER_VIEW_VOLUME
  5750. };
  5751. super(_arg1, "controlbar");
  5752. this.animations = new Animations(this);
  5753. this.controlbarConfig = _player.config.pluginConfig("controlbar");
  5754. if ((((this.controlbarConfig["position"] == "over")) && (this.hideOnIdle))){
  5755. alpha = 0;
  5756. };
  5757. if (!this.controlbarConfig["margin"]){
  5758. this.controlbarConfig["margin"] = 0;
  5759. };
  5760. this.BUTTONS = {
  5761. playButton:ViewEvent.JWPLAYER_VIEW_PLAY,
  5762. pauseButton:ViewEvent.JWPLAYER_VIEW_PAUSE,
  5763. stopButton:ViewEvent.JWPLAYER_VIEW_STOP,
  5764. prevButton:ViewEvent.JWPLAYER_VIEW_PREV,
  5765. nextButton:ViewEvent.JWPLAYER_VIEW_NEXT,
  5766. fullscreenButton:ViewEvent.JWPLAYER_VIEW_FULLSCREEN,
  5767. normalscreenButton:ViewEvent.JWPLAYER_VIEW_FULLSCREEN,
  5768. muteButton:ViewEvent.JWPLAYER_VIEW_MUTE,
  5769. unmuteButton:ViewEvent.JWPLAYER_VIEW_MUTE
  5770. };
  5771. this.skin = (_player.skin.getSWFSkin().getChildByName("controlbar") as Sprite);
  5772. this.skin.x = 0;
  5773. this.skin.y = 0;
  5774. this.skin.tabchildren = (this.tabchildren = true);
  5775. this.skin.tabenabled = (this.tabenabled = false);
  5776. addChild(this.skin);
  5777. _player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  5778. _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.timeHandler);
  5779. _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.muteHandler);
  5780. _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.volumeHandler);
  5781. _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.timeHandler);
  5782. _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.itemHandler);
  5783. _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.itemHandler);
  5784. _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
  5785. RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
  5786. RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
  5787. RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
  5788. this.stacker = new Stacker((this.skin as movieclip));
  5789. try {
  5790. this.getSkinComponent("linkButton").visible = false;
  5791. } catch(e:error) {
  5792. };
  5793. this.setButtons();
  5794. this.setColors();
  5795. this.itemHandler();
  5796. this.muteHandler();
  5797. this.stateHandler();
  5798. this.timeHandler();
  5799. this.volumeHandler();
  5800. }
  5801. public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
  5802. var _local4:movieclip;
  5803. var _local5:AccessibilityProperties;
  5804. var _local6:number;
  5805. if (((this.getSkinComponent("linkButton")) && (this.getSkinElementChild("linkButton", "back")))){
  5806. _local4 = (Draw.clone((this.getSkinComponent("linkButton") as movieclip)) as movieclip);
  5807. _local4.name = (_arg2 + "Button");
  5808. _local4.visible = true;
  5809. _local4.tabenabled = true;
  5810. _local5 = new AccessibilityProperties();
  5811. _local5.name = _arg2;
  5812. _local4.accessibilityProperties = _local5;
  5813. this.skin.addChild(_local4);
  5814. _local6 = math.round(((_local4.height - _arg1.height) / 2));
  5815. Draw.clear(_local4["icon"]);
  5816. _local4["icon"].addChild(_arg1);
  5817. _arg1.x = (_arg1.y = 0);
  5818. _local4["icon"].x = (_local4["icon"].y = _local6);
  5819. _local4["back"].width = (_arg1.width + (2 * _local6));
  5820. _local4.buttonMode = true;
  5821. _local4.mouseChildren = false;
  5822. _local4.addEventListener(MouseEvent.CLICK, _arg3);
  5823. if (this.front){
  5824. _local4["icon"].transform.colorTransform = this.front;
  5825. _local4.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  5826. _local4.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  5827. };
  5828. if (this.lastInsert){
  5829. this.stacker.insert(_local4, this.lastInsert);
  5830. } else {
  5831. this.stacker.insert(_local4, (this.getSkinComponent("linkButton") as movieclip));
  5832. };
  5833. this.lastInsert = _local4;
  5834. };
  5835. return (_local4);
  5836. }
  5837. public function removeButton(_arg1:string):void{
  5838. var _local2:DisplayObject = this.getSkinComponent(_arg1);
  5839. if (_local2){
  5840. _local2.visible = false;
  5841. this.stacker.rearrange();
  5842. this.skin.removeChild(this.getSkinComponent(_arg1));
  5843. };
  5844. }
  5845. override public function resize(_arg1:number, _arg2:number):void{
  5846. if (!((PlayerLayoutManager.testPosition(this.controlbarConfig["position"])) || ((this.controlbarConfig["position"] == "over")))){
  5847. this.skin.visible = false;
  5848. return;
  5849. };
  5850. var _local3:number = _arg1;
  5851. var _local4:number = this.controlbarConfig["margin"];
  5852. if ((((this.controlbarConfig["position"] == "over")) || ((_player.config.fullscreen == true)))){
  5853. x = (_local4 + player.config.pluginConfig("display")["x"]);
  5854. y = (((_arg2 - this.skin.height) - _local4) + player.config.pluginConfig("display")["y"]);
  5855. _local3 = (_arg1 - (2 * _local4));
  5856. };
  5857. try {
  5858. this.getSkinComponent("fullscreenButton").visible = false;
  5859. this.getSkinComponent("normalscreenButton").visible = false;
  5860. if (((stage["displayState"]) && ((_player.config.height > 40)))){
  5861. if (_player.config.fullscreen){
  5862. this.getSkinComponent("fullscreenButton").visible = false;
  5863. this.getSkinComponent("normalscreenButton").visible = true;
  5864. } else {
  5865. this.getSkinComponent("fullscreenButton").visible = true;
  5866. this.getSkinComponent("normalscreenButton").visible = false;
  5867. };
  5868. };
  5869. } catch(err:error) {
  5870. };
  5871. this.stacker.rearrange(_local3);
  5872. this.stateHandler();
  5873. this.fixTime();
  5874. if (!_player.config.fullscreen){
  5875. mouse.show();
  5876. };
  5877. if (_fullscreen != _player.config.fullscreen){
  5878. _fullscreen = _player.config.fullscreen;
  5879. _sentShow = false;
  5880. };
  5881. if (((visible) && ((alpha > 0)))){
  5882. sendShow();
  5883. };
  5884. }
  5885. public function getButton(_arg1:string):DisplayObject{
  5886. return (null);
  5887. }
  5888. public function block(_arg1:boolean):void{
  5889. this.blocking = _arg1;
  5890. this.timeHandler();
  5891. }
  5892. private function clickHandler(_arg1:MouseEvent):void{
  5893. var _local4:ViewEvent;
  5894. var _local2:string = this.BUTTONS[_arg1.target.name];
  5895. var _local3:object;
  5896. if (((((!((this.blocking == true))) || ((_local2 == ViewEvent.JWPLAYER_VIEW_FULLSCREEN)))) || ((_local2 == ViewEvent.JWPLAYER_VIEW_MUTE)))){
  5897. switch (_local2){
  5898. case ViewEvent.JWPLAYER_VIEW_FULLSCREEN:
  5899. _local3 = boolean(!(_player.config.fullscreen));
  5900. break;
  5901. case ViewEvent.JWPLAYER_VIEW_PAUSE:
  5902. _local3 = boolean((((_player.state == PlayerState.IDLE)) || ((_player.state == PlayerState.PAUSED))));
  5903. break;
  5904. case ViewEvent.JWPLAYER_VIEW_MUTE:
  5905. _local3 = boolean(!(_player.config.mute));
  5906. break;
  5907. };
  5908. _local4 = new ViewEvent(_local2, _local3);
  5909. dispatchEvent(_local4);
  5910. };
  5911. }
  5912. private function downHandler(_arg1:MouseEvent):void{
  5913. var _local2:Rectangle;
  5914. if (!_player.locked){
  5915. this.scrubber = movieclip(_arg1.target);
  5916. if (((!((this.blocking == true))) || ((this.scrubber.name == "volumeSlider")))){
  5917. _local2 = new Rectangle(this.scrubber.rail.x, this.scrubber.icon.y, (this.scrubber.rail.width - this.scrubber.icon.width), 0);
  5918. this.scrubber.icon.startdrag(true, _local2);
  5919. stage.addEventListener(MouseEvent.MOUSE_UP, this.upHandler);
  5920. } else {
  5921. this.scrubber = null;
  5922. };
  5923. };
  5924. }
  5925. private function itemHandler(_arg1:PlaylistEvent=null):void{
  5926. try {
  5927. if (((((_player.playlist) && ((_player.playlist.length > 1)))) && ((_player.config.playlist.tolowercase() == "none")))){
  5928. this.getSkinComponent("prevButton").visible = (this.getSkinComponent("nextButton").visible = true);
  5929. } else {
  5930. this.getSkinComponent("prevButton").visible = (this.getSkinComponent("nextButton").visible = false);
  5931. };
  5932. } catch(err:error) {
  5933. };
  5934. this.timeHandler();
  5935. this.stacker.rearrange();
  5936. this.fixTime();
  5937. }
  5938. private function muteHandler(_arg1:MediaEvent=null):void{
  5939. if (_player.config.mute == true){
  5940. try {
  5941. this.getSkinComponent("muteButton").visible = false;
  5942. this.getSkinComponent("unmuteButton").visible = true;
  5943. } catch(err:error) {
  5944. };
  5945. try {
  5946. this.getSkinElementChild("volumeSlider", "mark").visible = false;
  5947. this.getSkinElementChild("volumeSlider", "icon").x = this.getSkinElementChild("volumeSlider", "rail").x;
  5948. } catch(err:error) {
  5949. };
  5950. } else {
  5951. try {
  5952. this.getSkinComponent("muteButton").visible = true;
  5953. this.getSkinComponent("unmuteButton").visible = false;
  5954. } catch(err:error) {
  5955. };
  5956. try {
  5957. this.getSkinElementChild("volumeSlider", "mark").visible = true;
  5958. this.volumeHandler();
  5959. } catch(err:error) {
  5960. };
  5961. };
  5962. }
  5963. private function outHandler(_arg1:MouseEvent):void{
  5964. if (((this.front) && (_arg1.target["icon"]))){
  5965. _arg1.target["icon"].transform.colorTransform = this.front;
  5966. } else {
  5967. _arg1.target.gotoandplay("out");
  5968. };
  5969. }
  5970. private function overHandler(_arg1:MouseEvent):void{
  5971. if (((this.front) && (_arg1.target["icon"]))){
  5972. _arg1.target["icon"].transform.colorTransform = this.light;
  5973. } else {
  5974. _arg1.target.gotoandplay("over");
  5975. };
  5976. }
  5977. private function setButtons():void{
  5978. var _local1:DisplayObject;
  5979. var _local2:string;
  5980. var _local3:string;
  5981. for (_local2 in this.BUTTONS) {
  5982. _local1 = this.getSkinComponent(_local2);
  5983. if (_local1){
  5984. _local1.addEventListener(MouseEvent.CLICK, this.clickHandler);
  5985. _local1.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  5986. _local1.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  5987. if ((_local1 is movieclip)){
  5988. (_local1 as movieclip).mouseChildren = false;
  5989. (_local1 as movieclip).buttonMode = true;
  5990. };
  5991. };
  5992. };
  5993. for (_local3 in this.SLIDERS) {
  5994. _local1 = this.getSkinComponent(_local3);
  5995. if (_local1){
  5996. this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_DOWN, this.downHandler);
  5997. this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  5998. this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  5999. if ((_local1 is movieclip)){
  6000. (_local1 as movieclip).mouseChildren = false;
  6001. (_local1 as movieclip).tabenabled = false;
  6002. (_local1 as movieclip).buttonMode = true;
  6003. };
  6004. };
  6005. };
  6006. }
  6007. private function setColors():void{
  6008. var _local1:ColorTransform;
  6009. var _local2:string;
  6010. var _local3:string;
  6011. if (((_player.config.backcolor) && (this.getSkinElementChild("playButton", "icon")))){
  6012. _local1 = new ColorTransform();
  6013. _local1.color = _player.config.backcolor.color;
  6014. this.getSkinComponent("back").transform.colorTransform = _local1;
  6015. };
  6016. if (_player.config.frontcolor){
  6017. try {
  6018. this.front = new ColorTransform();
  6019. this.front.color = _player.config.frontcolor.color;
  6020. for (_local2 in this.BUTTONS) {
  6021. if (this.getSkinComponent(_local2)){
  6022. this.getSkinElementChild(_local2, "icon").transform.colorTransform = this.front;
  6023. };
  6024. };
  6025. for (_local3 in this.SLIDERS) {
  6026. if (this.getSkinComponent(_local3)){
  6027. this.getSkinElementChild(_local3, "icon").transform.colorTransform = this.front;
  6028. this.getSkinElementChild(_local3, "mark").transform.colorTransform = this.front;
  6029. this.getSkinElementChild(_local3, "rail").transform.colorTransform = this.front;
  6030. };
  6031. };
  6032. (this.getSkinComponent("elapsedText") as textfield).textcolor = this.front.color;
  6033. (this.getSkinComponent("totalText") as textfield).textcolor = this.front.color;
  6034. } catch(err:error) {
  6035. };
  6036. };
  6037. if (_player.config.lightcolor){
  6038. this.light = new ColorTransform();
  6039. this.light.color = _player.config.lightcolor.color;
  6040. } else {
  6041. this.light = this.front;
  6042. };
  6043. if (this.light){
  6044. try {
  6045. this.getSkinElementChild("timeSlider", "done").transform.colorTransform = this.light;
  6046. this.getSkinElementChild("volumeSlider", "mark").transform.colorTransform = this.light;
  6047. } catch(err:error) {
  6048. };
  6049. };
  6050. }
  6051. private function get fadeOnTimeout():boolean{
  6052. return ((((this.controlbarConfig["position"] == "over")) || (((_player.config.fullscreen) && (!((this.controlbarConfig["position"] == "none")))))));
  6053. }
  6054. private function get hideOnIdle():boolean{
  6055. return ((string(this.controlbarConfig["idlehide"]) == "true"));
  6056. }
  6057. private function startFader():void{
  6058. if (((this.fadeOnTimeout) && (!(hidden)))){
  6059. if (!isnan(this.hiding)){
  6060. clearTimeout(this.hiding);
  6061. };
  6062. this.hiding = setTimeout(this.moveTimeout, 2000);
  6063. };
  6064. }
  6065. private function stopFader():void{
  6066. if (hidden){
  6067. return;
  6068. };
  6069. if (alpha == 0){
  6070. sendShow();
  6071. this.animations.fade(1, 0.5);
  6072. };
  6073. if (!isnan(this.hiding)){
  6074. clearTimeout(this.hiding);
  6075. mouse.show();
  6076. };
  6077. }
  6078. private function moveHandler(_arg1:Event=null):void{
  6079. this.stopFader();
  6080. if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  6081. this.startFader();
  6082. };
  6083. }
  6084. private function moveTimeout(_arg1:Event=null):void{
  6085. if (!hidden){
  6086. if (alpha > 0){
  6087. sendHide();
  6088. this.animations.fade(0, 0.5);
  6089. };
  6090. if (_player.config.fullscreen){
  6091. mouse.hide();
  6092. };
  6093. };
  6094. }
  6095. private function mouseLeftStage(_arg1:Event=null):void{
  6096. if (((this.fadeOnTimeout) && (!(hidden)))){
  6097. if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  6098. sendHide();
  6099. this.animations.fade(0);
  6100. };
  6101. };
  6102. }
  6103. private function stateHandler(_arg1:PlayerEvent=null):void{
  6104. switch (_player.state){
  6105. case PlayerState.BUFFERING:
  6106. case PlayerState.PLAYING:
  6107. if (this.getSkinComponent("playButton")){
  6108. this.getSkinComponent("playButton").visible = false;
  6109. this.getSkinComponent("pauseButton").visible = true;
  6110. this.startFader();
  6111. };
  6112. break;
  6113. case PlayerState.IDLE:
  6114. this.timeHandler();
  6115. case PlayerState.PAUSED:
  6116. if (this.getSkinComponent("playButton")){
  6117. this.getSkinComponent("playButton").visible = true;
  6118. this.getSkinComponent("pauseButton").visible = false;
  6119. };
  6120. if (this.hideOnIdle){
  6121. this.mouseLeftStage();
  6122. } else {
  6123. this.stopFader();
  6124. };
  6125. break;
  6126. };
  6127. }
  6128. private function timeHandler(_arg1:MediaEvent=null):void{
  6129. var xps:* = nan;
  6130. var evt = _arg1;
  6131. var dur:* = 0;
  6132. var pos:* = 0;
  6133. if (evt){
  6134. if (evt.duration >= 0){
  6135. dur = evt.duration;
  6136. };
  6137. if (evt.position >= 0){
  6138. pos = evt.position;
  6139. };
  6140. } else {
  6141. if ((((_player.playlist.length > 0)) && (_player.playlist.currentItem))){
  6142. if (_player.playlist.currentItem.duration >= 0){
  6143. dur = _player.playlist.currentItem.duration;
  6144. };
  6145. };
  6146. };
  6147. var pct:* = (pos / dur);
  6148. if (isnan(pct)){
  6149. pct = 1;
  6150. };
  6151. try {
  6152. (this.getSkinComponent("elapsedText") as textfield).text = Strings.digits(pos);
  6153. (this.getSkinComponent("totalText") as textfield).text = Strings.digits(dur);
  6154. } catch(err:error) {
  6155. Logger.log(err);
  6156. };
  6157. try {
  6158. xps = math.round((pct * (this.getSkinElementChild("timeSlider", "rail").width - this.getSkinElementChild("timeSlider", "icon").width)));
  6159. this.bufferHandler(evt);
  6160. if (dur > 0){
  6161. this.getSkinElementChild("timeSlider", "icon").visible = !((_player.state == PlayerState.IDLE));
  6162. this.getSkinElementChild("timeSlider", "mark").visible = !((_player.state == PlayerState.IDLE));
  6163. if (((!(this.scrubber)) || (!((this.scrubber.name == "timeSlider"))))){
  6164. this.getSkinElementChild("timeSlider", "icon").x = xps;
  6165. this.getSkinElementChild("timeSlider", "done").width = xps;
  6166. };
  6167. this.getSkinElementChild("timeSlider", "done").visible = !((_player.state == PlayerState.IDLE));
  6168. } else {
  6169. if (_player.state != PlayerState.PLAYING){
  6170. this.getSkinElementChild("timeSlider", "icon").visible = false;
  6171. this.getSkinElementChild("timeSlider", "mark").visible = false;
  6172. this.getSkinElementChild("timeSlider", "done").visible = false;
  6173. };
  6174. };
  6175. } catch(err:error) {
  6176. };
  6177. }
  6178. private function bufferHandler(_arg1:MediaEvent):void{
  6179. var evt:* = _arg1;
  6180. if (((!(evt)) || ((evt.bufferPercent < 0)))){
  6181. return;
  6182. };
  6183. var mark:* = this.getSkinElementChild("timeSlider", "mark");
  6184. var railWidth:* = this.getSkinElementChild("timeSlider", "rail").width;
  6185. var markWidth:* = (((_player.state == PlayerState.IDLE)) ? 0 : math.round(((evt.bufferPercent / 100) * railWidth)));
  6186. var offset:* = (evt.offset / evt.duration);
  6187. try {
  6188. mark.x = (((evt.duration > 0)) ? math.round((railWidth * offset)) : 0);
  6189. mark.width = markWidth;
  6190. mark.visible = !((_player.state == PlayerState.IDLE));
  6191. } catch(e:error) {
  6192. Logger.log(e);
  6193. };
  6194. }
  6195. private function fixTime():void{
  6196. var _local1:number;
  6197. try {
  6198. _local1 = this.getSkinComponent("timeSlider").scaleX;
  6199. this.getSkinComponent("timeSlider").scaleX = 1;
  6200. this.getSkinElementChild("timeSlider", "icon").x = (_local1 * this.getSkinElementChild("timeSlider", "icon").x);
  6201. this.getSkinElementChild("timeSlider", "mark").x = (_local1 * this.getSkinElementChild("timeSlider", "mark").x);
  6202. this.getSkinElementChild("timeSlider", "mark").width = (_local1 * this.getSkinElementChild("timeSlider", "mark").width);
  6203. this.getSkinElementChild("timeSlider", "rail").width = (_local1 * this.getSkinElementChild("timeSlider", "rail").width);
  6204. this.getSkinElementChild("timeSlider", "done").x = (_local1 * this.getSkinElementChild("timeSlider", "done").x);
  6205. this.getSkinElementChild("timeSlider", "done").width = (_local1 * this.getSkinElementChild("timeSlider", "done").width);
  6206. } catch(err:error) {
  6207. };
  6208. }
  6209. private function upHandler(_arg1:MouseEvent):void{
  6210. var _local5:MediaEvent;
  6211. var _local2:number = 0;
  6212. var _local3:string = this.scrubber.name;
  6213. stage.removeEventListener(MouseEvent.MOUSE_UP, this.upHandler);
  6214. this.scrubber.icon.stopdrag();
  6215. if ((((((_local3 == "timeSlider")) && (_player.playlist))) && (_player.playlist.currentItem))){
  6216. _local2 = _player.playlist.currentItem.duration;
  6217. } else {
  6218. if (_local3 == "volumeSlider"){
  6219. _local2 = 100;
  6220. };
  6221. };
  6222. var _local4:number = (((this.scrubber.icon.x - this.scrubber.rail.x) / (this.scrubber.rail.width - this.scrubber.icon.width)) * _local2);
  6223. this.scrubber = null;
  6224. if (_local3 == "volumeSlider"){
  6225. _local5 = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME);
  6226. _local5.volume = math.round(_local4);
  6227. this.volumeHandler(_local5);
  6228. };
  6229. dispatchEvent(new ViewEvent(this.SLIDERS[_local3], math.round(_local4)));
  6230. }
  6231. private function volumeHandler(_arg1:MediaEvent=null):void{
  6232. var _local2:movieclip;
  6233. try {
  6234. _local2 = (this.getSkinComponent("volumeSlider") as movieclip);
  6235. _local2.mark.width = ((_player.config.volume * (_local2.rail.width - (_local2.icon.width / 2))) / 100);
  6236. _local2.icon.x = (_local2.mark.x + ((_player.config.volume * (_local2.rail.width - _local2.icon.width)) / 100));
  6237. } catch(err:error) {
  6238. };
  6239. }
  6240. private function getSkinComponent(_arg1:string):DisplayObject{
  6241. return ((this.skin.getChildByName(_arg1) as DisplayObject));
  6242. }
  6243. private function getSkinElementChild(_arg1:string, _arg2:string):DisplayObject{
  6244. return ((this.skin.getChildByName(_arg1) as movieclip).getChildByName(_arg2));
  6245. }
  6246. override public function show():void{
  6247. if (((!((getConfigParam("position") == "none"))) && (_hiding))){
  6248. _hiding = false;
  6249. this.visible = true;
  6250. sendShow();
  6251. };
  6252. }
  6253. override public function hide():void{
  6254. if (((!((getConfigParam("position") == "none"))) && (!(_hiding)))){
  6255. _hiding = true;
  6256. this.visible = false;
  6257. sendHide();
  6258. };
  6259. }
  6260. override protected function get displayRect():Rectangle{
  6261. if (((((this.parent) && ((getConfigParam("position") == "over")))) || (_fullscreen))){
  6262. return (getbounds(this.parent));
  6263. };
  6264. return (new Rectangle(0, 0, 0, 0));
  6265. }
  6266.  
  6267. }
  6268. }//package com.longtailvideo.jwplayer.view.components
  6269. package com.longtailvideo.jwplayer.view.components {
  6270. import com.longtailvideo.jwplayer.model.*;
  6271. import flash.events.*;
  6272. import flash.display.*;
  6273. import com.longtailvideo.jwplayer.utils.*;
  6274.  
  6275. public class ComponentButton extends movieclip {
  6276.  
  6277. protected static var currentTabIndex:number = 100;
  6278.  
  6279. protected var _background:DisplayObject;
  6280. protected var _clickFunction:function;
  6281. protected var _imageLayer:Sprite;
  6282. protected var _outColor:color;
  6283. protected var _outIcon:DisplayObject;
  6284. protected var _overColor:color;
  6285. protected var _overIcon:DisplayObject;
  6286. protected var _enabled:boolean = true;
  6287.  
  6288. public function ComponentButton(){
  6289. this.tabenabled = true;
  6290. this.tabchildren = false;
  6291. this.tabindex = currentTabIndex++;
  6292. this.buttonMode = true;
  6293. }
  6294. public function init():void{
  6295. if (this._background){
  6296. this.nameDisplayObject("backgroundLayer", this._background);
  6297. addChild(this._background);
  6298. this._background.x = 0;
  6299. this._background.y = 0;
  6300. };
  6301. this._imageLayer = new Sprite();
  6302. this._imageLayer.buttonMode = true;
  6303. this._imageLayer.mouseChildren = false;
  6304. this.nameDisplayObject("imageLayer", this._imageLayer);
  6305. addChild(this._imageLayer);
  6306. this._imageLayer.x = 0;
  6307. this._imageLayer.y = 0;
  6308. this.setImage(this._outIcon);
  6309. addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
  6310. addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
  6311. addEventListener(MouseEvent.CLICK, this.clickHandler);
  6312. }
  6313. protected function outHandler(_arg1:MouseEvent):void{
  6314. if (this._overIcon){
  6315. if (this._imageLayer.contains(this._overIcon)){
  6316. this._imageLayer.removeChild(this._overIcon);
  6317. };
  6318. this.setImage(this._outIcon);
  6319. };
  6320. }
  6321. protected function overHandler(_arg1:MouseEvent):void{
  6322. if (this._overIcon){
  6323. if (this._imageLayer.contains(this._outIcon)){
  6324. this._imageLayer.removeChild(this._outIcon);
  6325. };
  6326. this.setImage(this._overIcon);
  6327. };
  6328. }
  6329. protected function clickHandler(_arg1:MouseEvent):void{
  6330. var event:* = _arg1;
  6331. if (this._enabled){
  6332. try {
  6333. this._clickFunction(event);
  6334. } catch(error:error) {
  6335. Logger.log(error.message);
  6336. };
  6337. };
  6338. }
  6339. protected function setImage(_arg1:DisplayObject):void{
  6340. if (_arg1){
  6341. if (this._imageLayer.contains(_arg1)){
  6342. this._imageLayer.removeChild(_arg1);
  6343. };
  6344. this._imageLayer.addChild(_arg1);
  6345. this.centerIcon(_arg1);
  6346. };
  6347. }
  6348. public function setBackground(_arg1:DisplayObject=null):void{
  6349. if (this._background){
  6350. removeChild(this._background);
  6351. };
  6352. if (_arg1){
  6353. this._background = _arg1;
  6354. this.nameDisplayObject("backgroundLayer", this._background);
  6355. addChild(this._background);
  6356. setChildIndex(this._background, 0);
  6357. this._background.x = 0;
  6358. this._background.y = 0;
  6359. };
  6360. }
  6361. public function setOutIcon(_arg1:DisplayObject=null):void{
  6362. if (_arg1){
  6363. this._outIcon = _arg1;
  6364. };
  6365. }
  6366. public function setOverIcon(_arg1:DisplayObject=null):void{
  6367. if (_arg1){
  6368. this._overIcon = _arg1;
  6369. };
  6370. }
  6371. public function resize(_arg1:number, _arg2:number):void{
  6372. }
  6373. protected function centerIcon(_arg1:DisplayObject):void{
  6374. if (_arg1){
  6375. if (this._background){
  6376. _arg1.x = ((this._background.width - _arg1.width) / 2);
  6377. _arg1.y = ((this._background.height - _arg1.height) / 2);
  6378. } else {
  6379. _arg1.x = 0;
  6380. _arg1.y = 0;
  6381. };
  6382. };
  6383. }
  6384. public function set outColor(_arg1:color):void{
  6385. this._outColor = _arg1;
  6386. }
  6387. public function set overColor(_arg1:color):void{
  6388. this._overColor = _arg1;
  6389. }
  6390. public function set clickFunction(_arg1:function):void{
  6391. this._clickFunction = _arg1;
  6392. }
  6393. override public function set enabled(_arg1:boolean):void{
  6394. this._enabled = _arg1;
  6395. }
  6396. override public function get enabled():boolean{
  6397. return (this._enabled);
  6398. }
  6399. private function nameDisplayObject(_arg1:string, _arg2:DisplayObject):void{
  6400. try {
  6401. _arg2.name = _arg1;
  6402. } catch(error:error) {
  6403. };
  6404. }
  6405.  
  6406. }
  6407. }//package com.longtailvideo.jwplayer.view.components
  6408. package com.longtailvideo.jwplayer.view.components {
  6409. import com.longtailvideo.jwplayer.model.*;
  6410. import com.longtailvideo.jwplayer.view.interfaces.*;
  6411. import flash.events.*;
  6412. import com.longtailvideo.jwplayer.events.*;
  6413. import flash.display.*;
  6414. import com.longtailvideo.jwplayer.player.*;
  6415. import flash.geom.*;
  6416. import flash.ui.*;
  6417. import flash.accessibility.*;
  6418. import flash.utils.*;
  6419. import flash.text.*;
  6420. import com.longtailvideo.jwplayer.utils.*;
  6421.  
  6422. public class ControlbarComponent extends CoreComponent implements IControlbarComponent {
  6423.  
  6424. protected var _buttons:object;
  6425. protected var _customButtons:array;
  6426. protected var _removedButtons:array;
  6427. protected var _dividers:array;
  6428. protected var _dividerElements:object;
  6429. protected var _defaultLayout:string = "[play|stop|prev|next|elapsed][time][duration|blank|fullscreen|mute volume]";
  6430. protected var _currentLayout:string;
  6431. protected var _layoutManager:ControlbarLayoutManager;
  6432. protected var _width:number;
  6433. protected var _height:number;
  6434. protected var _timeSlider:Slider;
  6435. protected var _volSlider:Slider;
  6436. protected var _bgColorSheet:Sprite;
  6437. protected var animations:Animations;
  6438. protected var _fadingOut:number;
  6439.  
  6440. public function ControlbarComponent(_arg1:IPlayer){
  6441. this._buttons = {};
  6442. this._customButtons = [];
  6443. this._removedButtons = [];
  6444. super(_arg1, "controlbar");
  6445. this.animations = new Animations(this);
  6446. if ((((getConfigParam("position") == "over")) && (this.hideOnIdle))){
  6447. alpha = 0;
  6448. visible = false;
  6449. };
  6450. this._layoutManager = new ControlbarLayoutManager(this);
  6451. this._dividers = [];
  6452. this._dividerElements = {divider:this.setupDivider("divider")};
  6453. this.setupBackground();
  6454. this.setupDefaultButtons();
  6455. this.addEventListeners();
  6456. this.updateControlbarState();
  6457. this.settime(0, 0);
  6458. this.updateVolumeSlider();
  6459. }
  6460. private function setupDivider(_arg1:string):object{
  6461. return ({
  6462. copies:[],
  6463. index:0
  6464. });
  6465. }
  6466. private function addEventListeners():void{
  6467. player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  6468. player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistHandler);
  6469. player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.playlistHandler);
  6470. player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistHandler);
  6471. player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.stateHandler);
  6472. player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.updateVolumeSlider);
  6473. player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.mediaHandler);
  6474. player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.mediaHandler);
  6475. player.addEventListener(PlayerEvent.JWPLAYER_LOCKED, this.lockHandler);
  6476. player.addEventListener(PlayerEvent.JWPLAYER_UNLOCKED, this.lockHandler);
  6477. RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
  6478. RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
  6479. RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
  6480. }
  6481. private function lockHandler(_arg1:PlayerEvent):void{
  6482. if (_player.locked){
  6483. if (this._timeSlider){
  6484. this._timeSlider.lock();
  6485. };
  6486. if (this._volSlider){
  6487. this._volSlider.lock();
  6488. };
  6489. } else {
  6490. if (this._timeSlider){
  6491. this._timeSlider.unlock();
  6492. };
  6493. if (this._volSlider){
  6494. this._volSlider.unlock();
  6495. };
  6496. };
  6497. }
  6498. private function playlistHandler(_arg1:PlaylistEvent):void{
  6499. if (this._timeSlider){
  6500. this._timeSlider.reset();
  6501. };
  6502. this.updateControlbarState();
  6503. this.redraw();
  6504. }
  6505. private function get fadeOnTimeout():boolean{
  6506. return ((((getConfigParam("position") == "over")) || (((_player.config.fullscreen) && (!((getConfigParam("position") == "none")))))));
  6507. }
  6508. private function get hideOnIdle():boolean{
  6509. return ((string(getConfigParam("idlehide")) == "true"));
  6510. }
  6511. private function startFader():void{
  6512. if (((this.fadeOnTimeout) && (!(hidden)))){
  6513. if (!isnan(this._fadingOut)){
  6514. clearTimeout(this._fadingOut);
  6515. };
  6516. this._fadingOut = setTimeout(this.moveTimeout, 2000);
  6517. };
  6518. }
  6519. private function stopFader():void{
  6520. if (hidden){
  6521. return;
  6522. };
  6523. if (alpha == 0){
  6524. sendShow();
  6525. this.animations.fade(1, 0.5);
  6526. };
  6527. if (!isnan(this._fadingOut)){
  6528. clearTimeout(this._fadingOut);
  6529. mouse.show();
  6530. };
  6531. }
  6532. private function moveHandler(_arg1:Event=null):void{
  6533. this.stopFader();
  6534. if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  6535. this.startFader();
  6536. };
  6537. }
  6538. private function moveTimeout(_arg1:Event=null):void{
  6539. if (!hidden){
  6540. if (alpha > 0){
  6541. sendHide();
  6542. this.animations.fade(0, 0.5);
  6543. };
  6544. if (_fullscreen){
  6545. mouse.hide();
  6546. };
  6547. };
  6548. }
  6549. private function mouseLeftStage(_arg1:Event=null):void{
  6550. if (((this.fadeOnTimeout) && (!(hidden)))){
  6551. if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
  6552. if (_arg1){
  6553. sendHide();
  6554. };
  6555. this.animations.fade(0);
  6556. };
  6557. };
  6558. }
  6559. private function stateHandler(_arg1:PlayerEvent=null):void{
  6560. switch (_player.state){
  6561. case PlayerState.BUFFERING:
  6562. case PlayerState.PLAYING:
  6563. this.startFader();
  6564. break;
  6565. case PlayerState.PAUSED:
  6566. case PlayerState.IDLE:
  6567. if (this.hideOnIdle){
  6568. this.mouseLeftStage();
  6569. } else {
  6570. this.stopFader();
  6571. };
  6572. break;
  6573. };
  6574. this.updateControlbarState();
  6575. this.redraw();
  6576. }
  6577. private function parseStructuredLayout(_arg1:object):string{
  6578. var _local3:string;
  6579. var _local4:array;
  6580. var _local5:boolean;
  6581. var _local6:object;
  6582. var _local2 = "";
  6583. this.getTextField("elapsed").visible = false;
  6584. this.getTextField("duration").visible = false;
  6585. for each (_local3 in ["left", "center", "right"]) {
  6586. _local2 = (_local2 + "[");
  6587. _local4 = (_arg1[_local3] as array);
  6588. if (_local4){
  6589. _local5 = true;
  6590. for each (_local6 in _local4) {
  6591. if (_local6["type"] == "divider"){
  6592. if (_local6["element"]){
  6593. _local2 = (_local2 + (("<" + _local6["element"]) + ">"));
  6594. if (!this._dividerElements[_local6["element"]]){
  6595. this._dividerElements[_local6["element"]] = this.setupDivider(_local6["element"]);
  6596. };
  6597. } else {
  6598. if (_local6["width"] > 0){
  6599. _local2 = (_local2 + (("<" + _local6["width"]) + ">"));
  6600. } else {
  6601. _local2 = (_local2 + "|");
  6602. };
  6603. };
  6604. _local5 = true;
  6605. } else {
  6606. if (_local6["type"] == "text"){
  6607. this.getTextField(_local6["name"]).visible = true;
  6608. };
  6609. if (!_local5){
  6610. _local2 = (_local2 + " ");
  6611. };
  6612. _local2 = (_local2 + _local6["name"]);
  6613. _local5 = false;
  6614. };
  6615. };
  6616. };
  6617. _local2 = (_local2 + "]");
  6618. };
  6619. return (_local2);
  6620. }
  6621. private function updateControlbarState():void{
  6622. var _local3:string;
  6623. var _local1:string = this._defaultLayout;
  6624. var _local2:object = _player.skin.getSkinProperties().layout["controlbar"];
  6625. if (_local2){
  6626. _local1 = this.parseStructuredLayout(_local2);
  6627. };
  6628. this.removeInactive(_local1);
  6629. _local1 = _local1.replace("blank", this._customButtons.join("|"));
  6630. _local1 = this.removeButtonFromLayout("blank", _local1);
  6631. for each (_local3 in this._removedButtons) {
  6632. _local1 = this.removeButtonFromLayout(_local3, _local1);
  6633. };
  6634. if (player.state == PlayerState.PLAYING){
  6635. _local1 = _local1.replace("play", "pause");
  6636. this.hideButton("play");
  6637. } else {
  6638. if (player.state == PlayerState.IDLE){
  6639. if (this._timeSlider){
  6640. this._timeSlider.reset();
  6641. this._timeSlider.thumbVisible = false;
  6642. if (_player.playlist.currentItem){
  6643. this.settime(0, _player.playlist.currentItem.duration);
  6644. };
  6645. };
  6646. this.hideButton("pause");
  6647. } else {
  6648. this.hideButton("pause");
  6649. };
  6650. };
  6651. if ((((player.playlist.length <= 1)) || (!((player.config.playlist.tolowercase() == "none"))))){
  6652. _local1 = _local1.replace("|prev|next", "");
  6653. this.hideButton("prev");
  6654. this.hideButton("next");
  6655. };
  6656. if (player.config.mute){
  6657. _local1 = _local1.replace("mute", "unmute");
  6658. this.hideButton("mute");
  6659. } else {
  6660. this.hideButton("unmute");
  6661. };
  6662. if (player.config.fullscreen){
  6663. _local1 = _local1.replace("fullscreen", "normalscreen");
  6664. this.hideButton("fullscreen");
  6665. } else {
  6666. this.hideButton("normalscreen");
  6667. };
  6668. this._currentLayout = this.removeInactive(_local1);
  6669. }
  6670. private function removeInactive(_arg1:string):string{
  6671. var _local4:string;
  6672. var _local2:array = this._defaultLayout.match(/\W*([A-Za-z0-9]+?)\W/g);
  6673. var _local3:number = 0;
  6674. while (_local3 < _local2.length) {
  6675. _local4 = (_local2[_local3] as string).replace(/\W/g, "");
  6676. if (!this._buttons[_local4]){
  6677. _arg1 = this.removeButtonFromLayout(_local4, _arg1);
  6678. };
  6679. _local3++;
  6680. };
  6681. return (_arg1);
  6682. }
  6683. private function removeButtonFromLayout(_arg1:string, _arg2:string):string{
  6684. _arg2 = _arg2.replace(_arg1, "");
  6685. _arg2 = _arg2.replace(/\|+/g, "|");
  6686. return (_arg2);
  6687. }
  6688. private function mediaHandler(_arg1:MediaEvent):void{
  6689. var _local3:number;
  6690. var _local2:Slider = this._timeSlider;
  6691. switch (_arg1.type){
  6692. case MediaEvent.JWPLAYER_MEDIA_BUFFER:
  6693. case MediaEvent.JWPLAYER_MEDIA_TIME:
  6694. if (_local2){
  6695. _local2.setProgress(((_arg1.position / _arg1.duration) * 100));
  6696. _local2.thumbVisible = (_arg1.duration > 0);
  6697. if (_arg1.bufferPercent > 0){
  6698. _local3 = ((_arg1.offset / _arg1.duration) * 100);
  6699. _local2.setBuffer((_arg1.bufferPercent / (1 - (_local3 / 100))), _local3);
  6700. };
  6701. if (_arg1.position > 0){
  6702. this.settime(_arg1.position, _arg1.duration);
  6703. };
  6704. };
  6705. break;
  6706. default:
  6707. _local2.reset();
  6708. };
  6709. }
  6710. private function updateVolumeSlider(_arg1:MediaEvent=null):void{
  6711. var _local3:number;
  6712. var _local2:Slider = this._volSlider;
  6713. if (_local2){
  6714. _local3 = (getSkinElement("volumeSliderRail").width + _local2.capsWidth);
  6715. if (!_player.config.mute){
  6716. _local2.setBuffer(100);
  6717. _local2.setProgress(_player.config.volume);
  6718. _local2.thumbVisible = true;
  6719. _local2.resize(_local3, _local2.height);
  6720. } else {
  6721. _local2.reset();
  6722. _local2.thumbVisible = false;
  6723. _local2.resize(_local3, _local2.height);
  6724. };
  6725. };
  6726. }
  6727. private function settime(_arg1:number, _arg2:number):void{
  6728. if (_arg1 < 0){
  6729. _arg1 = 0;
  6730. };
  6731. if (_arg2 < 0){
  6732. _arg2 = 0;
  6733. };
  6734. var _local3:textfield = this.getTextField("elapsed");
  6735. if (_local3){
  6736. _local3.text = Strings.digits(_arg1);
  6737. };
  6738. var _local4:textfield = this.getTextField("duration");
  6739. if (_local4){
  6740. _local4.text = Strings.digits(_arg2);
  6741. };
  6742. }
  6743. private function setupBackground():void{
  6744. var _local4:Sprite;
  6745. var _local1:DisplayObject = getSkinElement("background");
  6746. var _local2:DisplayObject = getSkinElement("capLeft");
  6747. var _local3:DisplayObject = getSkinElement("capRight");
  6748. if (!_local1){
  6749. _local4 = new Sprite();
  6750. _local4.name = "background";
  6751. _local4.graphics.beginfill(0, 0);
  6752. _local4.graphics.drawRect(0, 0, 1, 1);
  6753. _local4.graphics.endfill();
  6754. _local1 = (_local4 as DisplayObject);
  6755. };
  6756. if (!_local2){
  6757. _local2 = new Sprite();
  6758. };
  6759. if (!_local3){
  6760. _local3 = new Sprite();
  6761. };
  6762. this._bgColorSheet = new Sprite();
  6763. if (backgroundcolor){
  6764. this._bgColorSheet.graphics.beginfill(backgroundcolor.color, 1);
  6765. this._bgColorSheet.graphics.drawRect(0, 0, 1, 1);
  6766. this._bgColorSheet.graphics.endfill();
  6767. };
  6768. addChildAt(this._bgColorSheet, 0);
  6769. this._buttons["background"] = _local1;
  6770. addChild(_local1);
  6771. this._height = _local1.height;
  6772. player.config.pluginConfig("controlbar")["size"] = _local1.height;
  6773. if (_local2){
  6774. this._buttons["capLeft"] = _local2;
  6775. addChild(_local2);
  6776. };
  6777. if (_local3){
  6778. this._buttons["capRight"] = _local3;
  6779. addChild(_local3);
  6780. };
  6781. }
  6782. private function setupDefaultButtons():void{
  6783. this.addComponentButton("play", ViewEvent.JWPLAYER_VIEW_PLAY);
  6784. this.addComponentButton("pause", ViewEvent.JWPLAYER_VIEW_PAUSE);
  6785. this.addComponentButton("prev", ViewEvent.JWPLAYER_VIEW_PREV);
  6786. this.addComponentButton("next", ViewEvent.JWPLAYER_VIEW_NEXT);
  6787. this.addComponentButton("stop", ViewEvent.JWPLAYER_VIEW_STOP);
  6788. this.addComponentButton("fullscreen", ViewEvent.JWPLAYER_VIEW_FULLSCREEN, true);
  6789. this.addComponentButton("normalscreen", ViewEvent.JWPLAYER_VIEW_FULLSCREEN, false);
  6790. this.addComponentButton("unmute", ViewEvent.JWPLAYER_VIEW_MUTE, false);
  6791. this.addComponentButton("mute", ViewEvent.JWPLAYER_VIEW_MUTE, true);
  6792. this.addTextField("elapsed");
  6793. this.addTextField("duration");
  6794. this.addSlider("time", ViewEvent.JWPLAYER_VIEW_CLICK, this.seekHandler);
  6795. this._timeSlider = this.getSlider("time");
  6796. this.addSlider("volume", ViewEvent.JWPLAYER_VIEW_CLICK, this.volumeHandler);
  6797. this._volSlider = this.getSlider("volume");
  6798. }
  6799. private function addComponentButton(_arg1:string, _arg2:string, _arg3=null):void{
  6800. var name:* = _arg1;
  6801. var event:* = _arg2;
  6802. var eventData = _arg3;
  6803. var button:* = new ComponentButton();
  6804. button.name = name;
  6805. button.setOutIcon(getSkinElement((name + "Button")));
  6806. button.setOverIcon(getSkinElement((name + "ButtonOver")));
  6807. button.setBackground(getSkinElement((name + "ButtonBack")));
  6808. button.clickFunction = function ():void{
  6809. forward(new ViewEvent(event, eventData));
  6810. };
  6811. if (((((getSkinElement((name + "Button"))) || (getSkinElement((name + "ButtonOver"))))) || (getSkinElement((name + "ButtonBack"))))){
  6812. button.init();
  6813. this.addButtonDisplayObject(button, name);
  6814. };
  6815. }
  6816. private function addSlider(_arg1:string, _arg2:string, _arg3:function, _arg4:number=0):void{
  6817. var slider:* = null;
  6818. var name:* = _arg1;
  6819. var event:* = _arg2;
  6820. var callback:* = _arg3;
  6821. var margin:int = _arg4;
  6822. try {
  6823. slider = new Slider(getSkinElement((name + "SliderRail")), getSkinElement((name + "SliderBuffer")), getSkinElement((name + "SliderProgress")), getSkinElement((name + "SliderThumb")), getSkinElement((name + "SliderCapLeft")), getSkinElement((name + "SliderCapRight")));
  6824. slider.addEventListener(event, callback);
  6825. slider.name = name;
  6826. slider.tabenabled = false;
  6827. this._buttons[name] = slider;
  6828. } catch(e:error) {
  6829. Logger.log((("Could not create " + name) + "slider"));
  6830. };
  6831. }
  6832. private function addTextField(_arg1:string):void{
  6833. var _local2:textformat = new textformat();
  6834. if (fontColor){
  6835. _local2.color = fontColor.color;
  6836. } else {
  6837. if (_player.config.frontcolor){
  6838. _local2.color = _player.config.frontcolor.color;
  6839. };
  6840. };
  6841. _local2.size = ((fontSize) ? fontSize : 10);
  6842. _local2.font = ((fontFace) ? fontFace : "_sans");
  6843. _local2.bold = ((!(fontWeight)) || ((fontWeight == "bold")));
  6844. _local2.italic = ((fontStyle) && ((fontStyle == "italic")));
  6845. var _local3:textfield = new textfield();
  6846. _local3.defaultTextFormat = _local2;
  6847. _local3.selectable = false;
  6848. _local3.autosize = TextFieldAutoSize.left;
  6849. _local3.name = "text";
  6850. var _local4:Sprite = new Sprite();
  6851. _local4.name = _arg1;
  6852. var _local5:DisplayObject = getSkinElement((_arg1 + "Background"));
  6853. if (_local5){
  6854. _local5.name = "back";
  6855. _local5.x = (_local5.y = 0);
  6856. _local4.addChild(_local5);
  6857. };
  6858. _local4.addChild(_local3);
  6859. addChild(_local4);
  6860. this._buttons[_arg1] = _local4;
  6861. }
  6862. private function forward(_arg1:ViewEvent):void{
  6863. dispatchEvent(_arg1);
  6864. }
  6865. private function volumeHandler(_arg1:ViewEvent):void{
  6866. var _local3:MediaEvent;
  6867. var _local2:number = math.round((_arg1.data * 100));
  6868. if (!_player.locked){
  6869. _local3 = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME);
  6870. _local3.volume = _local2;
  6871. this.updateVolumeSlider(_local3);
  6872. };
  6873. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_VOLUME, _local2));
  6874. }
  6875. private function seekHandler(_arg1:ViewEvent):void{
  6876. var _local2:number = 0;
  6877. try {
  6878. _local2 = player.playlist.currentItem.duration;
  6879. } catch(err:error) {
  6880. };
  6881. var _local3:number = math.round((_local2 * _arg1.data));
  6882. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_SEEK, _local3));
  6883. }
  6884. private function addButtonDisplayObject(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
  6885. var _local5:movieclip;
  6886. var _local4:AccessibilityProperties = new AccessibilityProperties();
  6887. _local4.name = _arg2;
  6888. if ((_arg1 is ComponentButton)){
  6889. _arg1.name = _arg2;
  6890. this._buttons[_arg2] = _arg1;
  6891. _arg1.accessibilityProperties = _local4;
  6892. return ((_arg1 as ComponentButton));
  6893. };
  6894. if (_arg1){
  6895. _local5 = new movieclip();
  6896. if (_arg3 != null){
  6897. _local5.addEventListener(MouseEvent.CLICK, _arg3);
  6898. };
  6899. _local5.name = _arg2;
  6900. _local5.accessibilityProperties = _local4;
  6901. _local5.addChild(_arg1);
  6902. this._buttons[_arg2] = _local5;
  6903. return (_local5);
  6904. };
  6905. return (null);
  6906. }
  6907. protected function get buttonColor():color{
  6908. return (((getConfigParam("buttoncolor")) ? new color(string(getConfigParam("buttoncolor"))) : null));
  6909. }
  6910. public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
  6911. var _local6:Sprite;
  6912. var _local7:DisplayObject;
  6913. var _local8:number;
  6914. var _local9:ColorTransform;
  6915. if (this._customButtons.indexof(_arg2) < 0){
  6916. this._customButtons.push(_arg2);
  6917. };
  6918. if (this._removedButtons.indexof(_arg2) >= 0){
  6919. this._removedButtons.splice(this._removedButtons.indexof(_arg2), 1);
  6920. };
  6921. _arg1.x = (_arg1.y = 0);
  6922. var _local4:ComponentButton = new ComponentButton();
  6923. _local4.name = _arg2;
  6924. _local4.clickFunction = _arg3;
  6925. var _local5:DisplayObject = getSkinElement("blankButton");
  6926. if (_local5){
  6927. _local6 = new Sprite();
  6928. _local7 = _arg1;
  6929. if (((this.buttonColor) || (_player.config.frontcolor))){
  6930. _local9 = new ColorTransform();
  6931. _local9.color = ((this.buttonColor) ? this.buttonColor.color : _player.config.frontcolor.color);
  6932. _local7.transform.colorTransform = _local9;
  6933. };
  6934. _local8 = math.round(((_local5.height - _local7.height) / 2));
  6935. _local5.width = (_local7.width + (2 * _local8));
  6936. _local6.addChild(_local5);
  6937. _local6.addChild(_local7);
  6938. _local7.x = (_local7.y = _local8);
  6939. _local4.setOutIcon(_local6);
  6940. _local4.init();
  6941. return (this.addButtonDisplayObject(_local4, _arg2));
  6942. };
  6943. return (null);
  6944. }
  6945. public function removeButton(_arg1:string):void{
  6946. if ((((this._buttons[_arg1] is DisplayObject)) && (this.contains((this._buttons[_arg1] as DisplayObject))))){
  6947. removeChild(this._buttons[_arg1]);
  6948. this._buttons[_arg1] = null;
  6949. this._defaultLayout = this.removeButtonFromLayout(_arg1, this._defaultLayout);
  6950. this._currentLayout = this.removeButtonFromLayout(_arg1, this._currentLayout);
  6951. if (this._removedButtons.indexof(_arg1) < 0){
  6952. this._removedButtons.push(_arg1);
  6953. };
  6954. this.redraw();
  6955. };
  6956. }
  6957. private function hideButton(_arg1:string):void{
  6958. if (this._buttons[_arg1]){
  6959. this._buttons[_arg1].visible = false;
  6960. };
  6961. }
  6962. public function getButton(_arg1:string):DisplayObject{
  6963. var _local2:object;
  6964. var _local3:DisplayObject;
  6965. if (this._dividerElements[_arg1]){
  6966. _local2 = this._dividerElements[_arg1];
  6967. if (_local2.index >= _local2.copies.length){
  6968. _local2.copies.push(getSkinElement(_arg1));
  6969. };
  6970. _local3 = (_local2.copies[_local2.index++] as DisplayObject);
  6971. return (_local3);
  6972. };
  6973. return (this._buttons[_arg1]);
  6974. }
  6975. private function getTextField(_arg1:string):textfield{
  6976. var _local2:Sprite = (this.getButton(_arg1) as Sprite);
  6977. if (_local2){
  6978. return ((_local2.getChildByName("text") as textfield));
  6979. };
  6980. return (null);
  6981. }
  6982. public function getSlider(_arg1:string):Slider{
  6983. return ((this.getButton(_arg1) as Slider));
  6984. }
  6985. override public function resize(_arg1:number, _arg2:number):void{
  6986. var _local4:number;
  6987. if (getConfigParam("position") == "none"){
  6988. visible = false;
  6989. return;
  6990. };
  6991. this._width = _arg1;
  6992. if ((((getConfigParam("position") == "over")) || ((_player.config.fullscreen == true)))){
  6993. _local4 = (((getConfigParam("margin") == null)) ? 0 : getConfigParam("margin"));
  6994. x = (_local4 + player.config.pluginConfig("display")["x"]);
  6995. y = (((_arg2 - this.background.height) - _local4) + player.config.pluginConfig("display")["y"]);
  6996. this._width = (_arg1 - (2 * _local4));
  6997. };
  6998. var _local3:number = this._width;
  6999. _local3 = (_local3 - this.capLeft.width);
  7000. this.capLeft.x = 0;
  7001. _local3 = (_local3 - this.capRight.width);
  7002. this.capRight.x = (this._width - this.capRight.width);
  7003. this.background.width = _local3;
  7004. this.background.x = this.capLeft.width;
  7005. setChildIndex(this.capLeft, (numChildren - 1));
  7006. setChildIndex(this.capRight, (numChildren - 1));
  7007. this._bgColorSheet.width = this._width;
  7008. this._bgColorSheet.height = this.background.height;
  7009. if (_fullscreen != _player.config.fullscreen){
  7010. _fullscreen = _player.config.fullscreen;
  7011. _sentShow = false;
  7012. this.stopFader();
  7013. };
  7014. if (!_fullscreen){
  7015. mouse.show();
  7016. };
  7017. if (((visible) && ((alpha > 0)))){
  7018. sendShow();
  7019. };
  7020. this.stateHandler();
  7021. this.redraw();
  7022. }
  7023. private function redraw():void{
  7024. if (((!(_player.config.fullscreen)) && ((_player.config.height <= 40)))){
  7025. this._currentLayout = this._currentLayout.replace("fullscreen", "");
  7026. };
  7027. this.clearDividers();
  7028. this.alignTextFields();
  7029. this._layoutManager.resize(this._width, this._height);
  7030. }
  7031. private function clearDividers():void{
  7032. var _local1:object;
  7033. var _local2:number;
  7034. var _local3:DisplayObject;
  7035. for each (_local1 in this._dividerElements) {
  7036. _local1.index = 0;
  7037. _local2 = 0;
  7038. while (_local2 < _local1.copies.length) {
  7039. _local3 = (_local1.copies[_local2] as DisplayObject);
  7040. if (((_local3) && (_local3.parent))){
  7041. _local3.parent.removeChild(_local3);
  7042. };
  7043. _local2++;
  7044. };
  7045. };
  7046. }
  7047. private function alignTextFields():void{
  7048. var _local1:string;
  7049. var _local2:Sprite;
  7050. var _local3:DisplayObject;
  7051. var _local4:DisplayObject;
  7052. for each (_local1 in ["elapsed", "duration"]) {
  7053. _local2 = (this.getButton(_local1) as Sprite);
  7054. _local2.tabenabled = false;
  7055. _local2.buttonMode = false;
  7056. _local3 = _local2.getChildByName("text");
  7057. _local4 = _local2.getChildByName("back");
  7058. if (((_local3) && (_local4))){
  7059. if (_local3.width > _local4.width){
  7060. _local3.x = 0;
  7061. _local4.x = ((_local3.width - _local4.width) / 2);
  7062. } else {
  7063. _local4.x = 0;
  7064. _local3.x = ((_local4.width - _local3.width) / 2);
  7065. };
  7066. if (_local3.height > _local4.height){
  7067. _local3.y = 0;
  7068. _local4.y = ((_local3.height - _local4.height) / 2);
  7069. } else {
  7070. _local4.y = 0;
  7071. _local3.y = ((_local4.height - _local3.height) / 2);
  7072. };
  7073. };
  7074. };
  7075. }
  7076. public function get layout():string{
  7077. return (this._currentLayout.replace(/\|/g, "<divider>"));
  7078. }
  7079. override public function show():void{
  7080. if (((!((getConfigParam("position") == "none"))) && (_hiding))){
  7081. _hiding = false;
  7082. this.visible = true;
  7083. sendShow();
  7084. };
  7085. }
  7086. override public function hide():void{
  7087. if (((!((getConfigParam("position") == "none"))) && (!(_hiding)))){
  7088. _hiding = true;
  7089. this.visible = false;
  7090. sendHide();
  7091. };
  7092. }
  7093. private function get background():DisplayObject{
  7094. if (this._buttons["background"]){
  7095. return (this._buttons["background"]);
  7096. };
  7097. return (new Sprite());
  7098. }
  7099. private function get capLeft():DisplayObject{
  7100. if (this._buttons["capLeft"]){
  7101. return (this._buttons["capLeft"]);
  7102. };
  7103. return (new Sprite());
  7104. }
  7105. private function get capRight():DisplayObject{
  7106. if (this._buttons["capRight"]){
  7107. return (this._buttons["capRight"]);
  7108. };
  7109. return (new Sprite());
  7110. }
  7111.  
  7112. }
  7113. }//package com.longtailvideo.jwplayer.view.components
  7114. package com.longtailvideo.jwplayer.view {
  7115. import com.longtailvideo.jwplayer.plugins.*;
  7116. import com.longtailvideo.jwplayer.player.*;
  7117. import flash.geom.*;
  7118.  
  7119. public class PlayerLayoutManager {
  7120.  
  7121. public static var left:string = "left";
  7122. public static var right:string = "right";
  7123. public static var TOP:string = "top";
  7124. public static var BOTTOM:string = "bottom";
  7125. public static var NONE:string = "none";
  7126.  
  7127. private var _player:IPlayer;
  7128. private var toLayout:array;
  7129. private var noLayout:array;
  7130. private var remainingSpace:Rectangle;
  7131.  
  7132. public function PlayerLayoutManager(_arg1:IPlayer){
  7133. this._player = _arg1;
  7134. }
  7135. public static function testPosition(_arg1:string):string{
  7136. if (!_arg1){
  7137. return ("");
  7138. };
  7139. switch (_arg1.tolowercase()){
  7140. case left:
  7141. case right:
  7142. case TOP:
  7143. case BOTTOM:
  7144. return (_arg1.tolowercase());
  7145. default:
  7146. return ("");
  7147. };
  7148. }
  7149.  
  7150. public function resize(_arg1:number, _arg2:number):void{
  7151. var _local3:string;
  7152. this.toLayout = [];
  7153. this.noLayout = [];
  7154. this.remainingSpace = new Rectangle(0, 0, _arg1, _arg2);
  7155. for each (_local3 in this._player.config.pluginIds) {
  7156. this.addLayout(_local3);
  7157. };
  7158. this.addLayout("playlist");
  7159. this.addLayout("controlbar");
  7160. this.addLayout("display");
  7161. this.addLayout("dock");
  7162. this.generateLayout();
  7163. }
  7164. private function pluginSize(_arg1:PluginConfig):number{
  7165. var _local2:string = string(_arg1["size"]);
  7166. var _local3:string = _arg1["position"];
  7167. if (!isnan(_arg1["size"])){
  7168. return (number(_arg1["size"]));
  7169. };
  7170. if (_local2.indexof("%") == (_local2.length - 1)){
  7171. _local2 = _local2.substr(0, (_local2.length - 1));
  7172. } else {
  7173. if (_local2.indexof("pct") == (_local2.length - 3)){
  7174. _local2 = _local2.substr(0, (_local2.length - 3));
  7175. } else {
  7176. return (0);
  7177. };
  7178. };
  7179. if ((((_local3 == left)) || ((_local3 == right)))){
  7180. return (((this.remainingSpace.width * number(_local2)) / 100));
  7181. };
  7182. return (((this.remainingSpace.height * number(_local2)) / 100));
  7183. }
  7184. private function addLayout(_arg1:string):void{
  7185. var _local2:PluginConfig = this._player.config.pluginConfig(_arg1);
  7186. if (((((!(this._player.config.fullscreen)) && (testPosition(_local2["position"])))) && ((this.pluginSize(_local2) > 0)))){
  7187. this.toLayout.push(_local2);
  7188. } else {
  7189. this.noLayout.push(_local2);
  7190. };
  7191. }
  7192. private function fitsLayout(_arg1:PluginConfig):boolean{
  7193. var _local2:PluginConfig;
  7194. var _local3:PluginConfig;
  7195. switch (testPosition(_arg1["position"])){
  7196. case BOTTOM:
  7197. case TOP:
  7198. _local2 = this._player.config.pluginConfig("controlbar");
  7199. if (((!((_arg1["id"] == "controlbar"))) && ((((testPosition(_local2["position"]) == TOP)) || ((testPosition(_local2["position"]) == BOTTOM)))))){
  7200. return ((((this.remainingSpace.height - this.pluginSize(_local2)) > this.pluginSize(_arg1)) > 0));
  7201. };
  7202. return (((this.remainingSpace.height > this.pluginSize(_arg1)) > 0));
  7203. case left:
  7204. case right:
  7205. _local3 = this._player.config.pluginConfig("playlist");
  7206. if (((!((_arg1["id"] == "playlist"))) && ((((testPosition(_local3["position"]) == left)) || ((testPosition(_local3["position"]) == right)))))){
  7207. return ((((this.remainingSpace.width - this.pluginSize(_local3)) > this.pluginSize(_arg1)) > 0));
  7208. };
  7209. return (((this.remainingSpace.width > this.pluginSize(_arg1)) > 0));
  7210. };
  7211. return (false);
  7212. }
  7213. protected function generateLayout():void{
  7214. var _local4:PluginConfig;
  7215. if (this.toLayout.length == 0){
  7216. for each (_local4 in this.noLayout) {
  7217. _local4["visible"] = !(((this._player.config.fullscreen) && (testPosition(_local4["position"]))));
  7218. this.assignSpace(_local4, this.remainingSpace);
  7219. };
  7220. this._player.config.width = this.remainingSpace.width;
  7221. this._player.config.height = this.remainingSpace.height;
  7222. return;
  7223. };
  7224. var _local1:PluginConfig = (this.toLayout.shift() as PluginConfig);
  7225. var _local2:Rectangle = new Rectangle();
  7226. var _local3:number = this.pluginSize(_local1);
  7227. if (this.fitsLayout(_local1)){
  7228. switch (testPosition(_local1["position"])){
  7229. case left:
  7230. _local2.x = this.remainingSpace.x;
  7231. _local2.y = this.remainingSpace.y;
  7232. _local2.width = _local3;
  7233. _local2.height = this.remainingSpace.height;
  7234. this.remainingSpace.width = (this.remainingSpace.width - _local3);
  7235. this.remainingSpace.x = (this.remainingSpace.x + _local3);
  7236. break;
  7237. case right:
  7238. _local2.x = ((this.remainingSpace.x + this.remainingSpace.width) - _local3);
  7239. _local2.y = this.remainingSpace.y;
  7240. _local2.width = _local3;
  7241. _local2.height = this.remainingSpace.height;
  7242. this.remainingSpace.width = (this.remainingSpace.width - _local3);
  7243. break;
  7244. case TOP:
  7245. _local2.x = this.remainingSpace.x;
  7246. _local2.y = this.remainingSpace.y;
  7247. _local2.width = this.remainingSpace.width;
  7248. _local2.height = _local3;
  7249. this.remainingSpace.height = (this.remainingSpace.height - _local3);
  7250. this.remainingSpace.y = (this.remainingSpace.y + _local3);
  7251. break;
  7252. case BOTTOM:
  7253. _local2.x = this.remainingSpace.x;
  7254. _local2.y = ((this.remainingSpace.y + this.remainingSpace.height) - _local3);
  7255. _local2.width = this.remainingSpace.width;
  7256. _local2.height = _local3;
  7257. this.remainingSpace.height = (this.remainingSpace.height - _local3);
  7258. break;
  7259. };
  7260. _local1["visible"] = true;
  7261. this.assignSpace(_local1, _local2);
  7262. } else {
  7263. this.noLayout.push(_local1);
  7264. };
  7265. this.generateLayout();
  7266. }
  7267. protected function assignSpace(_arg1:PluginConfig, _arg2:Rectangle):void{
  7268. _arg1["width"] = _arg2.width;
  7269. _arg1["height"] = _arg2.height;
  7270. _arg1["x"] = _arg2.x;
  7271. _arg1["y"] = _arg2.y;
  7272. }
  7273.  
  7274. }
  7275. }//package com.longtailvideo.jwplayer.view
  7276. package com.longtailvideo.jwplayer.view {
  7277. import flash.events.*;
  7278. import com.longtailvideo.jwplayer.events.*;
  7279. import flash.display.*;
  7280. import com.longtailvideo.jwplayer.player.*;
  7281. import flash.ui.*;
  7282. import flash.net.*;
  7283. import com.longtailvideo.jwplayer.utils.*;
  7284. import flash.system.*;
  7285.  
  7286. public class RightclickMenu extends GlobalEventDispatcher {
  7287.  
  7288. protected var _player:IPlayer;
  7289. protected var context:contextmenu;
  7290. protected var about:contextmenuitem;
  7291. protected var debug:contextmenuitem;
  7292. protected var fullscreen:contextmenuitem;
  7293. protected var stretching:contextmenuitem;
  7294.  
  7295. public function RightclickMenu(_arg1:IPlayer, _arg2:movieclip){
  7296. this._player = _arg1;
  7297. this.context = new contextmenu();
  7298. this.context.hidebuiltinitems();
  7299. _arg2.contextmenu = this.context;
  7300. this.initializeMenu();
  7301. }
  7302. protected function addItem(_arg1:contextmenuitem, _arg2:function):void{
  7303. _arg1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, _arg2);
  7304. _arg1.separatorbefore = true;
  7305. this.context.customitems.push(_arg1);
  7306. }
  7307. public function initializeMenu():void{
  7308. this.setAboutText();
  7309. this.addItem(this.about, this.aboutHandler);
  7310. try {
  7311. this.fullscreen = new contextmenuitem("Toggle Fullscreen...");
  7312. this.addItem(this.fullscreen, this.fullscreenHandler);
  7313. } catch(err:error) {
  7314. };
  7315. this.stretching = new contextmenuitem((("Stretching is " + this._player.config.stretching) + "..."));
  7316. this.addItem(this.stretching, this.stretchHandler);
  7317. if ((((capabilities.isdebugger == true)) || (!((this._player.config.debug == Logger.NONE))))){
  7318. this.debug = new contextmenuitem((("Logging to " + this._player.config.debug) + "..."));
  7319. this.addItem(this.debug, this.debugHandler);
  7320. };
  7321. }
  7322. protected function setAboutText():void{
  7323. this.about = new contextmenuitem((("About JW Player " + this._player.version) + "..."));
  7324. }
  7325. protected function aboutHandler(_arg1:ContextMenuEvent):void{
  7326. navigateToURL(new URLRequest("http://www.longtailvideo.com/players/jw-flv-player"), "_top");
  7327. }
  7328. protected function debugHandler(_arg1:ContextMenuEvent):void{
  7329. var _local2:array = new array(Logger.NONE, Logger.ARTHROPOD, Logger.CONSOLE, Logger.trace);
  7330. var _local3:number = _local2.indexof(this._player.config.debug);
  7331. _local3 = ((_local3)==(_local2.length - 1)) ? 0 : (_local3 + 1);
  7332. this.debug.caption = (("Logging to " + _local2[_local3]) + "...");
  7333. this.setCookie("debug", _local2[_local3]);
  7334. this._player.config.debug = _local2[_local3];
  7335. }
  7336. protected function fullscreenHandler(_arg1:ContextMenuEvent):void{
  7337. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, !(this._player.config.fullscreen)));
  7338. }
  7339. protected function stretchHandler(_arg1:ContextMenuEvent):void{
  7340. var _local2:array = new array(Stretcher.UNIFORM, Stretcher.FILL, Stretcher.EXACTFIT, Stretcher.NONE);
  7341. var _local3:number = _local2.indexof(this._player.config.stretching);
  7342. if ((_local3 == (_local2.length - 1))){
  7343. _local3 = 0;
  7344. } else {
  7345. _local3++;
  7346. };
  7347. this._player.config.stretching = _local2[_local3];
  7348. this.stretching.caption = (("Stretching is " + _local2[_local3]) + "...");
  7349. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_REDRAW));
  7350. }
  7351. protected function setCookie(_arg1:string, _arg2):void{
  7352. Configger.saveCookie(_arg1, _arg2);
  7353. }
  7354.  
  7355. }
  7356. }//package com.longtailvideo.jwplayer.view
  7357. package com.longtailvideo.jwplayer.view.interfaces {
  7358. import flash.events.*;
  7359. import flash.display.*;
  7360. import com.longtailvideo.jwplayer.view.skins.*;
  7361.  
  7362. public interface ISkin extends IEventDispatcher {
  7363.  
  7364. function load(_arg1:string=null):void;
  7365. function hasComponent(_arg1:string):boolean;
  7366. function getSkinElement(_arg1:string, _arg2:string):DisplayObject;
  7367. function getSWFSkin():Sprite;
  7368. function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void;
  7369. function getSkinProperties():SkinProperties;
  7370.  
  7371. }
  7372. }//package com.longtailvideo.jwplayer.view.interfaces
  7373. package com.longtailvideo.jwplayer.view.interfaces {
  7374. import flash.display.*;
  7375.  
  7376. public interface IDockComponent extends IPlayerComponent {
  7377.  
  7378. function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function, _arg4:string=null):movieclip;
  7379. function removeButton(_arg1:string):void;
  7380. function setButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void;
  7381.  
  7382. }
  7383. }//package com.longtailvideo.jwplayer.view.interfaces
  7384. package com.longtailvideo.jwplayer.view.interfaces {
  7385.  
  7386. public interface IPlaylistComponent extends IPlayerComponent {
  7387.  
  7388. }
  7389. }//package com.longtailvideo.jwplayer.view.interfaces
  7390. package com.longtailvideo.jwplayer.view.interfaces {
  7391. import flash.display.*;
  7392.  
  7393. public interface IDisplayComponent extends IPlayerComponent {
  7394.  
  7395. function setIcon(_arg1:DisplayObject):void;
  7396. function setText(_arg1:string):void;
  7397.  
  7398. }
  7399. }//package com.longtailvideo.jwplayer.view.interfaces
  7400. package com.longtailvideo.jwplayer.view.interfaces {
  7401. import flash.display.*;
  7402.  
  7403. public interface IControlbarComponent extends IPlayerComponent {
  7404.  
  7405. function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip;
  7406. function removeButton(_arg1:string):void;
  7407. function getButton(_arg1:string):DisplayObject;
  7408.  
  7409. }
  7410. }//package com.longtailvideo.jwplayer.view.interfaces
  7411. package com.longtailvideo.jwplayer.view.interfaces {
  7412. import com.longtailvideo.jwplayer.events.*;
  7413.  
  7414. public interface IPlayerComponent extends IGlobalEventDispatcher {
  7415.  
  7416. function resize(_arg1:number, _arg2:number):void;
  7417. function get height():number;
  7418. function get width():number;
  7419. function get x():number;
  7420. function set x(_arg1:number):void;
  7421. function get y():number;
  7422. function set y(_arg1:number):void;
  7423. function show():void;
  7424. function hide():void;
  7425.  
  7426. }
  7427. }//package com.longtailvideo.jwplayer.view.interfaces
  7428. package com.longtailvideo.jwplayer.view {
  7429. import com.longtailvideo.jwplayer.model.*;
  7430. import com.longtailvideo.jwplayer.view.interfaces.*;
  7431. import com.longtailvideo.jwplayer.plugins.*;
  7432. import com.longtailvideo.jwplayer.view.skins.*;
  7433. import com.longtailvideo.jwplayer.player.*;
  7434. import com.longtailvideo.jwplayer.view.components.*;
  7435.  
  7436. public class PlayerComponents implements IPlayerComponents {
  7437.  
  7438. private var _controlbar:IControlbarComponent;
  7439. private var _display:IDisplayComponent;
  7440. private var _dock:IDockComponent;
  7441. private var _playlist:IPlaylistComponent;
  7442. private var _config:PlayerConfig;
  7443. private var _skin:ISkin;
  7444. private var _player:IPlayer;
  7445.  
  7446. public function PlayerComponents(_arg1:IPlayer){
  7447. this._player = _arg1;
  7448. this._skin = _arg1.skin;
  7449. this._config = _arg1.config;
  7450. if ((this._skin is SWFSkin)){
  7451. this._controlbar = new ControlbarComponentV4(this._player);
  7452. } else {
  7453. this._controlbar = new ControlbarComponent(this._player);
  7454. };
  7455. this._display = new DisplayComponent(this._player);
  7456. this._playlist = new PlaylistComponent(this._player);
  7457. this._dock = new DockComponent(this._player);
  7458. }
  7459. public function get controlbar():IControlbarComponent{
  7460. return (this._controlbar);
  7461. }
  7462. public function get display():IDisplayComponent{
  7463. return (this._display);
  7464. }
  7465. public function get dock():IDockComponent{
  7466. return (this._dock);
  7467. }
  7468. public function get playlist():IPlaylistComponent{
  7469. return (this._playlist);
  7470. }
  7471. public function resize(_arg1:number, _arg2:number):void{
  7472. this.resizeComponent(this._display, this._config.pluginConfig("display"));
  7473. this.resizeComponent(this._controlbar, this._config.pluginConfig("controlbar"));
  7474. this.resizeComponent(this._playlist, this._config.pluginConfig("playlist"));
  7475. this.resizeComponent(this._dock, this._config.pluginConfig("dock"));
  7476. }
  7477. private function resizeComponent(_arg1:IPlayerComponent, _arg2:PluginConfig):void{
  7478. _arg1.x = _arg2["x"];
  7479. _arg1.y = _arg2["y"];
  7480. _arg1.resize(_arg2["width"], _arg2["height"]);
  7481. }
  7482.  
  7483. }
  7484. }//package com.longtailvideo.jwplayer.view
  7485. package com.longtailvideo.jwplayer.view {
  7486. import com.longtailvideo.jwplayer.model.*;
  7487. import com.longtailvideo.jwplayer.view.interfaces.*;
  7488. import com.longtailvideo.jwplayer.plugins.*;
  7489. import flash.events.*;
  7490. import com.longtailvideo.jwplayer.events.*;
  7491. import flash.display.*;
  7492. import com.longtailvideo.jwplayer.player.*;
  7493. import flash.geom.*;
  7494. import flash.utils.*;
  7495. import flash.net.*;
  7496. import flash.text.*;
  7497. import com.longtailvideo.jwplayer.utils.*;
  7498. import flash.system.*;
  7499. import flash.external.*;
  7500.  
  7501. public class View extends GlobalEventDispatcher {
  7502.  
  7503. protected var _player:IPlayer;
  7504. protected var _model:Model;
  7505. protected var _skin:ISkin;
  7506. protected var _components:IPlayerComponents;
  7507. protected var _fullscreen:boolean = false;
  7508. protected var _preserveAspect:boolean = false;
  7509. protected var _normalScreen:Rectangle;
  7510. protected var stage:stage;
  7511. protected var _root:movieclip;
  7512. protected var _maskedLayers:movieclip;
  7513. protected var _backgroundLayer:movieclip;
  7514. protected var _mediaLayer:movieclip;
  7515. protected var _imageLayer:movieclip;
  7516. protected var _componentsLayer:movieclip;
  7517. protected var _pluginsLayer:movieclip;
  7518. protected var _plugins:object;
  7519. protected var _displayMasker:movieclip;
  7520. protected var _image:Loader;
  7521. protected var _logo:Logo;
  7522. protected var layoutManager:PlayerLayoutManager;
  7523. protected var LoadingScreen:class;
  7524. protected var ErrorScreen:class;
  7525. protected var loaderScreen:Sprite;
  7526. protected var loaderAnim:DisplayObject;
  7527. protected var currentLayer:number = 0;
  7528. protected var firstIndex:number = -1;
  7529. protected var nextLastIndex:number = -1;
  7530. protected var lastIndex:number = -1;
  7531. private var imageDelay:Timer;
  7532. private var mediaDelay:Timer;
  7533. private var _lastImage:string;
  7534.  
  7535. public function View(_arg1:IPlayer, _arg2:Model){
  7536. this.LoadingScreen = View_LoadingScreen;
  7537. this.ErrorScreen = View_ErrorScreen;
  7538. this.imageDelay = new Timer(100, 1);
  7539. this.mediaDelay = new Timer(100, 1);
  7540. super();
  7541. this._player = _arg1;
  7542. this._model = _arg2;
  7543. RootReference.stage.scalemode = StageScaleMode.NO_SCALE;
  7544. RootReference.stage.stage.align = StageAlign.TOP_LEFT;
  7545. this.loaderScreen = new Sprite();
  7546. this.loaderScreen.name = "loaderScreen";
  7547. this.loaderAnim = (new this.LoadingScreen() as DisplayObject);
  7548. this.loaderAnim.alpha = 0.8;
  7549. this.loaderAnim.visible = false;
  7550. this.loaderScreen.addChild(this.loaderAnim);
  7551. RootReference.stage.addChildAt(this.loaderScreen, 0);
  7552. if (RootReference.stage.stageWidth > 0){
  7553. this.resizeStage();
  7554. } else {
  7555. RootReference.stage.addEventListener(Event.RESIZE, this.resizeStage);
  7556. RootReference.stage.addEventListener(Event.ADDED_TO_STAGE, this.resizeStage);
  7557. };
  7558. this._root = new movieclip();
  7559. this._normalScreen = new Rectangle();
  7560. }
  7561. protected function resizeStage(_arg1:Event=null):void{
  7562. var evt = _arg1;
  7563. try {
  7564. RootReference.stage.removeEventListener(Event.RESIZE, this.resizeStage);
  7565. RootReference.stage.removeEventListener(Event.ADDED_TO_STAGE, this.resizeStage);
  7566. } catch(err:error) {
  7567. Logger.log(("Can't add stage resize handlers: " + err.message));
  7568. };
  7569. this.loaderScreen.graphics.clear();
  7570. this.loaderScreen.graphics.beginfill(0, 0);
  7571. this.loaderScreen.graphics.drawRect(0, 0, RootReference.stage.stageWidth, RootReference.stage.stageHeight);
  7572. this.loaderScreen.graphics.endfill();
  7573. this.loaderAnim.x = ((RootReference.stage.stageWidth - this.loaderAnim.width) / 2);
  7574. this.loaderAnim.y = ((RootReference.stage.stageHeight - this.loaderAnim.height) / 2);
  7575. }
  7576. public function get skin():ISkin{
  7577. return (this._skin);
  7578. }
  7579. public function set skin(_arg1:ISkin):void{
  7580. this._skin = _arg1;
  7581. }
  7582. public function setupView():void{
  7583. RootReference.stage.addChildAt(this._root, 0);
  7584. this._root.visible = false;
  7585. this.setupLayers();
  7586. this.setupComponents();
  7587. RootReference.stage.addEventListener(Event.RESIZE, this.resizeHandler);
  7588. RootReference.stage.addEventListener(FocusEvent.FOCUS_OUT, this.keyFocusOutHandler);
  7589. RootReference.stage.addEventListener(FocusEvent.FOCUS_IN, this.keyFocusInHandler);
  7590. this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_LOADED, this.mediaLoaded);
  7591. this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
  7592. this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.itemHandler);
  7593. this._model.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
  7594. this.layoutManager = new PlayerLayoutManager(this._player);
  7595. this.setupRightClick();
  7596. this.redraw();
  7597. }
  7598. protected function keyFocusOutHandler(_arg1:FocusEvent):void{
  7599. var _local2:Sprite = (_arg1.target as Sprite);
  7600. if (!_local2){
  7601. return;
  7602. };
  7603. this.lastIndex = this.nextLastIndex;
  7604. this.nextLastIndex = _local2.tabindex;
  7605. }
  7606. protected function keyFocusInHandler(_arg1:FocusEvent):void{
  7607. var _local2:Sprite = (_arg1.target as Sprite);
  7608. if (!_local2){
  7609. return;
  7610. };
  7611. if ((((((this.firstIndex >= 0)) && ((_local2.tabindex == this.firstIndex)))) && ((this.nextLastIndex > this.lastIndex)))){
  7612. _arg1.preventDefault();
  7613. RootReference.stage.focus = null;
  7614. if (ExternalInterface.available){
  7615. ExternalInterface.call((("(function() { try { document.getElementById('" + PlayerVersion.id) + "').blur(); } catch(e) {} })"));
  7616. };
  7617. this.firstIndex = -1;
  7618. this.lastIndex = -1;
  7619. this.nextLastIndex = -1;
  7620. } else {
  7621. if (this.firstIndex < 0){
  7622. this.firstIndex = _local2.tabindex;
  7623. };
  7624. };
  7625. }
  7626. protected function setupRightClick():void{
  7627. var _local1:RightclickMenu = new RightclickMenu(this._player, this._root);
  7628. _local1.addGlobalListener(this.forward);
  7629. }
  7630. public function completeView(_arg1:boolean=false, _arg2:string=""):void{
  7631. var _local3:DisplayObject;
  7632. var _local4:textfield;
  7633. if (!_arg1){
  7634. this._root.visible = true;
  7635. this.loaderScreen.parent.removeChild(this.loaderScreen);
  7636. } else {
  7637. this.loaderScreen.removeChild(this.loaderAnim);
  7638. _local3 = (new this.ErrorScreen() as DisplayObject);
  7639. _local4 = new textfield();
  7640. _local4.defaultTextFormat = new textformat("_sans", 12, 0xFFFFFF);
  7641. _local4.text = _arg2;
  7642. _local4.width = (this.loaderScreen.width - 60);
  7643. _local4.wordwrap = true;
  7644. _local4.height = (_local4.textheight + 10);
  7645. _local3.x = ((this.loaderScreen.width - _local3.width) / 2);
  7646. _local3.y = ((((this.loaderScreen.height - _local3.height) - _local4.height) - 10) / 2);
  7647. _local4.x = ((this.loaderScreen.width - _local4.width) / 2);
  7648. _local4.y = ((_local3.y + _local3.height) + 10);
  7649. this.loaderScreen.addChild(_local3);
  7650. this.loaderScreen.addChild(_local4);
  7651. };
  7652. }
  7653. protected function setupLayers():void{
  7654. this._maskedLayers = this.setupLayer("masked", this.currentLayer++);
  7655. this._backgroundLayer = this.setupLayer("background", 0, this._maskedLayers);
  7656. this.setupBackground();
  7657. this._mediaLayer = this.setupLayer("media", 1, this._maskedLayers);
  7658. this._mediaLayer.visible = false;
  7659. this._imageLayer = this.setupLayer("image", 1, this._maskedLayers);
  7660. this._image = new Loader();
  7661. this._image.contentLoaderInfo.addEventListener(Event.COMPLETE, this.imageComplete);
  7662. this._image.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.imageError);
  7663. this._imageLayer.addChild(this._image);
  7664. this.imageDelay.addEventListener(TimerEvent.TIMER_COMPLETE, this.showImage);
  7665. this.mediaDelay.addEventListener(TimerEvent.TIMER_COMPLETE, this.showMedia);
  7666. this.setupLogo();
  7667. this._componentsLayer = this.setupLayer("components", this.currentLayer++);
  7668. this._pluginsLayer = this.setupLayer("plugins", this.currentLayer++);
  7669. this._plugins = {};
  7670. }
  7671. protected function setupLogo():void{
  7672. this._logo = new Logo(this._player);
  7673. }
  7674. protected function setupLayer(_arg1:string, _arg2:number, _arg3:DisplayObjectContainer=null):movieclip{
  7675. var _local4:movieclip = new movieclip();
  7676. if (_arg3){
  7677. _arg3.addChildAt(_local4, _arg2);
  7678. } else {
  7679. this._root.addChildAt(_local4, _arg2);
  7680. };
  7681. _local4.name = _arg1;
  7682. _local4.x = 0;
  7683. _local4.y = 0;
  7684. return (_local4);
  7685. }
  7686. protected function setupBackground():void{
  7687. var _local2:color;
  7688. var _local1:movieclip = new movieclip();
  7689. _local1.name = "background";
  7690. this._backgroundLayer.addChild(_local1);
  7691. if (this._model.config.screencolor){
  7692. _local2 = this._model.config.screencolor;
  7693. } else {
  7694. if (this._model.config.pluginConfig("display").hasOwnProperty("backgroundcolor")){
  7695. _local2 = new color(string(this._model.config.pluginConfig("display")["backgroundcolor"]));
  7696. };
  7697. };
  7698. _local1.graphics.beginfill(((_local2) ? _local2.color : 0), ((_local2) ? 1 : 0));
  7699. _local1.graphics.drawRect(0, 0, 1, 1);
  7700. _local1.graphics.endfill();
  7701. }
  7702. protected function setupDisplayMask():void{
  7703. this._displayMasker = new movieclip();
  7704. this._displayMasker.graphics.beginfill(0, 1);
  7705. this._displayMasker.graphics.drawRect(0, 0, this._player.config.width, this._player.config.height);
  7706. this._displayMasker.graphics.endfill();
  7707. this._maskedLayers.mask = this._displayMasker;
  7708. }
  7709. protected function setupComponents():void{
  7710. var _local1:number = 0;
  7711. this._components = new PlayerComponents(this._player);
  7712. var _temp1 = _local1;
  7713. _local1 = (_local1 + 1);
  7714. this.setupComponent(this._components.display, _temp1);
  7715. var _temp2 = _local1;
  7716. _local1 = (_local1 + 1);
  7717. this.setupComponent(this._components.playlist, _temp2);
  7718. var _temp3 = _local1;
  7719. _local1 = (_local1 + 1);
  7720. this.setupComponent(this._logo, _temp3);
  7721. var _temp4 = _local1;
  7722. _local1 = (_local1 + 1);
  7723. this.setupComponent(this._components.controlbar, _temp4);
  7724. var _temp5 = _local1;
  7725. _local1 = (_local1 + 1);
  7726. this.setupComponent(this._components.dock, _temp5);
  7727. }
  7728. protected function setupComponent(_arg1, _arg2:number):void{
  7729. if ((_arg1 is IGlobalEventDispatcher)){
  7730. (_arg1 as IGlobalEventDispatcher).addGlobalListener(this.forward);
  7731. };
  7732. if ((_arg1 is DisplayObject)){
  7733. this._componentsLayer.addChildAt((_arg1 as DisplayObject), _arg2);
  7734. };
  7735. }
  7736. protected function resizeHandler(_arg1:Event):void{
  7737. this._fullscreen = (RootReference.stage.displayState == StageDisplayState.FULL_SCREEN);
  7738. if (this._model.fullscreen != this._fullscreen){
  7739. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this._fullscreen));
  7740. };
  7741. dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_RESIZE, {
  7742. width:RootReference.stage.stageWidth,
  7743. height:RootReference.stage.stageHeight
  7744. }));
  7745. this.redraw();
  7746. }
  7747. public function fullscreen(_arg1:boolean=true):void{
  7748. var mode:boolean = _arg1;
  7749. try {
  7750. RootReference.stage.displayState = ((mode) ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL);
  7751. } catch(e:error) {
  7752. Logger.log(("Could not enter fullscreen mode: " + e.message));
  7753. };
  7754. }
  7755. public function redraw():void{
  7756. var plug:* = null;
  7757. var plugDisplay:* = null;
  7758. var cfg:* = null;
  7759. this.layoutManager.resize(RootReference.stage.stageWidth, RootReference.stage.stageHeight);
  7760. this._components.resize(this._player.config.width, this._player.config.height);
  7761. if (!this._fullscreen){
  7762. this._normalScreen.width = this._player.config.width;
  7763. this._normalScreen.height = this._player.config.height;
  7764. };
  7765. this.resizeBackground();
  7766. this.resizeMasker();
  7767. this._imageLayer.x = (this._mediaLayer.x = this._components.display.x);
  7768. this._imageLayer.y = (this._mediaLayer.y = this._components.display.y);
  7769. if (this._preserveAspect){
  7770. if (((!(this._fullscreen)) && (!((this._player.config.stretching == Stretcher.EXACTFIT))))){
  7771. this._preserveAspect = false;
  7772. };
  7773. } else {
  7774. if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
  7775. this._preserveAspect = true;
  7776. };
  7777. };
  7778. this.resizeImage(this._player.config.width, this._player.config.height);
  7779. this.resizeMedia(this._player.config.width, this._player.config.height);
  7780. if (this._logo){
  7781. this._logo.x = this._components.display.x;
  7782. this._logo.y = this._components.display.y;
  7783. this._logo.resize(this._player.config.width, this._player.config.height);
  7784. };
  7785. var i:* = 0;
  7786. while (i < this._pluginsLayer.numChildren) {
  7787. plug = (this._pluginsLayer.getChildAt(i) as IPlugin);
  7788. plugDisplay = (plug as DisplayObject);
  7789. if (((plug) && (plugDisplay))){
  7790. cfg = this._player.config.pluginConfig(plug.id);
  7791. if (cfg["visible"]){
  7792. plugDisplay.visible = true;
  7793. plugDisplay.x = cfg["x"];
  7794. plugDisplay.y = cfg["y"];
  7795. try {
  7796. plug.resize(cfg.width, cfg.height);
  7797. } catch(e:error) {
  7798. Logger.log(((("There was an error resizing plugin '" + plug.id) + "': ") + e.message));
  7799. };
  7800. } else {
  7801. plugDisplay.visible = false;
  7802. };
  7803. };
  7804. i = (i + 1);
  7805. };
  7806. PlayerV4Emulation.getInstance(this._player).resize(this._player.config.width, this._player.config.height);
  7807. }
  7808. protected function resizeMedia(_arg1:number, _arg2:number):void{
  7809. if ((((this._mediaLayer.numChildren > 0)) && (this._model.media.display))){
  7810. if (((this._preserveAspect) && (this._model.media.stretchMedia))){
  7811. if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
  7812. this._model.media.resize(this._normalScreen.width, this._normalScreen.height);
  7813. Stretcher.stretch(this._mediaLayer, _arg1, _arg2, Stretcher.UNIFORM);
  7814. } else {
  7815. this._model.media.resize(_arg1, _arg2);
  7816. this._mediaLayer.scaleX = (this._mediaLayer.scaleY = 1);
  7817. this._mediaLayer.x = (this._mediaLayer.y = 0);
  7818. };
  7819. } else {
  7820. this._model.media.resize(_arg1, _arg2);
  7821. this._mediaLayer.x = (this._mediaLayer.y = 0);
  7822. };
  7823. this._mediaLayer.x = (this._mediaLayer.x + this._components.display.x);
  7824. this._mediaLayer.y = (this._mediaLayer.y + this._components.display.y);
  7825. };
  7826. }
  7827. protected function resizeImage(_arg1:number, _arg2:number):void{
  7828. if (this._imageLayer.numChildren > 0){
  7829. if (this._preserveAspect){
  7830. if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
  7831. Stretcher.stretch(this._image, this._normalScreen.width, this._normalScreen.height, this._player.config.stretching);
  7832. Stretcher.stretch(this._imageLayer, _arg1, _arg2, Stretcher.UNIFORM);
  7833. } else {
  7834. Stretcher.stretch(this._image, _arg1, _arg2, this._player.config.stretching);
  7835. Stretcher.stretch(this._imageLayer, _arg1, _arg2, Stretcher.NONE);
  7836. this._imageLayer.x = (this._imageLayer.y = 0);
  7837. };
  7838. } else {
  7839. Stretcher.stretch(this._image, _arg1, _arg2, this._player.config.stretching);
  7840. this._imageLayer.x = (this._imageLayer.y = 0);
  7841. };
  7842. this._imageLayer.x = (this._imageLayer.x + this._components.display.x);
  7843. this._imageLayer.y = (this._imageLayer.y + this._components.display.y);
  7844. };
  7845. }
  7846. protected function resizeBackground():void{
  7847. var _local1:DisplayObject = this._backgroundLayer.getChildByName("background");
  7848. _local1.width = RootReference.stage.stageWidth;
  7849. _local1.height = RootReference.stage.stageHeight;
  7850. _local1.x = 0;
  7851. _local1.y = 0;
  7852. }
  7853. protected function resizeMasker():void{
  7854. if (this._displayMasker == null){
  7855. this.setupDisplayMask();
  7856. };
  7857. this._displayMasker.graphics.clear();
  7858. this._displayMasker.graphics.beginfill(0, 1);
  7859. this._displayMasker.graphics.drawRect(this._components.display.x, this._components.display.y, this._player.config.width, this._player.config.height);
  7860. this._displayMasker.graphics.endfill();
  7861. }
  7862. public function get components():IPlayerComponents{
  7863. return (this._components);
  7864. }
  7865. public function overrideComponent(_arg1:IPlayerComponent):void{
  7866. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "overrideComponent not implemented"));
  7867. }
  7868. public function addPlugin(_arg1:string, _arg2:IPlugin):void{
  7869. var plugDO:* = null;
  7870. var id:* = _arg1;
  7871. var plugin:* = _arg2;
  7872. try {
  7873. plugDO = (plugin as DisplayObject);
  7874. if (((!(this._plugins[id])) && (!((plugDO == null))))){
  7875. this._plugins[id] = plugDO;
  7876. this._pluginsLayer.addChild(plugDO);
  7877. };
  7878. if (this._player.config.pluginIds.indexof(id) < 0){
  7879. this._player.config.plugins = (this._player.config.plugins + ("," + id));
  7880. };
  7881. } catch(e:error) {
  7882. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
  7883. };
  7884. }
  7885. public function removePlugin(_arg1:IPlugin):void{
  7886. var _local2:string = _arg1.id.tolowercase();
  7887. if (((_local2) && ((this._plugins[_local2] is IPlugin)))){
  7888. this._pluginsLayer.removeChild(this._plugins[_local2]);
  7889. delete this._plugins[_local2];
  7890. };
  7891. }
  7892. public function loadedPlugins():array{
  7893. var _local2:string;
  7894. var _local1:array = [];
  7895. for (_local2 in this._plugins) {
  7896. if ((this._plugins[_local2] is IPlugin)){
  7897. _local1.push(_local2);
  7898. };
  7899. };
  7900. return (_local1);
  7901. }
  7902. public function getPlugin(_arg1:string):IPlugin{
  7903. return ((this._plugins[_arg1] as IPlugin));
  7904. }
  7905. public function bringPluginToFront(_arg1:string):void{
  7906. var _local2:IPlugin = this.getPlugin(_arg1);
  7907. this._pluginsLayer.setChildIndex((_local2 as DisplayObject), (this._pluginsLayer.numChildren - 1));
  7908. }
  7909. protected function mediaLoaded(_arg1:MediaEvent):void{
  7910. var _local2:DisplayObject = this._model.media.display;
  7911. if (((_local2) && (!((_local2.parent == this._mediaLayer))))){
  7912. while (this._mediaLayer.numChildren) {
  7913. this._mediaLayer.removeChildAt(0);
  7914. };
  7915. this._mediaLayer.addChild(this._model.media.display);
  7916. this.resizeMedia(this._player.config.width, this._player.config.height);
  7917. };
  7918. }
  7919. protected function itemHandler(_arg1:PlaylistEvent):void{
  7920. if (((this._model.playlist.currentItem) && (this._model.playlist.currentItem.image))){
  7921. if (this._lastImage != this._model.playlist.currentItem.image){
  7922. this._lastImage = this._model.playlist.currentItem.image;
  7923. this.loadImage(this._lastImage);
  7924. };
  7925. };
  7926. }
  7927. protected function loadImage(_arg1:string):void{
  7928. this._image.load(new URLRequest(_arg1), new LoaderContext(true));
  7929. }
  7930. protected function imageComplete(_arg1:Event):void{
  7931. var evt:* = _arg1;
  7932. if (this._image){
  7933. this.resizeImage(this._player.config.width, this._player.config.height);
  7934. try {
  7935. Draw.smooth((this._image.content as Bitmap));
  7936. } catch(e:error) {
  7937. Logger.log(("Could not smooth preview image: " + e.message));
  7938. };
  7939. };
  7940. }
  7941. protected function imageError(_arg1:ErrorEvent):void{
  7942. Logger.log(("Error loading preview image: " + _arg1.text));
  7943. }
  7944. protected function showImage(_arg1:TimerEvent):void{
  7945. this._imageLayer.visible = true;
  7946. this._mediaLayer.visible = false;
  7947. }
  7948. protected function showMedia(_arg1:TimerEvent):void{
  7949. this._mediaLayer.visible = boolean(this._model.media.display);
  7950. this._imageLayer.visible = !(boolean(this._model.media.display));
  7951. }
  7952. protected function stateHandler(_arg1:PlayerStateEvent):void{
  7953. this.imageDelay.reset();
  7954. this.mediaDelay.reset();
  7955. switch (_arg1.newstate){
  7956. case PlayerState.IDLE:
  7957. this.imageDelay.start();
  7958. break;
  7959. case PlayerState.PLAYING:
  7960. case PlayerState.PAUSED:
  7961. this.mediaDelay.start();
  7962. break;
  7963. };
  7964. }
  7965. protected function forward(_arg1:Event):void{
  7966. if ((_arg1 is PlayerEvent)){
  7967. dispatchEvent(_arg1);
  7968. };
  7969. }
  7970.  
  7971. }
  7972. }//package com.longtailvideo.jwplayer.view
  7973. package com.longtailvideo.jwplayer.view {
  7974. import mx.core.*;
  7975.  
  7976. public class View_ErrorScreen_dataClass extends ByteArrayAsset {
  7977.  
  7978. }
  7979. }//package com.longtailvideo.jwplayer.view
  7980. package com.longtailvideo.jwplayer.view {
  7981. import mx.core.*;
  7982.  
  7983. public class View_LoadingScreen_dataClass extends ByteArrayAsset {
  7984.  
  7985. }
  7986. }//package com.longtailvideo.jwplayer.view
  7987. package com.longtailvideo.jwplayer.parsers {
  7988. import com.longtailvideo.jwplayer.utils.*;
  7989.  
  7990. public class ParserFactory {
  7991.  
  7992. public static function getParser(_arg1:xml):IPlaylistParser{
  7993. var list:* = _arg1;
  7994. try {
  7995. switch (list.localName().tostring().tolowercase()){
  7996. case "asx":
  7997. return (new ASXParser());
  7998. case "feed":
  7999. return (new ATOMParser());
  8000. case "playlist":
  8001. return (new XSPFParser());
  8002. case "rss":
  8003. return (new RSSParser());
  8004. case "smil":
  8005. return (new SMILParser());
  8006. };
  8007. } catch(e:error) {
  8008. Logger.log("ParserFactory: Could not determine playlist type");
  8009. return (null);
  8010. };
  8011. return (null);
  8012. }
  8013.  
  8014. }
  8015. }//package com.longtailvideo.jwplayer.parsers
  8016. package com.longtailvideo.jwplayer.parsers {
  8017. import com.longtailvideo.jwplayer.utils.*;
  8018.  
  8019. public class MediaParser {
  8020.  
  8021. private static const PREFIX:string = "media";
  8022.  
  8023. public static function parseGroup(_arg1:xml, _arg2:object):object{
  8024. var _local4:xml;
  8025. var _local3:boolean;
  8026. for each (_local4 in _arg1.children()) {
  8027. if (_local4.namespace().prefix == MediaParser.PREFIX){
  8028. switch (_local4.localName().tolowercase()){
  8029. case "content":
  8030. if (!_local3){
  8031. _arg2["file"] = Strings.xmlAttribute(_local4, "url");
  8032. };
  8033. if ([email protected]() > 0){
  8034. _arg2["duration"] = Strings.seconds(Strings.xmlAttribute(_local4, "duration"));
  8035. };
  8036. if ([email protected]() > 0){
  8037. _arg2["start"] = Strings.seconds(Strings.xmlAttribute(_local4, "start"));
  8038. };
  8039. if (_local4.children().length() > 0){
  8040. _arg2 = MediaParser.parseGroup(_local4, _arg2);
  8041. };
  8042. if (((((([email protected]() > 0)) || (([email protected]() > 0)))) || (([email protected]() > 0)))){
  8043. if (!_arg2.levels){
  8044. _arg2.levels = new array();
  8045. };
  8046. _arg2.levels.push({
  8047. width:Strings.xmlAttribute(_local4, "width"),
  8048. bitrate:Strings.xmlAttribute(_local4, "bitrate"),
  8049. file:Strings.xmlAttribute(_local4, "url")
  8050. });
  8051. };
  8052. break;
  8053. case "title":
  8054. _arg2["title"] = _local4.text().tostring();
  8055. break;
  8056. case "description":
  8057. _arg2["description"] = _local4.text().tostring();
  8058. break;
  8059. case "keywords":
  8060. _arg2["tags"] = _local4.text().tostring();
  8061. break;
  8062. case "thumbnail":
  8063. _arg2["image"] = Strings.xmlAttribute(_local4, "url");
  8064. break;
  8065. case "credit":
  8066. _arg2["author"] = _local4.text().tostring();
  8067. break;
  8068. case "player":
  8069. if ([email protected]("youtube.com") > 0){
  8070. _local3 = true;
  8071. _arg2["file"] = Strings.xmlAttribute(_local4, "url");
  8072. };
  8073. break;
  8074. case "group":
  8075. _arg2 = MediaParser.parseGroup(_local4, _arg2);
  8076. break;
  8077. };
  8078. };
  8079. };
  8080. return (_arg2);
  8081. }
  8082.  
  8083. }
  8084. }//package com.longtailvideo.jwplayer.parsers
  8085. package com.longtailvideo.jwplayer.parsers {
  8086. import com.longtailvideo.jwplayer.model.*;
  8087. import com.longtailvideo.jwplayer.utils.*;
  8088.  
  8089. public class XSPFParser implements IPlaylistParser {
  8090.  
  8091. public function parse(_arg1:xml):array{
  8092. var _local3:xml;
  8093. var _local4:xml;
  8094. var _local2:array = new array();
  8095. for each (_local3 in _arg1.children()) {
  8096. if (_local3.localName().tolowercase() == "tracklist"){
  8097. for each (_local4 in _local3.children()) {
  8098. _local2.push(this.parseItem(_local4));
  8099. };
  8100. };
  8101. };
  8102. return (_local2);
  8103. }
  8104. public function parseItem(_arg1:xml):PlaylistItem{
  8105. var _local3:xml;
  8106. var _local4:xml;
  8107. var _local2:object = new object();
  8108. for each (_local3 in _arg1.children()) {
  8109. if (!_local3.localName()){
  8110. break;
  8111. };
  8112. switch (_local3.localName().tolowercase()){
  8113. case "location":
  8114. _local2["file"] = _local3.text().tostring();
  8115. break;
  8116. case "title":
  8117. _local2["title"] = _local3.text().tostring();
  8118. break;
  8119. case "annotation":
  8120. _local2["description"] = _local3.text().tostring();
  8121. break;
  8122. case "info":
  8123. _local2["link"] = _local3.text().tostring();
  8124. break;
  8125. case "image":
  8126. _local2["image"] = _local3.text().tostring();
  8127. break;
  8128. case "creator":
  8129. _local2["author"] = _local3.text().tostring();
  8130. break;
  8131. case "duration":
  8132. _local2["duration"] = Strings.seconds(_local3.text());
  8133. break;
  8134. case "meta":
  8135. _local2[Strings.xmlAttribute(_local3, "rel")] = _local3.text().tostring();
  8136. break;
  8137. case "extension":
  8138. for each (_local4 in _local3.children()) {
  8139. _local2[_local4.localName().tolowercase()] = _local4.text().tostring();
  8140. };
  8141. break;
  8142. };
  8143. };
  8144. _local2 = JWParser.parseEntry(_arg1, _local2);
  8145. return (new PlaylistItem(_local2));
  8146. }
  8147.  
  8148. }
  8149. }//package com.longtailvideo.jwplayer.parsers
  8150. package com.longtailvideo.jwplayer.parsers {
  8151. import com.longtailvideo.jwplayer.model.*;
  8152. import com.longtailvideo.jwplayer.utils.*;
  8153.  
  8154. public class ATOMParser implements IPlaylistParser {
  8155.  
  8156. public function parse(_arg1:xml):array{
  8157. var _local3:xml;
  8158. var _local2:array = new array();
  8159. for each (_local3 in _arg1.children()) {
  8160. if (_local3.localName().tolowercase() == "entry"){
  8161. _local2.push(this.parseItem(_local3));
  8162. };
  8163. };
  8164. return (_local2);
  8165. }
  8166. public function parseItem(_arg1:xml):PlaylistItem{
  8167. var _local3:xml;
  8168. var _local2:object = new object();
  8169. for each (_local3 in _arg1.children()) {
  8170. switch (_local3.localName().tolowercase()){
  8171. case "author":
  8172. _local2["author"] = _local3.children()[0].text().tostring();
  8173. break;
  8174. case "title":
  8175. _local2["title"] = _local3.text().tostring();
  8176. break;
  8177. case "summary":
  8178. _local2["description"] = _local3.text().tostring();
  8179. break;
  8180. case "link":
  8181. if (Strings.xmlAttribute(_local3, "rel") == "alternate"){
  8182. _local2["link"] = Strings.xmlAttribute(_local3, "href");
  8183. } else {
  8184. if (Strings.xmlAttribute(_local3, "rel") == "enclosure"){
  8185. _local2["file"] = Strings.xmlAttribute(_local3, "href");
  8186. };
  8187. };
  8188. break;
  8189. case "published":
  8190. _local2["date"] = _local3.text().tostring();
  8191. break;
  8192. };
  8193. };
  8194. _local2 = MediaParser.parseGroup(_arg1, _local2);
  8195. _local2 = JWParser.parseEntry(_arg1, _local2);
  8196. return (new PlaylistItem(_local2));
  8197. }
  8198.  
  8199. }
  8200. }//package com.longtailvideo.jwplayer.parsers
  8201. package com.longtailvideo.jwplayer.parsers {
  8202. import com.longtailvideo.jwplayer.model.*;
  8203. import com.longtailvideo.jwplayer.utils.*;
  8204.  
  8205. public class SMILParser implements IPlaylistParser {
  8206.  
  8207. public function parse(_arg1:xml):array{
  8208. var _local4:xml;
  8209. var _local2:array = new array();
  8210. var _local3:xml = _arg1.children()[1].children()[0];
  8211. if (_local3.localName().tolowercase() == "seq"){
  8212. for each (_local4 in _local3.children()) {
  8213. _local2.push(new PlaylistItem(this.parseSeq(_local4)));
  8214. };
  8215. } else {
  8216. _local2.push(this.parseItem(_local3));
  8217. };
  8218. return (_local2);
  8219. }
  8220. public function parseItem(_arg1:xml):PlaylistItem{
  8221. return (new PlaylistItem(this.parsePar(_arg1)));
  8222. }
  8223. public function parseSeq(_arg1:xml):object{
  8224. var _local2:object = new object();
  8225. switch (_arg1.localName().tolowercase()){
  8226. case "par":
  8227. _local2 = this.parsePar(_arg1);
  8228. break;
  8229. case "img":
  8230. case "video":
  8231. case "audio":
  8232. _local2 = this.parseAttributes(_arg1, _local2);
  8233. break;
  8234. };
  8235. return (_local2);
  8236. }
  8237. public function parsePar(_arg1:xml):object{
  8238. var _local3:xml;
  8239. var _local2:object = new object();
  8240. for each (_local3 in _arg1.children()) {
  8241. switch (_local3.localName().tolowercase()){
  8242. case "anchor":
  8243. _local2["link"] = Strings.xmlAttribute(_local3, "href");
  8244. break;
  8245. case "img":
  8246. if (_local2["file"]){
  8247. _local2["image"] = Strings.xmlAttribute(_local3, "src");
  8248. break;
  8249. };
  8250. _local2 = this.parseAttributes(_local3, _local2);
  8251. break;
  8252. case "video":
  8253. case "audio":
  8254. _local2 = this.parseAttributes(_local3, _local2);
  8255. break;
  8256. };
  8257. };
  8258. _local2 = JWParser.parseEntry(_arg1, _local2);
  8259. return (_local2);
  8260. }
  8261. public function parseAttributes(_arg1:xml, _arg2:object):object{
  8262. var _local4:string;
  8263. var _local3:number = 0;
  8264. while (_local3 < _arg1.attributes().length()) {
  8265. _local4 = _arg1.attributes()[_local3].name().tostring();
  8266. switch (_local4){
  8267. case "begin":
  8268. _arg2["start"] = Strings.seconds(Strings.xmlAttribute(_arg1, "begin"));
  8269. break;
  8270. case "src":
  8271. _arg2["file"] = Strings.xmlAttribute(_arg1, "src");
  8272. break;
  8273. case "dur":
  8274. _arg2["duration"] = Strings.seconds(Strings.xmlAttribute(_arg1, "dur"));
  8275. break;
  8276. case "alt":
  8277. _arg2["description"] = Strings.xmlAttribute(_arg1, "alt");
  8278. break;
  8279. default:
  8280. _arg2[_local4] = _arg1.attributes()[_local3].tostring();
  8281. };
  8282. _local3++;
  8283. };
  8284. return (_arg2);
  8285. }
  8286.  
  8287. }
  8288. }//package com.longtailvideo.jwplayer.parsers
  8289. package com.longtailvideo.jwplayer.parsers {
  8290. import com.longtailvideo.jwplayer.model.*;
  8291. import com.longtailvideo.jwplayer.utils.*;
  8292.  
  8293. public class LoadbalanceParser {
  8294.  
  8295. public static function parse(_arg1:xml):array{
  8296. var _local6:xml;
  8297. var _local7:PlaylistItemLevel;
  8298. var _local2:array = new array();
  8299. var _local3:xml = _arg1.children()[0].children()[0];
  8300. var _local4:string = Strings.xmlAttribute(_local3, "base");
  8301. var _local5:xml = _arg1.children()[1].children()[0];
  8302. if (_local5.localName().tolowercase() == "switch"){
  8303. for each (_local6 in _local5.children()) {
  8304. _local7 = new PlaylistItemLevel(Strings.xmlAttribute(_local6, "src"), (number(Strings.xmlAttribute(_local6, "system-bitrate")) / 1000), number(Strings.xmlAttribute(_local6, "width")), _local4);
  8305. _local2.push(_local7);
  8306. };
  8307. } else {
  8308. _local2.push({
  8309. file:Strings.xmlAttribute(_local5, "src"),
  8310. streamer:_local4
  8311. });
  8312. };
  8313. return (_local2);
  8314. }
  8315.  
  8316. }
  8317. }//package com.longtailvideo.jwplayer.parsers
  8318. package com.longtailvideo.jwplayer.parsers {
  8319. import com.longtailvideo.jwplayer.model.*;
  8320. import com.longtailvideo.jwplayer.utils.*;
  8321.  
  8322. public class RSSParser implements IPlaylistParser {
  8323.  
  8324. public function parse(_arg1:xml):array{
  8325. var _local3:xml;
  8326. var _local4:xml;
  8327. var _local2:array = new array();
  8328. for each (_local3 in _arg1.children()) {
  8329. if (_local3.localName().tolowercase() == "channel"){
  8330. for each (_local4 in _local3.children()) {
  8331. if (_local4.localName().tolowercase() == "item"){
  8332. _local2.push(this.parseItem(_local4));
  8333. };
  8334. };
  8335. };
  8336. };
  8337. return (_local2);
  8338. }
  8339. public function parseItem(_arg1:xml):PlaylistItem{
  8340. var _local3:xml;
  8341. var _local2:object = new object();
  8342. for each (_local3 in _arg1.children()) {
  8343. switch (_local3.localName().tolowercase()){
  8344. case "enclosure":
  8345. _local2["file"] = Strings.xmlAttribute(_local3, "url");
  8346. break;
  8347. case "title":
  8348. _local2["title"] = _local3.text().tostring();
  8349. break;
  8350. case "pubdate":
  8351. _local2["date"] = _local3.text().tostring();
  8352. break;
  8353. case "description":
  8354. _local2["description"] = _local3.text().tostring();
  8355. break;
  8356. case "link":
  8357. _local2["link"] = _local3.text().tostring();
  8358. break;
  8359. case "category":
  8360. if (_local2["tags"]){
  8361. _local2["tags"] = (_local2["tags"] + _local3.text().tostring());
  8362. } else {
  8363. _local2["tags"] = _local3.text().tostring();
  8364. };
  8365. break;
  8366. };
  8367. };
  8368. _local2 = ItunesParser.parseEntry(_arg1, _local2);
  8369. _local2 = MediaParser.parseGroup(_arg1, _local2);
  8370. _local2 = JWParser.parseEntry(_arg1, _local2);
  8371. return (new PlaylistItem(_local2));
  8372. }
  8373.  
  8374. }
  8375. }//package com.longtailvideo.jwplayer.parsers
  8376. package com.longtailvideo.jwplayer.parsers {
  8377. import com.longtailvideo.jwplayer.utils.*;
  8378.  
  8379. public class ItunesParser {
  8380.  
  8381. private static const PREFIX:string = "itunes";
  8382.  
  8383. public static function parseEntry(_arg1:xml, _arg2:object):object{
  8384. var _local3:xml;
  8385. for each (_local3 in _arg1.children()) {
  8386. if (_local3.namespace().prefix == ItunesParser.PREFIX){
  8387. switch (_local3.localName().tolowercase()){
  8388. case "author":
  8389. _arg2["author"] = _local3.text().tostring();
  8390. break;
  8391. case "duration":
  8392. _arg2["duration"] = Strings.seconds(_local3.text().tostring());
  8393. break;
  8394. case "summary":
  8395. _arg2["description"] = _local3.text().tostring();
  8396. break;
  8397. case "keywords":
  8398. _arg2["tags"] = _local3.text().tostring();
  8399. break;
  8400. };
  8401. };
  8402. };
  8403. return (_arg2);
  8404. }
  8405.  
  8406. }
  8407. }//package com.longtailvideo.jwplayer.parsers
  8408. package com.longtailvideo.jwplayer.parsers {
  8409.  
  8410. public interface IPlaylistParser {
  8411.  
  8412. function parse(_arg1:xml):array;
  8413.  
  8414. }
  8415. }//package com.longtailvideo.jwplayer.parsers
  8416. package com.longtailvideo.jwplayer.parsers {
  8417. import com.longtailvideo.jwplayer.model.*;
  8418. import com.longtailvideo.jwplayer.utils.*;
  8419.  
  8420. public class ASXParser implements IPlaylistParser {
  8421.  
  8422. public function parse(_arg1:xml):array{
  8423. var _local3:xml;
  8424. var _local2:array = new array();
  8425. for each (_local3 in _arg1.children()) {
  8426. if (_local3.localName().tolowercase() == "entry"){
  8427. _local2.push(this.parseItem(_local3));
  8428. };
  8429. };
  8430. return (_local2);
  8431. }
  8432. public function parseItem(_arg1:xml):PlaylistItem{
  8433. var _local3:xml;
  8434. var _local2:object = new object();
  8435. for each (_local3 in _arg1.children()) {
  8436. if (!_local3.localName()){
  8437. break;
  8438. };
  8439. switch (_local3.localName().tolowercase()){
  8440. case "ref":
  8441. _local2["file"] = Strings.xmlAttribute(_local3, "href");
  8442. break;
  8443. case "title":
  8444. _local2["title"] = _local3.text().tostring();
  8445. break;
  8446. case "moreinfo":
  8447. _local2["link"] = Strings.xmlAttribute(_local3, "href");
  8448. break;
  8449. case "abstract":
  8450. _local2["description"] = _local3.text().tostring();
  8451. break;
  8452. case "author":
  8453. _local2["author"] = _local3.text().tostring();
  8454. break;
  8455. case "duration":
  8456. _local2["duration"] = Strings.seconds(Strings.xmlAttribute(_local3, "value"));
  8457. break;
  8458. case "starttime":
  8459. _local2["start"] = Strings.seconds(Strings.xmlAttribute(_local3, "value"));
  8460. break;
  8461. case "param":
  8462. _local2[Strings.xmlAttribute(_local3, "name")] = Strings.xmlAttribute(_local3, "value");
  8463. break;
  8464. };
  8465. };
  8466. _local2 = JWParser.parseEntry(_arg1, _local2);
  8467. return (new PlaylistItem(_local2));
  8468. }
  8469.  
  8470. }
  8471. }//package com.longtailvideo.jwplayer.parsers
  8472. package com.longtailvideo.jwplayer.parsers {
  8473. import com.longtailvideo.jwplayer.utils.*;
  8474.  
  8475. public class JWParser {
  8476.  
  8477. private static const PREFIX:string = "jwplayer";
  8478.  
  8479. private static var extensions:object = {
  8480. 3g2:"video",
  8481. 3gp:"video",
  8482. aac:"video",
  8483. f4b:"video",
  8484. f4p:"video",
  8485. f4v:"video",
  8486. flv:"video",
  8487. gif:"image",
  8488. jpg:"image",
  8489. jpeg:"image",
  8490. m4a:"video",
  8491. m4v:"video",
  8492. mov:"video",
  8493. mp3:"sound",
  8494. mp4:"video",
  8495. png:"image",
  8496. rbs:"sound",
  8497. sdp:"video",
  8498. swf:"image",
  8499. vp6:"video",
  8500. webm:"video",
  8501. ogg:"video",
  8502. ogv:"video"
  8503. };
  8504.  
  8505. public static function parseEntry(_arg1:xml, _arg2:object):object{
  8506. var _local3:xml;
  8507. for each (_local3 in _arg1.children()) {
  8508. if (_local3.namespace().prefix == JWParser.PREFIX){
  8509. _arg2[_local3.localName()] = Strings.serialize(_local3.text().tostring());
  8510. };
  8511. if (((!(_arg2["file"])) && ((string(_arg2["link"]).tolowercase().indexof("youtube") > -1)))){
  8512. _arg2["file"] = _arg2["link"];
  8513. };
  8514. };
  8515. return (_arg2);
  8516. }
  8517. public static function getProvider(_arg1:object):string{
  8518. var _local2:string;
  8519. if (_arg1["type"]){
  8520. return (_arg1["type"]);
  8521. };
  8522. if (isYouTube(_arg1["file"])){
  8523. return ("youtube");
  8524. };
  8525. if (((_arg1["streamer"]) && ((_arg1["streamer"].indexof("rtmp") == 0)))){
  8526. return ("rtmp");
  8527. };
  8528. if (((_arg1["streamer"]) && ((_arg1["streamer"].indexof("http") == 0)))){
  8529. return ("http");
  8530. };
  8531. _local2 = Strings.extension(_arg1["file"]);
  8532. if (extensions.hasOwnProperty(_local2)){
  8533. return (extensions[_local2]);
  8534. };
  8535. return ("");
  8536. }
  8537. private static function isYouTube(_arg1:string):boolean{
  8538. if (!_arg1){
  8539. return (false);
  8540. };
  8541. if (_arg1.indexof("youtube.com/w") > -1){
  8542. return (true);
  8543. };
  8544. if (_arg1.indexof("youtube.com/v") > -1){
  8545. return (true);
  8546. };
  8547. if (_arg1.indexof("youtu.be") > -1){
  8548. return (true);
  8549. };
  8550. return (false);
  8551. }
  8552.  
  8553. }
  8554. }//package com.longtailvideo.jwplayer.parsers
  8555. package com.longtailvideo.jwplayer.events {
  8556. import flash.events.*;
  8557.  
  8558. public class MediaEvent extends PlayerEvent {
  8559.  
  8560. public static var JWPLAYER_MEDIA_BUFFER:string = "jwplayerMediaBuffer";
  8561. public static var SCALEENGINE_BUFFER_STATUS:string = "ScaleEngineBufferStatus";
  8562. public static var JWPLAYER_MEDIA_BUFFER_FULL:string = "jwplayerMediaBufferFull";
  8563. public static var JWPLAYER_MEDIA_ERROR:string = "jwplayerMediaError";
  8564. public static var JWPLAYER_MEDIA_LOADED:string = "jwplayerMediaLoaded";
  8565. public static var JWPLAYER_MEDIA_COMPLETE:string = "jwplayerMediaComplete";
  8566. public static var JWPLAYER_MEDIA_SEEK:string = "jwplayerMediaSeek";
  8567. public static var JWPLAYER_MEDIA_TIME:string = "jwplayerMediaTime";
  8568. public static var JWPLAYER_MEDIA_VOLUME:string = "jwplayerMediaVolume";
  8569. public static var JWPLAYER_MEDIA_META:string = "jwplayerMediaMeta";
  8570. public static var JWPLAYER_MEDIA_MUTE:string = "jwplayerMediaMute";
  8571.  
  8572. public var bufferPercent:number = -1;
  8573. public var duration:number = -1;
  8574. public var metadata:object = null;
  8575. public var position:number = -1;
  8576. public var offset:number = 0;
  8577. public var volume:number = -1;
  8578. public var mute:boolean = false;
  8579.  
  8580. public function MediaEvent(_arg1:string){
  8581. super(_arg1);
  8582. }
  8583. override public function clone():Event{
  8584. var _local1:MediaEvent = new MediaEvent(this.type);
  8585. _local1.bufferPercent = this.bufferPercent;
  8586. _local1.duration = this.duration;
  8587. _local1.metadata = this.metadata;
  8588. _local1.position = this.position;
  8589. _local1.offset = this.offset;
  8590. _local1.volume = this.volume;
  8591. _local1.mute = this.mute;
  8592. return (_local1);
  8593. }
  8594. override public function tostring():string{
  8595. var _local3:string;
  8596. var _local1 = (("[MediaEvent type=\"" + type) + "\"");
  8597. var _local2:MediaEvent = new MediaEvent("");
  8598. for (_local3 in this.metadata) {
  8599. _local1 = (_local1 + ((((" " + _local3) + "=\"") + this.metadata[_local3]) + "\""));
  8600. };
  8601. if (this.bufferPercent != _local2.bufferPercent){
  8602. _local1 = (_local1 + ((" bufferPercent=\"" + this.bufferPercent) + "\""));
  8603. };
  8604. if (this.duration != _local2.duration){
  8605. _local1 = (_local1 + ((" duration=\"" + this.duration) + "\""));
  8606. };
  8607. if (this.position != _local2.position){
  8608. _local1 = (_local1 + ((" position=\"" + this.position) + "\""));
  8609. };
  8610. if (this.offset != _local2.offset){
  8611. _local1 = (_local1 + ((" offset=\"" + this.offset) + "\""));
  8612. };
  8613. if (this.volume != _local2.volume){
  8614. _local1 = (_local1 + ((" volume=\"" + this.volume) + "\""));
  8615. };
  8616. if (this.mute != _local2.mute){
  8617. _local1 = (_local1 + ((" mute=\"" + this.mute) + "\""));
  8618. };
  8619. if (message != _local2.message){
  8620. _local1 = (_local1 + ((" message=\"" + message) + "\""));
  8621. };
  8622. _local1 = (_local1 + ((" id=\"" + id) + "\""));
  8623. _local1 = (_local1 + ((" client=\"" + client) + "\""));
  8624. _local1 = (_local1 + ((" version=\"" + version) + "\""));
  8625. _local1 = (_local1 + "]");
  8626. return (_local1);
  8627. }
  8628.  
  8629. }
  8630. }//package com.longtailvideo.jwplayer.events
  8631. package com.longtailvideo.jwplayer.events {
  8632. import com.longtailvideo.jwplayer.view.interfaces.*;
  8633. import flash.events.*;
  8634. import flash.geom.*;
  8635.  
  8636. public class ComponentEvent extends PlayerEvent {
  8637.  
  8638. public static var JWPLAYER_COMPONENT_SHOW:string = "jwplayerComponentShow";
  8639. public static var JWPLAYER_COMPONENT_HIDE:string = "jwplayerComponentHide";
  8640.  
  8641. public var component:IPlayerComponent;
  8642. public var boundingRect:Rectangle;
  8643.  
  8644. public function ComponentEvent(_arg1:string, _arg2:IPlayerComponent, _arg3:Rectangle=null){
  8645. super(_arg1);
  8646. this.component = _arg2;
  8647. if (_arg3){
  8648. this.boundingRect = _arg3;
  8649. } else {
  8650. this.boundingRect = new Rectangle(_arg2.x, _arg2.y, _arg2.width, _arg2.height);
  8651. };
  8652. }
  8653. override public function clone():Event{
  8654. return (new ComponentEvent(this.type, this.component));
  8655. }
  8656. override public function tostring():string{
  8657. return ((((((((((((((("[ComponentEvent type=\"" + type) + "\"") + " component=\"") + this.component) + "\"") + " boundingRect=") + this.boundingRect.tostring()) + " id=") + id) + " client=") + client) + " version=") + version) + "]"));
  8658. }
  8659.  
  8660. }
  8661. }//package com.longtailvideo.jwplayer.events
  8662. package com.longtailvideo.jwplayer.events {
  8663. import flash.events.*;
  8664.  
  8665. public interface IGlobalEventDispatcher extends IEventDispatcher {
  8666.  
  8667. function addGlobalListener(_arg1:function):void;
  8668. function removeGlobalListener(_arg1:function):void;
  8669.  
  8670. }
  8671. }//package com.longtailvideo.jwplayer.events
  8672. package com.longtailvideo.jwplayer.events {
  8673. import flash.events.*;
  8674.  
  8675. public class PlayerStateEvent extends PlayerEvent {
  8676.  
  8677. public static var JWPLAYER_PLAYER_STATE:string = "jwplayerPlayerState";
  8678.  
  8679. public var newstate:string = "";
  8680. public var oldstate:string = "";
  8681.  
  8682. public function PlayerStateEvent(_arg1:string, _arg2:string, _arg3:string){
  8683. super(_arg1);
  8684. this.newstate = _arg2;
  8685. this.oldstate = _arg3;
  8686. }
  8687. override public function clone():Event{
  8688. return (new PlayerStateEvent(this.type, this.newstate, this.oldstate));
  8689. }
  8690. override public function tostring():string{
  8691. return (((((((((((((((((((((("[PlayerStateEvent type=\"" + type) + "\"") + " oldstate=\"") + this.oldstate) + "\"") + " newstate=\"") + this.newstate) + "\"") + " id=\"") + id) + "\"") + " client=\"") + client) + "\"") + " version=\"") + version) + "\"") + " message=\"") + message) + "\"") + "]"));
  8692. }
  8693.  
  8694. }
  8695. }//package com.longtailvideo.jwplayer.events
  8696. package com.longtailvideo.jwplayer.events {
  8697. import com.longtailvideo.jwplayer.model.*;
  8698. import flash.events.*;
  8699.  
  8700. public class PlaylistEvent extends PlayerEvent {
  8701.  
  8702. public static var JWPLAYER_PLAYLIST_LOADED:string = "jwplayerPlaylistLoaded";
  8703. public static var JWPLAYER_PLAYLIST_UPDATED:string = "jwplayerPlaylistUpdated";
  8704. public static var JWPLAYER_PLAYLIST_ITEM:string = "jwplayerPlaylistItem";
  8705.  
  8706. private var _playlist:IPlaylist;
  8707.  
  8708. public function PlaylistEvent(_arg1:string, _arg2:IPlaylist){
  8709. this._playlist = _arg2;
  8710. super(_arg1);
  8711. }
  8712. override public function tostring():string{
  8713. return ((((((((((((((((((("[PlaylistEvent type=\"" + type) + "\"") + " index=\"") + this._playlist.currentIndex) + "\"") + " id=\"") + id) + "\"") + " client=\"") + client) + "\"") + " version=\"") + version) + "\"") + " message=\"") + message) + "\"") + "]"));
  8714. }
  8715. override public function clone():Event{
  8716. return (new PlaylistEvent(this.type, this._playlist));
  8717. }
  8718.  
  8719. }
  8720. }//package com.longtailvideo.jwplayer.events
  8721. package com.longtailvideo.jwplayer.events {
  8722. import flash.events.*;
  8723.  
  8724. public class ViewEvent extends PlayerEvent {
  8725.  
  8726. public static var JWPLAYER_RESIZE:string = "jwplayerResize";
  8727. public static var JWPLAYER_VIEW_PLAY:string = "jwplayerViewPlay";
  8728. public static var JWPLAYER_VIEW_PAUSE:string = "jwplayerViewPause";
  8729. public static var JWPLAYER_VIEW_STOP:string = "jwplayerViewStop";
  8730. public static var JWPLAYER_VIEW_NEXT:string = "jwplayerViewNext";
  8731. public static var JWPLAYER_VIEW_PREV:string = "jwplayerViewPrev";
  8732. public static var JWPLAYER_VIEW_MUTE:string = "jwplayerViewMute";
  8733. public static var JWPLAYER_VIEW_FULLSCREEN:string = "jwplayerViewFullscreen";
  8734. public static var JWPLAYER_VIEW_ITEM:string = "jwplayerViewItem";
  8735. public static var JWPLAYER_VIEW_VOLUME:string = "jwplayerViewVolume";
  8736. public static var JWPLAYER_VIEW_LOAD:string = "jwplayerViewLoad";
  8737. public static var JWPLAYER_VIEW_REDRAW:string = "jwplayerViewRedraw";
  8738. public static var JWPLAYER_VIEW_SEEK:string = "jwplayerViewSeek";
  8739. public static var JWPLAYER_VIEW_CLICK:string = "jwplayerViewClick";
  8740.  
  8741. public var data;
  8742.  
  8743. public function ViewEvent(_arg1:string, _arg2=null){
  8744. super(_arg1);
  8745. this.data = _arg2;
  8746. }
  8747. override public function clone():Event{
  8748. return (new ViewEvent(this.type, this.data));
  8749. }
  8750. override public function tostring():string{
  8751. return ((((((((((((("[ViewEvent type=\"" + type) + "\"") + " data=\"") + this.data) + "\"") + " id=") + id) + " client=") + client) + " version=") + version) + "]"));
  8752. }
  8753.  
  8754. }
  8755. }//package com.longtailvideo.jwplayer.events
  8756. package com.longtailvideo.jwplayer.events {
  8757. import flash.events.*;
  8758. import flash.utils.*;
  8759.  
  8760. public class GlobalEventDispatcher extends EventDispatcher implements IGlobalEventDispatcher {
  8761.  
  8762. private var _globalListeners:Dictionary;
  8763. private var _dispatcher:IEventDispatcher;
  8764.  
  8765. public function GlobalEventDispatcher(){
  8766. this._globalListeners = new Dictionary();
  8767. super();
  8768. }
  8769. public function addGlobalListener(_arg1:function):void{
  8770. this._globalListeners[_arg1] = true;
  8771. }
  8772. public function removeGlobalListener(_arg1:function):void{
  8773. delete this._globalListeners[_arg1];
  8774. }
  8775. override public function dispatchEvent(_arg1:Event):boolean{
  8776. var _local2:*;
  8777. var _local3:function;
  8778. for (_local2 in this._globalListeners) {
  8779. if ((_local2 is function)){
  8780. _local3 = (_local2 as function);
  8781. _local3(_arg1);
  8782. };
  8783. };
  8784. return (super.dispatchEvent(_arg1));
  8785. }
  8786.  
  8787. }
  8788. }//package com.longtailvideo.jwplayer.events
  8789. package com.longtailvideo.jwplayer.events {
  8790. import flash.events.*;
  8791. import com.longtailvideo.jwplayer.player.*;
  8792. import flash.system.*;
  8793. import flash.external.*;
  8794.  
  8795. public class PlayerEvent extends Event {
  8796.  
  8797. public static var JWPLAYER_READY:string = "jwplayerReady";
  8798. public static var JWPLAYER_LOCKED:string = "jwplayerLocked";
  8799. public static var JWPLAYER_UNLOCKED:string = "jwplayerUnlocked";
  8800. public static var JWPLAYER_ERROR:string = "jwplayerError";
  8801. public static var JWPLAYER_FULLSCREEN:string = "jwplayerFullscreen";
  8802.  
  8803. public var id:string;
  8804. public var client:string;
  8805. public var version:string;
  8806. public var message:string;
  8807.  
  8808. public function PlayerEvent(_arg1:string, _arg2:string=undefined){
  8809. super(_arg1, false, false);
  8810. try {
  8811. this.id = ((PlayerVersion.id) ? PlayerVersion.id : ExternalInterface.objectID);
  8812. } catch(e:error) {
  8813. };
  8814. this.client = ("FLASH " + capabilities.version);
  8815. this.version = PlayerVersion.version;
  8816. this.message = _arg2;
  8817. }
  8818. override public function tostring():string{
  8819. return (((((((((((((((("[PlayerEvent type=\"" + type) + "\"") + " id=\"") + this.id) + "\"") + " client=\"") + this.client) + "\"") + " version=\"") + this.version) + "\"") + " message=\"") + this.message) + "\"") + "]"));
  8820. }
  8821. override public function clone():Event{
  8822. return (new PlayerEvent(this.type, this.message));
  8823. }
  8824.  
  8825. }
  8826. }//package com.longtailvideo.jwplayer.events
  8827. package com.longtailvideo.jwplayer.utils {
  8828. import flash.events.*;
  8829. import flash.net.*;
  8830.  
  8831. public class Configger extends EventDispatcher {
  8832.  
  8833. private var _config:object;
  8834.  
  8835. public function Configger(){
  8836. this._config = {};
  8837. super();
  8838. }
  8839. public static function saveCookie(_arg1:string, _arg2):void{
  8840. var _local3:sharedobject;
  8841. try {
  8842. _local3 = sharedobject.getlocal("com.jeroenwijering", "/");
  8843. _local3.data[_arg1] = _arg2;
  8844. _local3.flush();
  8845. } catch(err:error) {
  8846. };
  8847. }
  8848.  
  8849. public function get config():object{
  8850. return (this._config);
  8851. }
  8852. public function loadConfig():void{
  8853. this.loadCookies();
  8854. if (this.xmlConfig){
  8855. this.loadXML(this.xmlConfig);
  8856. } else {
  8857. this.loadFlashvars(RootReference.root.loaderInfo.parameters);
  8858. };
  8859. }
  8860. public function get xmlConfig():string{
  8861. return (RootReference.root.loaderInfo.parameters["config"]);
  8862. }
  8863. public function loadXML(_arg1:string):void{
  8864. var _local2:URLLoader = new URLLoader();
  8865. _local2.addEventListener(IOErrorEvent.IO_ERROR, this.xmlFail);
  8866. _local2.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.xmlFail);
  8867. _local2.addEventListener(Event.COMPLETE, this.loadComplete);
  8868. _local2.load(new URLRequest(_arg1));
  8869. }
  8870. public function loadFlashvars(_arg1:object):void{
  8871. var param:* = null;
  8872. var params:* = _arg1;
  8873. try {
  8874. for (param in params) {
  8875. this.setConfigParam(param, params[param]);
  8876. };
  8877. dispatchEvent(new Event(Event.COMPLETE));
  8878. } catch(e:error) {
  8879. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
  8880. };
  8881. }
  8882. private function loadCookies():void{
  8883. var _local1:sharedobject;
  8884. try {
  8885. _local1 = sharedobject.getlocal("com.jeroenwijering", "/");
  8886. this.writeCookieData(_local1.data);
  8887. } catch(err:error) {
  8888. };
  8889. }
  8890. private function writeCookieData(_arg1:object):void{
  8891. var _local2:string;
  8892. for (_local2 in _arg1) {
  8893. this.setConfigParam(_local2.tolowercase(), _arg1[_local2]);
  8894. };
  8895. }
  8896. private function loadComplete(_arg1:Event):void{
  8897. var _local2:xml = xml((_arg1.target as URLLoader).data);
  8898. if ((((_local2.name().tostring().tolowercase() == "config")) && ((_local2.children().length() > 0)))){
  8899. this.parsexml(_local2);
  8900. this.loadFlashvars(RootReference.root.loaderInfo.parameters);
  8901. } else {
  8902. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "Config was empty"));
  8903. };
  8904. }
  8905. private function xmlFail(_arg1:ErrorEvent):void{
  8906. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
  8907. }
  8908. private function parsexml(_arg1:xml):void{
  8909. var _local2:xml;
  8910. for each (_local2 in _arg1.children()) {
  8911. if (_local2.name() == "pluginconfig"){
  8912. this.parsePluginConfig(_local2);
  8913. } else {
  8914. this.setConfigParam(_local2.name().tostring(), _local2.tostring());
  8915. };
  8916. };
  8917. }
  8918. private function parsePluginConfig(_arg1:xml):void{
  8919. var _local2:xml;
  8920. var _local3:xml;
  8921. for each (_local2 in _arg1.plugin) {
  8922. for each (_local3 in _local2.children()) {
  8923. this.setConfigParam(((_local2.@name + ".") + _local3.name()), _local3.tostring());
  8924. };
  8925. };
  8926. }
  8927. private function setConfigParam(_arg1:string, _arg2:string):void{
  8928. if (_arg1 != "fullscreen"){
  8929. this._config[_arg1.tolowercase()] = Strings.serialize(Strings.trim(_arg2));
  8930. };
  8931. }
  8932.  
  8933. }
  8934. }//package com.longtailvideo.jwplayer.utils
  8935. package com.longtailvideo.jwplayer.utils {
  8936. import flash.display.*;
  8937. import flash.system.*;
  8938.  
  8939. public class RootReference {
  8940.  
  8941. public static var root:DisplayObject;
  8942. private static var _stage:stage;
  8943.  
  8944. public function RootReference(_arg1:DisplayObject){
  8945. if (!RootReference.root){
  8946. RootReference.root = _arg1.root;
  8947. RootReference.stage = _arg1.stage;
  8948. try {
  8949. Security.allowdomain("*");
  8950. } catch(e:error) {
  8951. };
  8952. };
  8953. }
  8954. public static function get stage():stage{
  8955. return (_stage);
  8956. }
  8957. public static function set stage(_arg1:stage):void{
  8958. _stage = _arg1;
  8959. }
  8960.  
  8961. }
  8962. }//package com.longtailvideo.jwplayer.utils
  8963. package com.longtailvideo.jwplayer.utils {
  8964. import com.longtailvideo.jwplayer.model.*;
  8965. import flash.events.*;
  8966. import flash.net.*;
  8967. import flash.external.*;
  8968.  
  8969. public class Logger {
  8970.  
  8971. public static const ARTHROPOD:string = "arthropod";
  8972. private static const CONNECTION:localconnection = new localconnection();
  8973. private static const CONNECTION_NAME:string = "app#com.carlcalderon.Arthropod.161E714B6C1A76DE7B9865F88B32FCCE8FABA7B5.1:arthropod";
  8974. public static const CONSOLE:string = "console";
  8975. public static const NONE:string = "none";
  8976. public static const trace:string = "trace";
  8977.  
  8978. private static var _config:PlayerConfig;
  8979.  
  8980. public static function log(_arg1, _arg2:string="log"):void{
  8981. var message:* = _arg1;
  8982. var type:string = _arg2;
  8983. try {
  8984. if (message == undefined){
  8985. send(type.touppercase());
  8986. } else {
  8987. if ((message is string)){
  8988. send((((type.touppercase() + " (") + message) + ")"));
  8989. } else {
  8990. if ((((((message is boolean)) || ((message is number)))) || ((message is array)))){
  8991. send((((type.touppercase() + " (") + message.tostring()) + ")"));
  8992. } else {
  8993. Logger.object(message, type);
  8994. };
  8995. };
  8996. };
  8997. } catch(err:error) {
  8998. };
  8999. }
  9000. private static function object(_arg1:object, _arg2:string):void{
  9001. var _local3 = (_arg2.touppercase() + " (");
  9002. Strings.print_r(_arg1);
  9003. _local3 = (_local3 + ")");
  9004. Logger.send(_local3);
  9005. }
  9006. private static function send(_arg1:string):void{
  9007. var text:* = _arg1;
  9008. var debug:* = ((_config) ? _config.debug : trace);
  9009. switch (debug){
  9010. case ARTHROPOD:
  9011. try {
  9012. CONNECTION.send(CONNECTION_NAME, "debug", "CDC309AF", text, 0xCCCCCC);
  9013. } catch(e:error) {
  9014. };
  9015. break;
  9016. case CONSOLE:
  9017. if (ExternalInterface.available){
  9018. ExternalInterface.call("console.log", text);
  9019. };
  9020. break;
  9021. case trace:
  9022. break;
  9023. case NONE:
  9024. break;
  9025. default:
  9026. if (ExternalInterface.available){
  9027. ExternalInterface.call(_config.debug, text);
  9028. };
  9029. };
  9030. }
  9031. public static function setConfig(_arg1:PlayerConfig):void{
  9032. _config = _arg1;
  9033. }
  9034. private static function localConnectionEventHandler(_arg1:Event):void{
  9035. }
  9036.  
  9037. CONNECTION.addEventListener(AsyncErrorEvent.ASYNC_ERROR, localConnectionEventHandler);
  9038. CONNECTION.addEventListener(SecurityErrorEvent.SECURITY_ERROR, localConnectionEventHandler);
  9039. CONNECTION.addEventListener(StatusEvent.status, localConnectionEventHandler);
  9040. }
  9041. }//package com.longtailvideo.jwplayer.utils
  9042. package com.longtailvideo.jwplayer.utils {
  9043. import flash.events.*;
  9044. import flash.display.*;
  9045.  
  9046. public class Animations {
  9047.  
  9048. private var _tgt:movieclip;
  9049. private var _spd:number;
  9050. private var _end:number;
  9051. private var _xps:number;
  9052. private var _yps:number;
  9053. private var _str:string;
  9054.  
  9055. public function Animations(_arg1:movieclip){
  9056. this._tgt = _arg1;
  9057. }
  9058. public function fade(_arg1:number=1, _arg2:number=0.25):void{
  9059. this._end = _arg1;
  9060. if (this._tgt.alpha > this._end){
  9061. this._spd = -(math.abs(_arg2));
  9062. } else {
  9063. this._spd = math.abs(_arg2);
  9064. };
  9065. this._tgt.addEventListener(Event.ENTER_FRAME, this.fadeHandler);
  9066. }
  9067. private function fadeHandler(_arg1:Event):void{
  9068. if ((((((this._tgt.alpha >= (this._end - this._spd))) && ((this._spd > 0)))) || ((((this._tgt.alpha <= (this._end + this._spd))) && ((this._spd < 0)))))){
  9069. this._tgt.removeEventListener(Event.ENTER_FRAME, this.fadeHandler);
  9070. this._tgt.alpha = this._end;
  9071. if (this._end == 0){
  9072. this._tgt.visible = false;
  9073. };
  9074. } else {
  9075. this._tgt.visible = true;
  9076. this._tgt.alpha = (this._tgt.alpha + this._spd);
  9077. };
  9078. }
  9079. public function ease(_arg1:number, _arg2:number, _arg3:number=2):void{
  9080. this._spd = _arg3;
  9081. if (!_arg1){
  9082. this._xps = this._tgt.x;
  9083. } else {
  9084. this._xps = _arg1;
  9085. };
  9086. if (!_arg2){
  9087. this._yps = this._tgt.y;
  9088. } else {
  9089. this._yps = _arg2;
  9090. };
  9091. this._tgt.addEventListener(Event.ENTER_FRAME, this.easeHandler);
  9092. }
  9093. private function easeHandler(_arg1:Event):void{
  9094. if ((((math.abs((this._tgt.x - this._xps)) < 1)) && ((math.abs((this._tgt.y - this._yps)) < 1)))){
  9095. this._tgt.removeEventListener(Event.ENTER_FRAME, this.easeHandler);
  9096. this._tgt.x = this._xps;
  9097. this._tgt.y = this._yps;
  9098. } else {
  9099. this._tgt.x = (this._xps - ((this._xps - this._tgt.x) / this._spd));
  9100. this._tgt.y = (this._yps - ((this._yps - this._tgt.y) / this._spd));
  9101. };
  9102. }
  9103. public function write(_arg1:string, _arg2:number=1.5):void{
  9104. this._str = _arg1;
  9105. this._spd = _arg2;
  9106. this._tgt.tf.text = "";
  9107. this._tgt.addEventListener(Event.ENTER_FRAME, this.writeHandler);
  9108. }
  9109. private function writeHandler(_arg1:Event):void{
  9110. var _local2:number = math.floor(((this._str.length - this._tgt.tf.text.length) / this._spd));
  9111. this._tgt.tf.text = this._str.substr(0, (this._str.length - _local2));
  9112. if (this._tgt.tf.text == this._str){
  9113. this._tgt.tf.htmltext = this._str;
  9114. this._tgt.removeEventListener(Event.ENTER_FRAME, this.easeHandler);
  9115. };
  9116. }
  9117.  
  9118. }
  9119. }//package com.longtailvideo.jwplayer.utils
  9120. package com.longtailvideo.jwplayer.utils {
  9121. import flash.display.*;
  9122. import flash.utils.*;
  9123.  
  9124. public class Draw {
  9125.  
  9126. public static function clone(_arg1:DisplayObject, _arg2:boolean=false):DisplayObject{
  9127. var cls:* = null;
  9128. var idx:* = nan;
  9129. var tgt:* = _arg1;
  9130. var adc:boolean = _arg2;
  9131. var nam:* = getQualifiedClassName(tgt);
  9132. if (nam == "flash.display::MovieClip"){
  9133. return (tgt);
  9134. };
  9135. if (((tgt.hasOwnProperty("bitmapData")) && ((tgt["bitmapData"] is BitmapData)))){
  9136. return (new Bitmap(tgt["bitmapData"]));
  9137. };
  9138. try {
  9139. cls = (tgt.loaderInfo.applicationDomain.getDefinition(nam) as class);
  9140. } catch(e:error) {
  9141. cls = object(tgt).constructor;
  9142. };
  9143. var dup:* = new (cls)();
  9144. dup.transform = tgt.transform;
  9145. dup.filters = tgt.filters;
  9146. dup.cacheAsBitmap = tgt.cacheAsBitmap;
  9147. dup.opaqueBackground = tgt.opaqueBackground;
  9148. dup.name = tgt.name;
  9149. if (adc == true){
  9150. idx = tgt.parent.getChildIndex(tgt);
  9151. tgt.parent.addChildAt(dup, (idx + 1));
  9152. };
  9153. return (dup);
  9154. }
  9155. public static function clear(_arg1:DisplayObjectContainer):void{
  9156. var _local2:number = _arg1.numChildren;
  9157. var _local3:number = 0;
  9158. while (_local3 < _local2) {
  9159. _arg1.removeChildAt(0);
  9160. _local3++;
  9161. };
  9162. _arg1.scaleX = (_arg1.scaleY = 1);
  9163. }
  9164. public static function rect(_arg1:Sprite, _arg2:string, _arg3:number, _arg4:number, _arg5:number=0, _arg6:number=0, _arg7:number=1):Sprite{
  9165. var _local8:Sprite = new Sprite();
  9166. _local8.x = _arg5;
  9167. _local8.y = _arg6;
  9168. _local8.graphics.beginfill(uint(("0x" + _arg2)), _arg7);
  9169. _local8.graphics.drawRect(0, 0, _arg3, _arg4);
  9170. _arg1.addChild(_local8);
  9171. return (_local8);
  9172. }
  9173. public static function smooth(_arg1:Bitmap):void{
  9174. try {
  9175. _arg1.smoothing = true;
  9176. } catch(err:error) {
  9177. };
  9178. }
  9179.  
  9180. }
  9181. }//package com.longtailvideo.jwplayer.utils
  9182. package com.longtailvideo.jwplayer.utils {
  9183. import com.longtailvideo.jwplayer.model.*;
  9184. import flash.utils.*;
  9185.  
  9186. public class JavascriptSerialization {
  9187.  
  9188. public static function playlistToArray(_arg1:IPlaylist):array{
  9189. var _local2:array = [];
  9190. var _local3:number = 0;
  9191. while (_local3 < _arg1.length) {
  9192. _local2.push(playlistItemToObject(_arg1.getItemAt(_local3)));
  9193. _local3++;
  9194. };
  9195. return (_local2);
  9196. }
  9197. public static function playlistItemToObject(_arg1:PlaylistItem):object{
  9198. var _local3:string;
  9199. var _local4:PlaylistItemLevel;
  9200. var _local5:object;
  9201. var _local6:string;
  9202. var _local2:object = {
  9203. author:_arg1.author,
  9204. date:_arg1.date,
  9205. description:_arg1.description,
  9206. duration:_arg1.duration,
  9207. file:_arg1.file,
  9208. image:_arg1.image,
  9209. link:_arg1.link,
  9210. mediaid:_arg1.mediaid,
  9211. provider:_arg1.provider,
  9212. start:_arg1.start,
  9213. streamer:_arg1.streamer,
  9214. tags:_arg1.tags,
  9215. title:_arg1.title,
  9216. type:_arg1.provider
  9217. };
  9218. for (_local3 in _arg1) {
  9219. _local2[_local3] = _arg1[_local3];
  9220. };
  9221. if (_arg1.levels.length > 0){
  9222. _local2["levels"] = [];
  9223. for each (_local4 in _arg1.levels) {
  9224. _local5 = {
  9225. url:_local4.file,
  9226. bitrate:_local4.bitrate,
  9227. width:_local4.width
  9228. };
  9229. for (_local6 in _local4) {
  9230. _local5[_local6] = _local4[_local6];
  9231. };
  9232. _local2["levels"].push(_local5);
  9233. };
  9234. };
  9235. return (_local2);
  9236. }
  9237. public static function stripDots(_arg1){
  9238. var _local2:*;
  9239. var _local4:string;
  9240. var _local5:string;
  9241. var _local6:number;
  9242. var _local3:string = getQualifiedClassName(_arg1);
  9243. switch (getQualifiedClassName(_arg1)){
  9244. case "Object":
  9245. case "com.longtailvideo.jwplayer.model::PlaylistItem":
  9246. case "com.longtailvideo.jwplayer.model::PlaylistItemLevel":
  9247. case "com.longtailvideo.jwplayer.plugins::PluginConfig":
  9248. _local2 = {};
  9249. for (_local4 in _arg1) {
  9250. _local5 = _local4.replace(".", "__dot__");
  9251. _local5 = _local5.replace("-", "_");
  9252. _local2[_local5] = stripDots(_arg1[_local4]);
  9253. };
  9254. break;
  9255. case "Array":
  9256. _local2 = [];
  9257. _local6 = 0;
  9258. while (_local6 < (_arg1 as array).length) {
  9259. _local2[_local6] = stripDots(_arg1[_local6]);
  9260. _local6++;
  9261. };
  9262. break;
  9263. default:
  9264. _local2 = _arg1;
  9265. };
  9266. return (_local2);
  9267. }
  9268.  
  9269. }
  9270. }//package com.longtailvideo.jwplayer.utils
  9271. package com.longtailvideo.jwplayer.utils {
  9272. import com.longtailvideo.jwplayer.model.*;
  9273. import flash.utils.*;
  9274.  
  9275. public class TypeChecker {
  9276.  
  9277. public static function getType(_arg1:object, _arg2:string):string{
  9278. var type:* = null;
  9279. var object:* = _arg1;
  9280. var property:* = _arg2;
  9281. var description:* = describeType(object);
  9282. if ((description.accessor as XMLList).length()){
  9283. type = description.accessor.(@name == property).@type;
  9284. } else {
  9285. type = description.variable.(@name == property).@type;
  9286. };
  9287. return (type.replace(/(.+::)(.*)/, "$2"));
  9288. }
  9289. public static function guessType(_arg1:string):string{
  9290. var _local2:array = ["true", "false", "t", "f"];
  9291. if (_local2.indexof(_arg1.tolowercase().replace(" ", "")) >= 0){
  9292. return ("Boolean");
  9293. };
  9294. if (_arg1.search(/^(#|0x)[0-9a-fA-F]{3,6}/) >= 0){
  9295. return ("Color");
  9296. };
  9297. if (_arg1 === ""){
  9298. return ("String");
  9299. };
  9300. if (!isnan(number(_arg1))){
  9301. return ("Number");
  9302. };
  9303. return ("String");
  9304. }
  9305. public static function fromString(_arg1:string, _arg2:string=null){
  9306. if (_arg2 == null){
  9307. _arg2 = guessType(_arg1);
  9308. };
  9309. switch (_arg2.tolowercase()){
  9310. case "color":
  9311. if (_arg1.length > 0){
  9312. return (new color(stringToColor(_arg1)));
  9313. };
  9314. return (null);
  9315. case "number":
  9316. return (number(_arg1));
  9317. case "boolean":
  9318. if (_arg1.tolowercase() == "true"){
  9319. return (true);
  9320. };
  9321. if (_arg1 == "1"){
  9322. return (true);
  9323. };
  9324. return (false);
  9325. };
  9326. return (_arg1);
  9327. }
  9328. public static function stringToColor(_arg1:string):uint{
  9329. switch (_arg1.tolowercase()){
  9330. case "blue":
  9331. return (0xFF);
  9332. case "green":
  9333. return (0xFF00);
  9334. case "red":
  9335. return (0xFF0000);
  9336. case "cyan":
  9337. return (0xFFFF);
  9338. case "magenta":
  9339. return (0xFF00FF);
  9340. case "yellow":
  9341. return (0xFFFF00);
  9342. case "black":
  9343. return (0);
  9344. case "white":
  9345. return (0xFFFFFF);
  9346. default:
  9347. _arg1 = _arg1.replace(/(#|0x)?([0-9A-F]{3,6})$/gi, "$2");
  9348. if (_arg1.length == 3){
  9349. _arg1 = (((((_arg1.charat(0) + _arg1.charat(0)) + _arg1.charat(1)) + _arg1.charat(1)) + _arg1.charat(2)) + _arg1.charat(2));
  9350. };
  9351. return (uint(("0x" + _arg1)));
  9352. };
  9353. }
  9354.  
  9355. }
  9356. }//package com.longtailvideo.jwplayer.utils
  9357. package com.longtailvideo.jwplayer.utils {
  9358.  
  9359. public dynamic class NetClient {
  9360.  
  9361. private var callback:object;
  9362.  
  9363. public function NetClient(_arg1:object):void{
  9364. this.callback = _arg1;
  9365. }
  9366. private function forward(_arg1:object, _arg2:string):void{
  9367. var _local4:object;
  9368. _arg1["type"] = _arg2;
  9369. var _local3:object = new object();
  9370. for (_local4 in _arg1) {
  9371. _local3[_local4] = _arg1[_local4];
  9372. };
  9373. this.callback.onClientData(_local3);
  9374. }
  9375. public function close(... _args):void{
  9376. this.forward({close:true}, "close");
  9377. }
  9378. public function onBWCheck(... _args):number{
  9379. return (0);
  9380. }
  9381. public function onBWDone(... _args):void{
  9382. if (_args.length > 0){
  9383. this.forward({bandwidth:_args[0]}, "bandwidth");
  9384. };
  9385. }
  9386. public function onCaption(_arg1:string, _arg2:number):void{
  9387. this.forward({
  9388. captions:_arg1,
  9389. speaker:_arg2
  9390. }, "caption");
  9391. }
  9392. public function onCaptionInfo(_arg1:object):void{
  9393. this.forward(_arg1, "captioninfo");
  9394. }
  9395. public function onCuePoint(_arg1:object):void{
  9396. this.forward(_arg1, "cuepoint");
  9397. }
  9398. public function onFCSubscribe(_arg1:object):void{
  9399. this.forward(_arg1, "fcsubscribe");
  9400. }
  9401. public function onHeaderData(_arg1:object):void{
  9402. var _local5:string;
  9403. var _local6:string;
  9404. var _local2:object = new object();
  9405. var _local3 = "-";
  9406. var _local4 = "_";
  9407. for (_local5 in _arg1) {
  9408. _local6 = _local5.replace("-", "_");
  9409. _local2[_local6] = _arg1[_local5];
  9410. };
  9411. this.forward(_local2, "headerdata");
  9412. }
  9413. public function onid3(... _args):void{
  9414. this.forward(_args[0], "id3");
  9415. }
  9416. public function onImageData(_arg1:object):void{
  9417. this.forward(_arg1, "imagedata");
  9418. }
  9419. public function onLastSecond(_arg1:object):void{
  9420. this.forward(_arg1, "lastsecond");
  9421. }
  9422. public function onMetaData(_arg1:object, ... _args):void{
  9423. if (((_args) && ((_args.length > 0)))){
  9424. _args.splice(0, 0, _arg1);
  9425. this.forward({arguments:_args}, "metadata");
  9426. } else {
  9427. this.forward(_arg1, "metadata");
  9428. };
  9429. }
  9430. public function onPlayStatus(... _args):void{
  9431. var _local2:object;
  9432. for each (_local2 in _args) {
  9433. if (((_local2) && (_local2.hasOwnProperty("code")))){
  9434. if (_local2.code == "NetStream.Play.Complete"){
  9435. this.forward(_local2, "complete");
  9436. } else {
  9437. this.forward(_local2, "playstatus");
  9438. };
  9439. };
  9440. };
  9441. }
  9442. public function onSDES(... _args):void{
  9443. this.forward(_args[0], "sdes");
  9444. }
  9445. public function onXMPData(... _args):void{
  9446. this.forward(_args[0], "xmp");
  9447. }
  9448. public function onXMP(... _args):void{
  9449. this.onXMPData(_args);
  9450. }
  9451. public function RtmpSampleAccess(... _args):void{
  9452. this.forward(_args[0], "rtmpsampleaccess");
  9453. }
  9454. public function onTextData(_arg1:object):void{
  9455. this.forward(_arg1, "textdata");
  9456. }
  9457. public function onFI(_arg1:object):void{
  9458. this.forward(_arg1, "timecode");
  9459. }
  9460.  
  9461. }
  9462. }//package com.longtailvideo.jwplayer.utils
  9463. package com.longtailvideo.jwplayer.utils {
  9464. import flash.events.*;
  9465. import flash.display.*;
  9466. import flash.utils.*;
  9467. import flash.net.*;
  9468. import flash.system.*;
  9469.  
  9470. public class AssetLoader extends EventDispatcher {
  9471.  
  9472. private var _loaderExtensions:array;
  9473. private var _loader:Loader;
  9474. private var _urlLoader:URLLoader;
  9475. private var _errorState:boolean;
  9476. private var LoadedClass:class;
  9477. public var loadedObject;
  9478.  
  9479. public function AssetLoader(){
  9480. this._loaderExtensions = ["swf", "png", "gif", "jpg", "jpeg"];
  9481. super();
  9482. }
  9483. public function load(_arg1:string, _arg2:class=null):void{
  9484. this._errorState = false;
  9485. this.LoadedClass = _arg2;
  9486. var _local3:string = Strings.extension(_arg1);
  9487. if (this._loaderExtensions.indexof(_local3.tolowercase()) >= 0){
  9488. this.useLoader(_arg1);
  9489. } else {
  9490. this.useURLLoader(_arg1);
  9491. };
  9492. }
  9493. public function loadBytes(_arg1:ByteArray):void{
  9494. this.loader.loadBytes(_arg1);
  9495. }
  9496. protected function useLoader(_arg1:string):void{
  9497. var context:* = null;
  9498. var location:* = _arg1;
  9499. if (RootReference.root.loaderInfo.url.indexof("http") == 0){
  9500. context = new LoaderContext(true, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
  9501. this.loader.load(new URLRequest(location), context);
  9502. } else {
  9503. try {
  9504. this.loader.load(new URLRequest(location));
  9505. } catch(e:error) {
  9506. dispatchEvent(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, e.message));
  9507. };
  9508. };
  9509. }
  9510. protected function loadComplete(_arg1:Event):void{
  9511. var evt:* = _arg1;
  9512. try {
  9513. if (this.LoadedClass){
  9514. this.loadedObject = ((evt.target as LoaderInfo).content as this.LoadedClass);
  9515. } else {
  9516. this.loadedObject = (evt.target as LoaderInfo).content;
  9517. };
  9518. this.dispatchEvent(new Event(Event.COMPLETE));
  9519. } catch(e:error) {
  9520. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
  9521. };
  9522. }
  9523. protected function loadStatus(_arg1:HTTPStatusEvent):void{
  9524. switch (_arg1.status){
  9525. case 400:
  9526. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 400; Bad request."));
  9527. break;
  9528. case 401:
  9529. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 401; Unauthorized."));
  9530. break;
  9531. case 403:
  9532. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 403; Forbidden."));
  9533. break;
  9534. case 404:
  9535. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 404; Not Found."));
  9536. break;
  9537. case 500:
  9538. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 500; Internal Server Error."));
  9539. break;
  9540. case 503:
  9541. this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 503; Service Unavailable."));
  9542. break;
  9543. };
  9544. }
  9545. protected function loadError(_arg1:ErrorEvent):void{
  9546. this.dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
  9547. this._errorState = true;
  9548. }
  9549. protected function get loader():Loader{
  9550. if (!this._loader){
  9551. this._loader = new Loader();
  9552. this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loadComplete);
  9553. this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
  9554. this._loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loadError);
  9555. };
  9556. return (this._loader);
  9557. }
  9558. protected function useURLLoader(_arg1:string):void{
  9559. this.urlLoader.load(new URLRequest(_arg1));
  9560. }
  9561. protected function urlLoadComplete(_arg1:Event):void{
  9562. var evt:* = _arg1;
  9563. try {
  9564. if (this.LoadedClass){
  9565. this.loadedObject = this.LoadedClass((evt.target as URLLoader).data);
  9566. } else {
  9567. this.loadedObject = (evt.target as URLLoader).data;
  9568. };
  9569. this.dispatchEvent(new Event(Event.COMPLETE));
  9570. } catch(e:error) {
  9571. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
  9572. };
  9573. }
  9574. protected function get urlLoader():URLLoader{
  9575. if (!this._urlLoader){
  9576. this._urlLoader = new URLLoader();
  9577. this._urlLoader.addEventListener(Event.COMPLETE, this.urlLoadComplete);
  9578. this._urlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
  9579. this._urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.loadStatus);
  9580. this._urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loadError);
  9581. };
  9582. return (this._urlLoader);
  9583. }
  9584. override public function dispatchEvent(_arg1:Event):boolean{
  9585. if (!this._errorState){
  9586. return (super.dispatchEvent(_arg1));
  9587. };
  9588. return (false);
  9589. }
  9590.  
  9591. }
  9592. }//package com.longtailvideo.jwplayer.utils
  9593. package com.longtailvideo.jwplayer.utils {
  9594. import flash.display.*;
  9595.  
  9596. public class Stacker {
  9597.  
  9598. public var clip:movieclip;
  9599. private var stack:array;
  9600. private var _width:number;
  9601. private var latest:number = 0;
  9602.  
  9603. public function Stacker(_arg1:movieclip):void{
  9604. this.clip = _arg1;
  9605. this.analyze();
  9606. }
  9607. private function analyze():void{
  9608. var _local2:DisplayObject;
  9609. this._width = this.clip.width;
  9610. this.stack = new array();
  9611. var _local1:number = 0;
  9612. while (_local1 < this.clip.numChildren) {
  9613. _local2 = this.clip.getChildAt(_local1);
  9614. this.stack.push({
  9615. c:_local2,
  9616. x:_local2.x,
  9617. n:_local2.name,
  9618. w:_local2.width,
  9619. nr:_local2.hasOwnProperty("stacker.noresize")
  9620. });
  9621. _local1++;
  9622. };
  9623. this.stack.sorton(["x", "n"], [array.NUMERIC, array.CASEINSENSITIVE]);
  9624. }
  9625. private function overlaps(_arg1:number):boolean{
  9626. var _local2:number = this.stack[_arg1].x;
  9627. var _local3:number = (this.stack[_arg1].x + this.stack[_arg1].w);
  9628. var _local4:number = 0;
  9629. while (_local4 < this.stack.length) {
  9630. if (((((((((!((_local4 == _arg1))) && ((this.stack[_local4].c.visible == true)))) && ((this.stack[_local4].w < this._width)))) && ((this.stack[_local4].x < _local3)))) && (((this.stack[_local4].x + this.stack[_local4].w) > _local2)))){
  9631. return (true);
  9632. };
  9633. _local4++;
  9634. };
  9635. return (false);
  9636. }
  9637. public function rearrange(_arg1:number=undefined):void{
  9638. var _local6:number;
  9639. if (_arg1){
  9640. this.latest = _arg1;
  9641. };
  9642. var _local2:number = (this.latest - this.width);
  9643. var _local3:number = 0;
  9644. var _local4:number = 0;
  9645. while (_local4 < this.stack.length) {
  9646. if (this.stack[_local4].x > (this.width / 2)){
  9647. this.stack[_local4].c.x = (this.stack[_local4].x + _local2);
  9648. if ((((this.stack[_local4].c.visible == false)) && ((this.overlaps(_local4) == false)))){
  9649. if (_local4 < (this.stack.length - 1)){
  9650. _local2 = (_local2 - (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
  9651. } else {
  9652. _local2 = (_local2 - (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
  9653. };
  9654. };
  9655. } else {
  9656. this.stack[_local4].c.x = (this.stack[_local4].x - _local3);
  9657. if ((((this.stack[_local4].c.visible == false)) && ((this.overlaps(_local4) == false)))){
  9658. if (this.stack[(_local4 - 1)].w > (this.width / 4)){
  9659. _local3 = (_local3 + (this.stack[_local4].w + this.stack[_local4].x));
  9660. } else {
  9661. _local3 = (_local3 + (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
  9662. };
  9663. };
  9664. };
  9665. if ((((this.stack[_local4].w > (this.width / 4))) && (!(this.stack[_local4].nr)))){
  9666. this.stack[_local4].c.width = math.abs(((this.stack[_local4].w + _local2) + _local3));
  9667. } else {
  9668. if ((this.stack[_local4].c is InteractiveObject)){
  9669. this.stack[_local4].c.tabindex = (_local4 + 1);
  9670. };
  9671. };
  9672. _local4++;
  9673. };
  9674. var _local5:number = ((this.latest - this.width) - _local2);
  9675. if (_local5 > 0){
  9676. _local6 = 0;
  9677. while (_local6 < this.stack.length) {
  9678. if (this.stack[_local6].x > (this.width / 2)){
  9679. this.stack[_local6].c.x = (this.stack[_local6].c.x + _local5);
  9680. };
  9681. if ((((this.stack[_local6].w > (this.width / 4))) && ((this.stack[_local6].w < this.width)))){
  9682. this.stack[_local6].c.width = (this.stack[_local6].c.width + _local5);
  9683. };
  9684. _local6++;
  9685. };
  9686. };
  9687. }
  9688. public function get width():number{
  9689. return (this._width);
  9690. }
  9691. public function insert(_arg1:movieclip, _arg2:movieclip):void{
  9692. var _local3:number = 0;
  9693. var _local4:number = 0;
  9694. while (_local4 < this.stack.length) {
  9695. if (this.stack[_local4].w >= this._width){
  9696. this.stack[_local4].w = (this.stack[_local4].w + _arg1.width);
  9697. };
  9698. if ((((this.stack[_local4].c == _arg2)) && (!(_local3)))){
  9699. _local3 = _local4;
  9700. this.stack.splice(_local4, 0, {
  9701. c:_arg1,
  9702. x:this.stack[_local4].x,
  9703. n:_arg1.name,
  9704. w:_arg1.width
  9705. });
  9706. } else {
  9707. if (_local3){
  9708. this.stack[_local4].x = (this.stack[_local4].x + _arg1.width);
  9709. };
  9710. };
  9711. _local4++;
  9712. };
  9713. this._width = (this._width + _arg1.width);
  9714. this.rearrange();
  9715. }
  9716.  
  9717. }
  9718. }//package com.longtailvideo.jwplayer.utils
  9719. package com.longtailvideo.jwplayer.utils {
  9720. import com.adobe.serialization.json.*;
  9721.  
  9722. public class Strings {
  9723.  
  9724. public static function decode(_arg1:string):string{
  9725. if (_arg1.indexof("asfunction") == -1){
  9726. return (unescape(_arg1));
  9727. };
  9728. return ("");
  9729. }
  9730. public static function digits(_arg1:number):string{
  9731. var _local2:number = math.floor((_arg1 / 60));
  9732. var _local3:number = math.floor((_arg1 % 60));
  9733. var _local4:string = ((Strings.zero(_local2) + ":") + Strings.zero(_local3));
  9734. return (_local4);
  9735. }
  9736. public static function seconds(_arg1:string):number{
  9737. _arg1 = _arg1.replace(",", ".");
  9738. var _local2:array = _arg1.split(":");
  9739. var _local3:number = 0;
  9740. if (_arg1.substr(-2) == "ms"){
  9741. _local3 = (number(_arg1.substr(0, (_arg1.length - 2))) / 1000);
  9742. } else {
  9743. if (_arg1.substr(-1) == "s"){
  9744. _local3 = number(_arg1.substr(0, (_arg1.length - 1)));
  9745. } else {
  9746. if (_arg1.substr(-1) == "m"){
  9747. _local3 = (number(_arg1.substr(0, (_arg1.length - 1))) * 60);
  9748. } else {
  9749. if (_arg1.substr(-1) == "h"){
  9750. _local3 = (number(_arg1.substr(0, (_arg1.length - 1))) * 3600);
  9751. } else {
  9752. if (_local2.length > 1){
  9753. _local3 = number(_local2[(_local2.length - 1)]);
  9754. _local3 = (_local3 + (number(_local2[(_local2.length - 2)]) * 60));
  9755. if (_local2.length == 3){
  9756. _local3 = (_local3 + (number(_local2[(_local2.length - 3)]) * 3600));
  9757. };
  9758. } else {
  9759. _local3 = number(_arg1);
  9760. };
  9761. };
  9762. };
  9763. };
  9764. };
  9765. return (_local3);
  9766. }
  9767. public static function serialize(_arg1:string):object{
  9768. var jsonString:* = null;
  9769. var val:* = _arg1;
  9770. if (val == null){
  9771. return (null);
  9772. };
  9773. if (val == "true"){
  9774. return (true);
  9775. };
  9776. if (val == "false"){
  9777. return (false);
  9778. };
  9779. if (val.indexof("[[JSON]]") == 0){
  9780. jsonString = val.substring(8, val.length);
  9781. try {
  9782. return (new JSONDecoder(jsonString, false).getValue());
  9783. } catch(e:error) {
  9784. Logger.log(((("Error parsing JSON string: " + e.message) + ". String: ") + jsonString));
  9785. };
  9786. return (jsonString);
  9787. };
  9788. if (((((isnan(number(val))) || ((val.length > 5)))) || ((val.length == 0)))){
  9789. return (val);
  9790. };
  9791. return (number(val));
  9792. }
  9793. public static function strip(_arg1:string):string{
  9794. var _local4:number;
  9795. var _local2:array = _arg1.split("\n");
  9796. _arg1 = _local2.join("");
  9797. _local2 = _arg1.split("\r");
  9798. _arg1 = _local2.join("");
  9799. var _local3:number = _arg1.indexof("<");
  9800. while (_local3 != -1) {
  9801. _local4 = _arg1.indexof(">", (_local3 + 1));
  9802. if ((_local4 == -1)){
  9803. _local4 = (_arg1.length - 1);
  9804. };
  9805. _arg1 = ((_arg1.substr(0, _local3) + " ") + _arg1.substr((_local4 + 1), _arg1.length));
  9806. _local3 = _arg1.indexof("<", _local3);
  9807. };
  9808. return (_arg1);
  9809. }
  9810. public static function zero(_arg1:number):string{
  9811. if (_arg1 < 10){
  9812. return (("0" + _arg1));
  9813. };
  9814. return (("" + _arg1));
  9815. }
  9816. public static function extension(_arg1:string):string{
  9817. if (((_arg1) && ((_arg1.lastindexof(".") > 0)))){
  9818. if (_arg1.lastindexof("?") > 0){
  9819. _arg1 = string(_arg1.split("?")[0]);
  9820. };
  9821. return (_arg1.substring((_arg1.lastindexof(".") + 1), _arg1.length).tolowercase());
  9822. };
  9823. return ("");
  9824. }
  9825. public static function print_r(_arg1:object):string{
  9826. var _local3:object;
  9827. var _local2 = "";
  9828. if (typeof(_arg1) == "object"){
  9829. _local2 = (_local2 + "{");
  9830. };
  9831. for (_local3 in _arg1) {
  9832. if (typeof(_arg1[_local3]) == "object"){
  9833. _local2 = (_local2 + (_local3 + ": "));
  9834. } else {
  9835. _local2 = (_local2 + ((_local3 + ": ") + _arg1[_local3]));
  9836. };
  9837. _local2 = (_local2 + (print_r(_arg1[_local3]) + ", "));
  9838. };
  9839. if (_local2 != "{"){
  9840. _local2 = _local2.substr(0, (_local2.length - 2));
  9841. };
  9842. if (typeof(_arg1) == "object"){
  9843. _local2 = (_local2 + "}");
  9844. };
  9845. return (_local2);
  9846. }
  9847. public static function trim(_arg1:string):string{
  9848. return (_arg1.replace(/^\s+/, "").replace(/\s+$/, ""));
  9849. }
  9850. public static function xmlAttribute(_arg1:xml, _arg2:string):string{
  9851. var _local3:xml;
  9852. for each (_local3 in _arg1.attributes()) {
  9853. if (_local3.name().tostring().tolowercase() == _arg2.tolowercase()){
  9854. return (_local3.tostring());
  9855. };
  9856. };
  9857. return ("");
  9858. }
  9859. public static function getAbsolutePath(_arg1:string, _arg2:string=null):string{
  9860. var _local5:array;
  9861. if (_arg2 == null){
  9862. return (_arg1);
  9863. };
  9864. if (isAbsolutePath(_arg1)){
  9865. return (_arg1);
  9866. };
  9867. var _local3:string = _arg2.substring(0, (_arg2.indexof("://") + 3));
  9868. var _local4:string = _arg2.substring(_local3.length, _arg2.indexof("/", (_local3.length + 1)));
  9869. if (_arg1.indexof("/") === 0){
  9870. _local5 = _arg1.split("/");
  9871. } else {
  9872. _arg2 = _arg2.split("?")[0];
  9873. _arg2 = _arg2.substring(((_local3.length + _local4.length) + 1), _arg2.lastindexof("/"));
  9874. _local5 = _arg2.split("/").concat(_arg1.split("/"));
  9875. };
  9876. var _local6:array = [];
  9877. var _local7:int;
  9878. while (_local7 < _local5.length) {
  9879. if (((((!(_local5[_local7])) || ((_local5[_local7] === undefined)))) || ((_local5[_local7] == ".")))){
  9880. } else {
  9881. if (_local5[_local7] == ".."){
  9882. _local6.pop();
  9883. } else {
  9884. _local6.push(_local5[_local7]);
  9885. };
  9886. };
  9887. _local7++;
  9888. };
  9889. return ((((_local3 + _local4) + "/") + _local6.join("/")));
  9890. }
  9891. public static function isAbsolutePath(_arg1:string):boolean{
  9892. var _local2:int = _arg1.indexof("://");
  9893. var _local3:int = _arg1.indexof("?");
  9894. return ((((_local2 > 0)) && ((((_local3 < 0)) || ((_local3 > _local2))))));
  9895. }
  9896. public static function cleanLink(_arg1:string):string{
  9897. return (_arg1.replace(/^(javascript|asfunction|vbscript)\:/, ""));
  9898. }
  9899.  
  9900. }
  9901. }//package com.longtailvideo.jwplayer.utils
  9902. package com.longtailvideo.jwplayer.utils {
  9903. import flash.display.*;
  9904.  
  9905. public class Stretcher {
  9906.  
  9907. public static var EXACTFIT:string = "exactfit";
  9908. public static var FILL:string = "fill";
  9909. public static var NONE:string = "none";
  9910. public static var UNIFORM:string = "uniform";
  9911.  
  9912. public static function stretch(_arg1:DisplayObject, _arg2:number, _arg3:number, _arg4:string="uniform"):void{
  9913. var _local5:number = (_arg2 / _arg1.width);
  9914. var _local6:number = (_arg3 / _arg1.height);
  9915. switch (_arg4.tolowercase()){
  9916. case Stretcher.EXACTFIT:
  9917. _arg1.width = _arg2;
  9918. _arg1.height = _arg3;
  9919. break;
  9920. case Stretcher.FILL:
  9921. if (_local5 > _local6){
  9922. _arg1.width = (_arg1.width * _local5);
  9923. _arg1.height = (_arg1.height * _local5);
  9924. } else {
  9925. _arg1.width = (_arg1.width * _local6);
  9926. _arg1.height = (_arg1.height * _local6);
  9927. };
  9928. break;
  9929. case Stretcher.NONE:
  9930. _arg1.scaleX = 1;
  9931. _arg1.scaleY = 1;
  9932. break;
  9933. case Stretcher.UNIFORM:
  9934. default:
  9935. if (_local5 > _local6){
  9936. _arg1.width = (_arg1.width * _local6);
  9937. _arg1.height = (_arg1.height * _local6);
  9938. } else {
  9939. _arg1.width = (_arg1.width * _local5);
  9940. _arg1.height = (_arg1.height * _local5);
  9941. };
  9942. };
  9943. _arg1.x = math.round(((_arg2 / 2) - (_arg1.width / 2)));
  9944. _arg1.y = math.round(((_arg3 / 2) - (_arg1.height / 2)));
  9945. if (_arg1.width > 0){
  9946. _arg1.width = math.ceil(_arg1.width);
  9947. };
  9948. if (_arg1.height > 0){
  9949. _arg1.height = math.ceil(_arg1.height);
  9950. };
  9951. }
  9952.  
  9953. }
  9954. }//package com.longtailvideo.jwplayer.utils
  9955. package com.longtailvideo.jwplayer.controller {
  9956. import flash.events.*;
  9957. import com.longtailvideo.jwplayer.events.*;
  9958. import flash.utils.*;
  9959.  
  9960. public class TaskQueue extends EventDispatcher {
  9961.  
  9962. private var activeTask:function = null;
  9963. private var taskIndex:number = -1;
  9964. private var taskSuccess:Dictionary;
  9965. private var taskFailure:Dictionary;
  9966. private var taskOrder:array;
  9967. private var continueOnFailure:boolean;
  9968. private var failureState:boolean = false;
  9969. private var completed:boolean = false;
  9970.  
  9971. public function TaskQueue(_arg1:boolean=false){
  9972. this.taskOrder = [];
  9973. this.taskSuccess = new Dictionary();
  9974. this.taskFailure = new Dictionary();
  9975. this.continueOnFailure = _arg1;
  9976. }
  9977. public function queueTask(_arg1:function, _arg2:function=null, _arg3:function=null):void{
  9978. this.taskOrder.push(_arg1);
  9979. if (_arg2 != null){
  9980. this.taskSuccess[_arg1] = _arg2;
  9981. this.taskFailure[_arg1] = _arg3;
  9982. };
  9983. }
  9984. public function runTasks():void{
  9985. if (this.activeTask == null){
  9986. this.nextTask();
  9987. };
  9988. }
  9989. public function success(_arg1:Event=null):void{
  9990. var _local2:function;
  9991. if (!this.failureState){
  9992. _local2 = (this.taskSuccess[this.activeTask] as function);
  9993. if (_local2 != null){
  9994. _local2(_arg1);
  9995. };
  9996. this.nextTask();
  9997. };
  9998. }
  9999. public function failure(_arg1:Event):void{
  10000. var _local2:function = (this.taskFailure[this.activeTask] as function);
  10001. if (_local2 != null){
  10002. _local2(_arg1);
  10003. };
  10004. if ((_arg1 is ErrorEvent)){
  10005. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + ErrorEvent(_arg1).text)));
  10006. } else {
  10007. if ((((_arg1 is PlayerEvent)) && ((_arg1 as PlayerEvent).message))){
  10008. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + PlayerEvent(_arg1).message)));
  10009. } else {
  10010. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + _arg1.tostring())));
  10011. };
  10012. };
  10013. if (this.continueOnFailure){
  10014. this.nextTask();
  10015. } else {
  10016. this.failureState = true;
  10017. };
  10018. }
  10019. private function nextTask():void{
  10020. if (this.taskOrder.length > 0){
  10021. this.activeTask = (this.taskOrder.shift() as function);
  10022. this.taskIndex++;
  10023. this.activeTask();
  10024. } else {
  10025. if (!this.completed){
  10026. this.completed = true;
  10027. dispatchEvent(new Event(Event.COMPLETE));
  10028. };
  10029. };
  10030. }
  10031.  
  10032. }
  10033. }//package com.longtailvideo.jwplayer.controller
  10034. package com.longtailvideo.jwplayer.controller {
  10035. import com.longtailvideo.jwplayer.plugins.*;
  10036.  
  10037. public class LockManager {
  10038.  
  10039. private var _queue:array;
  10040.  
  10041. public function LockManager(){
  10042. this._queue = [];
  10043. super();
  10044. }
  10045. public function lock(_arg1:IPlugin, _arg2:function):boolean{
  10046. var _local3:object = {};
  10047. _local3["plugin"] = _arg1;
  10048. _local3["callback"] = _arg2;
  10049. this._queue.push(_local3);
  10050. return (true);
  10051. }
  10052. public function unlock(_arg1:IPlugin):boolean{
  10053. var _local2:object;
  10054. if (this.locked()){
  10055. _local2 = this._queue[0];
  10056. if (_local2["plugin"] == _arg1){
  10057. this._queue.shift();
  10058. this.executeCallback();
  10059. return (true);
  10060. };
  10061. };
  10062. return (false);
  10063. }
  10064. public function executeCallback():void{
  10065. var _local1:object;
  10066. var _local2:function;
  10067. if (this.locked()){
  10068. _local1 = this._queue[0];
  10069. _local2 = (_local1["callback"] as function);
  10070. _local2();
  10071. };
  10072. }
  10073. public function locked():boolean{
  10074. return ((this._queue.length > 0));
  10075. }
  10076.  
  10077. }
  10078. }//package com.longtailvideo.jwplayer.controller
  10079. package com.longtailvideo.jwplayer.controller {
  10080. import flash.events.*;
  10081. import com.longtailvideo.jwplayer.media.*;
  10082. import com.longtailvideo.jwplayer.utils.*;
  10083.  
  10084. public class MediaProviderLoader extends EventDispatcher {
  10085.  
  10086. private var repository:string = "http://providers.longtailvideo.com/5/";
  10087. public var loadedSource:MediaProvider;
  10088.  
  10089. public function loadSource(_arg1:string):void{
  10090. var _local2:AssetLoader = new AssetLoader();
  10091. _local2.addEventListener(Event.COMPLETE, this.loadHandler);
  10092. _local2.addEventListener(ErrorEvent.error, this.loadHandler);
  10093. if (_arg1.substr((_arg1.length - 4), 4) == ".swf"){
  10094. _local2.load(_arg1);
  10095. } else {
  10096. _local2.load(((this.repository + _arg1) + ".swf"));
  10097. };
  10098. }
  10099. private function loadHandler(_arg1:Event):void{
  10100. var evt:* = _arg1;
  10101. var loader:* = (evt.target as AssetLoader);
  10102. try {
  10103. this.loadedSource = (loader.loadedObject as MediaProvider);
  10104. if (this.loadedSource){
  10105. dispatchEvent(new Event(Event.COMPLETE));
  10106. } else {
  10107. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "Loaded file is not a valid media provider."));
  10108. };
  10109. } catch(e:error) {
  10110. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
  10111. };
  10112. }
  10113. private function loadError(_arg1:ErrorEvent):void{
  10114. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
  10115. }
  10116.  
  10117. }
  10118. }//package com.longtailvideo.jwplayer.controller
  10119. package com.longtailvideo.jwplayer.controller {
  10120. import com.longtailvideo.jwplayer.model.*;
  10121. import com.longtailvideo.jwplayer.plugins.*;
  10122. import com.longtailvideo.jwplayer.view.*;
  10123. import flash.events.*;
  10124. import com.longtailvideo.jwplayer.events.*;
  10125. import com.longtailvideo.jwplayer.player.*;
  10126. import com.jeroenwijering.events.*;
  10127. import com.longtailvideo.jwplayer.parsers.*;
  10128. import com.longtailvideo.jwplayer.utils.*;
  10129.  
  10130. public class Controller extends GlobalEventDispatcher {
  10131.  
  10132. protected var _player:IPlayer;
  10133. protected var _model:Model;
  10134. protected var _view:View;
  10135. protected var _setupComplete:boolean = false;
  10136. protected var _setupFinalized:boolean = false;
  10137. protected var _unlockAutostart:boolean = false;
  10138. protected var _lockingResume:boolean = false;
  10139. protected var _lockManager:LockManager;
  10140. protected var _unlockAndLoad:boolean;
  10141. protected var _playlistReady:boolean = false;
  10142. protected var _queuedSeek:number = -1;
  10143. protected var _idleSeek:number = -1;
  10144. protected var cdns:object;
  10145. protected var _delayedItem:PlaylistItem;
  10146. protected var _mediaLoader:MediaProviderLoader;
  10147.  
  10148. public function Controller(_arg1:IPlayer, _arg2:Model, _arg3:View){
  10149. this.cdns = {
  10150. bitgravity:{
  10151. http.startparam:"starttime",
  10152. provider:"http"
  10153. },
  10154. edgecast:{
  10155. http.startparam:"ec_seek",
  10156. provider:"http"
  10157. },
  10158. flvseek:{
  10159. http.startparam:"fs",
  10160. provider:"http"
  10161. },
  10162. highwinds:{
  10163. rtmp.loadbalance:true,
  10164. provider:"rtmp"
  10165. },
  10166. lighttpd:{
  10167. http.startparam:"start",
  10168. provider:"http"
  10169. },
  10170. vdox:{
  10171. rtmp.loadbalance:true,
  10172. provider:"rtmp"
  10173. }
  10174. };
  10175. super();
  10176. this._player = _arg1;
  10177. this._model = _arg2;
  10178. this._view = _arg3;
  10179. this._lockManager = new LockManager();
  10180. }
  10181. public function setupPlayer():void{
  10182. var _local1:PlayerSetup = new PlayerSetup(this._player, this._model, this._view);
  10183. _local1.addEventListener(Event.COMPLETE, this.setupComplete);
  10184. _local1.addEventListener(ErrorEvent.error, this.setupError);
  10185. this.addViewListeners();
  10186. _local1.setupPlayer();
  10187. }
  10188. protected function addViewListeners():void{
  10189. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PLAY, this.playHandler);
  10190. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PAUSE, this.pauseHandler);
  10191. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_STOP, this.stopHandler);
  10192. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_NEXT, this.nextHandler);
  10193. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PREV, this.prevHandler);
  10194. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_SEEK, this.seekHandler);
  10195. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_MUTE, this.muteHandler);
  10196. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_VOLUME, this.volumeHandler);
  10197. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this.fullscreenHandler);
  10198. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_LOAD, this.loadHandler);
  10199. this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_REDRAW, this.redrawHandler);
  10200. }
  10201. protected function playHandler(_arg1:ViewEvent):void{
  10202. this.play();
  10203. }
  10204. protected function stopHandler(_arg1:ViewEvent):void{
  10205. this.stop();
  10206. }
  10207. protected function pauseHandler(_arg1:ViewEvent):void{
  10208. this.pause();
  10209. }
  10210. protected function nextHandler(_arg1:ViewEvent):void{
  10211. this.next();
  10212. }
  10213. protected function prevHandler(_arg1:ViewEvent):void{
  10214. this.previous();
  10215. }
  10216. protected function seekHandler(_arg1:ViewEvent):void{
  10217. this.seek(_arg1.data);
  10218. }
  10219. protected function muteHandler(_arg1:ViewEvent):void{
  10220. this.mute(_arg1.data);
  10221. }
  10222. protected function volumeHandler(_arg1:ViewEvent):void{
  10223. this.setvolume(_arg1.data);
  10224. }
  10225. protected function fullscreenHandler(_arg1:ViewEvent):void{
  10226. this.fullscreen(_arg1.data);
  10227. }
  10228. protected function loadHandler(_arg1:ViewEvent):void{
  10229. this.load(_arg1.data);
  10230. }
  10231. protected function redrawHandler(_arg1:ViewEvent):void{
  10232. this.redraw();
  10233. }
  10234. protected function setupComplete(_arg1:Event):void{
  10235. this._setupComplete = true;
  10236. RootReference.stage.dispatchEvent(new Event(Event.RESIZE));
  10237. this._view.completeView();
  10238. this.finalizeSetup();
  10239. }
  10240. protected function setupError(_arg1:ErrorEvent):void{
  10241. Logger.log(("STARTUP: Error occurred during player startup: " + _arg1.text));
  10242. this._view.completeView(true, _arg1.text);
  10243. dispatchEvent(_arg1.clone());
  10244. }
  10245. protected function finalizeSetup():void{
  10246. if (((((!(this.locking)) && (this._setupComplete))) && (!(this._setupFinalized)))){
  10247. this._setupFinalized = true;
  10248. this._player.addEventListener(ErrorEvent.error, this.errorHandler);
  10249. this._model.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistLoadHandler, false, -1);
  10250. this._model.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistItemHandler, false, 1000);
  10251. this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_COMPLETE, this.completeHandler, false);
  10252. this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.timeHandler);
  10253. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_READY));
  10254. if (this._model.playlist.length > 0){
  10255. this._model.dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this._model.playlist));
  10256. };
  10257. };
  10258. }
  10259. protected function playlistLoadHandler(_arg1:PlaylistEvent=null):void{
  10260. this._playlistReady = true;
  10261. if (this._model.config.shuffle){
  10262. this.shuffleItem();
  10263. } else {
  10264. if (this._model.config.item >= this._model.playlist.length){
  10265. this._model.config.item = (this._model.playlist.length - 1);
  10266. };
  10267. this._model.playlist.currentIndex = this._model.config.item;
  10268. };
  10269. if (this._model.config.autostart){
  10270. if (this.locking){
  10271. this._unlockAutostart = true;
  10272. } else {
  10273. this.play();
  10274. };
  10275. };
  10276. }
  10277. protected function shuffleItem():void{
  10278. this._model.playlist.currentIndex = math.floor((math.random() * this._model.playlist.length));
  10279. }
  10280. protected function playlistItemHandler(_arg1:PlaylistEvent):void{
  10281. this._model.config.item = this._model.playlist.currentIndex;
  10282. this.load(this._model.playlist.currentItem);
  10283. }
  10284. protected function errorHandler(_arg1:ErrorEvent):void{
  10285. this._delayedItem = null;
  10286. this._mediaLoader = null;
  10287. this.errorState(_arg1.text);
  10288. }
  10289. protected function errorState(_arg1:string=""):void{
  10290. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, _arg1));
  10291. }
  10292. protected function completeHandler(_arg1:MediaEvent):void{
  10293. switch (this._model.config.repeat){
  10294. case RepeatOptions.SINGLE:
  10295. this.play();
  10296. break;
  10297. case RepeatOptions.ALWAYS:
  10298. if ((((this._model.playlist.currentIndex == (this._model.playlist.length - 1))) && (!(this._model.config.shuffle)))){
  10299. this._model.playlist.currentIndex = 0;
  10300. this.play();
  10301. } else {
  10302. this.next();
  10303. };
  10304. break;
  10305. case RepeatOptions.list:
  10306. if ((((this._model.playlist.currentIndex == (this._model.playlist.length - 1))) && (!(this._model.config.shuffle)))){
  10307. this._lockingResume = false;
  10308. this._model.playlist.currentIndex = 0;
  10309. } else {
  10310. this.next();
  10311. };
  10312. break;
  10313. };
  10314. }
  10315. public function get locking():boolean{
  10316. return (this._lockManager.locked());
  10317. }
  10318. public function lockPlayback(_arg1:IPlugin, _arg2:function):void{
  10319. var _local3:boolean = this.locking;
  10320. if (this._lockManager.lock(_arg1, _arg2)){
  10321. if ((((this._player.state == PlayerState.PLAYING)) || ((this._player.state == PlayerState.BUFFERING)))){
  10322. this._model.media.pause();
  10323. this._lockingResume = true;
  10324. };
  10325. if (!_local3){
  10326. Logger.log((_arg1.id + " locking playback"), "LOCK");
  10327. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_LOCKED));
  10328. this._lockManager.executeCallback();
  10329. };
  10330. };
  10331. }
  10332. public function unlockPlayback(_arg1:IPlugin):boolean{
  10333. if (this._lockManager.unlock(_arg1)){
  10334. if (!this.locking){
  10335. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_UNLOCKED));
  10336. };
  10337. if (((this._setupComplete) && (!(this._setupFinalized)))){
  10338. this.finalizeSetup();
  10339. };
  10340. if (!this.locking){
  10341. if (this._unlockAndLoad){
  10342. this.load(this._player.playlist.currentItem);
  10343. this._unlockAndLoad = false;
  10344. };
  10345. if (((this._lockingResume) || (this._unlockAutostart))){
  10346. this._lockingResume = false;
  10347. this.play();
  10348. if (this._unlockAutostart){
  10349. this._unlockAutostart = false;
  10350. };
  10351. };
  10352. return (true);
  10353. };
  10354. };
  10355. return (false);
  10356. }
  10357. public function setvolume(_arg1:number):boolean{
  10358. if (this.locking){
  10359. return (false);
  10360. };
  10361. if (this._model.media){
  10362. this.mute(false);
  10363. this._model.config.volume = _arg1;
  10364. this._model.media.setvolume(_arg1);
  10365. this.setCookie("volume", _arg1);
  10366. return (true);
  10367. };
  10368. return (false);
  10369. }
  10370. public function mute(_arg1:boolean):boolean{
  10371. if (this.locking){
  10372. return (false);
  10373. };
  10374. if (((_arg1) && (!(this._model.mute)))){
  10375. this._model.mute = true;
  10376. this.setCookie("mute", true);
  10377. return (true);
  10378. };
  10379. if (((!(_arg1)) && (this._model.mute))){
  10380. this._model.mute = false;
  10381. this.setCookie("mute", false);
  10382. return (true);
  10383. };
  10384. return (false);
  10385. }
  10386. public function play():boolean{
  10387. if (!this._playlistReady){
  10388. Logger.log("Attempted to begin playback before playlist is ready");
  10389. return (false);
  10390. };
  10391. if (this._mediaLoader){
  10392. this._delayedItem = this._model.playlist.currentItem;
  10393. return (false);
  10394. };
  10395. if (this.locking){
  10396. return (false);
  10397. };
  10398. if (this._model.playlist.currentItem){
  10399. switch (this._player.state){
  10400. case PlayerState.IDLE:
  10401. this._model.media.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL, this.bufferFullHandler);
  10402. this._model.media.load(this._model.playlist.currentItem);
  10403. break;
  10404. case PlayerState.PAUSED:
  10405. if (this._queuedSeek >= 0){
  10406. this._model.media.seek(this._queuedSeek);
  10407. this._queuedSeek = -1;
  10408. } else {
  10409. this._model.media.play();
  10410. };
  10411. break;
  10412. };
  10413. };
  10414. return (true);
  10415. }
  10416. public function pause():boolean{
  10417. if (this.locking){
  10418. return (false);
  10419. };
  10420. if (!this._model.media){
  10421. return (false);
  10422. };
  10423. switch (this._model.media.state){
  10424. case PlayerState.PLAYING:
  10425. case PlayerState.BUFFERING:
  10426. this._model.media.pause();
  10427. return (true);
  10428. };
  10429. return (false);
  10430. }
  10431. public function stop():boolean{
  10432. if (this.locking){
  10433. return (false);
  10434. };
  10435. if (!this._model.media){
  10436. return (false);
  10437. };
  10438. switch (this._model.media.state){
  10439. case PlayerState.PLAYING:
  10440. case PlayerState.BUFFERING:
  10441. case PlayerState.PAUSED:
  10442. this._model.media.stop();
  10443. return (true);
  10444. };
  10445. return (false);
  10446. }
  10447. public function next():boolean{
  10448. if (this.locking){
  10449. this._unlockAndLoad = true;
  10450. return (false);
  10451. };
  10452. this._lockingResume = true;
  10453. this.stop();
  10454. if (this._model.config.shuffle){
  10455. this.shuffleItem();
  10456. } else {
  10457. if (this._model.playlist.currentIndex == (this._model.playlist.length - 1)){
  10458. this._player.playlist.currentIndex = 0;
  10459. } else {
  10460. this._player.playlist.currentIndex = (this._player.playlist.currentIndex + 1);
  10461. };
  10462. };
  10463. this.play();
  10464. return (true);
  10465. }
  10466. public function previous():boolean{
  10467. if (this.locking){
  10468. this._unlockAndLoad = true;
  10469. return (false);
  10470. };
  10471. this._lockingResume = true;
  10472. this.stop();
  10473. if (this._model.config.shuffle){
  10474. this.shuffleItem();
  10475. } else {
  10476. if (this._model.playlist.currentIndex <= 0){
  10477. this._model.playlist.currentIndex = (this._model.playlist.length - 1);
  10478. } else {
  10479. this._player.playlist.currentIndex = (this._player.playlist.currentIndex - 1);
  10480. };
  10481. };
  10482. this.play();
  10483. return (true);
  10484. }
  10485. public function setPlaylistIndex(_arg1:number):boolean{
  10486. if (this.locking){
  10487. this._unlockAndLoad = true;
  10488. return (false);
  10489. };
  10490. this._lockingResume = true;
  10491. if ((((0 <= _arg1)) && ((_arg1 < this._player.playlist.length)))){
  10492. this.stop();
  10493. this._player.playlist.currentIndex = _arg1;
  10494. this.play();
  10495. return (true);
  10496. };
  10497. return (false);
  10498. }
  10499. public function seek(_arg1:number):boolean{
  10500. if (this.locking){
  10501. return (false);
  10502. };
  10503. if (((!(this._model.media)) || ((_arg1 == -1)))){
  10504. return (false);
  10505. };
  10506. switch (this._model.media.state){
  10507. case PlayerState.PLAYING:
  10508. case PlayerState.PAUSED:
  10509. this._model.seek(_arg1);
  10510. return (true);
  10511. case PlayerState.IDLE:
  10512. this._model.playlist.currentItem.start = _arg1;
  10513. this._idleSeek = _arg1;
  10514. this.play();
  10515. return (true);
  10516. case PlayerState.BUFFERING:
  10517. this._queuedSeek = _arg1;
  10518. break;
  10519. };
  10520. return (false);
  10521. }
  10522. public function load(_arg1):boolean{
  10523. if (this.locking){
  10524. this._unlockAndLoad = true;
  10525. return (false);
  10526. };
  10527. if (this._model.state != ModelStates.IDLE){
  10528. this._model.media.stop();
  10529. };
  10530. if ((_arg1 is PlaylistItem)){
  10531. return (this.loadPlaylistItem((_arg1 as PlaylistItem)));
  10532. };
  10533. if ((_arg1 is string)){
  10534. return (this.loadString((_arg1 as string)));
  10535. };
  10536. if ((_arg1 is number)){
  10537. return (this.loadNumber((_arg1 as number)));
  10538. };
  10539. if ((_arg1 is array)){
  10540. return (this.loadArray((_arg1 as array)));
  10541. };
  10542. if ((_arg1 is object)){
  10543. return (this.loadObject((_arg1 as object)));
  10544. };
  10545. return (false);
  10546. }
  10547. protected function loadPlaylistItem(_arg1:PlaylistItem):boolean{
  10548. var item:* = _arg1;
  10549. if (this.locking){
  10550. this._lockingResume = true;
  10551. return (false);
  10552. };
  10553. if (!this._model.playlist.contains(item)){
  10554. this._model.playlist.load(item);
  10555. return (false);
  10556. };
  10557. try {
  10558. if (((!(item.streamer)) && (this._model.config.streamer))){
  10559. item.streamer = this._model.config.streamer;
  10560. };
  10561. if (!item.provider){
  10562. item.provider = JWParser.getProvider(item);
  10563. };
  10564. if (((!(this.setProvider(item))) && (item.file))){
  10565. this._model.playlist.load(item.file);
  10566. } else {
  10567. if (this._mediaLoader){
  10568. this._model.setActiveMediaProvider("default");
  10569. dispatchEvent(new PlayerStateEvent(PlayerStateEvent.JWPLAYER_PLAYER_STATE, PlayerState.BUFFERING, PlayerState.IDLE));
  10570. };
  10571. };
  10572. } catch(err:error) {
  10573. Logger.log(err.message, "ERROR");
  10574. return (false);
  10575. };
  10576. Logger.log(("Loading PlaylistItem: " + item.tostring()), "LOAD");
  10577. return (true);
  10578. }
  10579. protected function loadString(_arg1:string):boolean{
  10580. this._model.playlist.load(new PlaylistItem({file:_arg1}));
  10581. return (true);
  10582. }
  10583. protected function loadArray(_arg1:array):boolean{
  10584. if (_arg1.length > 0){
  10585. this._model.playlist.load(_arg1);
  10586. return (true);
  10587. };
  10588. return (false);
  10589. }
  10590. protected function loadNumber(_arg1:number):boolean{
  10591. if ((((_arg1 >= 0)) && ((_arg1 < this._model.playlist.length)))){
  10592. this._model.playlist.currentIndex = _arg1;
  10593. return (this.loadPlaylistItem(this._model.playlist.currentItem));
  10594. };
  10595. return (false);
  10596. }
  10597. protected function loadObject(_arg1:object):boolean{
  10598. if (((_arg1.hasOwnProperty("file")) || (_arg1.hasOwnProperty("levels")))){
  10599. this._model.playlist.load(new PlaylistItem(_arg1));
  10600. return (true);
  10601. };
  10602. return (false);
  10603. }
  10604. protected function setProvider(_arg1:PlaylistItem):boolean{
  10605. var _local2:string = _arg1.provider;
  10606. if (_local2){
  10607. if (this.cdns.hasOwnProperty(_local2)){
  10608. this._model.config.setConfig(this.cdns[_local2]);
  10609. _local2 = this.cdns[_local2]["provider"];
  10610. };
  10611. if (!this._model.hasMediaProvider(_local2)){
  10612. this._mediaLoader = new MediaProviderLoader();
  10613. this._mediaLoader.addEventListener(Event.COMPLETE, this.mediaSourceLoaded);
  10614. this._mediaLoader.addEventListener(ErrorEvent.error, this.errorHandler);
  10615. this._mediaLoader.loadSource(_local2);
  10616. return (true);
  10617. };
  10618. this._model.setActiveMediaProvider(_local2);
  10619. return (true);
  10620. };
  10621. return (false);
  10622. }
  10623. protected function mediaSourceLoaded(_arg1:Event):void{
  10624. var _local2:MediaProviderLoader = this._mediaLoader;
  10625. this._mediaLoader = null;
  10626. if (this._delayedItem){
  10627. this._model.setMediaProvider(this._delayedItem.provider, _local2.loadedSource);
  10628. this._model.setActiveMediaProvider(this._delayedItem.provider);
  10629. this._delayedItem = null;
  10630. this.play();
  10631. } else {
  10632. this._model.setMediaProvider(this._model.playlist.currentItem.provider, _local2.loadedSource);
  10633. this._model.setActiveMediaProvider(this._model.playlist.currentItem.provider);
  10634. };
  10635. }
  10636. private function bufferFullHandler(_arg1:MediaEvent):void{
  10637. if (!this.locking){
  10638. if (this._queuedSeek >= 0){
  10639. this._model.media.seek(this._queuedSeek);
  10640. this._queuedSeek = -1;
  10641. } else {
  10642. this._model.media.play();
  10643. };
  10644. } else {
  10645. this._lockingResume = true;
  10646. };
  10647. }
  10648. private function timeHandler(_arg1:MediaEvent):void{
  10649. if ((((this._idleSeek > 0)) && ((_arg1.position >= this._idleSeek)))){
  10650. this._model.playlist.currentItem.start = 0;
  10651. this._idleSeek = -1;
  10652. };
  10653. }
  10654. public function redraw():boolean{
  10655. if (this.locking){
  10656. return (false);
  10657. };
  10658. this._view.redraw();
  10659. return (true);
  10660. }
  10661. public function fullscreen(_arg1:boolean):boolean{
  10662. this._view.fullscreen(_arg1);
  10663. this._model.fullscreen = _arg1;
  10664. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_FULLSCREEN, _arg1.tostring()));
  10665. return (true);
  10666. }
  10667. protected function setCookie(_arg1:string, _arg2):void{
  10668. Configger.saveCookie(_arg1, _arg2);
  10669. }
  10670.  
  10671. }
  10672. }//package com.longtailvideo.jwplayer.controller
  10673. package com.longtailvideo.jwplayer.controller {
  10674. import flash.events.*;
  10675. import flash.display.*;
  10676. import flash.utils.*;
  10677. import com.longtailvideo.jwplayer.utils.*;
  10678.  
  10679. public class PluginLoader extends EventDispatcher {
  10680.  
  10681. public var plugins:object;
  10682. private var loaders:Dictionary;
  10683.  
  10684. public function PluginLoader(){
  10685. this.loaders = new Dictionary();
  10686. this.plugins = {};
  10687. }
  10688. protected function get pluginRepository():string{
  10689. try {
  10690. if (RootReference.root.loaderInfo.url.indexof("https://") == 0){
  10691. return ("https://secureplugins.longtailvideo.com/");
  10692. };
  10693. } catch(e:error) {
  10694. };
  10695. return ("http://plugins.longtailvideo.com/");
  10696. }
  10697. public function loadPlugins(_arg1:string):void{
  10698. var _local2:array;
  10699. var _local3:string;
  10700. if (_arg1){
  10701. _local2 = _arg1.replace(/\s*/g, "").split(",");
  10702. for each (_local3 in _local2) {
  10703. if (_local3){
  10704. this.loadLocalPlugin(_local3);
  10705. };
  10706. };
  10707. } else {
  10708. dispatchEvent(new Event(Event.COMPLETE));
  10709. };
  10710. }
  10711. private function loadLocalPlugin(_arg1:string):void{
  10712. var _local2:AssetLoader;
  10713. if (_arg1.indexof("/") >= 0){
  10714. _local2 = new AssetLoader();
  10715. _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
  10716. _local2.addEventListener(ErrorEvent.error, this.loadLocalFailed);
  10717. this.loaders[_local2] = _arg1;
  10718. _local2.load(_arg1);
  10719. } else {
  10720. this.loadV5Plugin(_arg1);
  10721. };
  10722. }
  10723. private function loadLocalFailed(_arg1:ErrorEvent):void{
  10724. var _local2:AssetLoader = (_arg1.target as AssetLoader);
  10725. var _local3:string = this.loaders[_local2];
  10726. _local2.removeEventListener(ErrorEvent.error, this.loadLocalFailed);
  10727. delete this.loaders[_local2];
  10728. this.checkComplete();
  10729. }
  10730. private function loadV5Plugin(_arg1:string):void{
  10731. var _local2:AssetLoader = new AssetLoader();
  10732. _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
  10733. _local2.addEventListener(ErrorEvent.error, this.loadV5Failed);
  10734. var _local3:array = _arg1.substr((_arg1.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-");
  10735. var _local4:string = _local3[0];
  10736. var _local5:string = (((_local3.length > 1)) ? ("-" + _local3[1]) : "");
  10737. var _local6 = ((((((this.pluginRepository + "5/") + _local4) + "/") + _local4) + _local5) + ".swf");
  10738. this.loaders[_local2] = _arg1;
  10739. _local2.load(_local6);
  10740. }
  10741. private function loadV5Failed(_arg1:ErrorEvent):void{
  10742. var _local2:AssetLoader = (_arg1.target as AssetLoader);
  10743. var _local3:string = (this.loaders[_local2] as string);
  10744. _local2.removeEventListener(ErrorEvent.error, this.loadV5Failed);
  10745. delete this.loaders[_local2];
  10746. this.loadV4Plugin(_local3);
  10747. }
  10748. private function loadV4Plugin(_arg1:string):void{
  10749. var _local2:AssetLoader = new AssetLoader();
  10750. _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
  10751. _local2.addEventListener(ErrorEvent.error, this.loadV4Failed);
  10752. this.loaders[_local2] = _arg1;
  10753. if (Strings.extension(_arg1) == "swf"){
  10754. _arg1 = _arg1.substring(0, (_arg1.length - 4));
  10755. };
  10756. _local2.load((((this.pluginRepository + "4/") + _arg1) + ".swf"));
  10757. }
  10758. private function loadV4Failed(_arg1:ErrorEvent):void{
  10759. var _local2:AssetLoader = (_arg1.target as AssetLoader);
  10760. delete this.loaders[_local2];
  10761. this.checkComplete();
  10762. }
  10763. private function loadSuccess(_arg1:Event):void{
  10764. var _local2:AssetLoader = (_arg1.target as AssetLoader);
  10765. var _local3:string = (this.loaders[_local2] as string);
  10766. var _local4:string = _local3.substr((_local3.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-")[0];
  10767. this.plugins[_local4] = (_local2.loadedObject as DisplayObject);
  10768. _local2.removeEventListener(Event.COMPLETE, this.loadSuccess);
  10769. delete this.loaders[_local2];
  10770. this.checkComplete();
  10771. }
  10772. private function checkComplete():void{
  10773. var _local2:string;
  10774. var _local1:boolean;
  10775. for each (_local2 in this.loaders) {
  10776. _local1 = true;
  10777. };
  10778. if (!_local1){
  10779. dispatchEvent(new Event(Event.COMPLETE));
  10780. };
  10781. }
  10782.  
  10783. }
  10784. }//package com.longtailvideo.jwplayer.controller
  10785. package com.longtailvideo.jwplayer.controller {
  10786. import com.longtailvideo.jwplayer.model.*;
  10787. import com.longtailvideo.jwplayer.view.interfaces.*;
  10788. import com.longtailvideo.jwplayer.plugins.*;
  10789. import com.longtailvideo.jwplayer.view.*;
  10790. import flash.events.*;
  10791. import com.longtailvideo.jwplayer.events.*;
  10792. import flash.display.*;
  10793. import com.longtailvideo.jwplayer.view.skins.*;
  10794. import com.longtailvideo.jwplayer.player.*;
  10795. import com.jeroenwijering.events.*;
  10796. import com.longtailvideo.jwplayer.utils.*;
  10797.  
  10798. public class PlayerSetup extends EventDispatcher {
  10799.  
  10800. protected var _player:IPlayer;
  10801. protected var _model:Model;
  10802. protected var _view:View;
  10803. protected var tasker:TaskQueue;
  10804. protected var confHash:object;
  10805. protected var confPlaylist:array;
  10806.  
  10807. public function PlayerSetup(_arg1:IPlayer, _arg2:Model, _arg3:View){
  10808. this._player = _arg1;
  10809. this._model = _arg2;
  10810. this._view = _arg3;
  10811. }
  10812. public function setupPlayer():void{
  10813. this.tasker = new TaskQueue(false);
  10814. this.tasker.addEventListener(Event.COMPLETE, this.setupTasksComplete);
  10815. this.tasker.addEventListener(ErrorEvent.error, this.setupTasksFailed);
  10816. this.tasker.queueTask(this.loadConfig, this.loadConfigComplete);
  10817. this.tasker.queueTask(this.loadSkin, this.loadSkinComplete);
  10818. this.tasker.queueTask(this.setupMediaProviders);
  10819. this.tasker.queueTask(this.setupView);
  10820. this.tasker.queueTask(this.loadPlugins, this.loadPluginsComplete);
  10821. this.tasker.queueTask(this.loadPlaylist, this.loadPlaylistComplete);
  10822. this.tasker.queueTask(this.initPlugins);
  10823. this.tasker.runTasks();
  10824. }
  10825. protected function setupTasksComplete(_arg1:Event):void{
  10826. this.complete();
  10827. }
  10828. protected function setupTasksFailed(_arg1:ErrorEvent):void{
  10829. this.error(_arg1.text);
  10830. }
  10831. protected function complete():void{
  10832. dispatchEvent(new Event(Event.COMPLETE));
  10833. }
  10834. protected function error(_arg1:string):void{
  10835. dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1));
  10836. }
  10837. protected function loadConfig():void{
  10838. var configger:* = new Configger();
  10839. configger.addEventListener(Event.COMPLETE, this.tasker.success);
  10840. configger.addEventListener(ErrorEvent.error, this.tasker.failure);
  10841. try {
  10842. configger.loadConfig();
  10843. } catch(e:error) {
  10844. error(e.message);
  10845. };
  10846. }
  10847. protected function loadConfigComplete(_arg1:Event):void{
  10848. this.confHash = (_arg1.target as Configger).config;
  10849. if (((this.confHash["playlist"]) && ((this.confHash["playlist"] is array)))){
  10850. this.confPlaylist = this.confHash["playlist"];
  10851. delete this.confHash["playlist"];
  10852. };
  10853. }
  10854. protected function loadSkin(_arg1:ErrorEvent=null):void{
  10855. var _local2:ISkin;
  10856. if (((((this.confHash) && (this.confHash["skin"]))) && ((_arg1 == null)))){
  10857. if (Strings.extension(this.confHash["skin"]) == "swf"){
  10858. _local2 = new SWFSkin();
  10859. } else {
  10860. if (Strings.extension(this.confHash["skin"]) == "zip"){
  10861. _local2 = new ZIPSkin();
  10862. } else {
  10863. if (Strings.extension(this.confHash["skin"]) == "xml"){
  10864. _local2 = new PNGSkin();
  10865. } else {
  10866. Logger.log(("Could not load skin " + this.confHash["skin"]));
  10867. };
  10868. };
  10869. };
  10870. };
  10871. if (_local2){
  10872. _local2.addEventListener(ErrorEvent.error, this.loadSkin);
  10873. } else {
  10874. if (_arg1){
  10875. Logger.log(("Error loading skin: " + _arg1.text));
  10876. (_arg1.target as EventDispatcher).removeEventListener(ErrorEvent.error, this.loadSkin);
  10877. };
  10878. _local2 = new DefaultSkin();
  10879. _local2.addEventListener(ErrorEvent.error, this.tasker.failure);
  10880. };
  10881. _local2.addEventListener(Event.COMPLETE, this.tasker.success);
  10882. _local2.load(this.confHash["skin"]);
  10883. }
  10884. protected function loadSkinComplete(_arg1:Event=null):void{
  10885. var _local2:ISkin;
  10886. var _local3:SkinProperties;
  10887. if (_arg1){
  10888. _local2 = (_arg1.target as ISkin);
  10889. _local2.removeEventListener(Event.COMPLETE, this.tasker.success);
  10890. _local2.removeEventListener(ErrorEvent.error, this.tasker.failure);
  10891. _local2.removeEventListener(ErrorEvent.error, this.loadSkin);
  10892. _local3 = _local2.getSkinProperties();
  10893. this._model.config.setConfig(_local3);
  10894. this._model.config.setConfig(this.confHash);
  10895. this._view.skin = _local2;
  10896. } else {
  10897. this._model.config.setConfig(this.confHash);
  10898. };
  10899. Logger.setConfig(this._model.config);
  10900. }
  10901. protected function setupMediaProviders():void{
  10902. this._model.setupMediaProviders();
  10903. this.tasker.success();
  10904. }
  10905. protected function setupView():void{
  10906. try {
  10907. this._view.setupView();
  10908. } catch(e:error) {
  10909. tasker.failure(new ErrorEvent(ErrorEvent.error, false, false, ("View setup failed: " + e.message)));
  10910. };
  10911. this.tasker.success();
  10912. }
  10913. protected function loadPlugins():void{
  10914. var _local1:PluginLoader;
  10915. if (this._model.config.plugins){
  10916. _local1 = new PluginLoader();
  10917. _local1.addEventListener(Event.COMPLETE, this.tasker.success);
  10918. _local1.addEventListener(ErrorEvent.error, this.tasker.failure);
  10919. _local1.loadPlugins(this._model.config.plugins);
  10920. } else {
  10921. this.tasker.success();
  10922. };
  10923. }
  10924. protected function loadPluginsComplete(_arg1:Event=null):void{
  10925. var _local2:PluginLoader;
  10926. var _local3:string;
  10927. var _local4:DisplayObject;
  10928. var _local5:object;
  10929. var _local6:PluginConfig;
  10930. var _local7:string;
  10931. if (_arg1){
  10932. _local2 = (_arg1.target as PluginLoader);
  10933. for (_local3 in _local2.plugins) {
  10934. _local4 = (_local2.plugins[_local3] as DisplayObject);
  10935. if ((_local4 is IPlugin)){
  10936. this._view.addPlugin(_local3, (_local4 as IPlugin));
  10937. } else {
  10938. if ((_local4 is PluginInterface)){
  10939. if ((_local4 as object).hasOwnProperty("config")){
  10940. _local5 = (_local4 as object).config;
  10941. _local6 = this._model.config.pluginConfig(_local3);
  10942. for (_local7 in _local5) {
  10943. if (!_local6.hasOwnProperty(_local7)){
  10944. _local6[_local7] = _local5[_local7];
  10945. };
  10946. };
  10947. _local6["width"] = this._player.controls.display.width;
  10948. _local6["height"] = this._player.controls.display.height;
  10949. _local6["visible"] = true;
  10950. };
  10951. this._view.addPlugin(_local3, new V4Plugin((_local4 as PluginInterface), _local3));
  10952. };
  10953. };
  10954. };
  10955. };
  10956. }
  10957. protected function loadPlaylist():void{
  10958. this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.tasker.success);
  10959. this._model.playlist.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.tasker.failure);
  10960. if (((this.confPlaylist) && ((this.confPlaylist.length > 0)))){
  10961. this._model.playlist.load(this.confPlaylist);
  10962. } else {
  10963. if (this._model.config.playlistfile){
  10964. this._model.playlist.load(this._model.config.playlistfile);
  10965. } else {
  10966. if (this._model.config.singleItem.file){
  10967. this._model.playlist.load(this._model.config.singleItem);
  10968. } else {
  10969. this.tasker.success();
  10970. };
  10971. };
  10972. };
  10973. }
  10974. protected function loadPlaylistComplete(_arg1:Event=null):void{
  10975. this._model.playlist.removeEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.tasker.success);
  10976. this._model.playlist.removeEventListener(PlayerEvent.JWPLAYER_ERROR, this.tasker.failure);
  10977. }
  10978. protected function initPlugins():void{
  10979. var pluginId:* = null;
  10980. var plugin:* = null;
  10981. for each (pluginId in this._view.loadedPlugins()) {
  10982. try {
  10983. plugin = this._view.getPlugin(pluginId);
  10984. plugin.initPlugin(this._player, this._model.config.pluginConfig(pluginId));
  10985. } catch(e:error) {
  10986. Logger.log(("Error initializing plugin: " + e.message));
  10987. if (plugin){
  10988. _view.removePlugin(plugin);
  10989. };
  10990. };
  10991. };
  10992. this.tasker.success();
  10993. }
  10994.  
  10995. }
  10996. }//package com.longtailvideo.jwplayer.controller
  10997. package com.longtailvideo.jwplayer.controller {
  10998.  
  10999. public class RepeatOptions {
  11000.  
  11001. public static const list:string = "list";
  11002. public static const ALWAYS:string = "always";
  11003. public static const SINGLE:string = "single";
  11004. public static const NONE:string = "none";
  11005.  
  11006. }
  11007. }//package com.longtailvideo.jwplayer.controller
  11008. package com.longtailvideo.jwplayer.model {
  11009. import flash.events.*;
  11010. import com.longtailvideo.jwplayer.events.*;
  11011. import com.longtailvideo.jwplayer.media.*;
  11012. import com.longtailvideo.jwplayer.parsers.*;
  11013. import com.longtailvideo.jwplayer.utils.*;
  11014.  
  11015. public class Playlist extends GlobalEventDispatcher implements IPlaylist {
  11016.  
  11017. private var list:array;
  11018. private var index:number;
  11019. private var lastItem:PlaylistItem = null;
  11020. private var playlistLoader:AssetLoader;
  11021.  
  11022. public function Playlist(){
  11023. this.list = [];
  11024. this.index = -1;
  11025. this.playlistLoader = new AssetLoader();
  11026. this.playlistLoader.addEventListener(Event.COMPLETE, this.playlistLoaded);
  11027. this.playlistLoader.addEventListener(ErrorEvent.error, this.playlistLoadError);
  11028. }
  11029. public function load(_arg1:object):void{
  11030. var _local3:number;
  11031. var _local4:PlaylistItem;
  11032. var _local5:PlaylistItem;
  11033. var _local6:PlaylistItem;
  11034. var _local2:array = [];
  11035. if ((_arg1 is array)){
  11036. _local3 = 0;
  11037. while (_local3 < (_arg1 as array).length) {
  11038. if (!(_arg1[_local3] is PlaylistItem)){
  11039. _local4 = new PlaylistItem(_arg1[_local3]);
  11040. _arg1[_local3] = _local4;
  11041. };
  11042. try {
  11043. if ((_arg1[_local3] as PlaylistItem).file){
  11044. _local2.push((_arg1[_local3] as PlaylistItem));
  11045. };
  11046. } catch(e:error) {
  11047. };
  11048. _local3++;
  11049. };
  11050. } else {
  11051. if ((_arg1 is PlaylistItem)){
  11052. _local5 = (_arg1 as PlaylistItem);
  11053. if (JWParser.getProvider(_local5)){
  11054. _local2.push(_local5);
  11055. } else {
  11056. this.load(_local5.file);
  11057. return;
  11058. };
  11059. } else {
  11060. if ((_arg1 is Playlist)){
  11061. _local3 = 0;
  11062. while (_local3 < (_arg1 as Playlist).length) {
  11063. _local2.push((_arg1 as Playlist).getItemAt(_local3));
  11064. _local3++;
  11065. };
  11066. } else {
  11067. if ((((_arg1 is string)) && (!((_arg1 == ""))))){
  11068. this.playlistLoader.load(string(_arg1), xml);
  11069. return;
  11070. };
  11071. this.playlistError("Incorrect playlist type");
  11072. return;
  11073. };
  11074. };
  11075. };
  11076. if (_local2.length > 0){
  11077. for each (_local6 in _local2) {
  11078. if (!_local6.provider){
  11079. _local6.provider = JWParser.getProvider(_local6);
  11080. };
  11081. if ((((_local6.provider == "youtube")) && (!(_local6.image)))){
  11082. _local6.image = (("http://i.ytimg.com/vi/" + YouTubeMediaProvider.getID(_local6.file)) + "/0.jpg");
  11083. };
  11084. };
  11085. this.list = _local2;
  11086. this.index = 0;
  11087. dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this));
  11088. } else {
  11089. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, "Loaded playlist is empty"));
  11090. };
  11091. }
  11092. protected function playlistLoaded(_arg1:Event):void{
  11093. var _local4:array;
  11094. var _local2:xml = (this.playlistLoader.loadedObject as xml);
  11095. var _local3:IPlaylistParser = ParserFactory.getParser(_local2);
  11096. if (_local3){
  11097. _local4 = _local3.parse(_local2);
  11098. if (_local4.length > 0){
  11099. this.load(_local4);
  11100. } else {
  11101. this.playlistError("XML could not be parsed or playlist was empty");
  11102. };
  11103. } else {
  11104. this.playlistError("Playlist file did not contain a valid playlist");
  11105. };
  11106. }
  11107. protected function playlistLoadError(_arg1:ErrorEvent):void{
  11108. this.playlistError(_arg1.text);
  11109. }
  11110. protected function playlistError(_arg1:string):void{
  11111. if (_arg1.indexof("Error #2048") >= 0){
  11112. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, "Playlist could not be loaded due to crossdomain policy restrictions."));
  11113. } else {
  11114. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, ("Playlist could not be loaded: " + _arg1)));
  11115. };
  11116. }
  11117. public function getItemAt(_arg1:number):PlaylistItem{
  11118. try {
  11119. return (this.list[_arg1]);
  11120. } catch(e:error) {
  11121. };
  11122. return (null);
  11123. }
  11124. public function insertItem(_arg1:PlaylistItem, _arg2:number=-1):void{
  11125. if ((((_arg2 >= 0)) && ((_arg2 < this.list.length)))){
  11126. this.list.splice(_arg2, 0, _arg1);
  11127. } else {
  11128. this.list.push(_arg1);
  11129. };
  11130. dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this));
  11131. if (this.index < 0){
  11132. this.currentIndex = (this.list.length - 1);
  11133. };
  11134. }
  11135. public function removeItemAt(_arg1:number):void{
  11136. if ((((((_arg1 >= 0)) && ((_arg1 < this.list.length)))) && ((this.list.length > 0)))){
  11137. this.list.splice(_arg1, 1);
  11138. dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this));
  11139. };
  11140. if (this.index >= this.list.length){
  11141. this.currentIndex = (this.list.length - 1);
  11142. };
  11143. }
  11144. public function get currentIndex():number{
  11145. return (this.index);
  11146. }
  11147. public function set currentIndex(_arg1:number):void{
  11148. if (_arg1 > this.list.length){
  11149. _arg1 = 0;
  11150. };
  11151. if (_arg1 >= 0){
  11152. this.index = _arg1;
  11153. if (this.getItemAt(_arg1) != this.lastItem){
  11154. this.lastItem = this.currentItem;
  11155. dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this));
  11156. };
  11157. } else {
  11158. this.lastItem = null;
  11159. this.index = -1;
  11160. };
  11161. }
  11162. public function get currentItem():PlaylistItem{
  11163. return ((((this.index >= 0)) ? this.getItemAt(this.index) : null));
  11164. }
  11165. public function get length():number{
  11166. return (this.list.length);
  11167. }
  11168. public function contains(_arg1:PlaylistItem):boolean{
  11169. var _local2:number = 0;
  11170. while (_local2 < this.length) {
  11171. if (this.getItemAt(_local2) == _arg1){
  11172. return (true);
  11173. };
  11174. _local2++;
  11175. };
  11176. return (false);
  11177. }
  11178.  
  11179. }
  11180. }//package com.longtailvideo.jwplayer.model
  11181. package com.longtailvideo.jwplayer.model {
  11182. import com.longtailvideo.jwplayer.plugins.*;
  11183. import flash.events.*;
  11184. import com.longtailvideo.jwplayer.player.*;
  11185. import flash.utils.*;
  11186. import com.longtailvideo.jwplayer.utils.*;
  11187.  
  11188. public dynamic class PlayerConfig extends EventDispatcher {
  11189.  
  11190. protected var _singleItem:PlaylistItem;
  11191. protected var _playlistfile:string = null;
  11192. protected var _autostart:boolean = false;
  11193. protected var _bandwidth:number = 1500;
  11194. protected var _bufferlength:number = 3;
  11195. protected var _displaytitle:boolean = true;
  11196. protected var _se_livestream:boolean = false;
  11197. protected var _se_disabledynamic:boolean = false;
  11198. protected var _fullscreen:boolean = false;
  11199. protected var _item:number = 0;
  11200. protected var _linktarget:string = "_blank";
  11201. protected var _levels:array = null;
  11202. protected var _mute:boolean = false;
  11203. protected var _repeat:string = "none";
  11204. protected var _shuffle:boolean = false;
  11205. protected var _smoothing:boolean = true;
  11206. protected var _stretching:string = "uniform";
  11207. protected var _volume:number = 90;
  11208. protected var _backcolor:color = null;
  11209. protected var _frontcolor:color = null;
  11210. protected var _lightcolor:color = null;
  11211. protected var _screencolor:color = null;
  11212. protected var _controlbar:string = "bottom";
  11213. protected var _dock:boolean = true;
  11214. protected var _height:number = 400;
  11215. protected var _icons:boolean = true;
  11216. protected var _logo:string = null;
  11217. protected var _playlist:string = "none";
  11218. protected var _playlistsize:string = "180";
  11219. protected var _skin:string = null;
  11220. protected var _width:number = 280;
  11221. protected var _plugins:string = "";
  11222. protected var _pluginConfig:object;
  11223. protected var _id:string = "";
  11224. protected var _playerready:string = "";
  11225. protected var _debug:string;
  11226.  
  11227. public function PlayerConfig():void{
  11228. this._singleItem = new PlaylistItem();
  11229. this._pluginConfig = {};
  11230. this._debug = Logger.NONE;
  11231. super();
  11232. this.controlbar = this._controlbar;
  11233. this.playlist = this._playlist;
  11234. this.playlistsize = this._playlistsize;
  11235. this.logo = this._logo;
  11236. }
  11237. public function setConfig(_arg1:object):void{
  11238. var _local2:string;
  11239. var _local3:number;
  11240. var _local4:object;
  11241. for (_local2 in _arg1) {
  11242. if (_local2.indexof(".") > 0){
  11243. this.setPluginProperty(_local2, _arg1[_local2]);
  11244. this._singleItem[_local2.tolowercase()] = _arg1[_local2];
  11245. } else {
  11246. if (this._singleItem.hasOwnProperty(_local2)){
  11247. if ((((((_local2 == "file")) && ((Strings.extension(_arg1[_local2]) == "xml")))) && (!(_arg1["provider"])))){
  11248. this.setproperty("playlistfile", _arg1[_local2]);
  11249. } else {
  11250. if (_local2 == "levels"){
  11251. if ((_arg1[_local2] is array)){
  11252. _local3 = 0;
  11253. while (_local3 < (_arg1[_local2] as array).length) {
  11254. _local4 = _arg1[_local2][_local3];
  11255. this._singleItem.addLevel(new PlaylistItemLevel(_local4.file, _local4.bitrate, _local4.width, _local4.streamer));
  11256. _local3++;
  11257. };
  11258. };
  11259. } else {
  11260. this._singleItem[_local2.tolowercase()] = _arg1[_local2];
  11261. };
  11262. };
  11263. } else {
  11264. if (_arg1[_local2.tolowercase()] != null){
  11265. this.setproperty(_local2, _arg1[_local2]);
  11266. };
  11267. };
  11268. };
  11269. };
  11270. }
  11271. protected function setproperty(_arg1:string, _arg2):void{
  11272. if (((hasOwnProperty(_arg1)) && ((_arg2 is string)))){
  11273. try {
  11274. this[_arg1] = TypeChecker.fromString(_arg2, TypeChecker.getType(this, _arg1));
  11275. } catch(e:error) {
  11276. };
  11277. } else {
  11278. this[_arg1] = _arg2;
  11279. };
  11280. }
  11281. protected function setPluginProperty(_arg1:string, _arg2):void{
  11282. var _local3:string = _arg1.substring(0, _arg1.indexof(".")).tolowercase();
  11283. var _local4:string = _arg1.substring((_arg1.indexof(".") + 1), _arg1.length).tolowercase();
  11284. if (((_local3) && (_local4))){
  11285. if (!this._pluginConfig.hasOwnProperty(_local3)){
  11286. this._pluginConfig[_local3] = new PluginConfig(_local3);
  11287. };
  11288. if ((_arg2 is string)){
  11289. this._pluginConfig[_local3][_local4] = TypeChecker.fromString(_arg2);
  11290. } else {
  11291. this._pluginConfig[_local3][_local4] = _arg2;
  11292. };
  11293. };
  11294. }
  11295. protected function playlistItem(_arg1:string):string{
  11296. try {
  11297. return (this._singleItem[_arg1].tostring());
  11298. } catch(e:error) {
  11299. };
  11300. return ("");
  11301. }
  11302. public function get playlistfile():string{
  11303. return (this._playlistfile);
  11304. }
  11305. public function set playlistfile(_arg1:string):void{
  11306. this._playlistfile = _arg1;
  11307. }
  11308. public function get author():string{
  11309. return (this.playlistItem("author"));
  11310. }
  11311. public function get date():string{
  11312. return (this.playlistItem("date"));
  11313. }
  11314. public function get description():string{
  11315. return (this.playlistItem("description"));
  11316. }
  11317. public function get duration():string{
  11318. return (this.playlistItem("duration"));
  11319. }
  11320. public function get file():string{
  11321. return (this.playlistItem("file"));
  11322. }
  11323. public function get image():string{
  11324. return (this.playlistItem("image"));
  11325. }
  11326. public function get link():string{
  11327. return (this.playlistItem("link"));
  11328. }
  11329. public function get mediaid():string{
  11330. return (this.playlistItem("mediaid"));
  11331. }
  11332. public function get start():string{
  11333. return (this.playlistItem("start"));
  11334. }
  11335. public function get streamer():string{
  11336. return (this.playlistItem("streamer"));
  11337. }
  11338. public function get tags():string{
  11339. return (this.playlistItem("tags"));
  11340. }
  11341. public function get title():string{
  11342. return (this.playlistItem("title"));
  11343. }
  11344. public function get provider():string{
  11345. return (this.playlistItem("provider"));
  11346. }
  11347. public function get type():string{
  11348. return (this.playlistItem("provider"));
  11349. }
  11350. public function get singleItem():PlaylistItem{
  11351. return (this._singleItem);
  11352. }
  11353. public function get backcolor():color{
  11354. return (this._backcolor);
  11355. }
  11356. public function set backcolor(_arg1:color):void{
  11357. this._backcolor = _arg1;
  11358. }
  11359. public function get frontcolor():color{
  11360. return (this._frontcolor);
  11361. }
  11362. public function set frontcolor(_arg1:color):void{
  11363. this._frontcolor = _arg1;
  11364. }
  11365. public function get lightcolor():color{
  11366. return (this._lightcolor);
  11367. }
  11368. public function set lightcolor(_arg1:color):void{
  11369. this._lightcolor = _arg1;
  11370. }
  11371. public function get screencolor():color{
  11372. return (this._screencolor);
  11373. }
  11374. public function set screencolor(_arg1:color):void{
  11375. this._screencolor = _arg1;
  11376. }
  11377. public function get controlbar():string{
  11378. if (((this._pluginConfig["controlbar"]) && (this._pluginConfig["controlbar"].hasOwnProperty("position")))){
  11379. return (this._pluginConfig["controlbar"]["position"]);
  11380. };
  11381. return (this._controlbar);
  11382. }
  11383. public function set controlbar(_arg1:string):void{
  11384. this.setPluginProperty("controlbar.position", _arg1.tolowercase());
  11385. }
  11386. public function get dock():boolean{
  11387. return (this._dock);
  11388. }
  11389. public function set dock(_arg1:boolean):void{
  11390. this._dock = _arg1;
  11391. }
  11392. public function get height():number{
  11393. return (this._height);
  11394. }
  11395. public function set height(_arg1:number):void{
  11396. this._height = _arg1;
  11397. }
  11398. public function get icons():boolean{
  11399. return (this._icons);
  11400. }
  11401. public function set icons(_arg1:boolean):void{
  11402. this._icons = _arg1;
  11403. }
  11404. public function get logo():string{
  11405. if (((this._pluginConfig["logo"]) && (this._pluginConfig["logo"].hasOwnProperty("file")))){
  11406. return (this._pluginConfig["logo"]["file"]);
  11407. };
  11408. return (this._logo);
  11409. }
  11410. public function set logo(_arg1:string):void{
  11411. if (_arg1 != null){
  11412. this.setPluginProperty("logo.file", _arg1.tolowercase());
  11413. };
  11414. }
  11415. public function get playlist():string{
  11416. if (((this._pluginConfig["playlist"]) && (this._pluginConfig["playlist"].hasOwnProperty("position")))){
  11417. return (((this._pluginConfig["playlist"]) && (this._pluginConfig["playlist"]["position"])));
  11418. };
  11419. return (this._playlist);
  11420. }
  11421. public function set playlist(_arg1:string):void{
  11422. this.setPluginProperty("playlist.position", _arg1.tolowercase());
  11423. }
  11424. public function get playlistsize():string{
  11425. return (this._playlistsize);
  11426. }
  11427. public function set playlistsize(_arg1:string):void{
  11428. this._playlistsize = _arg1;
  11429. this.setPluginProperty("playlist.size", _arg1.tostring());
  11430. }
  11431. public function get skin():string{
  11432. return (this._skin);
  11433. }
  11434. public function set skin(_arg1:string):void{
  11435. this._skin = _arg1;
  11436. }
  11437. public function get width():number{
  11438. return (this._width);
  11439. }
  11440. public function set width(_arg1:number):void{
  11441. this._width = _arg1;
  11442. }
  11443. public function get autostart():boolean{
  11444. return (this._autostart);
  11445. }
  11446. public function set autostart(_arg1:boolean):void{
  11447. this._autostart = _arg1;
  11448. }
  11449. public function get bandwidth():number{
  11450. return (this._bandwidth);
  11451. }
  11452. public function set bandwidth(_arg1:number):void{
  11453. this._bandwidth = _arg1;
  11454. }
  11455. public function get bufferlength():number{
  11456. return (this._bufferlength);
  11457. }
  11458. public function set bufferlength(_arg1:number):void{
  11459. this._bufferlength = _arg1;
  11460. }
  11461. public function get se_livestream():boolean{
  11462. return (this._se_livestream);
  11463. }
  11464. public function set se_livestream(_arg1:boolean):void{
  11465. this._se_livestream = _arg1;
  11466. }
  11467. public function get se_disabledynamic():boolean{
  11468. return (this._se_disabledynamic);
  11469. }
  11470. public function set se_disabledynamic(_arg1:boolean):void{
  11471. this._se_disabledynamic = _arg1;
  11472. }
  11473. public function get displaytitle():boolean{
  11474. return (this._displaytitle);
  11475. }
  11476. public function set displaytitle(_arg1:boolean):void{
  11477. this._displaytitle = _arg1;
  11478. }
  11479. public function get fullscreen():boolean{
  11480. return (this._fullscreen);
  11481. }
  11482. public function set fullscreen(_arg1:boolean):void{
  11483. this._fullscreen = _arg1;
  11484. }
  11485. public function get item():number{
  11486. return (this._item);
  11487. }
  11488. public function set item(_arg1:number):void{
  11489. this._item = _arg1;
  11490. }
  11491. public function get linktarget():string{
  11492. return (this._linktarget);
  11493. }
  11494. public function set linktarget(_arg1:string):void{
  11495. this._linktarget = _arg1;
  11496. }
  11497. public function get mute():boolean{
  11498. return (this._mute);
  11499. }
  11500. public function set mute(_arg1:boolean):void{
  11501. this._mute = _arg1;
  11502. }
  11503. public function get repeat():string{
  11504. return (this._repeat);
  11505. }
  11506. public function set repeat(_arg1:string):void{
  11507. this._repeat = _arg1.tolowercase();
  11508. }
  11509. public function get shuffle():boolean{
  11510. return (this._shuffle);
  11511. }
  11512. public function set shuffle(_arg1:boolean):void{
  11513. this._shuffle = _arg1;
  11514. }
  11515. public function get smoothing():boolean{
  11516. return (this._smoothing);
  11517. }
  11518. public function set smoothing(_arg1:boolean):void{
  11519. this._smoothing = _arg1;
  11520. }
  11521. public function get stretching():string{
  11522. return (this._stretching);
  11523. }
  11524. public function set stretching(_arg1:string):void{
  11525. this._stretching = _arg1.tolowercase();
  11526. }
  11527. public function get volume():number{
  11528. return (this._volume);
  11529. }
  11530. public function set volume(_arg1:number):void{
  11531. this._volume = _arg1;
  11532. }
  11533. public function get plugins():string{
  11534. return (this._plugins);
  11535. }
  11536. public function set plugins(_arg1:string):void{
  11537. this._plugins = _arg1;
  11538. }
  11539. public function get debug():string{
  11540. return (this._debug);
  11541. }
  11542. public function set debug(_arg1:string):void{
  11543. if (_arg1 != "0"){
  11544. this._debug = _arg1;
  11545. };
  11546. }
  11547. public function pluginConfig(_arg1:string):PluginConfig{
  11548. var _local2:PluginConfig;
  11549. var _local3:PluginConfig;
  11550. _arg1 = _arg1.tolowercase();
  11551. if (this._pluginConfig.hasOwnProperty(_arg1)){
  11552. return ((this._pluginConfig[_arg1] as PluginConfig));
  11553. };
  11554. if (((this[_arg1]) && ((getQualifiedClassName(this[_arg1]) == "Object")))){
  11555. _local2 = new PluginConfig(_arg1, this[_arg1]);
  11556. this._pluginConfig[_arg1] = _local2;
  11557. return (_local2);
  11558. };
  11559. _local3 = new PluginConfig(_arg1);
  11560. this._pluginConfig[_arg1] = _local3;
  11561. return (_local3);
  11562. }
  11563. public function get pluginIds():array{
  11564. var _local2:string;
  11565. var _local3:string;
  11566. var _local1:array = [];
  11567. for each (_local2 in this._plugins.split(",")) {
  11568. _local3 = (_local2.substr((_local2.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-")[0] as string).tolowercase();
  11569. if (_local3){
  11570. _local1.push(_local3);
  11571. };
  11572. };
  11573. return (_local1);
  11574. }
  11575. public function get id():string{
  11576. return (this._id);
  11577. }
  11578. public function set id(_arg1:string):void{
  11579. PlayerVersion.id = (this._id = _arg1);
  11580. }
  11581. public function get playerready():string{
  11582. return (this._playerready);
  11583. }
  11584. public function set playerready(_arg1:string):void{
  11585. this._playerready = _arg1;
  11586. }
  11587.  
  11588. }
  11589. }//package com.longtailvideo.jwplayer.model
  11590. package com.longtailvideo.jwplayer.model {
  11591. import com.longtailvideo.jwplayer.utils.*;
  11592.  
  11593. public class color {
  11594.  
  11595. private var _color:uint;
  11596.  
  11597. public function color(_arg1){
  11598. if ((_arg1 is string)){
  11599. this._color = TypeChecker.stringToColor(_arg1);
  11600. } else {
  11601. if ((((_arg1 is uint)) || ((_arg1 is number)))){
  11602. this._color = _arg1;
  11603. } else {
  11604. throw (new error("Color must be a String, Number or uint"));
  11605. };
  11606. };
  11607. }
  11608. public function tostring():string{
  11609. var _local1:string = ((this._color)==0) ? "000000" : this._color.tostring(16);
  11610. while (_local1.length < 6) {
  11611. _local1 = ("0" + _local1);
  11612. };
  11613. return (("0x" + _local1));
  11614. }
  11615. public function get color():uint{
  11616. return (this._color);
  11617. }
  11618.  
  11619. }
  11620. }//package com.longtailvideo.jwplayer.model
  11621. package com.longtailvideo.jwplayer.model {
  11622. import com.longtailvideo.jwplayer.events.*;
  11623.  
  11624. public interface IPlaylist extends IGlobalEventDispatcher {
  11625.  
  11626. function load(_arg1:object):void;
  11627. function getItemAt(_arg1:number):PlaylistItem;
  11628. function insertItem(_arg1:PlaylistItem, _arg2:number=-1):void;
  11629. function removeItemAt(_arg1:number):void;
  11630. function contains(_arg1:PlaylistItem):boolean;
  11631. function get currentIndex():number;
  11632. function set currentIndex(_arg1:number):void;
  11633. function get currentItem():PlaylistItem;
  11634. function get length():number;
  11635.  
  11636. }
  11637. }//package com.longtailvideo.jwplayer.model
  11638. package com.longtailvideo.jwplayer.model {
  11639. import flash.events.*;
  11640. import com.longtailvideo.jwplayer.events.*;
  11641. import com.longtailvideo.jwplayer.player.*;
  11642. import com.longtailvideo.jwplayer.media.*;
  11643.  
  11644. public class Model extends GlobalEventDispatcher {
  11645.  
  11646. protected var _config:PlayerConfig;
  11647. protected var _playlist:IPlaylist;
  11648. protected var _fullscreen:boolean = false;
  11649. protected var _currentMedia:MediaProvider;
  11650. protected var _mediaSources:object;
  11651.  
  11652. public function Model(){
  11653. this._playlist = new Playlist();
  11654. this._playlist.addGlobalListener(this.forwardEvents);
  11655. this._config = new PlayerConfig();
  11656. this._mediaSources = {};
  11657. }
  11658. public function get config():PlayerConfig{
  11659. return (this._config);
  11660. }
  11661. public function set config(_arg1:PlayerConfig):void{
  11662. this._config = _arg1;
  11663. }
  11664. public function get media():MediaProvider{
  11665. return (this._currentMedia);
  11666. }
  11667. public function get state():string{
  11668. return (((this._currentMedia) ? this._currentMedia.state : PlayerState.IDLE));
  11669. }
  11670. public function get playlist():IPlaylist{
  11671. return (this._playlist);
  11672. }
  11673. public function get fullscreen():boolean{
  11674. return (this._fullscreen);
  11675. }
  11676. public function set fullscreen(_arg1:boolean):void{
  11677. this._fullscreen = _arg1;
  11678. this._config.fullscreen = _arg1;
  11679. }
  11680. public function get mute():boolean{
  11681. return (this._config.mute);
  11682. }
  11683. public function set mute(_arg1:boolean):void{
  11684. this._config.mute = _arg1;
  11685. this._currentMedia.mute(_arg1);
  11686. }
  11687. public function setupMediaProviders():void{
  11688. this.setMediaProvider("default", new MediaProvider("default"));
  11689. this.setMediaProvider("video", new VideoMediaProvider());
  11690. this.setMediaProvider("http", new HTTPMediaProvider());
  11691. this.setMediaProvider("rtmp", new RTMPMediaProvider());
  11692. this.setMediaProvider("sound", new SoundMediaProvider());
  11693. this.setMediaProvider("image", new ImageMediaProvider());
  11694. this.setMediaProvider("youtube", new YouTubeMediaProvider());
  11695. this.setActiveMediaProvider("default");
  11696. }
  11697. public function seek(_arg1:number):void{
  11698. var _local2:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_SEEK);
  11699. _local2.position = this.media.position;
  11700. _local2.offset = _arg1;
  11701. dispatchEvent(_local2);
  11702. this.media.seek(_arg1);
  11703. }
  11704. public function hasMediaProvider(_arg1:string):boolean{
  11705. return ((this._mediaSources[this.url2type(_arg1)] is MediaProvider));
  11706. }
  11707. public function setMediaProvider(_arg1:string, _arg2:MediaProvider):void{
  11708. if (!this.hasMediaProvider(_arg1)){
  11709. this._mediaSources[this.url2type(_arg1)] = _arg2;
  11710. _arg2.initializeMediaProvider(this.config);
  11711. };
  11712. }
  11713. public function setActiveMediaProvider(_arg1:string):boolean{
  11714. if (!this.hasMediaProvider(_arg1)){
  11715. _arg1 = "video";
  11716. };
  11717. var _local2:MediaProvider = (this._mediaSources[this.url2type(_arg1)] as MediaProvider);
  11718. if (this._currentMedia != _local2){
  11719. if (this._currentMedia){
  11720. this._currentMedia.stop();
  11721. this._currentMedia.removeGlobalListener(this.forwardEvents);
  11722. };
  11723. _local2.addGlobalListener(this.forwardEvents);
  11724. this._currentMedia = _local2;
  11725. };
  11726. return (true);
  11727. }
  11728. protected function forwardEvents(_arg1:Event):void{
  11729. if ((_arg1 is PlayerEvent)){
  11730. if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_ERROR){
  11731. dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, (_arg1 as MediaEvent).message));
  11732. };
  11733. dispatchEvent(_arg1);
  11734. };
  11735. }
  11736. protected function url2type(_arg1:string):string{
  11737. if (_arg1.tolowercase() == "audio"){
  11738. return ("sound");
  11739. };
  11740. return (_arg1.substring((_arg1.lastindexof("/") + 1), _arg1.length).replace(".swf", "").tolowercase());
  11741. }
  11742.  
  11743. }
  11744. }//package com.longtailvideo.jwplayer.model
  11745. package com.longtailvideo.jwplayer.model {
  11746.  
  11747. public dynamic class PlaylistItemLevel {
  11748.  
  11749. public var file:string = "";
  11750. public var bitrate:number = 0;
  11751. public var width:number = 0;
  11752. public var streamer:string = "";
  11753. public var blacklisted:boolean = false;
  11754.  
  11755. public function PlaylistItemLevel(_arg1:string, _arg2:number, _arg3:number, _arg4:string=""){
  11756. this.file = _arg1;
  11757. this.streamer = _arg4;
  11758. this.bitrate = _arg2;
  11759. this.width = _arg3;
  11760. }
  11761. }
  11762. }//package com.longtailvideo.jwplayer.model
  11763. package com.longtailvideo.jwplayer.model {
  11764. import com.longtailvideo.jwplayer.utils.*;
  11765.  
  11766. public dynamic class PlaylistItem {
  11767.  
  11768. public var author:string = "";
  11769. public var date:string = "";
  11770. public var description:string = "";
  11771. public var image:string = "";
  11772. public var link:string = "";
  11773. public var mediaid:string = "";
  11774. public var tags:string = "";
  11775. public var title:string = "";
  11776. protected var _duration:number = -1;
  11777. protected var _file:string = "";
  11778. protected var _provider:string = "";
  11779. protected var _start:number = 0;
  11780. protected var _streamer:string = "";
  11781. protected var _currentLevel:number = -1;
  11782. protected var _levels:array;
  11783.  
  11784. public function PlaylistItem(_arg1:object=null){
  11785. var _local2:string;
  11786. var _local3:array;
  11787. var _local4:object;
  11788. var _local5:PlaylistItemLevel;
  11789. var _local6:string;
  11790. this._levels = [];
  11791. super();
  11792. for (_local2 in _arg1) {
  11793. if ((((_local2 == "levels")) && ((_arg1[_local2] is array)))){
  11794. _local3 = (_arg1[_local2] as array);
  11795. for each (_local4 in _local3) {
  11796. if (_local4["file"]){
  11797. _local5 = new PlaylistItemLevel(_local4["file"], number(_local4["bitrate"]), number(_local4["width"]), _local4["streamer"]);
  11798. for (_local6 in _local4) {
  11799. switch (_local6){
  11800. case "file":
  11801. case "bitrate":
  11802. case "width":
  11803. case "streamer":
  11804. break;
  11805. default:
  11806. _local5[_local6] = _local4[_local6];
  11807. };
  11808. };
  11809. this.addLevel(_local5);
  11810. };
  11811. };
  11812. } else {
  11813. this[_local2] = _arg1[_local2];
  11814. };
  11815. };
  11816. }
  11817. public function get file():string{
  11818. var _local1:PlaylistItemLevel;
  11819. if ((((((this._levels.length > 0)) && ((this._currentLevel > -1)))) && ((this._currentLevel < this._levels.length)))){
  11820. _local1 = (this._levels[this._currentLevel] as PlaylistItemLevel);
  11821. return (((_local1.file) ? _local1.file : this._file));
  11822. };
  11823. return (this._file);
  11824. }
  11825. public function set file(_arg1:string):void{
  11826. this._file = _arg1;
  11827. }
  11828. public function get streamer():string{
  11829. var _local1:PlaylistItemLevel;
  11830. if ((((((this._levels.length > 0)) && ((this._currentLevel > -1)))) && ((this._currentLevel < this._levels.length)))){
  11831. _local1 = (this._levels[this._currentLevel] as PlaylistItemLevel);
  11832. return (((_local1.streamer) ? _local1.streamer : this._streamer));
  11833. };
  11834. return (this._streamer);
  11835. }
  11836. public function set streamer(_arg1:string):void{
  11837. this._streamer = _arg1;
  11838. }
  11839. public function get levels():array{
  11840. return (this._levels);
  11841. }
  11842. public function addLevel(_arg1:PlaylistItemLevel):void{
  11843. var _local2:number;
  11844. var _local3:PlaylistItemLevel;
  11845. if (this.validExtension(_arg1.file)){
  11846. if (this._currentLevel < 0){
  11847. this._currentLevel = 0;
  11848. };
  11849. _local2 = 0;
  11850. while (_local2 < this._levels.length) {
  11851. _local3 = (this._levels[_local2] as PlaylistItemLevel);
  11852. if (_arg1.bitrate > _local3.bitrate){
  11853. this._levels.splice(_local2, 0, _arg1);
  11854. return;
  11855. };
  11856. if (((((isnan(_arg1.bitrate)) || ((_arg1.bitrate == _local3.bitrate)))) && ((_arg1.width > _local3.width)))){
  11857. this._levels.splice(_local2, 0, _arg1);
  11858. return;
  11859. };
  11860. _local2++;
  11861. };
  11862. this._levels.push(_arg1);
  11863. };
  11864. }
  11865. public function clearLevels():void{
  11866. this._levels = new array();
  11867. }
  11868. public function blacklistLevel(_arg1:number, _arg2:boolean=true):void{
  11869. if (this.levels[_arg1]){
  11870. this.levels[_arg1].blacklisted = _arg2;
  11871. };
  11872. }
  11873. protected function validExtension(_arg1:string):boolean{
  11874. switch (Strings.extension(_arg1)){
  11875. case "ogv":
  11876. case "ogg":
  11877. case "webm":
  11878. return (false);
  11879. default:
  11880. return (true);
  11881. };
  11882. }
  11883. public function get currentLevel():number{
  11884. return (this._currentLevel);
  11885. }
  11886. public function getLevel(_arg1:number, _arg2:number):number{
  11887. var _local4:PlaylistItemLevel;
  11888. var _local3:number = 0;
  11889. while (_local3 < this._levels.length) {
  11890. _local4 = (this._levels[_local3] as PlaylistItemLevel);
  11891. if (((((((isnan(_local4.bitrate)) || ((_arg1 >= (_local4.bitrate * 1.5))))) && (((isnan(_local4.width)) || ((_arg2 >= (_local4.width * 0.67))))))) && (!(_local4.blacklisted)))){
  11892. return (_local3);
  11893. };
  11894. _local3++;
  11895. };
  11896. return ((this._levels.length - 1));
  11897. }
  11898. public function setLevel(_arg1:number):void{
  11899. if ((((_arg1 >= 0)) && ((_arg1 < this._levels.length)))){
  11900. this._currentLevel = _arg1;
  11901. } else {
  11902. throw (new error("Level index out of bounds"));
  11903. };
  11904. }
  11905. public function tostring():string{
  11906. return (((((("[PlaylistItem" + ((this.file) ? (" file=" + this.file) : "")) + ((this.streamer) ? (" streamer=" + this.streamer) : "")) + ((this.provider) ? (" provider=" + this.provider) : "")) + ((this.levels.length) ? (" level=" + this.currentLevel.tostring()) : "")) + "]"));
  11907. }
  11908. public function get start():number{
  11909. return (this._start);
  11910. }
  11911. public function set start(_arg1):void{
  11912. this._start = Strings.seconds(string(_arg1));
  11913. if ((((this._start > this._duration)) && ((this._duration > 0)))){
  11914. this._duration = (this._duration + this._start);
  11915. };
  11916. }
  11917. public function get duration():number{
  11918. return (this._duration);
  11919. }
  11920. public function set duration(_arg1):void{
  11921. this._duration = Strings.seconds(string(_arg1));
  11922. if ((((this._start > this._duration)) && ((this._duration > 0)))){
  11923. this._duration = (this._duration + this._start);
  11924. };
  11925. }
  11926. public function get provider():string{
  11927. return (this._provider);
  11928. }
  11929. public function set provider(_arg1):void{
  11930. this._provider = ((_arg1)=="audio") ? "sound" : _arg1;
  11931. }
  11932. public function get type():string{
  11933. return (this._provider);
  11934. }
  11935. public function set type(_arg1:string):void{
  11936. this.provider = _arg1;
  11937. }
  11938.  
  11939. }
  11940. }//package com.longtailvideo.jwplayer.model
  11941. package com.longtailvideo.jwplayer.plugins {
  11942.  
  11943. public dynamic class PluginConfig {
  11944.  
  11945. private var _id:string;
  11946.  
  11947. public function PluginConfig(_arg1:string, _arg2:object=null){
  11948. var _local3:string;
  11949. super();
  11950. this._id = _arg1.tolowercase();
  11951. if (_arg2){
  11952. for (_local3 in _arg2) {
  11953. this[_local3] = _arg2[_local3];
  11954. };
  11955. };
  11956. }
  11957. public function get id():string{
  11958. return (this._id);
  11959. }
  11960.  
  11961. }
  11962. }//package com.longtailvideo.jwplayer.plugins
  11963. package com.longtailvideo.jwplayer.plugins {
  11964. import com.longtailvideo.jwplayer.player.*;
  11965.  
  11966. public interface IPlugin {
  11967.  
  11968. function initPlugin(_arg1:IPlayer, _arg2:PluginConfig):void;
  11969. function resize(_arg1:number, _arg2:number):void;
  11970. function get id():string;
  11971.  
  11972. }
  11973. }//package com.longtailvideo.jwplayer.plugins
  11974. package com.longtailvideo.jwplayer.plugins {
  11975. import flash.display.*;
  11976. import com.longtailvideo.jwplayer.player.*;
  11977. import com.jeroenwijering.events.*;
  11978.  
  11979. public class V4Plugin extends Sprite implements IPlugin {
  11980.  
  11981. private var plug:PluginInterface;
  11982. public var pluginId:string;
  11983.  
  11984. public function V4Plugin(_arg1:PluginInterface, _arg2:string){
  11985. this.plug = _arg1;
  11986. this.pluginId = _arg2;
  11987. addChild((this.plug as DisplayObject));
  11988. }
  11989. public function initPlugin(_arg1:IPlayer, _arg2:PluginConfig):void{
  11990. if ((this.plug as object).hasOwnProperty("config")){
  11991. (this.plug as object).config = _arg2;
  11992. };
  11993. var _local3:PlayerV4Emulation = PlayerV4Emulation.getInstance(_arg1);
  11994. this.plug.initializePlugin(_local3);
  11995. }
  11996. public function resize(_arg1:number, _arg2:number):void{
  11997. this.x = 0;
  11998. this.y = 0;
  11999. }
  12000. public function get id():string{
  12001. return (this.pluginId);
  12002. }
  12003.  
  12004. }
  12005. }//package com.longtailvideo.jwplayer.plugins
  12006. package com.longtailvideo.jwplayer.media {
  12007. import com.longtailvideo.jwplayer.model.*;
  12008. import flash.events.*;
  12009. import com.longtailvideo.jwplayer.events.*;
  12010. import com.longtailvideo.jwplayer.player.*;
  12011. import flash.utils.*;
  12012. import flash.net.*;
  12013. import com.longtailvideo.jwplayer.utils.*;
  12014. import flash.media.*;
  12015.  
  12016. public class HTTPMediaProvider extends MediaProvider {
  12017.  
  12018. protected var _connection:netconnection;
  12019. protected var _stream:netstream;
  12020. protected var _video:video;
  12021. protected var _transformer:SoundTransform;
  12022. protected var _positionInterval:uint;
  12023. protected var _meta:boolean;
  12024. protected var _keyframes:object;
  12025. protected var _byteoffset:number = 0;
  12026. protected var _timeoffset:number = 0;
  12027. protected var _mp4:boolean;
  12028. private var _startparam:string = "start";
  12029. private var _bufferFull:boolean;
  12030. private var _bufferingComplete:boolean;
  12031. private var _bandwidthSwitch:boolean = true;
  12032. private var _bandwidthChecked:boolean;
  12033. private var _bandwidthDelay:number = 2000;
  12034. private var _bandwidthTimeout:uint;
  12035. private var _dvroffset:number = 0;
  12036. private var _dvrloaded:number = 0;
  12037. private var _framerate:number = 30;
  12038. private var _droppedFrames:array;
  12039. private var _droppedFramesInterval:number;
  12040.  
  12041. public function HTTPMediaProvider(){
  12042. super("http");
  12043. }
  12044. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  12045. super.initializeMediaProvider(_arg1);
  12046. this._connection = new netconnection();
  12047. this._connection.connect(null);
  12048. this._stream = new netstream(this._connection);
  12049. this._stream.checkPolicyFile = true;
  12050. this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
  12051. this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  12052. this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
  12053. this._stream.buffertime = config.bufferlength;
  12054. this._stream.client = new NetClient(this);
  12055. this._transformer = new SoundTransform();
  12056. this._video = new video(320, 240);
  12057. this._video.smoothing = config.smoothing;
  12058. this._video.attachNetStream(this._stream);
  12059. }
  12060. protected function convertSeekpoints(_arg1:object):object{
  12061. var _local3:string;
  12062. var _local2:object = new object();
  12063. _local2.times = new array();
  12064. _local2.filepositions = new array();
  12065. for (_local3 in _arg1) {
  12066. _local2.times[_local3] = number(_arg1[_local3]["time"]);
  12067. _local2.filepositions[_local3] = number(_arg1[_local3]["offset"]);
  12068. };
  12069. return (_local2);
  12070. }
  12071. protected function errorHandler(_arg1:ErrorEvent):void{
  12072. error(_arg1.text);
  12073. }
  12074. private function checkBandwidth(_arg1:number):void{
  12075. var _local4:object;
  12076. var _local2:number = this._stream.bytesloaded;
  12077. var _local3:number = ((math.ceil(((_local2 - _arg1) / 0x0400)) * 8) / (this._bandwidthDelay / 1000));
  12078. if (_local2 < this._stream.bytestotal){
  12079. if (_local3 > 0){
  12080. config.bandwidth = _local3;
  12081. Configger.saveCookie("bandwidth", _local3);
  12082. _local4 = {bandwidth:_local3};
  12083. if (item.duration > 0){
  12084. _local4.bitrate = math.ceil((((this._stream.bytestotal / 0x0400) * 8) / item.duration));
  12085. };
  12086. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local4});
  12087. };
  12088. if (this._bandwidthSwitch){
  12089. this._bandwidthSwitch = false;
  12090. this._bandwidthChecked = false;
  12091. if (item.currentLevel != item.getLevel(config.bandwidth, config.width)){
  12092. this.load(item);
  12093. return;
  12094. };
  12095. };
  12096. clearTimeout(this._bandwidthTimeout);
  12097. this._bandwidthTimeout = setTimeout(this.checkBandwidth, this._bandwidthDelay, _local2);
  12098. };
  12099. }
  12100. private function checkFramedrop():void{
  12101. var _local2:number;
  12102. this._droppedFrames.push(this._stream.info.droppedFrames);
  12103. var _local1:number = this._droppedFrames.length;
  12104. if ((((_local1 > 5)) && ((state == PlayerState.PLAYING)))){
  12105. _local2 = ((this._droppedFrames[(_local1 - 1)] - this._droppedFrames[(_local1 - 6)]) / 5);
  12106. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{droppedFrames:_local2}});
  12107. };
  12108. }
  12109. protected function getOffset(_arg1:number, _arg2:boolean=false):number{
  12110. if (!this._keyframes){
  12111. return (0);
  12112. };
  12113. var _local3:number = 0;
  12114. while (_local3 < (this._keyframes.times.length - 1)) {
  12115. if ((((this._keyframes.times[_local3] <= _arg1)) && ((this._keyframes.times[(_local3 + 1)] >= _arg1)))){
  12116. break;
  12117. };
  12118. _local3++;
  12119. };
  12120. if (_arg2 == true){
  12121. return (this._keyframes.times[_local3]);
  12122. };
  12123. return (this._keyframes.filepositions[_local3]);
  12124. }
  12125. protected function geturl():string{
  12126. var _local1:string = Strings.getAbsolutePath(item.file, config["netstreambasepath"]);
  12127. var _local2:number = this._byteoffset;
  12128. if ((getConfigProperty("startparam") as string)){
  12129. this._startparam = getConfigProperty("startparam");
  12130. };
  12131. if (item.streamer){
  12132. if (item.streamer.indexof("/") >= 0){
  12133. _local1 = item.streamer;
  12134. _local1 = this.getURLConcat(_local1, "file", item.file);
  12135. } else {
  12136. this._startparam = item.streamer;
  12137. };
  12138. };
  12139. if (((this._mp4) || ((this._startparam == "starttime")))){
  12140. _local2 = (math.ceil((this._timeoffset * 100)) / 100);
  12141. this._mp4 = true;
  12142. };
  12143. if (((((!(this._mp4)) || ((_local2 > 0)))) && (!(getConfigProperty("dvr"))))){
  12144. _local1 = this.getURLConcat(_local1, this._startparam, _local2);
  12145. };
  12146. if (((config["token"]) || (item["token"]))){
  12147. _local1 = this.getURLConcat(_local1, "token", ((item["token"]) ? item["token"] : config["token"]));
  12148. };
  12149. return (_local1);
  12150. }
  12151. private function getURLConcat(_arg1:string, _arg2:string, _arg3):string{
  12152. if (_arg1.indexof("?") > -1){
  12153. return (((((_arg1 + "&") + _arg2) + "=") + _arg3));
  12154. };
  12155. return (((((_arg1 + "?") + _arg2) + "=") + _arg3));
  12156. }
  12157. private function initDVR(_arg1:number):void{
  12158. this._dvroffset = _arg1;
  12159. this._dvrloaded = (new date().valueof() - (config.bufferlength * 1000));
  12160. super.resize(_width, _height);
  12161. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{dvroffset:this._dvroffset}});
  12162. }
  12163. override public function load(_arg1:PlaylistItem):void{
  12164. if (_item != _arg1){
  12165. _item = _arg1;
  12166. media = this._video;
  12167. };
  12168. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
  12169. this._bufferFull = false;
  12170. this._bufferingComplete = false;
  12171. if (item.levels.length > 0){
  12172. item.setLevel(item.getLevel(config.bandwidth, config.width));
  12173. };
  12174. this._stream.play(this.geturl());
  12175. clearinterval(this._positionInterval);
  12176. this._positionInterval = setinterval(this.positionInterval, 100);
  12177. this._droppedFrames = new array();
  12178. clearinterval(this._droppedFramesInterval);
  12179. this._droppedFramesInterval = setinterval(this.checkFramedrop, 1000);
  12180. setState(PlayerState.BUFFERING);
  12181. sendBufferEvent(0, 0);
  12182. this.streamVolume(((config.mute) ? 0 : config.volume));
  12183. }
  12184. public function onClientData(_arg1:object):void{
  12185. if (!_arg1){
  12186. return;
  12187. };
  12188. if (_arg1.width){
  12189. this._video.width = _arg1.width;
  12190. this._video.height = _arg1.height;
  12191. super.resize(_width, _height);
  12192. };
  12193. if (_arg1.videoframerate){
  12194. this._framerate = number(_arg1.videoframerate);
  12195. };
  12196. if (((_arg1["duration"]) && ((item.duration <= 0)))){
  12197. item.duration = _arg1["duration"];
  12198. };
  12199. if ((((_arg1["type"] == "metadata")) && (!(this._meta)))){
  12200. if (_arg1["seekpoints"]){
  12201. this._mp4 = true;
  12202. this._keyframes = this.convertSeekpoints(_arg1["seekpoints"]);
  12203. } else {
  12204. this._mp4 = false;
  12205. this._keyframes = _arg1["keyframes"];
  12206. };
  12207. if (((!(this._meta)) && (_item.start))){
  12208. this.seek(_item.start);
  12209. };
  12210. this._meta = true;
  12211. };
  12212. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
  12213. }
  12214. override public function pause():void{
  12215. this._stream.pause();
  12216. super.pause();
  12217. }
  12218. override public function play():void{
  12219. if (!this._positionInterval){
  12220. this._positionInterval = setinterval(this.positionInterval, 100);
  12221. };
  12222. if (this._bufferFull){
  12223. this._stream.resume();
  12224. super.play();
  12225. } else {
  12226. setState(PlayerState.BUFFERING);
  12227. };
  12228. }
  12229. protected function positionInterval():void{
  12230. var _local2:number;
  12231. var _local3:number;
  12232. var _local5:number;
  12233. var _local1:number = (math.round((this._stream.time * 100)) / 100);
  12234. if (this._mp4){
  12235. _local1 = (_local1 + this._timeoffset);
  12236. };
  12237. if (getConfigProperty("dvr")){
  12238. if (((!(this._dvroffset)) && (_local1))){
  12239. this.initDVR(_local1);
  12240. };
  12241. _local1 = (_local1 - this._dvroffset);
  12242. if (this._dvrloaded){
  12243. item.duration = ((new date().valueof() - this._dvrloaded) / 1000);
  12244. };
  12245. };
  12246. if ((((item.duration > 0)) && (this._stream))){
  12247. _local2 = ((this._timeoffset / item.duration) * 100);
  12248. _local5 = (((this._stream.buffertime < (item.duration - _local1))) ? this._stream.buffertime : math.ceil((item.duration - _local1)));
  12249. _local3 = ((this._stream.buffertime) ? math.ceil(((math.ceil(this._stream.bufferlength) / _local5) * 100)) : 0);
  12250. } else {
  12251. _local2 = 0;
  12252. _local3 = ((this._stream.buffertime) ? ((this._stream.bufferlength / this._stream.buffertime) * 100) : 0);
  12253. };
  12254. var _local4:number = ((this._stream.bytestotal) ? (((this._stream.bytesloaded / this._stream.bytestotal) * (1 - (_local2 / 100))) * 100) : 0);
  12255. if (((((!(this._bandwidthChecked)) && ((this._stream.bytesloaded > 0)))) && ((this._stream.bytesloaded < this._stream.bytestotal)))){
  12256. this._bandwidthChecked = true;
  12257. clearTimeout(this._bandwidthTimeout);
  12258. this._bandwidthTimeout = setTimeout(this.checkBandwidth, this._bandwidthDelay, this._stream.bytesloaded);
  12259. };
  12260. if ((((((_local3 <= 50)) && ((state == PlayerState.PLAYING)))) && (((item.duration - _local1) > 5)))){
  12261. this._bufferFull = false;
  12262. this._stream.pause();
  12263. setState(PlayerState.BUFFERING);
  12264. } else {
  12265. if ((((_local3 > 95)) && (!(this._bufferFull)))){
  12266. this._bufferFull = true;
  12267. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  12268. };
  12269. };
  12270. if (!this._bufferingComplete){
  12271. if (((((_local4 + _local2) == 100)) && ((this._bufferingComplete == false)))){
  12272. this._bufferingComplete = true;
  12273. };
  12274. sendBufferEvent(_local4, this._timeoffset, {
  12275. loaded:this._stream.bytesloaded,
  12276. total:this._stream.bytestotal,
  12277. offset:this._timeoffset
  12278. });
  12279. };
  12280. if (state != PlayerState.PLAYING){
  12281. return;
  12282. };
  12283. if (_local1 < item.duration){
  12284. _position = _local1;
  12285. if (_position >= 0){
  12286. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  12287. position:_position,
  12288. duration:item.duration,
  12289. offset:this._timeoffset
  12290. });
  12291. };
  12292. } else {
  12293. if (item.duration > 0){
  12294. this.complete();
  12295. };
  12296. };
  12297. }
  12298. override public function resize(_arg1:number, _arg2:number):void{
  12299. super.resize(_arg1, _arg2);
  12300. if (((((!((state == PlayerState.IDLE))) && ((item.levels.length > 0)))) && (!((item.getLevel(config.bandwidth, config.width) == item.currentLevel))))){
  12301. this._byteoffset = this.getOffset(position);
  12302. this._timeoffset = (_position = this.getOffset(position, true));
  12303. this.load(item);
  12304. };
  12305. }
  12306. override public function seek(_arg1:number):void{
  12307. var _local2:number = this.getOffset(_arg1);
  12308. super.seek(_arg1);
  12309. clearinterval(this._positionInterval);
  12310. this._positionInterval = undefined;
  12311. if ((((_local2 < this._byteoffset)) || ((_local2 >= (this._byteoffset + this._stream.bytesloaded))))){
  12312. if (this._keyframes){
  12313. this._timeoffset = (_position = this.getOffset(_arg1, true));
  12314. } else {
  12315. this._timeoffset = _arg1;
  12316. };
  12317. this._byteoffset = _local2;
  12318. this.load(item);
  12319. } else {
  12320. if (state == PlayerState.PAUSED){
  12321. this._stream.resume();
  12322. };
  12323. if (getConfigProperty("dvr")){
  12324. this._stream.seek(((_arg1 + this._dvroffset) - config.bufferlength));
  12325. } else {
  12326. if (this._mp4){
  12327. this._stream.seek(this.getOffset((_position - this._timeoffset), true));
  12328. } else {
  12329. this._stream.seek(this.getOffset(_position, true));
  12330. };
  12331. };
  12332. this.play();
  12333. };
  12334. }
  12335. protected function statusHandler(_arg1:NetStatusEvent):void{
  12336. switch (_arg1.info.code){
  12337. case "NetStream.Play.Stop":
  12338. if (((!((state == PlayerState.BUFFERING))) && (!(getConfigProperty("dvr"))))){
  12339. this.complete();
  12340. };
  12341. break;
  12342. case "NetStream.Play.StreamNotFound":
  12343. this.stop();
  12344. error(("Video not found: " + item.file));
  12345. break;
  12346. case "NetStream.Buffer.Full":
  12347. if (!this._bufferFull){
  12348. this._bufferFull = true;
  12349. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  12350. };
  12351. break;
  12352. };
  12353. }
  12354. override public function stop():void{
  12355. if ((((this._stream.bytesloaded < this._stream.bytestotal)) || ((this._byteoffset > 0)))){
  12356. this._stream.close();
  12357. } else {
  12358. this._stream.pause();
  12359. };
  12360. clearinterval(this._positionInterval);
  12361. clearinterval(this._droppedFramesInterval);
  12362. this._positionInterval = undefined;
  12363. _position = (this._byteoffset = (this._timeoffset = 0));
  12364. this._dvroffset = (this._dvrloaded = 0);
  12365. this._droppedFrames = new array();
  12366. this._keyframes = undefined;
  12367. this._framerate = 30;
  12368. this._bandwidthSwitch = true;
  12369. this._bandwidthChecked = false;
  12370. this._meta = false;
  12371. this._timeoffset = 0;
  12372. super.stop();
  12373. }
  12374. override protected function complete():void{
  12375. if (state != PlayerState.IDLE){
  12376. this.stop();
  12377. setTimeout(sendMediaEvent, 100, MediaEvent.JWPLAYER_MEDIA_COMPLETE);
  12378. };
  12379. }
  12380. override public function setvolume(_arg1:number):void{
  12381. this.streamVolume(_arg1);
  12382. super.setvolume(_arg1);
  12383. }
  12384. protected function streamVolume(_arg1:number):void{
  12385. this._transformer.volume = (_arg1 / 100);
  12386. if (this._stream){
  12387. this._stream.soundTransform = this._transformer;
  12388. };
  12389. }
  12390.  
  12391. }
  12392. }//package com.longtailvideo.jwplayer.media
  12393. package com.longtailvideo.jwplayer.media {
  12394. import com.longtailvideo.jwplayer.model.*;
  12395. import com.longtailvideo.jwplayer.plugins.*;
  12396. import flash.events.*;
  12397. import com.longtailvideo.jwplayer.events.*;
  12398. import flash.display.*;
  12399. import com.longtailvideo.jwplayer.player.*;
  12400. import flash.utils.*;
  12401. import flash.net.*;
  12402.  
  12403. public class YouTubeMediaProvider extends MediaProvider {
  12404.  
  12405. private var _loader:Loader;
  12406. private var _ytApiUrl:string = "http://www.youtube.com/apiplayer?version=3&modestbranding=1";
  12407. private var _ytAPI:object;
  12408. private var _loading:boolean = false;
  12409. private var _ready:boolean = false;
  12410. private var _statusTimer:Timer;
  12411. private var _offset:number = 0;
  12412. private var _videoId:string = "";
  12413. private var _qualityLevels:array;
  12414. private var bytesLodaed:number;
  12415. private var bytestotal:number;
  12416. private var bytesOffset:number;
  12417.  
  12418. public function YouTubeMediaProvider(){
  12419. super("youtube");
  12420. this.stretch = false;
  12421. this._statusTimer = new Timer(100);
  12422. this._statusTimer.addEventListener(TimerEvent.TIMER, this.updatePlaybackStatus);
  12423. this._loader = new Loader();
  12424. this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.apiLoaded);
  12425. this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadErrorHandler);
  12426. }
  12427. public static function getID(_arg1:string):string{
  12428. var _local4:string;
  12429. var _local2:array = _arg1.split(/\?|\#\!/);
  12430. var _local3 = "";
  12431. for (_local4 in _local2) {
  12432. if (_local2[_local4].substr(0, 2) == "v="){
  12433. _local3 = _local2[_local4].substr(2);
  12434. };
  12435. };
  12436. if (_local3 == ""){
  12437. if (_arg1.indexof("/v/") >= 0){
  12438. _local3 = _arg1.substr((_arg1.indexof("/v/") + 3));
  12439. } else {
  12440. if (_arg1.indexof("youtu.be") >= 0){
  12441. _local3 = _arg1.substr((_arg1.indexof("youtu.be/") + 9));
  12442. } else {
  12443. _local3 = _arg1;
  12444. };
  12445. };
  12446. };
  12447. if (_local3.indexof("?") > -1){
  12448. _local3 = _local3.substr(0, _local3.indexof("?"));
  12449. };
  12450. if (_local3.indexof("&") > -1){
  12451. _local3 = _local3.substr(0, _local3.indexof("&"));
  12452. };
  12453. return (_local3);
  12454. }
  12455.  
  12456. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  12457. super.initializeMediaProvider(_arg1);
  12458. }
  12459. private function loadErrorHandler(_arg1:ErrorEvent):void{
  12460. error(_arg1.text);
  12461. }
  12462. override public function load(_arg1:PlaylistItem):void{
  12463. this.bytesLodaed = (this.bytestotal = (this.bytesOffset = (this._offset = 0)));
  12464. _item = _arg1;
  12465. this._qualityLevels = null;
  12466. this._videoId = getID(_item.file);
  12467. _position = (this._offset = 0);
  12468. setState(PlayerState.BUFFERING);
  12469. sendBufferEvent(0);
  12470. if (this._ready){
  12471. this.completeLoad(_arg1);
  12472. } else {
  12473. this._loading = true;
  12474. this._loader.load(new URLRequest(this._ytApiUrl));
  12475. };
  12476. }
  12477. private function apiLoaded(_arg1:Event):void{
  12478. this._ytAPI = this._loader.content;
  12479. this._ytAPI.addEventListener("onReady", this.apiReady);
  12480. this._ytAPI.addEventListener("onError", this.onPlayerError);
  12481. this._ytAPI.addEventListener("onStateChange", this.onStateChange);
  12482. }
  12483. private function apiReady(_arg1:Event):void{
  12484. this._ready = true;
  12485. var _local2:PluginConfig = config.pluginConfig("display");
  12486. this.resize(_local2.width, _local2.height);
  12487. if (this._loading){
  12488. this._loading = false;
  12489. this.completeLoad(_item);
  12490. };
  12491. }
  12492. private function onPlayerError(_arg1:Event):void{
  12493. var _local2:number = number(object(_arg1).data);
  12494. if (!isnan(_local2)){
  12495. switch (_local2){
  12496. case 2:
  12497. error(("Invalid video ID: " + this._videoId));
  12498. break;
  12499. case 100:
  12500. error("The requested video could not found, or has been marked as private.");
  12501. break;
  12502. case 101:
  12503. case 150:
  12504. error("The requested video is not allowed to be played in embedded players.");
  12505. break;
  12506. };
  12507. } else {
  12508. error("An unknown error occurred in the YouTube MediaProvider");
  12509. };
  12510. }
  12511. private function completeLoad(_arg1:PlaylistItem):void{
  12512. var _local2:string = getConfigProperty("quality");
  12513. this._ytAPI.cueVideoById(this._videoId, _item.start, ((_local2) ? _local2 : "default"));
  12514. media = this._loader;
  12515. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
  12516. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  12517. this.setvolume(((config.mute) ? 0 : config.volume));
  12518. this._statusTimer.start();
  12519. }
  12520. public function onStateChange(_arg1:Event):void{
  12521. switch (number(object(_arg1).data)){
  12522. case 0:
  12523. if (((!((state == PlayerState.BUFFERING))) && (!((state == PlayerState.IDLE))))){
  12524. complete();
  12525. this._offset = 0;
  12526. };
  12527. break;
  12528. case 1:
  12529. super.play();
  12530. break;
  12531. case 2:
  12532. super.pause();
  12533. break;
  12534. case 3:
  12535. setState(PlayerState.BUFFERING);
  12536. break;
  12537. };
  12538. }
  12539. private function updatePlaybackStatus(_arg1:TimerEvent):void{
  12540. this.bytesLodaed = this._ytAPI.getVideoBytesLoaded();
  12541. this.bytestotal = this._ytAPI.getVideoBytesTotal();
  12542. this.bytesOffset = this._ytAPI.getVideoStartBytes();
  12543. if (_item.duration <= 0){
  12544. _item.duration = this._ytAPI.getDuration();
  12545. };
  12546. if (this.bytestotal > 0){
  12547. if (item.duration > 0){
  12548. this._offset = ((this.bytesOffset / (this.bytesOffset + this.bytestotal)) * _item.duration);
  12549. };
  12550. sendBufferEvent((100 * (this.bytesLodaed / (this.bytesOffset + this.bytestotal))), this._offset, {
  12551. loaded:this.bytesLodaed,
  12552. total:this.bytestotal
  12553. });
  12554. };
  12555. if (state == PlayerState.PLAYING){
  12556. _position = this._ytAPI.getCurrentTime();
  12557. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  12558. position:_position,
  12559. duration:_item.duration,
  12560. offset:this._offset
  12561. });
  12562. if (_position > item.duration){
  12563. complete();
  12564. };
  12565. };
  12566. if (((!(this._qualityLevels)) || ((this._qualityLevels.length == 0)))){
  12567. this._qualityLevels = this._ytAPI.getAvailableQualityLevels();
  12568. if (((this._qualityLevels) && ((this._qualityLevels.length > 0)))){
  12569. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{youtubequalitylevels:this._qualityLevels}});
  12570. };
  12571. };
  12572. }
  12573. override public function pause():void{
  12574. if ((((state == PlayerState.PLAYING)) || ((state == PlayerState.BUFFERING)))){
  12575. if (this._ready){
  12576. this._ytAPI.pauseVideo();
  12577. };
  12578. super.pause();
  12579. };
  12580. }
  12581. override public function play():void{
  12582. if (this._ready){
  12583. this._ytAPI.playVideo();
  12584. };
  12585. }
  12586. override public function resize(_arg1:number, _arg2:number):void{
  12587. if (this._ready){
  12588. this._ytAPI.setSize(_arg1, _arg2);
  12589. };
  12590. }
  12591. override public function seek(_arg1:number):void{
  12592. if (this._ready){
  12593. if ((((_arg1 < this._offset)) || (((this._offset / item.duration) > ((this.bytesLodaed + this.bytesOffset) / this.bytestotal))))){
  12594. sendBufferEvent(0, _arg1);
  12595. setState(PlayerState.BUFFERING);
  12596. };
  12597. this._ytAPI.seekTo(_arg1, true);
  12598. this._offset = _arg1;
  12599. super.seek(_arg1);
  12600. this.play();
  12601. };
  12602. }
  12603. override public function stop():void{
  12604. if (this._ready){
  12605. if (this._ytAPI.getPlayerState() > 0){
  12606. this._ytAPI.stopVideo();
  12607. };
  12608. };
  12609. this._statusTimer.stop();
  12610. _position = (this._offset = 0);
  12611. super.stop();
  12612. }
  12613. override public function setvolume(_arg1:number):void{
  12614. if (this._ready){
  12615. this._ytAPI.setvolume(math.min(math.max(0, _arg1), 100));
  12616. };
  12617. super.setvolume(_arg1);
  12618. }
  12619.  
  12620. }
  12621. }//package com.longtailvideo.jwplayer.media
  12622. package com.longtailvideo.jwplayer.media {
  12623. import com.longtailvideo.jwplayer.model.*;
  12624. import flash.events.*;
  12625. import com.longtailvideo.jwplayer.events.*;
  12626. import com.longtailvideo.jwplayer.player.*;
  12627. import flash.utils.*;
  12628. import flash.net.*;
  12629. import com.longtailvideo.jwplayer.parsers.*;
  12630. import com.longtailvideo.jwplayer.utils.*;
  12631. import flash.media.*;
  12632. import com.wowza.encryptionAS3.*;
  12633.  
  12634. public class RTMPMediaProvider extends MediaProvider {
  12635.  
  12636. private var _SEBufferStatus:number = -1;
  12637. private var _bandwidthChecked:boolean;
  12638. private var _bandwidthSwitch:boolean;
  12639. private var _connection:netconnection;
  12640. private var _responded:boolean;
  12641. private var _dynamic:boolean;
  12642. private var _currentFile:string;
  12643. private var _positionInterval:number;
  12644. private var _xmlLoaders:Dictionary;
  12645. private var _stream:netstream;
  12646. private var _subscribeCount:number = 0;
  12647. private var _subscribeInterval:number;
  12648. private var _timeoffset:number = -1;
  12649. private var _transformer:SoundTransform;
  12650. private var _isStreaming:boolean;
  12651. private var _transitionLevel:number = -1;
  12652. private var _video:video;
  12653. private var _bufferFull:boolean = false;
  12654. private var _dvrStartDuration:number = 0;
  12655. private var _dvrStartDate:number = 0;
  12656. private var _lockOnStream:boolean = false;
  12657. private var _loadbalanceOnSwitch:boolean;
  12658. private var _streamInfo:array;
  12659. private var _streamInfoInterval:number;
  12660. private var _userDuration:boolean;
  12661.  
  12662. public function RTMPMediaProvider(){
  12663. super("rtmp");
  12664. }
  12665. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  12666. super.initializeMediaProvider(_arg1);
  12667. this._connection = new netconnection();
  12668. this._connection.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
  12669. this._connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
  12670. this._connection.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  12671. this._connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
  12672. this._connection.objectEncoding = ObjectEncoding.AMF0;
  12673. this._connection.client = new NetClient(this);
  12674. this._xmlLoaders = new Dictionary();
  12675. this._transformer = new SoundTransform();
  12676. this._video = new video(320, 240);
  12677. this._video.smoothing = config.smoothing;
  12678. }
  12679. private function checkDynamic(_arg1:string):void{
  12680. var _local2:number = number(new PlayerEvent("").client.split(" ")[2].split(",")[0]);
  12681. var _local3:number = number(_arg1.split(",")[0]);
  12682. var _local4:number = number(_arg1.split(",")[1]);
  12683. if ((((_local2 > 9)) && ((((_local3 > 3)) || ((((_local3 == 3)) && ((_local4 > 4)))))))){
  12684. this._dynamic = true;
  12685. } else {
  12686. this._dynamic = false;
  12687. };
  12688. if (config.se_disabledynamic == true){
  12689. this._dynamic = false;
  12690. };
  12691. }
  12692. private function connectTunneled():void{
  12693. if (this._responded){
  12694. return;
  12695. };
  12696. var _local1:string = item.streamer;
  12697. if (_local1.substr(0, 7) == "rtmp://"){
  12698. _local1 = _local1.replace("rtmp://", "rtmpt://");
  12699. } else {
  12700. if (_local1.substr(0, 8) == "rtmpe://"){
  12701. _local1 = _local1.replace("rtmpe://", "rtmpte://");
  12702. } else {
  12703. return;
  12704. };
  12705. };
  12706. var _local2:number = _local1.indexof("/", 10);
  12707. var _local3:number = _local1.indexof(":", 10);
  12708. if ((((_local3 > -1)) && ((_local3 < _local2)))){
  12709. _local1 = ((_local1.substr(0, _local3) + ":80") + _local1.substr(_local2));
  12710. } else {
  12711. _local1 = ((_local1.substr(0, _local2) + ":80") + _local1.substr(_local2));
  12712. };
  12713. Logger.log(("Fallback to tunneled connection: " + _local1));
  12714. item.streamer = _local1;
  12715. this._connection.connect(item.streamer);
  12716. }
  12717. private function doDVRInfo(_arg1:string):void{
  12718. this._connection.call("DVRGetStreamInfo", new Responder(this.doDVRInfoCallback), _arg1);
  12719. }
  12720. private function doDVRInfoCallback(_arg1:object):void{
  12721. var _local2:string;
  12722. this._subscribeCount++;
  12723. if (_arg1.code == "NetStream.DVRStreamInfo.Success"){
  12724. if (_arg1.data.currLen < 10){
  12725. setTimeout(this.doDVRInfo, 4000, this.getID(item.file));
  12726. } else {
  12727. this._dvrStartDuration = (_arg1.data.currLen - 20);
  12728. if (_arg1.data.isRec){
  12729. this._dvrStartDate = new date().valueof();
  12730. if (this._dvrStartDuration > 20){
  12731. this._timeoffset = (this._dvrStartDuration - 10);
  12732. };
  12733. };
  12734. this.setStream();
  12735. };
  12736. } else {
  12737. if (_arg1.code == "NetStream.DVRStreamInfo.Retry"){
  12738. if (this._subscribeCount > 3){
  12739. clearinterval(this._subscribeInterval);
  12740. this.stop();
  12741. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:"Subscribing to the dvr stream timed out."});
  12742. } else {
  12743. setTimeout(this.doDVRInfo, 2000, this.getID(item.file));
  12744. };
  12745. };
  12746. };
  12747. for (_local2 in _arg1.data) {
  12748. _arg1[_local2] = _arg1.data[_local2];
  12749. };
  12750. delete _arg1.data;
  12751. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
  12752. }
  12753. private function doSubscribe():void{
  12754. var _local1:number;
  12755. this._subscribeCount++;
  12756. if (this._subscribeCount > 3){
  12757. clearinterval(this._subscribeInterval);
  12758. this.stop();
  12759. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:"Subscribing to the live stream timed out."});
  12760. } else {
  12761. if (((item.levels) && ((item.levels.length > 1)))){
  12762. _local1 = 0;
  12763. while (_local1 < item.levels.length) {
  12764. this._connection.call("FCSubscribe", null, this.getID(item.levels[_local1].file));
  12765. _local1++;
  12766. };
  12767. } else {
  12768. this._connection.call("FCSubscribe", null, this.getID(item.file));
  12769. };
  12770. };
  12771. }
  12772. private function errorHandler(_arg1:ErrorEvent):void{
  12773. this.stop();
  12774. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:_arg1.text});
  12775. }
  12776. private function getStreamInfo():void{
  12777. var bwd:* = nan;
  12778. var drf:* = nan;
  12779. var stt:* = null;
  12780. var len:* = nan;
  12781. var lvl:* = nan;
  12782. if (!this._stream){
  12783. clearinterval(this._streamInfoInterval);
  12784. return;
  12785. };
  12786. try {
  12787. bwd = math.round(((this._stream.info.maxBytesPerSecond * 8) / 0x0400));
  12788. drf = this._stream.info.droppedFrames;
  12789. stt = state;
  12790. this._streamInfo.push({
  12791. bwd:bwd,
  12792. drf:drf,
  12793. stt:stt
  12794. });
  12795. len = this._streamInfo.length;
  12796. if ((((len > 5)) && ((state == PlayerState.PLAYING)))){
  12797. bwd = math.round((((((this._streamInfo[(len - 1)].bwd + this._streamInfo[(len - 2)].bwd) + this._streamInfo[(len - 3)].bwd) + this._streamInfo[(len - 4)].bwd) + this._streamInfo[(len - 5)].bwd) / 5));
  12798. config.bandwidth = bwd;
  12799. Configger.saveCookie("bandwidth", bwd);
  12800. if ((((this._streamInfo[(len - 2)].stt == PlayerState.BUFFERING)) || ((this._streamInfo[(len - 3)].stt == PlayerState.BUFFERING)))){
  12801. drf = 0;
  12802. } else {
  12803. drf = (math.round(((this._streamInfo[(len - 1)].drf - this._streamInfo[(len - 3)].drf) * 5)) / 10);
  12804. };
  12805. if ((((item.levels.length > 0)) && (!((item.getLevel(bwd, config.width) == item.currentLevel))))){
  12806. Logger.log("swapping to another level b/c of bandwidth", bwd.tostring());
  12807. this.swap(item.getLevel(bwd, config.width));
  12808. };
  12809. if ((((((item.levels.length > 0)) && ((drf > 10)))) && ((item.currentLevel < (item.levels.length - 1))))){
  12810. lvl = item.currentLevel;
  12811. item.blacklistLevel(lvl);
  12812. setTimeout(this.unBlacklist, 30000, lvl);
  12813. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
  12814. type:"blacklist",
  12815. level:lvl,
  12816. state:true
  12817. }});
  12818. Logger.log("swapping to another level b/c of framedrops", drf.tostring());
  12819. this.swap(item.getLevel(bwd, config.width));
  12820. };
  12821. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
  12822. bandwidth:bwd,
  12823. droppedFrames:drf
  12824. }});
  12825. };
  12826. } catch(e:error) {
  12827. Logger.log(("There was an error attempting to get stream info: " + e.message));
  12828. };
  12829. }
  12830. private function unBlacklist(_arg1:number):void{
  12831. item.blacklistLevel(_arg1, false);
  12832. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
  12833. type:"blacklist",
  12834. level:_arg1,
  12835. state:false
  12836. }});
  12837. }
  12838. private function getID(_arg1:string):string{
  12839. var _local2:array = _arg1.split("?");
  12840. var _local3:string = _local2[0].substr(-4);
  12841. _local2[0] = _local2[0].substr(0, (_local2[0].length - 4));
  12842. if (_arg1.indexof(":") > -1){
  12843. return (_arg1);
  12844. };
  12845. if (_local3 == ".mp3"){
  12846. return (("mp3:" + _local2.join("?")));
  12847. };
  12848. if ((((((((((((_local3 == ".mp4")) || ((_local3 == ".mov")))) || ((_local3 == ".m4v")))) || ((_local3 == ".aac")))) || ((_local3 == ".m4a")))) || ((_local3 == ".f4v")))){
  12849. return (("mp4:" + _arg1));
  12850. };
  12851. if (_local3 == ".flv"){
  12852. return (_local2.join("?"));
  12853. };
  12854. return (_arg1);
  12855. }
  12856. override public function load(_arg1:PlaylistItem):void{
  12857. _item = _arg1;
  12858. _position = 0;
  12859. this._bufferFull = false;
  12860. this._bandwidthSwitch = false;
  12861. this._lockOnStream = false;
  12862. this._userDuration = (_item.duration > 0);
  12863. if (this._timeoffset < 0){
  12864. this._timeoffset = item.start;
  12865. };
  12866. if (item.levels.length > 0){
  12867. item.setLevel(item.getLevel(config.bandwidth, config.width));
  12868. };
  12869. clearinterval(this._positionInterval);
  12870. if (getConfigProperty("loadbalance")){
  12871. this.loadSmil();
  12872. } else {
  12873. this.finishLoad();
  12874. };
  12875. setState(PlayerState.BUFFERING);
  12876. sendBufferEvent(0);
  12877. }
  12878. private function loadSmil():void{
  12879. var _local3:number;
  12880. if (!item.hasOwnProperty("smil")){
  12881. item.smil = [];
  12882. if (item.levels.length > 0){
  12883. _local3 = 0;
  12884. while (_local3 < item.levels.length) {
  12885. item.smil[_local3] = (item.levels[_local3] as PlaylistItemLevel).file;
  12886. _local3++;
  12887. };
  12888. } else {
  12889. item.smil[0] = item.file;
  12890. };
  12891. };
  12892. var _local1:string = (((item.levels.length > 0)) ? item.smil[item.currentLevel] : item.smil[0]);
  12893. var _local2:AssetLoader = new AssetLoader();
  12894. _local2.addEventListener(Event.COMPLETE, this.loaderHandler);
  12895. _local2.addEventListener(ErrorEvent.error, this.errorHandler);
  12896. this._xmlLoaders[_local2] = _local1;
  12897. _local2.load(_local1, xml);
  12898. }
  12899. private function finishLoad():void{
  12900. if ((((((((item.file.substr(-4) == ".mp3")) || ((item.file.substr(0, 4) == "mp3:")))) || ((item.file.substr(-4) == ".aac")))) || ((item.file.substr(-4) == ".m4a")))){
  12901. media = null;
  12902. } else {
  12903. if (!media){
  12904. media = this._video;
  12905. };
  12906. };
  12907. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
  12908. try {
  12909. this._responded = false;
  12910. this._connection.connect(item.streamer);
  12911. if (getConfigProperty("tunneling") !== false){
  12912. setTimeout(this.connectTunneled, 5000);
  12913. };
  12914. } catch(e:error) {
  12915. error(("Could not connect to application: " + e.message));
  12916. };
  12917. }
  12918. private function loaderHandler(_arg1:Event):void{
  12919. var _local4:number;
  12920. var _local5:PlaylistItemLevel;
  12921. var _local2:array = LoadbalanceParser.parse((_arg1.target as AssetLoader).loadedObject);
  12922. var _local3:string = this._xmlLoaders[_arg1.target];
  12923. delete this._xmlLoaders[_arg1.target];
  12924. if (_local2.length > 1){
  12925. item.clearLevels();
  12926. _local4 = 0;
  12927. while (_local4 < _local2.length) {
  12928. item.addLevel(_local2[_local4]);
  12929. _local4++;
  12930. };
  12931. item.setLevel(item.getLevel(config.bandwidth, config.width));
  12932. } else {
  12933. if (item.levels.length > 0){
  12934. _local5 = (item.levels[(item.smil as array).indexof(_local3)] as PlaylistItemLevel);
  12935. _local5.streamer = _local2[0].streamer;
  12936. _local5.file = _local2[0].file;
  12937. this._loadbalanceOnSwitch = true;
  12938. } else {
  12939. item.streamer = _local2[0].streamer;
  12940. item.file = _local2[0].file;
  12941. };
  12942. };
  12943. this.finishLoad();
  12944. }
  12945. public function onClientData(_arg1:object):void{
  12946. if (!_arg1){
  12947. return;
  12948. };
  12949. if (_arg1.type == "fcsubscribe"){
  12950. if (_arg1.code == "NetStream.Play.StreamNotFound"){
  12951. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Subscription failed: " + item.file)});
  12952. } else {
  12953. if ((((_arg1.code == "NetStream.Play.Start")) && (!(this._stream)))){
  12954. this.setStream();
  12955. };
  12956. };
  12957. clearinterval(this._subscribeInterval);
  12958. };
  12959. if (_arg1.width){
  12960. this._video.width = _arg1.width;
  12961. this._video.height = _arg1.height;
  12962. super.resize(_width, _height);
  12963. };
  12964. if (_arg1.code == "NetStream.Play.TransitionComplete"){
  12965. if (this._transitionLevel >= 0){
  12966. this._transitionLevel = -1;
  12967. };
  12968. } else {
  12969. if (_arg1.type == "metadata"){
  12970. if (((_arg1.duration) && (!(this._userDuration)))){
  12971. item.duration = _arg1.duration;
  12972. };
  12973. if (config.se_livestream == true){
  12974. item.duration = 0;
  12975. };
  12976. };
  12977. };
  12978. if (_arg1.type == "complete"){
  12979. clearinterval(this._positionInterval);
  12980. this.complete();
  12981. };
  12982. if (_arg1.type == "close"){
  12983. this.stop();
  12984. };
  12985. if (_arg1.type == "bandwidth"){
  12986. config.bandwidth = _arg1.bandwidth;
  12987. Configger.saveCookie("bandwidth", _arg1.bandwidth);
  12988. if (this._bandwidthSwitch){
  12989. this._bandwidthSwitch = false;
  12990. this.setStream();
  12991. };
  12992. };
  12993. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
  12994. }
  12995. override public function pause():void{
  12996. super.pause();
  12997. if (this._stream){
  12998. if (this.isLivestream){
  12999. this._stream.close();
  13000. } else {
  13001. this._stream.pause();
  13002. };
  13003. } else {
  13004. this._lockOnStream = true;
  13005. };
  13006. }
  13007. override public function play():void{
  13008. if (this._lockOnStream){
  13009. this._lockOnStream = false;
  13010. if (this._stream){
  13011. this.seek(this._timeoffset);
  13012. } else {
  13013. this.setStream();
  13014. };
  13015. } else {
  13016. if (state == PlayerState.PAUSED){
  13017. if (this.isLivestream){
  13018. this._stream.play(this.getID(item.file), -1);
  13019. } else {
  13020. this._stream.resume();
  13021. };
  13022. };
  13023. };
  13024. super.play();
  13025. clearinterval(this._positionInterval);
  13026. this._positionInterval = setinterval(this.positionInterval, 100);
  13027. }
  13028. private function positionInterval():void{
  13029. var _local3:object;
  13030. var _local1:number = (math.round((this._stream.time * 100)) / 100);
  13031. var _local2:number = (this._stream.bufferlength / this._stream.buffertime);
  13032. if (math.round(this._SEBufferStatus) != math.round(this._stream.bufferlength)){
  13033. _local3 = {
  13034. bufferLevel:this._stream.bufferlength,
  13035. bufferMax:this._stream.buffertime,
  13036. bufferStatus:(this._stream.bufferlength / this._stream.buffertime)
  13037. };
  13038. sendMediaEvent(MediaEvent.SCALEENGINE_BUFFER_STATUS, {metadata:_local3});
  13039. };
  13040. this._SEBufferStatus = this._stream.bufferlength;
  13041. if ((((((_local2 < 0.25)) && ((_local1 < (this.duration - 5))))) && (!((state == PlayerState.BUFFERING))))){
  13042. this._bufferFull = false;
  13043. setState(PlayerState.BUFFERING);
  13044. } else {
  13045. if ((((((((_local2 > 1)) && (!((state == PlayerState.PLAYING))))) && (!(this._bufferFull)))) && (!(this.isLivestream)))){
  13046. this._bufferFull = true;
  13047. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL, {bufferPercent:_local2});
  13048. };
  13049. };
  13050. if (((!(getConfigProperty("dvr"))) && (!((state == PlayerState.PLAYING))))){
  13051. return;
  13052. };
  13053. if (_local1 < this.duration){
  13054. _position = _local1;
  13055. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  13056. position:position,
  13057. duration:this.duration
  13058. });
  13059. } else {
  13060. if ((((position > 0)) && ((this.duration > 0)))){
  13061. this._stream.pause();
  13062. clearinterval(this._positionInterval);
  13063. this.complete();
  13064. };
  13065. };
  13066. }
  13067. override public function resize(_arg1:number, _arg2:number):void{
  13068. super.resize(_arg1, _arg2);
  13069. if (state == PlayerState.PLAYING){
  13070. if ((((item.levels.length > 0)) && (!((item.currentLevel == item.getLevel(config.bandwidth, config.width)))))){
  13071. if (this._dynamic){
  13072. Logger.log(("swapping to another level b/c of size: " + config.width));
  13073. this.swap(item.getLevel(config.bandwidth, config.width));
  13074. } else {
  13075. this.seek(position);
  13076. };
  13077. };
  13078. };
  13079. }
  13080. override public function seek(_arg1:number):void{
  13081. var pos:* = _arg1;
  13082. this._transitionLevel = -1;
  13083. if (((((getConfigProperty("dvr")) && (this._dvrStartDate))) && ((pos > (this.duration - 10))))){
  13084. pos = (this.duration - 10);
  13085. };
  13086. this._timeoffset = pos;
  13087. clearinterval(this._positionInterval);
  13088. if ((((item.levels.length > 0)) && (!((item.getLevel(config.bandwidth, config.width) == item.currentLevel))))){
  13089. item.setLevel(item.getLevel(config.bandwidth, config.width));
  13090. if (this._loadbalanceOnSwitch){
  13091. this.load(item);
  13092. return;
  13093. };
  13094. };
  13095. if (state == PlayerState.PAUSED){
  13096. this.play();
  13097. };
  13098. if (this._currentFile != item.file){
  13099. this._currentFile = item.file;
  13100. try {
  13101. if (this._dvrStartDate){
  13102. this._stream.play(this.getID(item.file), 10);
  13103. Logger.log(("dvring " + item.file), "rtmp");
  13104. } else {
  13105. this._stream.play(this.getID(item.file));
  13106. if (this._dynamic){
  13107. this._streamInfo = new array();
  13108. clearinterval(this._streamInfoInterval);
  13109. this._streamInfoInterval = setinterval(this.getStreamInfo, 1000);
  13110. };
  13111. };
  13112. } catch(e:error) {
  13113. Logger.log(("Error: " + e.message));
  13114. };
  13115. };
  13116. if ((((((this._timeoffset > 0)) || ((_position > this._timeoffset)))) || ((state == PlayerState.IDLE)))){
  13117. this._bufferFull = false;
  13118. setState(PlayerState.BUFFERING);
  13119. this._stream.seek(this._timeoffset);
  13120. };
  13121. this._isStreaming = true;
  13122. clearinterval(this._positionInterval);
  13123. this._positionInterval = setinterval(this.positionInterval, 100);
  13124. }
  13125. private function setStream():void{
  13126. this._stream = new netstream(this._connection);
  13127. this._stream.checkPolicyFile = true;
  13128. this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
  13129. this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  13130. this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
  13131. if (((((getConfigProperty("dvr")) || (getConfigProperty("subscribe")))) || (this._dynamic))){
  13132. this._stream.buffertime = 4;
  13133. } else {
  13134. this._stream.buffertime = config.bufferlength;
  13135. };
  13136. this._stream.client = new NetClient(this);
  13137. this._video.attachNetStream(this._stream);
  13138. this.streamVolume(((config.mute) ? 0 : config.volume));
  13139. if (!this._lockOnStream){
  13140. this.seek(this._timeoffset);
  13141. };
  13142. }
  13143. private function statusHandler(_arg1:NetStatusEvent):void{
  13144. var msg:* = null;
  13145. var evt:* = _arg1;
  13146. this._responded = true;
  13147. switch (evt.info.code){
  13148. case "NetConnection.Connect.Success":
  13149. if (evt.info.secureToken != undefined){
  13150. this._connection.call("secureTokenResponse", null, TEA.decrypt(evt.info.secureToken, config.token));
  13151. };
  13152. if (evt.info.data){
  13153. this._connection.call("netStreamEnable", null);
  13154. this.checkDynamic(evt.info.data.version);
  13155. };
  13156. if (getConfigProperty("dvr")){
  13157. this._connection.call("DVRSubscribe", null, this.getID(item.file));
  13158. setTimeout(this.doDVRInfo, 2000, this.getID(item.file));
  13159. } else {
  13160. if (getConfigProperty("subscribe")){
  13161. this._subscribeInterval = setinterval(this.doSubscribe, 2000);
  13162. } else {
  13163. if (item.levels.length > 0){
  13164. if (((this._dynamic) || (this._bandwidthChecked))){
  13165. this.setStream();
  13166. } else {
  13167. this._bandwidthChecked = true;
  13168. this._bandwidthSwitch = true;
  13169. this._connection.call("checkBandwidth", null);
  13170. };
  13171. } else {
  13172. this.setStream();
  13173. };
  13174. this._connection.call("getStreamLength", new Responder(this.streamlengthHandler), this.getID(item.file));
  13175. };
  13176. };
  13177. break;
  13178. case "NetStream.Seek.Notify":
  13179. clearinterval(this._positionInterval);
  13180. this._positionInterval = setinterval(this.positionInterval, 100);
  13181. break;
  13182. case "NetConnection.Connect.Rejected":
  13183. try {
  13184. if (evt.info.ex.code == 302){
  13185. item.streamer = evt.info.ex.redirect;
  13186. setTimeout(this.load, 100, item);
  13187. return;
  13188. };
  13189. } catch(err:error) {
  13190. stop();
  13191. msg = evt.info.code;
  13192. if (evt.info["description"]){
  13193. msg = evt.info["description"];
  13194. };
  13195. stop();
  13196. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:msg});
  13197. };
  13198. break;
  13199. case "NetStream.Play.Failed":
  13200. msg = evt.info.code;
  13201. if (evt.info["description"]){
  13202. msg = evt.info["description"];
  13203. };
  13204. this.stop();
  13205. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:msg});
  13206. break;
  13207. case "NetStream.Failed":
  13208. case "NetStream.Play.StreamNotFound":
  13209. if (!this._isStreaming){
  13210. this.onClientData({type:"complete"});
  13211. } else {
  13212. this.stop();
  13213. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Stream not found: " + item.file)});
  13214. };
  13215. break;
  13216. case "NetStream.Seek.Failed":
  13217. if (!this._isStreaming){
  13218. this.onClientData({type:"complete"});
  13219. } else {
  13220. this.stop();
  13221. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Could not seek: " + item.file)});
  13222. };
  13223. break;
  13224. case "NetConnection.Connect.Closed":
  13225. this.stop();
  13226. break;
  13227. case "NetConnection.Connect.Failed":
  13228. if (item.streamer.substr(0, 5) == "rtmpt"){
  13229. this.stop();
  13230. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Server not found: " + item.streamer)});
  13231. } else {
  13232. this._responded = false;
  13233. };
  13234. break;
  13235. case "NetStream.Play.UnpublishNotify":
  13236. this.stop();
  13237. break;
  13238. case "NetStream.Buffer.Full":
  13239. if (!this._bufferFull){
  13240. this._bufferFull = true;
  13241. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  13242. };
  13243. break;
  13244. case "NetStream.Play.Transition":
  13245. this.onClientData(evt.info);
  13246. break;
  13247. case "NetStream.Play.Stop":
  13248. if (getConfigProperty("dvr")){
  13249. this.stop();
  13250. };
  13251. break;
  13252. };
  13253. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:evt.info});
  13254. }
  13255. override public function stop():void{
  13256. var _local1:PlaylistItemLevel;
  13257. var _local2:number;
  13258. if (((this._stream) && (this._stream.time))){
  13259. this._stream.close();
  13260. };
  13261. this._stream = null;
  13262. this._isStreaming = false;
  13263. this._currentFile = undefined;
  13264. this._video.clear();
  13265. this._connection.close();
  13266. clearinterval(this._positionInterval);
  13267. _position = 0;
  13268. this._timeoffset = -1;
  13269. this._dvrStartDuration = (this._dvrStartDate = (this._subscribeCount = 0));
  13270. this._streamInfo = new array();
  13271. clearinterval(this._streamInfoInterval);
  13272. super.stop();
  13273. if (((item) && (item.hasOwnProperty("smil")))){
  13274. if (item.levels.length > 0){
  13275. for each (_local1 in item.levels) {
  13276. _local2 = 0;
  13277. while (_local2 < (item.smil as array).length) {
  13278. _local1.file = item.smil[_local2];
  13279. _local2++;
  13280. };
  13281. };
  13282. } else {
  13283. item.file = item.smil[0];
  13284. };
  13285. };
  13286. }
  13287. private function streamlengthHandler(_arg1:number):void{
  13288. if (((((_arg1) && (!(this._userDuration)))) && (!((config.se_livestream == true))))){
  13289. item.duration = _arg1;
  13290. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{duration:_arg1}});
  13291. };
  13292. }
  13293. private function swap(_arg1:number):void{
  13294. var _local2:NetStreamPlayOptions;
  13295. if ((((this._transitionLevel == -1)) && ((((((_arg1 < item.currentLevel)) || ((this._stream.bufferlength < (this._stream.buffertime * 1.5))))) || (item.levels[item.currentLevel].blacklisted))))){
  13296. this._transitionLevel = _arg1;
  13297. item.setLevel(_arg1);
  13298. _local2 = new NetStreamPlayOptions();
  13299. _local2.streamName = this.getID(item.file);
  13300. _local2.transition = NetStreamPlayTransitions.switch;
  13301. clearinterval(this._streamInfoInterval);
  13302. this._streamInfo = new array();
  13303. this._streamInfoInterval = setinterval(this.getStreamInfo, 1000);
  13304. this._stream.play2(_local2);
  13305. };
  13306. }
  13307. override public function setvolume(_arg1:number):void{
  13308. this.streamVolume(_arg1);
  13309. super.setvolume(_arg1);
  13310. }
  13311. protected function streamVolume(_arg1:number):void{
  13312. this._transformer.volume = (_arg1 / 100);
  13313. if (this._stream){
  13314. this._stream.soundTransform = this._transformer;
  13315. };
  13316. }
  13317. override protected function complete():void{
  13318. this.stop();
  13319. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
  13320. }
  13321. protected function get isLivestream():boolean{
  13322. if (config.se_livestream == true){
  13323. return (true);
  13324. };
  13325. return (((!((this.duration > 0))) && (this._stream)));
  13326. }
  13327. protected function get duration():number{
  13328. var _local1:number;
  13329. if (config.se_livestream == true){
  13330. return (0);
  13331. };
  13332. if (getConfigProperty("dvr")){
  13333. _local1 = this._dvrStartDuration;
  13334. if (this._dvrStartDate){
  13335. _local1 = (_local1 + ((new date().valueof() - this._dvrStartDate) / 1000));
  13336. };
  13337. return (math.round(_local1));
  13338. };
  13339. return (item.duration);
  13340. }
  13341.  
  13342. }
  13343. }//package com.longtailvideo.jwplayer.media
  13344. package com.longtailvideo.jwplayer.media {
  13345. import com.longtailvideo.jwplayer.model.*;
  13346. import flash.events.*;
  13347. import com.longtailvideo.jwplayer.events.*;
  13348. import com.longtailvideo.jwplayer.player.*;
  13349. import flash.utils.*;
  13350. import flash.net.*;
  13351. import com.longtailvideo.jwplayer.utils.*;
  13352. import flash.media.*;
  13353.  
  13354. public class VideoMediaProvider extends MediaProvider {
  13355.  
  13356. protected var _video:video;
  13357. protected var _connection:netconnection;
  13358. protected var _stream:netstream;
  13359. protected var _transformer:SoundTransform;
  13360. protected var _positionInterval:number;
  13361. protected var _currentFile:string;
  13362. private var _bufferFull:boolean;
  13363. private var _bufferingComplete:boolean;
  13364. private var _bandwidthChecked:boolean;
  13365. private var _bandwidthSwitch:boolean = true;
  13366. private var _bandwidthTimeout:number = 2000;
  13367.  
  13368. public function VideoMediaProvider(){
  13369. super("video");
  13370. }
  13371. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  13372. super.initializeMediaProvider(_arg1);
  13373. this._connection = new netconnection();
  13374. this._connection.connect(null);
  13375. this._stream = new netstream(this._connection);
  13376. this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
  13377. this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  13378. this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
  13379. this._stream.buffertime = config.bufferlength;
  13380. this._stream.client = new NetClient(this);
  13381. this._transformer = new SoundTransform();
  13382. this._video = new video(320, 240);
  13383. this._video.smoothing = config.smoothing;
  13384. this._video.attachNetStream(this._stream);
  13385. }
  13386. protected function errorHandler(_arg1:ErrorEvent):void{
  13387. error(_arg1.text);
  13388. }
  13389. override public function load(_arg1:PlaylistItem):void{
  13390. var _local2:boolean;
  13391. var _local3:string;
  13392. this._bufferFull = false;
  13393. this._bufferingComplete = false;
  13394. if (_arg1.levels.length > 0){
  13395. _arg1.setLevel(_arg1.getLevel(config.bandwidth, config.width));
  13396. this._bandwidthChecked = false;
  13397. } else {
  13398. this._bandwidthChecked = true;
  13399. };
  13400. if (((((((!(item)) || (!((this._currentFile == _arg1.file))))) || ((this._stream.bytesloaded == 0)))) || (((this._stream.bytesloaded < this._stream.bytestotal) > 0)))){
  13401. this._currentFile = _arg1.file;
  13402. if ((((Strings.extension(this._currentFile) == "aac")) || ((Strings.extension(this._currentFile) == "m4a")))){
  13403. media = null;
  13404. } else {
  13405. media = this._video;
  13406. };
  13407. this._stream.checkPolicyFile = true;
  13408. _local3 = Strings.getAbsolutePath(_arg1.file, config["netstreambasepath"]);
  13409. this._stream.play(_local3);
  13410. this._stream.pause();
  13411. } else {
  13412. if (_arg1.duration <= 0){
  13413. _arg1.duration = item.duration;
  13414. };
  13415. this.seekStream(_arg1.start, false);
  13416. };
  13417. _item = _arg1;
  13418. super.load(_arg1);
  13419. setState(PlayerState.BUFFERING);
  13420. sendBufferEvent(0);
  13421. this.streamVolume(((config.mute) ? 0 : config.volume));
  13422. clearinterval(this._positionInterval);
  13423. this._positionInterval = setinterval(this.positionHandler, 200);
  13424. }
  13425. public function onClientData(_arg1:object):void{
  13426. if (!_arg1){
  13427. return;
  13428. };
  13429. if (_arg1.width){
  13430. this._video.width = _arg1.width;
  13431. this._video.height = _arg1.height;
  13432. resize(_width, _height);
  13433. };
  13434. if (((_arg1.duration) && ((item.duration < 0)))){
  13435. item.duration = _arg1.duration;
  13436. };
  13437. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
  13438. }
  13439. override public function pause():void{
  13440. this._stream.pause();
  13441. super.pause();
  13442. }
  13443. override public function play():void{
  13444. if (!this._positionInterval){
  13445. this._positionInterval = setinterval(this.positionHandler, 100);
  13446. };
  13447. if (this._bufferFull){
  13448. this._stream.resume();
  13449. super.play();
  13450. } else {
  13451. setState(PlayerState.BUFFERING);
  13452. };
  13453. }
  13454. protected function positionHandler():void{
  13455. var _local3:number;
  13456. var _local4:number;
  13457. var _local5:number;
  13458. if (((!(this._bandwidthChecked)) && ((this._stream.bytesloaded > 0)))){
  13459. this._bandwidthChecked = true;
  13460. setTimeout(this.checkBandwidth, this._bandwidthTimeout, this._stream.bytesloaded);
  13461. };
  13462. var _local1:number = (math.round((math.min(this._stream.time, math.max(item.duration, 0)) * 100)) / 100);
  13463. var _local2:number = (((item.duration > 0)) ? (item.duration - this._stream.time) : this._stream.time);
  13464. if ((((((item.duration > 0)) && (this._stream))) && ((this._stream.bytestotal > 0)))){
  13465. _local3 = (((this._stream.buffertime < _local2)) ? this._stream.buffertime : math.ceil(_local2));
  13466. _local4 = ((this._stream.buffertime) ? math.ceil(((math.ceil(this._stream.bufferlength) / _local3) * 100)) : 0);
  13467. } else {
  13468. _local4 = ((this._stream.buffertime) ? ((this._stream.bufferlength / this._stream.buffertime) * 100) : 0);
  13469. _local3 = ((this._stream.bytestotal)>0) ? 100 : 0;
  13470. };
  13471. if ((((((_local4 <= 50)) && ((state == PlayerState.PLAYING)))) && (((item.duration - _local1) > 5)))){
  13472. this._bufferFull = false;
  13473. this._stream.pause();
  13474. setState(PlayerState.BUFFERING);
  13475. } else {
  13476. if ((((((_local4 > 95)) && (!(this._bufferFull)))) && ((_local3 > 0)))){
  13477. this._bufferFull = true;
  13478. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  13479. };
  13480. };
  13481. if (!this._bufferingComplete){
  13482. if (this._stream.bytestotal > 0){
  13483. _local5 = (100 * (this._stream.bytesloaded / this._stream.bytestotal));
  13484. } else {
  13485. _local5 = (((this._stream.bytesloaded > 0)) ? 100 : 0);
  13486. };
  13487. if ((((_local5 == 100)) && ((this._bufferingComplete == false)))){
  13488. this._bufferingComplete = true;
  13489. };
  13490. sendBufferEvent(_local5, 0, {
  13491. loaded:this._stream.bytesloaded,
  13492. total:this._stream.bytestotal
  13493. });
  13494. };
  13495. if (state != PlayerState.PLAYING){
  13496. return;
  13497. };
  13498. _position = _local1;
  13499. if (position < item.duration){
  13500. if (position >= 0){
  13501. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  13502. position:position,
  13503. duration:item.duration
  13504. });
  13505. };
  13506. } else {
  13507. if (item.duration > 0){
  13508. complete();
  13509. };
  13510. };
  13511. }
  13512. private function checkBandwidth(_arg1:number):void{
  13513. var _local4:object;
  13514. var _local2:number = this._stream.bytesloaded;
  13515. var _local3:number = ((math.ceil(((_local2 - _arg1) / 0x0400)) * 8) / (this._bandwidthTimeout / 1000));
  13516. if (_local2 < this._stream.bytestotal){
  13517. if (_local3 > 0){
  13518. config.bandwidth = _local3;
  13519. Configger.saveCookie("bandwidth", _local3);
  13520. _local4 = {bandwidth:_local3};
  13521. if ((((item.duration > 0)) && ((this._stream.bytestotal > 0)))){
  13522. _local4.bitrate = math.ceil((((this._stream.bytestotal / 0x0400) * 8) / item.duration));
  13523. };
  13524. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local4});
  13525. };
  13526. if (this._bandwidthSwitch){
  13527. this._bandwidthSwitch = false;
  13528. if (item.currentLevel != item.getLevel(config.bandwidth, config.width)){
  13529. this.load(item);
  13530. return;
  13531. };
  13532. };
  13533. };
  13534. setTimeout(this.checkBandwidth, this._bandwidthTimeout, _local2);
  13535. }
  13536. override public function seek(_arg1:number):void{
  13537. this.seekStream(_arg1);
  13538. }
  13539. private function seekStream(_arg1:number, _arg2:boolean=true):void{
  13540. var _local3:number = (((this._stream.bytestotal > 0)) ? ((this._stream.bytesloaded / this._stream.bytestotal) * item.duration) : 0);
  13541. if (_arg1 <= _local3){
  13542. super.seek(_arg1);
  13543. clearinterval(this._positionInterval);
  13544. this._positionInterval = undefined;
  13545. this._stream.seek(position);
  13546. if (_arg2){
  13547. this.play();
  13548. };
  13549. };
  13550. }
  13551. protected function statusHandler(_arg1:NetStatusEvent):void{
  13552. switch (_arg1.info.code){
  13553. case "NetStream.Play.Stop":
  13554. complete();
  13555. break;
  13556. case "NetStream.Play.StreamNotFound":
  13557. error(("Video not found or access denied: " + item.file));
  13558. break;
  13559. };
  13560. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{status:_arg1.info.code}});
  13561. }
  13562. override public function stop():void{
  13563. if (this._stream.bytesloaded < this._stream.bytestotal){
  13564. this._stream.close();
  13565. } else {
  13566. this._stream.pause();
  13567. this._stream.seek(0);
  13568. };
  13569. clearinterval(this._positionInterval);
  13570. this._positionInterval = undefined;
  13571. super.stop();
  13572. }
  13573. override public function setvolume(_arg1:number):void{
  13574. this.streamVolume(_arg1);
  13575. super.setvolume(_arg1);
  13576. }
  13577. protected function streamVolume(_arg1:number):void{
  13578. this._transformer.volume = (_arg1 / 100);
  13579. if (this._stream){
  13580. this._stream.soundTransform = this._transformer;
  13581. };
  13582. }
  13583.  
  13584. }
  13585. }//package com.longtailvideo.jwplayer.media
  13586. package com.longtailvideo.jwplayer.media {
  13587. import com.longtailvideo.jwplayer.model.*;
  13588. import flash.events.*;
  13589. import com.longtailvideo.jwplayer.events.*;
  13590. import flash.display.*;
  13591. import com.longtailvideo.jwplayer.player.*;
  13592. import flash.utils.*;
  13593. import flash.net.*;
  13594. import com.longtailvideo.jwplayer.utils.*;
  13595. import flash.system.*;
  13596.  
  13597. public class ImageMediaProvider extends MediaProvider {
  13598.  
  13599. private var _loader:Loader;
  13600. private var _postitionInterval:number;
  13601. private var _lastFile:string;
  13602.  
  13603. public function ImageMediaProvider(){
  13604. super("image");
  13605. }
  13606. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  13607. super.initializeMediaProvider(_arg1);
  13608. this._loader = new Loader();
  13609. this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
  13610. this._loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.progressHandler);
  13611. this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  13612. }
  13613. override public function load(_arg1:PlaylistItem):void{
  13614. _item = _arg1;
  13615. _item.duration = this._duration;
  13616. _position = 0;
  13617. if (item.file != this._lastFile){
  13618. this._lastFile = item.file;
  13619. this._loader.load(new URLRequest(item.file), new LoaderContext(true));
  13620. setState(PlayerState.BUFFERING);
  13621. sendBufferEvent(0);
  13622. } else {
  13623. setState(PlayerState.BUFFERING);
  13624. sendBufferEvent(0);
  13625. this.loaderHandler();
  13626. };
  13627. }
  13628. private function errorHandler(_arg1:ErrorEvent):void{
  13629. this.stop();
  13630. error(_arg1.text);
  13631. }
  13632. private function loaderHandler(_arg1:Event=null):void{
  13633. var evt = _arg1;
  13634. media = this._loader;
  13635. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
  13636. try {
  13637. Draw.smooth((this._loader.content as Bitmap));
  13638. } catch(e:error) {
  13639. Logger.log(("Could not smooth image file: " + e.message));
  13640. };
  13641. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
  13642. height:this._loader.content.height,
  13643. width:this._loader.content.width
  13644. }});
  13645. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  13646. }
  13647. override public function pause():void{
  13648. clearinterval(this._postitionInterval);
  13649. super.pause();
  13650. }
  13651. override public function play():void{
  13652. this._postitionInterval = setinterval(this.positionInterval, 100);
  13653. super.play();
  13654. }
  13655. protected function positionInterval():void{
  13656. if (state != PlayerState.PLAYING){
  13657. return;
  13658. };
  13659. _position = (math.round(((position * 10) + 1)) / 10);
  13660. if (position < this._duration){
  13661. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  13662. position:position,
  13663. duration:item.duration
  13664. });
  13665. } else {
  13666. if (this._duration > 0){
  13667. complete();
  13668. };
  13669. };
  13670. }
  13671. private function progressHandler(_arg1:ProgressEvent):void{
  13672. var _local2:number = math.round(((_arg1.bytesloaded / _arg1.bytestotal) * 100));
  13673. sendBufferEvent(_local2);
  13674. }
  13675. override public function seek(_arg1:number):void{
  13676. clearinterval(this._postitionInterval);
  13677. _position = _arg1;
  13678. this.play();
  13679. }
  13680. override public function stop():void{
  13681. clearinterval(this._postitionInterval);
  13682. super.stop();
  13683. }
  13684. private function get _duration():number{
  13685. if (!isnan(getConfigProperty("duration"))){
  13686. return (((((_item) && ((_item.duration > 0)))) ? _item.duration : getConfigProperty("duration")));
  13687. };
  13688. return (_item.duration);
  13689. }
  13690.  
  13691. }
  13692. }//package com.longtailvideo.jwplayer.media
  13693. package com.longtailvideo.jwplayer.media {
  13694. import com.longtailvideo.jwplayer.model.*;
  13695. import flash.events.*;
  13696. import com.longtailvideo.jwplayer.events.*;
  13697. import com.longtailvideo.jwplayer.player.*;
  13698. import flash.utils.*;
  13699. import flash.net.*;
  13700. import flash.media.*;
  13701.  
  13702. public class SoundMediaProvider extends MediaProvider {
  13703.  
  13704. private var _sound:sound;
  13705. private var _transformer:SoundTransform;
  13706. private var _channel:SoundChannel;
  13707. private var _context:SoundLoaderContext;
  13708. protected var _positionInterval:number;
  13709. private var _bufferFull:boolean;
  13710. private var _bufferingComplete:boolean;
  13711. private var _userDuration:number = -1;
  13712.  
  13713. public function SoundMediaProvider(){
  13714. super("_sound");
  13715. }
  13716. override public function initializeMediaProvider(_arg1:PlayerConfig):void{
  13717. super.initializeMediaProvider(_arg1);
  13718. this._transformer = new SoundTransform();
  13719. this._context = new SoundLoaderContext(0, true);
  13720. }
  13721. private function completeHandler(_arg1:Event):void{
  13722. complete();
  13723. }
  13724. private function errorHandler(_arg1:ErrorEvent):void{
  13725. this.stop();
  13726. error(_arg1.text);
  13727. }
  13728. private function id3Handler(_arg1:Event):void{
  13729. var _local2:ID3Info;
  13730. var _local3:object;
  13731. try {
  13732. _local2 = this._sound.id3;
  13733. _local3 = {
  13734. type:"id3",
  13735. album:_local2.album,
  13736. artist:_local2.artist,
  13737. comment:_local2.comment,
  13738. genre:_local2.genre,
  13739. name:_local2.songName,
  13740. track:_local2.track,
  13741. year:_local2.year
  13742. };
  13743. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local3});
  13744. } catch(err:error) {
  13745. };
  13746. }
  13747. override public function load(_arg1:PlaylistItem):void{
  13748. _position = 0;
  13749. this._bufferFull = false;
  13750. this._userDuration = _arg1.duration;
  13751. if (((((!(_item)) || (!((_item.file == _arg1.file))))) || (!(this._bufferingComplete)))){
  13752. this._bufferingComplete = false;
  13753. this._sound = new sound();
  13754. this._sound.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  13755. this._sound.addEventListener(Event.id3, this.id3Handler);
  13756. this._sound.addEventListener(ProgressEvent.PROGRESS, this.positionHandler);
  13757. this._sound.load(new URLRequest(_arg1.file), this._context);
  13758. };
  13759. _item = _arg1;
  13760. if (!this._positionInterval){
  13761. this._positionInterval = setinterval(this.positionHandler, 100);
  13762. };
  13763. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
  13764. setState(PlayerState.BUFFERING);
  13765. sendBufferEvent(0);
  13766. this.streamVolume(((config.mute) ? 0 : config.volume));
  13767. }
  13768. override public function pause():void{
  13769. if (this._positionInterval){
  13770. clearinterval(this._positionInterval);
  13771. this._positionInterval = undefined;
  13772. };
  13773. if (this._channel){
  13774. this._channel.stop();
  13775. };
  13776. super.pause();
  13777. }
  13778. override public function play():void{
  13779. if ((((position == 0)) && ((_item.start > 0)))){
  13780. this.seek(item.start);
  13781. return;
  13782. };
  13783. if (!this._positionInterval){
  13784. this._positionInterval = setinterval(this.positionHandler, 100);
  13785. };
  13786. if (this._channel){
  13787. this._channel.stop();
  13788. this._channel = null;
  13789. };
  13790. this._channel = this._sound.play((_position * 1000), 0, this._transformer);
  13791. this._channel.addEventListener(Event.SOUND_COMPLETE, this.completeHandler);
  13792. super.play();
  13793. }
  13794. protected function positionHandler(_arg1:ProgressEvent=null):void{
  13795. var _local2:number = 0;
  13796. var _local3:number = 0;
  13797. var _local4:number = config.bufferlength;
  13798. if (this._userDuration < 0){
  13799. if ((((this._sound.bytestotal > 0)) && (((this._sound.bytesloaded / this._sound.bytestotal) > 0.1)))){
  13800. _item.duration = (((this._sound.length / 1000) / this._sound.bytesloaded) * this._sound.bytestotal);
  13801. } else {
  13802. if (this._sound.length > 0){
  13803. _item.duration = (math.floor((this._sound.length / 100)) / 10);
  13804. };
  13805. };
  13806. };
  13807. if (this._channel){
  13808. _position = (math.floor((this._channel.position / 100)) / 10);
  13809. };
  13810. if (((!((_item.duration == 0))) || ((this._userDuration == 0)))){
  13811. if (this._sound.bytestotal > 0){
  13812. _local2 = math.floor(((this._sound.bytesloaded / this._sound.bytestotal) * 100));
  13813. _local3 = math.max(0, (((this._sound.bytesloaded / this._sound.bytestotal) * _item.duration) - _position));
  13814. _local4 = math.min(_local4, (_item.duration - _position));
  13815. } else {
  13816. _local2 = 0;
  13817. _local3 = 1;
  13818. _local4 = 0;
  13819. };
  13820. };
  13821. if ((((((((state == PlayerState.BUFFERING)) && (!(this._bufferFull)))) && ((_local3 >= _local4)))) && ((this._sound.bytesloaded > 0)))){
  13822. this._bufferFull = true;
  13823. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  13824. } else {
  13825. if ((((state == PlayerState.PLAYING)) && ((_local3 < (_local4 / 3))))){
  13826. this._bufferFull = false;
  13827. if (this._channel){
  13828. this._channel.stop();
  13829. };
  13830. setState(PlayerState.BUFFERING);
  13831. return;
  13832. };
  13833. };
  13834. if (((((((this._sound) && (!(isnan(_local2))))) && ((_local2 > 0)))) && (!(this._bufferingComplete)))){
  13835. if ((((_local2 == 100)) && ((this._bufferingComplete == false)))){
  13836. this._bufferingComplete = true;
  13837. };
  13838. sendBufferEvent(_local2, 0, {
  13839. loaded:this._sound.bytesloaded,
  13840. total:this._sound.bytestotal
  13841. });
  13842. };
  13843. if (state != PlayerState.PLAYING){
  13844. return;
  13845. };
  13846. if (_position < _item.duration){
  13847. sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
  13848. position:_position,
  13849. duration:_item.duration
  13850. });
  13851. } else {
  13852. if ((((_item.duration > 0)) && ((this._sound.bytestotal > 0)))){
  13853. complete();
  13854. };
  13855. };
  13856. }
  13857. override public function seek(_arg1:number):void{
  13858. if ((((((((this._userDuration >= 0)) && ((_arg1 < this._userDuration)))) || ((((((this._userDuration < 0)) && (this._sound))) && ((_arg1 < this._sound.length)))))) || (item.start))){
  13859. clearinterval(this._positionInterval);
  13860. this._positionInterval = undefined;
  13861. if (this._channel){
  13862. this._channel.stop();
  13863. };
  13864. _position = _arg1;
  13865. this.play();
  13866. };
  13867. }
  13868. override public function stop():void{
  13869. clearinterval(this._positionInterval);
  13870. this._positionInterval = undefined;
  13871. if (item){
  13872. item.duration = this._userDuration;
  13873. };
  13874. super.stop();
  13875. if (this._channel){
  13876. this._channel.stop();
  13877. this._channel = null;
  13878. };
  13879. try {
  13880. this._sound.close();
  13881. } catch(err:error) {
  13882. };
  13883. }
  13884. override public function setvolume(_arg1:number):void{
  13885. this.streamVolume(_arg1);
  13886. super.setvolume(_arg1);
  13887. }
  13888. protected function streamVolume(_arg1:number):void{
  13889. this._transformer.volume = (_arg1 / 100);
  13890. if (this._channel){
  13891. this._channel.soundTransform = this._transformer;
  13892. };
  13893. }
  13894.  
  13895. }
  13896. }//package com.longtailvideo.jwplayer.media
  13897. package com.longtailvideo.jwplayer.media {
  13898. import com.longtailvideo.jwplayer.model.*;
  13899. import flash.events.*;
  13900. import com.longtailvideo.jwplayer.events.*;
  13901. import flash.display.*;
  13902. import com.longtailvideo.jwplayer.player.*;
  13903. import com.longtailvideo.jwplayer.utils.*;
  13904.  
  13905. public class MediaProvider extends Sprite implements IGlobalEventDispatcher {
  13906.  
  13907. private var _config:PlayerConfig;
  13908. private var _provider:string;
  13909. protected var _item:PlaylistItem;
  13910. protected var _position:number = 0;
  13911. private var _volume:number;
  13912. private var _state:string;
  13913. private var _media:movieclip;
  13914. private var _bufferPercent:number;
  13915. private var _dispatcher:GlobalEventDispatcher;
  13916. private var _stretch:boolean;
  13917. private var _queuedBufferFull:boolean;
  13918. protected var _width:number;
  13919. protected var _height:number;
  13920.  
  13921. public function MediaProvider(_arg1:string){
  13922. this._provider = _arg1;
  13923. this._dispatcher = new GlobalEventDispatcher();
  13924. this._stretch = true;
  13925. }
  13926. public function initializeMediaProvider(_arg1:PlayerConfig):void{
  13927. this._config = _arg1;
  13928. this._state = PlayerState.IDLE;
  13929. }
  13930. public function load(_arg1:PlaylistItem):void{
  13931. this._item = _arg1;
  13932. this.dispatchEvent(new MediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED));
  13933. }
  13934. public function play():void{
  13935. if (this._queuedBufferFull){
  13936. this._queuedBufferFull = false;
  13937. this.setState(PlayerState.BUFFERING);
  13938. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
  13939. } else {
  13940. this.setState(PlayerState.PLAYING);
  13941. };
  13942. }
  13943. public function pause():void{
  13944. this.setState(PlayerState.PAUSED);
  13945. }
  13946. public function seek(_arg1:number):void{
  13947. this._position = _arg1;
  13948. }
  13949. public function stop():void{
  13950. this.setState(PlayerState.IDLE);
  13951. this._position = 0;
  13952. }
  13953. public function setvolume(_arg1:number):void{
  13954. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME, {volume:_arg1});
  13955. }
  13956. public function mute(_arg1:boolean):void{
  13957. if ((_arg1 == true)){
  13958. this.setvolume(0);
  13959. } else {
  13960. this.setvolume(this._config.volume);
  13961. };
  13962. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_MUTE, {mute:_arg1});
  13963. }
  13964. public function resize(_arg1:number, _arg2:number):void{
  13965. if (this._stretch){
  13966. this._width = _arg1;
  13967. this._height = _arg2;
  13968. if (this._media){
  13969. Stretcher.stretch(this._media, _arg1, _arg2, this._config.stretching);
  13970. };
  13971. };
  13972. }
  13973. public function get display():DisplayObject{
  13974. return (this._media);
  13975. }
  13976. public function get provider():string{
  13977. return (this._provider);
  13978. }
  13979. public function get state():string{
  13980. return (this._state);
  13981. }
  13982. public function get item():PlaylistItem{
  13983. return (this._item);
  13984. }
  13985. public function get position():number{
  13986. return (this._position);
  13987. }
  13988. public function get volume():number{
  13989. return (this._volume);
  13990. }
  13991. protected function buffer():void{
  13992. }
  13993. protected function complete():void{
  13994. if (this.state != PlayerState.IDLE){
  13995. this.stop();
  13996. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
  13997. };
  13998. }
  13999. protected function error(_arg1:string):void{
  14000. this.stop();
  14001. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:_arg1});
  14002. }
  14003. protected function setState(_arg1:string):void{
  14004. var _local2:PlayerStateEvent;
  14005. if (this.state != _arg1){
  14006. _local2 = new PlayerStateEvent(PlayerStateEvent.JWPLAYER_PLAYER_STATE, _arg1, this.state);
  14007. this._state = _arg1;
  14008. this.dispatchEvent(_local2);
  14009. };
  14010. }
  14011. protected function sendMediaEvent(_arg1:string, _arg2:object=null):void{
  14012. var _local3:MediaEvent;
  14013. var _local4:string;
  14014. if ((((_arg1 == MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL)) && ((this.state == PlayerState.PAUSED)))){
  14015. this._queuedBufferFull = true;
  14016. } else {
  14017. _local3 = new MediaEvent(_arg1);
  14018. for (_local4 in _arg2) {
  14019. if (_local3.hasOwnProperty(_local4)){
  14020. _local3[_local4] = _arg2[_local4];
  14021. };
  14022. };
  14023. this.dispatchEvent(_local3);
  14024. };
  14025. }
  14026. protected function sendBufferEvent(_arg1:number, _arg2:number=0, _arg3:object=null):void{
  14027. var _local4:object;
  14028. if (((((!((this._bufferPercent == _arg1))) || ((_arg1 == 0)))) && (((0 <= _arg1) < 100)))){
  14029. this._bufferPercent = _arg1;
  14030. _local4 = {
  14031. bufferPercent:this._bufferPercent,
  14032. offset:_arg2,
  14033. duration:this._item.duration,
  14034. position:math.max(0, this._position),
  14035. metadata:_arg3
  14036. };
  14037. this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER, _local4);
  14038. };
  14039. }
  14040. protected function get config():PlayerConfig{
  14041. return (this._config);
  14042. }
  14043. protected function getConfigProperty(_arg1:string){
  14044. if (((this.item) && (this.item.hasOwnProperty(((this._provider + ".") + _arg1))))){
  14045. return (this.item[((this._provider + ".") + _arg1)]);
  14046. };
  14047. return (this._config.pluginConfig(this.provider)[_arg1]);
  14048. }
  14049. protected function get media():DisplayObject{
  14050. return (this._media);
  14051. }
  14052. protected function set media(_arg1:DisplayObject):void{
  14053. if (_arg1){
  14054. this._media = new movieclip();
  14055. this._media.addChild(_arg1);
  14056. if ((this._width * this._height) > 0){
  14057. Stretcher.stretch(this._media, this._width, this._height, this._config.stretching);
  14058. };
  14059. } else {
  14060. this._media = null;
  14061. };
  14062. }
  14063. protected function set stretch(_arg1:boolean):void{
  14064. this._stretch = _arg1;
  14065. }
  14066. public function get stretchMedia():boolean{
  14067. return (this._stretch);
  14068. }
  14069. public function addGlobalListener(_arg1:function):void{
  14070. this._dispatcher.addGlobalListener(_arg1);
  14071. }
  14072. public function removeGlobalListener(_arg1:function):void{
  14073. this._dispatcher.removeGlobalListener(_arg1);
  14074. }
  14075. override public function dispatchEvent(_arg1:Event):boolean{
  14076. this._dispatcher.dispatchEvent(_arg1);
  14077. return (super.dispatchEvent(_arg1));
  14078. }
  14079.  
  14080. }
  14081. }//package com.longtailvideo.jwplayer.media
  14082. package mx.utils {
  14083. import flash.display.*;
  14084. import mx.core.*;
  14085. import flash.utils.*;
  14086.  
  14087. public class NameUtil {
  14088.  
  14089. mx_internal static const version:string = "4.6.0.23201";
  14090.  
  14091. private static var counter:int = 0;
  14092.  
  14093. public static function createUniqueName(_arg1:object):string{
  14094. if (!_arg1){
  14095. return (null);
  14096. };
  14097. var _local2:string = getQualifiedClassName(_arg1);
  14098. var _local3:int = _local2.indexof("::");
  14099. if (_local3 != -1){
  14100. _local2 = _local2.substr((_local3 + 2));
  14101. };
  14102. var _local4:int = _local2.charcodeat((_local2.length - 1));
  14103. if ((((_local4 >= 48)) && ((_local4 <= 57)))){
  14104. _local2 = (_local2 + "_");
  14105. };
  14106. return ((_local2 + counter++));
  14107. }
  14108. public static function displayObjectToString(_arg1:DisplayObject):string{
  14109. var _local2:string;
  14110. var _local3:DisplayObject;
  14111. var _local4:string;
  14112. var _local5:array;
  14113. try {
  14114. _local3 = _arg1;
  14115. while (_local3 != null) {
  14116. if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
  14117. break;
  14118. };
  14119. _local4 = ((((("id" in _local3)) && (_local3["id"]))) ? _local3["id"] : _local3.name);
  14120. if ((_local3 is IRepeaterClient)){
  14121. _local5 = IRepeaterClient(_local3).instanceIndices;
  14122. if (_local5){
  14123. _local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
  14124. };
  14125. };
  14126. _local2 = (((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2));
  14127. _local3 = _local3.parent;
  14128. };
  14129. } catch(e:SecurityError) {
  14130. };
  14131. return (_local2);
  14132. }
  14133. public static function getUnqualifiedClassName(_arg1:object):string{
  14134. var _local2:string;
  14135. if ((_arg1 is string)){
  14136. _local2 = (_arg1 as string);
  14137. } else {
  14138. _local2 = getQualifiedClassName(_arg1);
  14139. };
  14140. var _local3:int = _local2.indexof("::");
  14141. if (_local3 != -1){
  14142. _local2 = _local2.substr((_local3 + 2));
  14143. };
  14144. return (_local2);
  14145. }
  14146.  
  14147. }
  14148. }//package mx.utils
  14149. package mx.core {
  14150.  
  14151. public interface IRepeaterClient {
  14152.  
  14153. function get instanceIndices():array;
  14154. function set instanceIndices(_arg1:array):void;
  14155. function get isDocument():boolean;
  14156. function get repeaterIndices():array;
  14157. function set repeaterIndices(_arg1:array):void;
  14158. function get repeaters():array;
  14159. function set repeaters(_arg1:array):void;
  14160. function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
  14161.  
  14162. }
  14163. }//package mx.core
  14164. package mx.core {
  14165.  
  14166. public interface IBorder {
  14167.  
  14168. function get borderMetrics():EdgeMetrics;
  14169.  
  14170. }
  14171. }//package mx.core
  14172. package mx.core {
  14173. import flash.events.*;
  14174. import flash.display.*;
  14175. import flash.geom.*;
  14176. import flash.accessibility.*;
  14177.  
  14178. public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
  14179.  
  14180. function get root():DisplayObject;
  14181. function get stage():stage;
  14182. function get name():string;
  14183. function set name(_arg1:string):void;
  14184. function get parent():DisplayObjectContainer;
  14185. function get mask():DisplayObject;
  14186. function set mask(_arg1:DisplayObject):void;
  14187. function get visible():boolean;
  14188. function set visible(_arg1:boolean):void;
  14189. function get x():number;
  14190. function set x(_arg1:number):void;
  14191. function get y():number;
  14192. function set y(_arg1:number):void;
  14193. function get scaleX():number;
  14194. function set scaleX(_arg1:number):void;
  14195. function get scaleY():number;
  14196. function set scaleY(_arg1:number):void;
  14197. function get mouseX():number;
  14198. function get mouseY():number;
  14199. function get rotation():number;
  14200. function set rotation(_arg1:number):void;
  14201. function get alpha():number;
  14202. function set alpha(_arg1:number):void;
  14203. function get width():number;
  14204. function set width(_arg1:number):void;
  14205. function get height():number;
  14206. function set height(_arg1:number):void;
  14207. function get cacheAsBitmap():boolean;
  14208. function set cacheAsBitmap(_arg1:boolean):void;
  14209. function get opaqueBackground():object;
  14210. function set opaqueBackground(_arg1:object):void;
  14211. function get scrollRect():Rectangle;
  14212. function set scrollRect(_arg1:Rectangle):void;
  14213. function get filters():array;
  14214. function set filters(_arg1:array):void;
  14215. function get blendMode():string;
  14216. function set blendMode(_arg1:string):void;
  14217. function get transform():Transform;
  14218. function set transform(_arg1:Transform):void;
  14219. function get scale9Grid():Rectangle;
  14220. function set scale9Grid(_arg1:Rectangle):void;
  14221. function globaltolocal(_arg1:Point):Point;
  14222. function localtoglobal(_arg1:Point):Point;
  14223. function getbounds(_arg1:DisplayObject):Rectangle;
  14224. function getRect(_arg1:DisplayObject):Rectangle;
  14225. function get loaderInfo():LoaderInfo;
  14226. function hitTestObject(_arg1:DisplayObject):boolean;
  14227. function hitTestPoint(_arg1:number, _arg2:number, _arg3:boolean=false):boolean;
  14228. function get accessibilityProperties():AccessibilityProperties;
  14229. function set accessibilityProperties(_arg1:AccessibilityProperties):void;
  14230. function get measuredHeight():number;
  14231. function get measuredWidth():number;
  14232. function move(_arg1:number, _arg2:number):void;
  14233. function setActualSize(_arg1:number, _arg2:number):void;
  14234.  
  14235. }
  14236. }//package mx.core
  14237. package mx.core {
  14238. import flash.display.*;
  14239. import mx.utils.*;
  14240.  
  14241. public class FlexMovieClip extends movieclip {
  14242.  
  14243. mx_internal static const version:string = "4.6.0.23201";
  14244.  
  14245. public function FlexMovieClip(){
  14246. try {
  14247. name = NameUtil.createUniqueName(this);
  14248. } catch(e:error) {
  14249. };
  14250. }
  14251. override public function tostring():string{
  14252. return (NameUtil.displayObjectToString(this));
  14253. }
  14254.  
  14255. }
  14256. }//package mx.core
  14257. package mx.core {
  14258. import flash.utils.*;
  14259.  
  14260. public class ByteArrayAsset extends ByteArray implements IFlexAsset {
  14261.  
  14262. mx_internal static const version:string = "4.6.0.23201";
  14263.  
  14264. }
  14265. }//package mx.core
  14266. package mx.core {
  14267.  
  14268. public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
  14269.  
  14270. mx_internal static const version:string = "4.6.0.23201";
  14271.  
  14272. private var _measuredHeight:number;
  14273. private var _measuredWidth:number;
  14274.  
  14275. public function MovieClipAsset(){
  14276. this._measuredWidth = width;
  14277. this._measuredHeight = height;
  14278. }
  14279. public function get measuredHeight():number{
  14280. return (this._measuredHeight);
  14281. }
  14282. public function get measuredWidth():number{
  14283. return (this._measuredWidth);
  14284. }
  14285. public function get borderMetrics():EdgeMetrics{
  14286. if (scale9Grid == null){
  14287. return (EdgeMetrics.EMPTY);
  14288. };
  14289. return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, math.ceil((this.measuredWidth - scale9Grid.right)), math.ceil((this.measuredHeight - scale9Grid.bottom))));
  14290. }
  14291. public function move(_arg1:number, _arg2:number):void{
  14292. this.x = _arg1;
  14293. this.y = _arg2;
  14294. }
  14295. public function setActualSize(_arg1:number, _arg2:number):void{
  14296. width = _arg1;
  14297. height = _arg2;
  14298. }
  14299.  
  14300. }
  14301. }//package mx.core
  14302. package mx.core {
  14303.  
  14304. public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
  14305. }//package mx.core
  14306. package mx.core {
  14307. import flash.events.*;
  14308. import flash.display.*;
  14309. import flash.utils.*;
  14310. import flash.system.*;
  14311.  
  14312. public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
  14313.  
  14314. mx_internal static const version:string = "4.6.0.23201";
  14315.  
  14316. private var loader:Loader = null;
  14317. private var initialized:boolean = false;
  14318. private var requestedWidth:number;
  14319. private var requestedHeight:number;
  14320. protected var initialWidth:number = 0;
  14321. protected var initialHeight:number = 0;
  14322.  
  14323. public function MovieClipLoaderAsset(){
  14324. var _local1:LoaderContext = new LoaderContext();
  14325. _local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
  14326. if (("allowLoadBytesCodeExecution" in _local1)){
  14327. _local1["allowLoadBytesCodeExecution"] = true;
  14328. };
  14329. this.loader = new Loader();
  14330. this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.completeHandler);
  14331. this.loader.loadBytes(this.movieClipData, _local1);
  14332. addChild(this.loader);
  14333. }
  14334. override public function get height():number{
  14335. if (!this.initialized){
  14336. return (this.initialHeight);
  14337. };
  14338. return (super.height);
  14339. }
  14340. override public function set height(_arg1:number):void{
  14341. if (!this.initialized){
  14342. this.requestedHeight = _arg1;
  14343. } else {
  14344. this.loader.height = _arg1;
  14345. };
  14346. }
  14347. override public function get measuredHeight():number{
  14348. return (this.initialHeight);
  14349. }
  14350. override public function get measuredWidth():number{
  14351. return (this.initialWidth);
  14352. }
  14353. override public function get width():number{
  14354. if (!this.initialized){
  14355. return (this.initialWidth);
  14356. };
  14357. return (super.width);
  14358. }
  14359. override public function set width(_arg1:number):void{
  14360. if (!this.initialized){
  14361. this.requestedWidth = _arg1;
  14362. } else {
  14363. this.loader.width = _arg1;
  14364. };
  14365. }
  14366. public function get movieClipData():ByteArray{
  14367. return (null);
  14368. }
  14369. private function completeHandler(_arg1:Event):void{
  14370. this.initialized = true;
  14371. this.initialWidth = this.loader.contentLoaderInfo.width;
  14372. this.initialHeight = this.loader.contentLoaderInfo.height;
  14373. if (!isnan(this.requestedWidth)){
  14374. this.loader.width = this.requestedWidth;
  14375. };
  14376. if (!isnan(this.requestedHeight)){
  14377. this.loader.height = this.requestedHeight;
  14378. };
  14379. dispatchEvent(_arg1);
  14380. }
  14381.  
  14382. }
  14383. }//package mx.core
  14384. package mx.core {
  14385.  
  14386. public class EdgeMetrics {
  14387.  
  14388. mx_internal static const version:string = "4.6.0.23201";
  14389. public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
  14390. ;
  14391.  
  14392. public var bottom:number;
  14393. public var left:number;
  14394. public var right:number;
  14395. public var top:number;
  14396.  
  14397. public function EdgeMetrics(_arg1:number=0, _arg2:number=0, _arg3:number=0, _arg4:number=0){
  14398. this.left = _arg1;
  14399. this.top = _arg2;
  14400. this.right = _arg3;
  14401. this.bottom = _arg4;
  14402. }
  14403. public function clone():EdgeMetrics{
  14404. return (new EdgeMetrics(this.left, this.top, this.right, this.bottom));
  14405. }
  14406.  
  14407. }
  14408. }//package mx.core
  14409. package mx.core {
  14410.  
  14411. public interface IFlexAsset {
  14412.  
  14413. }
  14414. }//package mx.core
Advertisement
Add Comment
Please, Sign In to add comment