Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wowza.encryptionAS3 {
- public class TEA {
- public static function encrypt(_arg1:string, _arg2:string):string{
- var _local9:number;
- var _local10:number;
- var _local14:number;
- if (_arg1.length == 0){
- return ("");
- };
- var _local3:array = charsToLongs(strToChars(_arg1));
- if (_local3.length <= 1){
- _local3[1] = 0;
- };
- var _local4:array = charsToLongs(strToChars(_arg2.substr(0, 16)));
- var _local5:number = _local3.length;
- var _local6:number = _local3[(_local5 - 1)];
- var _local7:number = _local3[0];
- var _local8:number = 2654435769;
- var _local11:number = math.floor((6 + (52 / _local5)));
- var _local12:number = 0;
- while (_local11-- > 0) {
- _local12 = (_local12 + _local8);
- _local10 = ((_local12 >>> 2) & 3);
- _local14 = 0;
- while (_local14 < _local5) {
- _local7 = _local3[((_local14 + 1) % _local5)];
- _local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local14 & 3) ^ _local10)] ^ _local6)));
- _local6 = (_local3[_local14] = (_local3[_local14] + _local9));
- _local14++;
- };
- };
- var _local13:array = longsToChars(_local3);
- return (charsToHex(_local13));
- }
- public static function decrypt(_arg1:string, _arg2:string):string{
- var _local9:number;
- var _local10:number;
- var _local14:number;
- if (_arg1.length == 0){
- return ("");
- };
- var _local3:array = charsToLongs(hexToChars(_arg1));
- var _local4:array = charsToLongs(strToChars(_arg2.substr(0, 16)));
- var _local5:number = _local3.length;
- var _local6:number = _local3[(_local5 - 1)];
- var _local7:number = _local3[0];
- var _local8:number = 2654435769;
- var _local11:number = math.floor((6 + (52 / _local5)));
- var _local12:number = (_local11 * _local8);
- while (_local12 != 0) {
- _local10 = ((_local12 >>> 2) & 3);
- _local14 = (_local5 - 1);
- while (_local14 >= 0) {
- _local6 = _local3[(((_local14 > 0)) ? (_local14 - 1) : (_local5 - 1))];
- _local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local14 & 3) ^ _local10)] ^ _local6)));
- _local7 = (_local3[_local14] = (_local3[_local14] - _local9));
- _local14--;
- };
- _local12 = (_local12 - _local8);
- };
- var _local13:array = longsToChars(_local3);
- return (charsToStr(_local13));
- }
- private static function charsToLongs(_arg1:array):array{
- var _local2:array = new array(math.ceil((_arg1.length / 4)));
- var _local3:number = 0;
- while (_local3 < _local2.length) {
- _local2[_local3] = (((_arg1[(_local3 * 4)] + (_arg1[((_local3 * 4) + 1)] << 8)) + (_arg1[((_local3 * 4) + 2)] << 16)) + (_arg1[((_local3 * 4) + 3)] << 24));
- _local3++;
- };
- return (_local2);
- }
- private static function longsToChars(_arg1:array):array{
- var _local2:array = new array();
- var _local3:number = 0;
- while (_local3 < _arg1.length) {
- _local2.push((_arg1[_local3] & 0xFF), ((_arg1[_local3] >>> 8) & 0xFF), ((_arg1[_local3] >>> 16) & 0xFF), ((_arg1[_local3] >>> 24) & 0xFF));
- _local3++;
- };
- return (_local2);
- }
- private static function longToChars(_arg1:number):array{
- var _local2:array = new array();
- _local2.push((_arg1 & 0xFF), ((_arg1 >>> 8) & 0xFF), ((_arg1 >>> 16) & 0xFF), ((_arg1 >>> 24) & 0xFF));
- return (_local2);
- }
- private static function charsToHex(_arg1:array):string{
- var _local2:string = new string("");
- var _local3:array = new array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
- var _local4:number = 0;
- while (_local4 < _arg1.length) {
- _local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
- _local4++;
- };
- return (_local2);
- }
- private static function hexToChars(_arg1:string):array{
- var _local2:array = new array();
- var _local3:number = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
- while (_local3 < _arg1.length) {
- _local2.push(parseint(_arg1.substr(_local3, 2), 16));
- _local3 = (_local3 + 2);
- };
- return (_local2);
- }
- private static function charsToStr(_arg1:array):string{
- var _local2:string = new string("");
- var _local3:number = 0;
- while (_local3 < _arg1.length) {
- _local2 = (_local2 + string.fromcharcode(_arg1[_local3]));
- _local3++;
- };
- return (_local2);
- }
- private static function strToChars(_arg1:string):array{
- var _local2:array = new array();
- var _local3:number = 0;
- while (_local3 < _arg1.length) {
- _local2.push(_arg1.charcodeat(_local3));
- _local3++;
- };
- return (_local2);
- }
- }
- }//package com.wowza.encryptionAS3
- package com.nochump.util.zip {
- import flash.utils.*;
- public class ZipFile {
- private var buf:ByteArray;
- private var entryList:array;
- private var entryTable:Dictionary;
- private var locOffsetTable:Dictionary;
- public function ZipFile(_arg1:IDataInput){
- this.buf = new ByteArray();
- this.buf.endian = Endian.LITTLE_ENDIAN;
- _arg1.readBytes(this.buf);
- this.readEntries();
- }
- public function get entries():array{
- return (this.entryList);
- }
- public function get size():uint{
- return (this.entryList.length);
- }
- public function getEntry(_arg1:string):ZipEntry{
- return (this.entryTable[_arg1]);
- }
- public function getInput(_arg1:ZipEntry):ByteArray{
- var _local4:ByteArray;
- var _local5:Inflater;
- this.buf.position = ((this.locOffsetTable[_arg1.name] + ZipConstants.LOCHDR) - 2);
- var _local2:uint = this.buf.readShort();
- this.buf.position = (this.buf.position + (_arg1.name.length + _local2));
- var _local3:ByteArray = new ByteArray();
- if (_arg1.compressedSize > 0){
- this.buf.readBytes(_local3, 0, _arg1.compressedSize);
- };
- switch (_arg1.method){
- case ZipConstants.STORED:
- return (_local3);
- case ZipConstants.DEFLATED:
- _local4 = new ByteArray();
- _local5 = new Inflater();
- _local5.setInput(_local3);
- _local5.inflate(_local4);
- return (_local4);
- default:
- throw (new ZipError("invalid compression method"));
- };
- }
- private function readEntries():void{
- var _local2:ByteArray;
- var _local3:uint;
- var _local4:ZipEntry;
- this.readEND();
- this.entryTable = new Dictionary();
- this.locOffsetTable = new Dictionary();
- var _local1:uint;
- while (_local1 < this.entryList.length) {
- _local2 = new ByteArray();
- _local2.endian = Endian.LITTLE_ENDIAN;
- this.buf.readBytes(_local2, 0, ZipConstants.CENHDR);
- if (_local2.readUnsignedInt() != ZipConstants.CENSIG){
- throw (new ZipError("invalid CEN header (bad signature)"));
- };
- _local2.position = ZipConstants.CENNAM;
- _local3 = _local2.readUnsignedShort();
- if (_local3 == 0){
- throw (new ZipError("missing entry name"));
- };
- _local4 = new ZipEntry(this.buf.readUTFBytes(_local3));
- _local3 = _local2.readUnsignedShort();
- _local4.extra = new ByteArray();
- if (_local3 > 0){
- this.buf.readBytes(_local4.extra, 0, _local3);
- };
- this.buf.position = (this.buf.position + _local2.readUnsignedShort());
- _local2.position = ZipConstants.CENVER;
- _local4.version = _local2.readUnsignedShort();
- _local4.flag = _local2.readUnsignedShort();
- if ((_local4.flag & 1) == 1){
- throw (new ZipError("encrypted ZIP entry not supported"));
- };
- _local4.method = _local2.readUnsignedShort();
- _local4.dostime = _local2.readUnsignedInt();
- _local4.crc = _local2.readUnsignedInt();
- _local4.compressedSize = _local2.readUnsignedInt();
- _local4.size = _local2.readUnsignedInt();
- this.entryList[_local1] = _local4;
- this.entryTable[_local4.name] = _local4;
- _local2.position = ZipConstants.CENOFF;
- this.locOffsetTable[_local4.name] = _local2.readUnsignedInt();
- _local1++;
- };
- }
- private function readEND():void{
- var _local1:ByteArray = new ByteArray();
- _local1.endian = Endian.LITTLE_ENDIAN;
- this.buf.position = this.findEND();
- this.buf.readBytes(_local1, 0, ZipConstants.ENDHDR);
- _local1.position = ZipConstants.ENDTOT;
- this.entryList = new array(_local1.readUnsignedShort());
- _local1.position = ZipConstants.ENDOFF;
- this.buf.position = _local1.readUnsignedInt();
- }
- private function findEND():uint{
- var _local1:uint = (this.buf.length - ZipConstants.ENDHDR);
- var _local2:uint = math.max(0, (_local1 - 0xFFFF));
- while (_local1 >= _local2) {
- if (this.buf[_local1] != 80){
- } else {
- this.buf.position = _local1;
- if (this.buf.readUnsignedInt() == ZipConstants.ENDSIG){
- return (_local1);
- };
- };
- _local1--;
- };
- throw (new ZipError("invalid zip"));
- }
- }
- }//package com.nochump.util.zip
- package com.nochump.util.zip {
- class ZipConstants {
- static const LOCSIG:uint = 67324752;
- static const LOCHDR:uint = 30;
- static const LOCVER:uint = 4;
- static const LOCNAM:uint = 26;
- static const EXTSIG:uint = 134695760;
- static const EXTHDR:uint = 16;
- static const CENSIG:uint = 33639248;
- static const CENHDR:uint = 46;
- static const CENVER:uint = 6;
- static const CENNAM:uint = 28;
- static const CENOFF:uint = 42;
- static const ENDSIG:uint = 101010256;
- static const ENDHDR:uint = 22;
- static const ENDTOT:uint = 10;
- static const ENDOFF:uint = 16;
- static const STORED:uint = 0;
- static const DEFLATED:uint = 8;
- }
- }//package com.nochump.util.zip
- package com.nochump.util.zip {
- import flash.utils.*;
- public class ZipEntry {
- private var _name:string;
- private var _size:int = -1;
- private var _compressedSize:int = -1;
- private var _crc:uint;
- var dostime:uint;
- private var _method:int = -1;
- private var _extra:ByteArray;
- private var _comment:string;
- var flag:int;
- var version:int;
- var offset:int;
- public function ZipEntry(_arg1:string){
- this._name = _arg1;
- }
- public function get name():string{
- return (this._name);
- }
- public function get time():number{
- 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));
- return (_local1.time);
- }
- public function set time(_arg1:number):void{
- var _local2:date = new date(_arg1);
- this.dostime = ((((((((_local2.fullYear - 1980) & 127) << 25) | ((_local2.month + 1) << 21)) | (_local2.day << 16)) | (_local2.hours << 11)) | (_local2.minutes << 5)) | (_local2.seconds >> 1));
- }
- public function get size():int{
- return (this._size);
- }
- public function set size(_arg1:int):void{
- this._size = _arg1;
- }
- public function get compressedSize():int{
- return (this._compressedSize);
- }
- public function set compressedSize(_arg1:int):void{
- this._compressedSize = _arg1;
- }
- public function get crc():uint{
- return (this._crc);
- }
- public function set crc(_arg1:uint):void{
- this._crc = _arg1;
- }
- public function get method():int{
- return (this._method);
- }
- public function set method(_arg1:int):void{
- this._method = _arg1;
- }
- public function get extra():ByteArray{
- return (this._extra);
- }
- public function set extra(_arg1:ByteArray):void{
- this._extra = _arg1;
- }
- public function get comment():string{
- return (this._comment);
- }
- public function set comment(_arg1:string):void{
- this._comment = _arg1;
- }
- public function isDirectory():boolean{
- return ((this._name.charat((this._name.length - 1)) == "/"));
- }
- public function tostring():string{
- return (this._name);
- }
- }
- }//package com.nochump.util.zip
- package com.nochump.util.zip {
- import flash.utils.*;
- public class Inflater {
- private static const MAXBITS:int = 15;
- private static const MAXLCODES:int = 286;
- private static const MAXDCODES:int = 30;
- private static const MAXCODES:int = 316;
- private static const FIXLCODES:int = 288;
- 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];
- 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];
- 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];
- 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];
- private var inbuf:ByteArray;
- private var incnt:uint;
- private var bitbuf:int;
- private var bitcnt:int;
- private var lencode:object;
- private var distcode:object;
- public function setInput(_arg1:ByteArray):void{
- this.inbuf = _arg1;
- this.inbuf.endian = Endian.LITTLE_ENDIAN;
- }
- public function inflate(_arg1:ByteArray):uint{
- var _local3:int;
- var _local4:int;
- this.incnt = (this.bitbuf = (this.bitcnt = 0));
- var _local2:int;
- do {
- _local3 = this.bits(1);
- _local4 = this.bits(2);
- if (_local4 == 0){
- this.stored(_arg1);
- } else {
- if (_local4 == 3){
- throw (new error("invalid block type (type == 3)", -1));
- };
- this.lencode = {
- count:[],
- symbol:[]
- };
- this.distcode = {
- count:[],
- symbol:[]
- };
- if (_local4 == 1){
- this.constructFixedTables();
- } else {
- if (_local4 == 2){
- _local2 = this.constructDynamicTables();
- };
- };
- if (_local2 != 0){
- return (_local2);
- };
- _local2 = this.codes(_arg1);
- };
- if (_local2 != 0){
- break;
- };
- } while (!(_local3));
- return (_local2);
- }
- private function bits(_arg1:int):int{
- var _local2:int = this.bitbuf;
- while (this.bitcnt < _arg1) {
- if (this.incnt == this.inbuf.length){
- throw (new error("available inflate data did not terminate", 2));
- };
- _local2 = (_local2 | (this.inbuf[this.incnt++] << this.bitcnt));
- this.bitcnt = (this.bitcnt + 8);
- };
- this.bitbuf = (_local2 >> _arg1);
- this.bitcnt = (this.bitcnt - _arg1);
- return ((_local2 & ((1 << _arg1) - 1)));
- }
- private function construct(_arg1:object, _arg2:array, _arg3:int):int{
- var _local4:array = [];
- var _local5:int;
- while (_local5 <= MAXBITS) {
- _arg1.count[_local5] = 0;
- _local5++;
- };
- var _local6:int;
- while (_local6 < _arg3) {
- var _local8 = _arg1.count;
- var _local9 = _arg2[_local6];
- var _local10 = (_local8[_local9] + 1);
- _local8[_local9] = _local10;
- _local6++;
- };
- if (_arg1.count[0] == _arg3){
- return (0);
- };
- var _local7 = 1;
- _local5 = 1;
- while (_local5 <= MAXBITS) {
- _local7 = (_local7 << 1);
- _local7 = (_local7 - _arg1.count[_local5]);
- if (_local7 < 0){
- return (_local7);
- };
- _local5++;
- };
- _local4[1] = 0;
- _local5 = 1;
- while (_local5 < MAXBITS) {
- _local4[(_local5 + 1)] = (_local4[_local5] + _arg1.count[_local5]);
- _local5++;
- };
- _local6 = 0;
- while (_local6 < _arg3) {
- if (_arg2[_local6] != 0){
- _local9 = _local4;
- _local10 = _arg2[_local6];
- var _local11 = (_local9[_local10] + 1);
- _local9[_local10] = _local11;
- _local8 = _local9[_local10];
- _arg1.symbol[_local8] = _local6;
- };
- _local6++;
- };
- return (_local7);
- }
- private function decode(_arg1:object):int{
- var _local6:int;
- var _local2:int;
- var _local3:int;
- var _local4:int;
- var _local5 = 1;
- while (_local5 <= MAXBITS) {
- _local2 = (_local2 | this.bits(1));
- _local6 = _arg1.count[_local5];
- if (_local2 < (_local3 + _local6)){
- return (_arg1.symbol[(_local4 + (_local2 - _local3))]);
- };
- _local4 = (_local4 + _local6);
- _local3 = (_local3 + _local6);
- _local3 = (_local3 << 1);
- _local2 = (_local2 << 1);
- _local5++;
- };
- return (-9);
- }
- private function codes(_arg1:ByteArray):int{
- var _local2:int;
- var _local3:int;
- var _local4:uint;
- do {
- _local2 = this.decode(this.lencode);
- if (_local2 < 0){
- return (_local2);
- };
- if (_local2 < 0x0100){
- _arg1[_arg1.length] = _local2;
- } else {
- if (_local2 > 0x0100){
- _local2 = (_local2 - 0x0101);
- if (_local2 >= 29){
- throw (new error("invalid literal/length or distance code in fixed or dynamic block", -9));
- };
- _local3 = (LENS[_local2] + this.bits(LEXT[_local2]));
- _local2 = this.decode(this.distcode);
- if (_local2 < 0){
- return (_local2);
- };
- _local4 = (DISTS[_local2] + this.bits(DEXT[_local2]));
- if (_local4 > _arg1.length){
- throw (new error("distance is too far back in fixed or dynamic block", -10));
- };
- while (_local3--) {
- _arg1[_arg1.length] = _arg1[(_arg1.length - _local4)];
- };
- };
- };
- } while (_local2 != 0x0100);
- return (0);
- }
- private function stored(_arg1:ByteArray):void{
- this.bitbuf = 0;
- this.bitcnt = 0;
- if ((this.incnt + 4) > this.inbuf.length){
- throw (new error("available inflate data did not terminate", 2));
- };
- var _local2:uint = this.inbuf[this.incnt++];
- var _temp1 = _local2;
- _local2 = (_temp1 | (this.inbuf[this++] << 8));
- if (((!((this.inbuf[this.incnt++] == (~(_local2) & 0xFF)))) || (!((this.inbuf[this.incnt++] == ((~(_local2) >> 8) & 0xFF)))))){
- throw (new error("stored block length did not match one's complement", -2));
- };
- if ((this.incnt + _local2) > this.inbuf.length){
- throw (new error("available inflate data did not terminate", 2));
- };
- while (_local2--) {
- _arg1[_arg1.length] = this.inbuf[this.incnt++];
- };
- }
- private function constructFixedTables():void{
- var _local1:array = [];
- var _local2:int;
- while (_local2 < 144) {
- _local1[_local2] = 8;
- _local2++;
- };
- while (_local2 < 0x0100) {
- _local1[_local2] = 9;
- _local2++;
- };
- while (_local2 < 280) {
- _local1[_local2] = 7;
- _local2++;
- };
- while (_local2 < FIXLCODES) {
- _local1[_local2] = 8;
- _local2++;
- };
- this.construct(this.lencode, _local1, FIXLCODES);
- _local2 = 0;
- while (_local2 < MAXDCODES) {
- _local1[_local2] = 5;
- _local2++;
- };
- this.construct(this.distcode, _local1, MAXDCODES);
- }
- private function constructDynamicTables():int{
- var _local8:int;
- var _local9:int;
- var _local1:array = [];
- var _local2:array = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
- var _local3:int = (this.bits(5) + 0x0101);
- var _local4:int = (this.bits(5) + 1);
- var _local5:int = (this.bits(4) + 4);
- if ((((_local3 > MAXLCODES)) || ((_local4 > MAXDCODES)))){
- throw (new error("dynamic block code description: too many length or distance codes", -3));
- };
- var _local6:int;
- while (_local6 < _local5) {
- _local1[_local2[_local6]] = this.bits(3);
- _local6++;
- };
- while (_local6 < 19) {
- _local1[_local2[_local6]] = 0;
- _local6++;
- };
- var _local7:int = this.construct(this.lencode, _local1, 19);
- if (_local7 != 0){
- throw (new error("dynamic block code description: code lengths codes incomplete", -4));
- };
- _local6 = 0;
- while (_local6 < (_local3 + _local4)) {
- _local8 = this.decode(this.lencode);
- if (_local8 < 16){
- var _temp1 = _local6;
- _local6 = (_local6 + 1);
- var _local10 = _temp1;
- _local1[_local10] = _local8;
- } else {
- _local9 = 0;
- if (_local8 == 16){
- if (_local6 == 0){
- throw (new error("dynamic block code description: repeat lengths with no first length", -5));
- };
- _local9 = _local1[(_local6 - 1)];
- _local8 = (3 + this.bits(2));
- } else {
- if (_local8 == 17){
- _local8 = (3 + this.bits(3));
- } else {
- _local8 = (11 + this.bits(7));
- };
- };
- if ((_local6 + _local8) > (_local3 + _local4)){
- throw (new error("dynamic block code description: repeat more than specified lengths", -6));
- };
- while (_local8--) {
- var _temp2 = _local6;
- _local6 = (_local6 + 1);
- _local10 = _temp2;
- _local1[_local10] = _local9;
- };
- };
- };
- _local7 = this.construct(this.lencode, _local1, _local3);
- if ((((_local7 < 0)) || ((((_local7 > 0)) && (!(((_local3 - this.lencode.count[0]) == 1))))))){
- throw (new error("dynamic block code description: invalid literal/length code lengths", -7));
- };
- _local7 = this.construct(this.distcode, _local1.slice(_local3), _local4);
- if ((((_local7 < 0)) || ((((_local7 > 0)) && (!(((_local4 - this.distcode.count[0]) == 1))))))){
- throw (new error("dynamic block code description: invalid distance code lengths", -8));
- };
- return (_local7);
- }
- }
- }//package com.nochump.util.zip
- package com.nochump.util.zip {
- import flash.errors.*;
- public class ZipError extends IOError {
- public function ZipError(_arg1:string="", _arg2:int=0){
- super(_arg1, _arg2);
- }
- }
- }//package com.nochump.util.zip
- package com.jeroenwijering.events {
- public class ModelStates {
- public static var IDLE:string = "IDLE";
- public static var BUFFERING:string = "BUFFERING";
- public static var PLAYING:string = "PLAYING";
- public static var PAUSED:string = "PAUSED";
- public static var COMPLETED:string = "COMPLETED";
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- import flash.events.*;
- public class ControllerEvent extends Event {
- public static var error:string = "ERROR";
- public static var ITEM:string = "ITEM";
- public static var MUTE:string = "MUTE";
- public static var play:string = "PLAY";
- public static var PLAYLIST:string = "PLAYLIST";
- public static var RESIZE:string = "RESIZE";
- public static var seek:string = "SEEK";
- public static var stop:string = "STOP";
- public static var VOLUME:string = "VOLUME";
- private var _data:object;
- public function ControllerEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
- super(_arg1, _arg3, _arg4);
- this._data = _arg2;
- }
- public function get data():object{
- return (this._data);
- }
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- public interface PluginInterface {
- function initializePlugin(_arg1:AbstractView):void;
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- import flash.events.*;
- import flash.display.*;
- public class AbstractView extends EventDispatcher {
- public function get config():object{
- return (new object());
- }
- public function get playlist():array{
- return (new array());
- }
- public function get skin():movieclip{
- return (new movieclip());
- }
- public function addControllerListener(_arg1:string, _arg2:function):void{
- }
- public function removeControllerListener(_arg1:string, _arg2:function):void{
- }
- public function addModelListener(_arg1:string, _arg2:function):void{
- }
- public function removeModelListener(_arg1:string, _arg2:function):void{
- }
- public function addViewListener(_arg1:string, _arg2:function):void{
- }
- public function removeViewListener(_arg1:string, _arg2:function):void{
- }
- public function getPlugin(_arg1:string):object{
- return ({});
- }
- public function getPluginConfig(_arg1:object):object{
- return ({});
- }
- public function loadPlugin(_arg1:string, _arg2:string=null):boolean{
- return (true);
- }
- public function sendEvent(_arg1:string, _arg2:object=undefined):void{
- }
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- import flash.events.*;
- public class ViewEvent extends Event {
- public static var FULLSCREEN:string = "FULLSCREEN";
- public static var ITEM:string = "ITEM";
- public static var LINK:string = "LINK";
- public static var load:string = "LOAD";
- public static var MUTE:string = "MUTE";
- public static var NEXT:string = "NEXT";
- public static var play:string = "PLAY";
- public static var PREV:string = "PREV";
- public static var REDRAW:string = "REDRAW";
- public static var seek:string = "SEEK";
- public static var stop:string = "STOP";
- public static var trace:string = "TRACE";
- public static var VOLUME:string = "VOLUME";
- private var _data:object;
- public function ViewEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
- super(_arg1, _arg3, _arg4);
- this._data = _arg2;
- }
- public function get data():object{
- return (this._data);
- }
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- import flash.events.*;
- public class ModelEvent extends Event {
- public static var BUFFER:string = "BUFFER";
- public static var error:string = "ERROR";
- public static var loaded:string = "LOADED";
- public static var META:string = "META";
- public static var STATE:string = "STATE";
- public static var time:string = "TIME";
- private var _data:object;
- public function ModelEvent(_arg1:string, _arg2:object=undefined, _arg3:boolean=false, _arg4:boolean=false):void{
- super(_arg1, _arg3, _arg4);
- this._data = _arg2;
- }
- public function get data():object{
- return (this._data);
- }
- }
- }//package com.jeroenwijering.events
- package com.jeroenwijering.events {
- import flash.events.*;
- public class PlayerEvent extends Event {
- public static var READY:string = "READY";
- public function PlayerEvent(_arg1:string, _arg2:boolean=false, _arg3:boolean=false):void{
- super(_arg1, _arg2, _arg3);
- }
- }
- }//package com.jeroenwijering.events
- package com.adobe.serialization.json {
- public class JSONToken {
- private var _value:object;
- private var _type:int;
- public function JSONToken(_arg1:int=-1, _arg2:object=null){
- this._type = _arg1;
- this._value = _arg2;
- }
- public function get value():object{
- return (this._value);
- }
- public function get type():int{
- return (this._type);
- }
- public function set type(_arg1:int):void{
- this._type = _arg1;
- }
- public function set value(_arg1:object):void{
- this._value = _arg1;
- }
- }
- }//package com.adobe.serialization.json
- package com.adobe.serialization.json {
- public class JSONDecoder {
- private var strict:boolean;
- private var value;
- private var tokenizer:JSONTokenizer;
- private var token:JSONToken;
- public function JSONDecoder(_arg1:string, _arg2:boolean){
- this.strict = _arg2;
- this.tokenizer = new JSONTokenizer(_arg1, _arg2);
- this.nextToken();
- this.value = this.parseValue();
- if (((_arg2) && (!((this.nextToken() == null))))){
- this.tokenizer.parseError("Unexpected characters left in input stream");
- };
- }
- private function nextToken():JSONToken{
- return ((this.token = this.tokenizer.getNextToken()));
- }
- private function parseObject():object{
- var _local2:string;
- var _local1:object = new object();
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACE){
- return (_local1);
- };
- if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACE){
- return (_local1);
- };
- this.tokenizer.parseError(("Leading commas are not supported. Expecting '}' but found " + this.token.value));
- };
- if (this.token.type == JSONTokenType.string){
- _local2 = string(this.token.value);
- this.nextToken();
- if (this.token.type == JSONTokenType.COLON){
- this.nextToken();
- _local1[_local2] = this.parseValue();
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACE){
- return (_local1);
- };
- if (this.token.type == JSONTokenType.COMMA){
- this.nextToken();
- if (!this.strict){
- if (this.token.type == JSONTokenType.RIGHT_BRACE){
- return (_local1);
- };
- };
- } else {
- this.tokenizer.parseError(("Expecting } or , but found " + this.token.value));
- };
- } else {
- this.tokenizer.parseError(("Expecting : but found " + this.token.value));
- };
- } else {
- this.tokenizer.parseError(("Expecting string but found " + this.token.value));
- };
- //unresolved jump
- }
- private function parseArray():array{
- var _local1:array = new array();
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACKET){
- return (_local1);
- };
- if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACKET){
- return (_local1);
- };
- this.tokenizer.parseError(("Leading commas are not supported. Expecting ']' but found " + this.token.value));
- };
- _local1.push(this.parseValue());
- this.nextToken();
- if (this.token.type == JSONTokenType.RIGHT_BRACKET){
- return (_local1);
- };
- if (this.token.type == JSONTokenType.COMMA){
- this.nextToken();
- if (!this.strict){
- if (this.token.type == JSONTokenType.RIGHT_BRACKET){
- return (_local1);
- };
- };
- } else {
- this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value));
- };
- //unresolved jump
- }
- public function getValue(){
- return (this.value);
- }
- private function parseValue():object{
- if (this.token == null){
- this.tokenizer.parseError("Unexpected end of input");
- };
- switch (this.token.type){
- case JSONTokenType.LEFT_BRACE:
- return (this.parseObject());
- case JSONTokenType.LEFT_BRACKET:
- return (this.parseArray());
- case JSONTokenType.string:
- case JSONTokenType.number:
- case JSONTokenType.true:
- case JSONTokenType.false:
- case JSONTokenType.null:
- return (this.token.value);
- case JSONTokenType.nan:
- if (!this.strict){
- return (this.token.value);
- };
- this.tokenizer.parseError(("Unexpected " + this.token.value));
- default:
- this.tokenizer.parseError(("Unexpected " + this.token.value));
- };
- return (null);
- }
- }
- }//package com.adobe.serialization.json
- package com.adobe.serialization.json {
- public class JSONTokenType {
- public static const false:int = 8;
- public static const RIGHT_BRACKET:int = 4;
- public static const null:int = 9;
- public static const number:int = 11;
- public static const true:int = 7;
- public static const RIGHT_BRACE:int = 2;
- public static const string:int = 10;
- public static const LEFT_BRACKET:int = 3;
- public static const LEFT_BRACE:int = 1;
- public static const UNKNOWN:int = -1;
- public static const COMMA:int = 0;
- public static const nan:int = 12;
- public static const COLON:int = 6;
- }
- }//package com.adobe.serialization.json
- package com.adobe.serialization.json {
- public class JSONTokenizer {
- private var ch:string;
- private var loc:int;
- private var jsonString:string;
- private var strict:boolean;
- private var controlCharsRegExp:RegExp;
- private var obj:object;
- public function JSONTokenizer(_arg1:string, _arg2:boolean){
- this.controlCharsRegExp = /[\x00-\x1F]/;
- super();
- this.jsonString = _arg1;
- this.strict = _arg2;
- this.loc = 0;
- this.nextChar();
- }
- private function skipComments():void{
- if (this.ch == "/"){
- this.nextChar();
- switch (this.ch){
- case "/":
- do {
- this.nextChar();
- } while (((!((this.ch == "\n"))) && (!((this.ch == "")))));
- this.nextChar();
- break;
- case "*":
- this.nextChar();
- while (true) {
- if (this.ch == "*"){
- this.nextChar();
- if (this.ch == "/"){
- this.nextChar();
- break;
- };
- } else {
- this.nextChar();
- };
- if (this.ch == ""){
- this.parseError("Multi-line comment not closed");
- };
- };
- break;
- default:
- this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )"));
- };
- };
- }
- private function isDigit(_arg1:string):boolean{
- return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
- }
- private function readNumber():JSONToken{
- var _local3:JSONToken;
- var _local1 = "";
- if (this.ch == "-"){
- _local1 = (_local1 + "-");
- this.nextChar();
- };
- if (!this.isDigit(this.ch)){
- this.parseError("Expecting a digit");
- };
- if (this.ch == "0"){
- _local1 = (_local1 + this.ch);
- this.nextChar();
- if (this.isDigit(this.ch)){
- this.parseError("A digit cannot immediately follow 0");
- } else {
- if (((!(this.strict)) && ((this.ch == "x")))){
- _local1 = (_local1 + this.ch);
- this.nextChar();
- if (this.isHexDigit(this.ch)){
- _local1 = (_local1 + this.ch);
- this.nextChar();
- } else {
- this.parseError("Number in hex format require at least one hex digit after \"0x\"");
- };
- while (this.isHexDigit(this.ch)) {
- _local1 = (_local1 + this.ch);
- this.nextChar();
- };
- };
- };
- } else {
- while (this.isDigit(this.ch)) {
- _local1 = (_local1 + this.ch);
- this.nextChar();
- };
- };
- if (this.ch == "."){
- _local1 = (_local1 + ".");
- this.nextChar();
- if (!this.isDigit(this.ch)){
- this.parseError("Expecting a digit");
- };
- while (this.isDigit(this.ch)) {
- _local1 = (_local1 + this.ch);
- this.nextChar();
- };
- };
- if ((((this.ch == "e")) || ((this.ch == "E")))){
- _local1 = (_local1 + "e");
- this.nextChar();
- if ((((this.ch == "+")) || ((this.ch == "-")))){
- _local1 = (_local1 + this.ch);
- this.nextChar();
- };
- if (!this.isDigit(this.ch)){
- this.parseError("Scientific notation number needs exponent value");
- };
- while (this.isDigit(this.ch)) {
- _local1 = (_local1 + this.ch);
- this.nextChar();
- };
- };
- var _local2:number = number(_local1);
- if (((isfinite(_local2)) && (!(isnan(_local2))))){
- _local3 = new JSONToken();
- _local3.type = JSONTokenType.number;
- _local3.value = _local2;
- return (_local3);
- };
- this.parseError((("Number " + _local2) + " is not valid!"));
- return (null);
- }
- public function unescapeString(_arg1:string):string{
- var _local6:*;
- var _local7:*;
- var _local8:*;
- var _local9:*;
- var _local10:*;
- if (((this.strict) && (this.controlCharsRegExp.test(_arg1)))){
- this.parseError("String contains unescaped control character (0x00-0x1F)");
- };
- var _local2 = "";
- var _local3:int;
- var _local4:int;
- var _local5:int = _arg1.length;
- do {
- _local3 = _arg1.indexof("\\", _local4);
- if (_local3 >= 0){
- _local2 = (_local2 + _arg1.substr(_local4, (_local3 - _local4)));
- _local4 = (_local3 + 2);
- _local6 = (_local3 + 1);
- _local7 = _arg1.charat(_local6);
- switch (_local7){
- case "\"":
- _local2 = (_local2 + "\"");
- break;
- case "\\":
- _local2 = (_local2 + "\\");
- break;
- case "n":
- _local2 = (_local2 + "\n");
- break;
- case "r":
- _local2 = (_local2 + "\r");
- break;
- case "t":
- _local2 = (_local2 + "\t");
- break;
- case "u":
- _local8 = "";
- if ((_local4 + 4) > _local5){
- this.parseError("Unexpected end of input. Expecting 4 hex digits after \\u.");
- };
- _local9 = _local4;
- while (_local9 < (_local4 + 4)) {
- _local10 = _arg1.charat(_local9);
- if (!this.isHexDigit(_local10)){
- this.parseError(("Excepted a hex digit, but found: " + _local10));
- };
- _local8 = (_local8 + _local10);
- _local9++;
- };
- _local2 = (_local2 + string.fromcharcode(parseint(_local8, 16)));
- _local4 = (_local4 + 4);
- break;
- case "f":
- _local2 = (_local2 + "\f");
- break;
- case "/":
- _local2 = (_local2 + "/");
- break;
- case "b":
- _local2 = (_local2 + "\b");
- break;
- default:
- _local2 = (_local2 + ("\\" + _local7));
- };
- } else {
- _local2 = (_local2 + _arg1.substr(_local4));
- break;
- };
- } while (_local4 < _local5);
- return (_local2);
- }
- private function skipWhite():void{
- while (this.isWhiteSpace(this.ch)) {
- this.nextChar();
- };
- }
- private function isWhiteSpace(_arg1:string):boolean{
- if ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r")))){
- return (true);
- };
- if (((!(this.strict)) && ((_arg1.charcodeat(0) == 160)))){
- return (true);
- };
- return (false);
- }
- public function parseError(_arg1:string):void{
- throw (new JSONParseError(_arg1, this.loc, this.jsonString));
- }
- private function readString():JSONToken{
- var _local3:*;
- var _local4:*;
- var _local1:int = this.loc;
- do {
- _local1 = this.jsonString.indexof("\"", _local1);
- if (_local1 >= 0){
- _local3 = 0;
- _local4 = (_local1 - 1);
- while (this.jsonString.charat(_local4) == "\\") {
- _local3++;
- _local4--;
- };
- if ((_local3 % 2) == 0){
- break;
- };
- _local1++;
- } else {
- this.parseError("Unterminated string literal");
- };
- } while (true);
- var _local2:JSONToken = new JSONToken();
- _local2.type = JSONTokenType.string;
- _local2.value = this.unescapeString(this.jsonString.substr(this.loc, (_local1 - this.loc)));
- this.loc = (_local1 + 1);
- this.nextChar();
- return (_local2);
- }
- private function nextChar():string{
- return ((this.ch = this.jsonString.charat(this.loc++)));
- }
- private function skipIgnored():void{
- var _local1:int;
- do {
- _local1 = this.loc;
- this.skipWhite();
- this.skipComments();
- } while (_local1 != this.loc);
- }
- private function isHexDigit(_arg1:string):boolean{
- return (((((this.isDigit(_arg1)) || ((((_arg1 >= "A")) && ((_arg1 <= "F")))))) || ((((_arg1 >= "a")) && ((_arg1 <= "f"))))));
- }
- public function getNextToken():JSONToken{
- var _local2:string;
- var _local3:string;
- var _local4:string;
- var _local5:string;
- var _local1:JSONToken = new JSONToken();
- this.skipIgnored();
- switch (this.ch){
- case "{":
- _local1.type = JSONTokenType.LEFT_BRACE;
- _local1.value = "{";
- this.nextChar();
- break;
- case "}":
- _local1.type = JSONTokenType.RIGHT_BRACE;
- _local1.value = "}";
- this.nextChar();
- break;
- case "[":
- _local1.type = JSONTokenType.LEFT_BRACKET;
- _local1.value = "[";
- this.nextChar();
- break;
- case "]":
- _local1.type = JSONTokenType.RIGHT_BRACKET;
- _local1.value = "]";
- this.nextChar();
- break;
- case ",":
- _local1.type = JSONTokenType.COMMA;
- _local1.value = ",";
- this.nextChar();
- break;
- case ":":
- _local1.type = JSONTokenType.COLON;
- _local1.value = ":";
- this.nextChar();
- break;
- case "t":
- _local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar());
- if (_local2 == "true"){
- _local1.type = JSONTokenType.true;
- _local1.value = true;
- this.nextChar();
- } else {
- this.parseError(("Expecting 'true' but found " + _local2));
- };
- break;
- case "f":
- _local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar());
- if (_local3 == "false"){
- _local1.type = JSONTokenType.false;
- _local1.value = false;
- this.nextChar();
- } else {
- this.parseError(("Expecting 'false' but found " + _local3));
- };
- break;
- case "n":
- _local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar());
- if (_local4 == "null"){
- _local1.type = JSONTokenType.null;
- _local1.value = null;
- this.nextChar();
- } else {
- this.parseError(("Expecting 'null' but found " + _local4));
- };
- break;
- case "N":
- _local5 = (("N" + this.nextChar()) + this.nextChar());
- if (_local5 == "NaN"){
- _local1.type = JSONTokenType.nan;
- _local1.value = nan;
- this.nextChar();
- } else {
- this.parseError(("Expecting 'NaN' but found " + _local5));
- };
- break;
- case "\"":
- _local1 = this.readString();
- break;
- default:
- if (((this.isDigit(this.ch)) || ((this.ch == "-")))){
- _local1 = this.readNumber();
- } else {
- if (this.ch == ""){
- return (null);
- };
- this.parseError((("Unexpected " + this.ch) + " encountered"));
- };
- };
- return (_local1);
- }
- }
- }//package com.adobe.serialization.json
- package com.adobe.serialization.json {
- public class JSONParseError extends error {
- private var _location:int;
- private var _text:string;
- public function JSONParseError(_arg1:string="", _arg2:int=0, _arg3:string=""){
- super(_arg1);
- name = "JSONParseError";
- this._location = _arg2;
- this._text = _arg3;
- }
- public function get location():int{
- return (this._location);
- }
- public function get text():string{
- return (this._text);
- }
- }
- }//package com.adobe.serialization.json
- package com.longtailvideo.jwplayer.player {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- public interface IPlayer extends IEventDispatcher, IGlobalEventDispatcher {
- function get config():PlayerConfig;
- function get version():string;
- function get skin():ISkin;
- function get state():string;
- function get playlist():IPlaylist;
- function get locked():boolean;
- function lock(_arg1:IPlugin, _arg2:function):void;
- function unlock(_arg1:IPlugin):boolean;
- function volume(_arg1:number):boolean;
- function mute(_arg1:boolean):void;
- function play():boolean;
- function pause():boolean;
- function stop():boolean;
- function seek(_arg1:number):boolean;
- function load(_arg1):boolean;
- function playlistItem(_arg1:number):boolean;
- function playlistNext():boolean;
- function playlistPrev():boolean;
- function redraw():boolean;
- function fullscreen(_arg1:boolean):void;
- function get controls():IPlayerComponents;
- function overrideComponent(_arg1:IPlayerComponent):void;
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- public class PlayerState {
- public static var IDLE:string = "IDLE";
- public static var BUFFERING:string = "BUFFERING";
- public static var PLAYING:string = "PLAYING";
- public static var PAUSED:string = "PAUSED";
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.external.*;
- public class JavascriptAPI {
- protected var _player:IPlayer;
- protected var _playerBuffer:number = 0;
- protected var _playerPosition:number = 0;
- protected var _listeners:object;
- protected var _queuedEvents:array;
- public function JavascriptAPI(_arg1:IPlayer){
- this._queuedEvents = [];
- super();
- this._listeners = {};
- this._player = _arg1;
- this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
- this.setupPlayerListeners();
- this.setupJSListeners();
- this._player.addGlobalListener(this.queueEvents);
- }
- protected function playerReady(_arg1:PlayerEvent):void{
- var evt:* = _arg1;
- var timer:* = new Timer(50, 1);
- timer.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:TimerEvent):void{
- var _local3:string;
- _player.removeGlobalListener(queueEvents);
- var _local2:string = ((_player.config.playerready) ? ((_player.config.playerready + ",") + "playerReady") : "playerReady");
- if (ExternalInterface.available){
- for each (_local3 in _local2.replace(/\s/, "").split(",")) {
- try {
- ExternalInterface.call(_local3, {
- id:evt.id,
- client:evt.client,
- version:evt.version
- });
- } catch(e:error) {
- };
- };
- clearQueuedEvents();
- };
- });
- timer.start();
- }
- protected function queueEvents(_arg1:Event):void{
- this._queuedEvents.push(_arg1);
- }
- protected function clearQueuedEvents():void{
- var _local1:Event;
- for each (_local1 in this._queuedEvents) {
- this.listenerCallback(_local1);
- };
- this._queuedEvents = null;
- }
- protected function setupPlayerListeners():void{
- this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.resetPosition);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.updatePosition);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.updateBuffer);
- }
- protected function resetPosition(_arg1:PlaylistEvent):void{
- this._playerPosition = 0;
- this._playerBuffer = 0;
- }
- protected function updatePosition(_arg1:MediaEvent):void{
- this._playerPosition = _arg1.position;
- }
- protected function updateBuffer(_arg1:MediaEvent):void{
- this._playerBuffer = _arg1.bufferPercent;
- }
- protected function setupJSListeners():void{
- try {
- ExternalInterface.addCallback("jwAddEventListener", this.js_addEventListener);
- ExternalInterface.addCallback("jwRemoveEventListener", this.js_removeEventListener);
- ExternalInterface.addCallback("jwGetBuffer", this.js_getBuffer);
- ExternalInterface.addCallback("jwGetDuration", this.js_getDuration);
- ExternalInterface.addCallback("jwGetFullscreen", this.js_getFullscreen);
- ExternalInterface.addCallback("jwGetHeight", this.js_getHeight);
- ExternalInterface.addCallback("jwGetMute", this.js_getMute);
- ExternalInterface.addCallback("jwGetPlaylist", this.js_getPlaylist);
- ExternalInterface.addCallback("jwGetPlaylistIndex", this.js_getPlaylistIndex);
- ExternalInterface.addCallback("jwGetPosition", this.js_getPosition);
- ExternalInterface.addCallback("jwGetState", this.js_getState);
- ExternalInterface.addCallback("jwGetWidth", this.js_getWidth);
- ExternalInterface.addCallback("jwGetVersion", this.js_getVersion);
- ExternalInterface.addCallback("jwGetVolume", this.js_getVolume);
- ExternalInterface.addCallback("jwPlay", this.js_play);
- ExternalInterface.addCallback("jwPause", this.js_pause);
- ExternalInterface.addCallback("jwStop", this.js_stop);
- ExternalInterface.addCallback("jwSeek", this.js_seek);
- ExternalInterface.addCallback("jwLoad", this.js_load);
- ExternalInterface.addCallback("jwPlaylistItem", this.js_playlistItem);
- ExternalInterface.addCallback("jwPlaylistNext", this.js_playlistNext);
- ExternalInterface.addCallback("jwPlaylistPrev", this.js_playlistPrev);
- ExternalInterface.addCallback("jwSetMute", this.js_mute);
- ExternalInterface.addCallback("jwSetVolume", this.js_volume);
- ExternalInterface.addCallback("jwSetFullscreen", this.js_fullscreen);
- ExternalInterface.addCallback("jwControlbarShow", this.js_showControlbar);
- ExternalInterface.addCallback("jwControlbarHide", this.js_hideControlbar);
- ExternalInterface.addCallback("jwDisplayShow", this.js_showDisplay);
- ExternalInterface.addCallback("jwDisplayHide", this.js_hideDisplay);
- ExternalInterface.addCallback("jwDockHide", this.js_hideDock);
- ExternalInterface.addCallback("jwDockSetButton", this.js_dockSetButton);
- ExternalInterface.addCallback("jwDockShow", this.js_showDock);
- } catch(e:error) {
- Logger.log(("Could not initialize JavaScript API: " + e.message));
- };
- }
- protected function js_addEventListener(_arg1:string, _arg2:string):void{
- if (!this._listeners[_arg1]){
- this._listeners[_arg1] = [];
- this._player.addEventListener(_arg1, this.listenerCallback);
- };
- (this._listeners[_arg1] as array).push(_arg2);
- }
- protected function js_removeEventListener(_arg1:string, _arg2:string):void{
- var _local4:number;
- var _local3:array = this._listeners[_arg1];
- if (_local3){
- _local4 = _local3.indexof(_arg2);
- if (_local4 > -1){
- _local3.splice(_local4, 1);
- };
- };
- }
- protected function listenerCallback(_arg1:Event):void{
- var args:* = null;
- var call:* = null;
- var evt:* = _arg1;
- args = {};
- if ((evt is MediaEvent)){
- args = this.listenerCallbackMedia((evt as MediaEvent));
- } else {
- if ((evt is PlayerStateEvent)){
- args = this.listenerCallbackState((evt as PlayerStateEvent));
- } else {
- if ((evt is PlaylistEvent)){
- args = this.listenerCallbackPlaylist((evt as PlaylistEvent));
- } else {
- if ((evt is ComponentEvent)){
- args = this.listenerCallbackComponent((evt as ComponentEvent));
- } else {
- if ((((evt is ViewEvent)) && (!(((evt as ViewEvent).data == null))))){
- args = {data:JavascriptSerialization.stripDots((evt as ViewEvent).data)};
- } else {
- if ((evt is PlayerEvent)){
- args = {message:(evt as PlayerEvent).message};
- };
- };
- };
- };
- };
- };
- args.type = evt.type;
- var callbacks:* = (this._listeners[evt.type] as array);
- if (callbacks){
- for each (call in callbacks) {
- if (evt.type == MediaEvent.JWPLAYER_MEDIA_COMPLETE){
- ExternalInterface.call(call, args);
- } else {
- setTimeout(function ():void{
- ExternalInterface.call(call, args);
- }, 0);
- };
- };
- };
- }
- protected function merge(_arg1:object, _arg2:object):object{
- var _local4:string;
- var _local3:object = {};
- for (_local4 in _arg1) {
- _local3[_local4] = _arg1[_local4];
- };
- for (_local4 in _arg2) {
- _local3[_local4] = _arg2[_local4];
- };
- return (_local3);
- }
- protected function listenerCallbackMedia(_arg1:MediaEvent):object{
- var _local2:object = {};
- if (_arg1.bufferPercent >= 0){
- _local2.bufferPercent = _arg1.bufferPercent;
- };
- if (_arg1.duration >= 0){
- _local2.duration = _arg1.duration;
- };
- if (_arg1.message){
- _local2.message = _arg1.message;
- };
- if (_arg1.metadata != null){
- _local2.metadata = JavascriptSerialization.stripDots(_arg1.metadata);
- };
- if (_arg1.offset > 0){
- _local2.offset = _arg1.offset;
- };
- if (_arg1.position >= 0){
- _local2.position = _arg1.position;
- };
- if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_MUTE){
- _local2.mute = _arg1.mute;
- };
- if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_VOLUME){
- _local2.volume = _arg1.volume;
- };
- return (_local2);
- }
- protected function listenerCallbackState(_arg1:PlayerStateEvent):object{
- if (_arg1.type == PlayerStateEvent.JWPLAYER_PLAYER_STATE){
- return ({
- newstate:_arg1.newstate,
- oldstate:_arg1.oldstate
- });
- };
- return ({});
- }
- protected function listenerCallbackPlaylist(_arg1:PlaylistEvent):object{
- var _local2:array;
- if (_arg1.type == PlaylistEvent.JWPLAYER_PLAYLIST_LOADED){
- _local2 = JavascriptSerialization.playlistToArray(this._player.playlist);
- _local2 = (JavascriptSerialization.stripDots(_local2) as array);
- return ({playlist:_local2});
- };
- if (_arg1.type == PlaylistEvent.JWPLAYER_PLAYLIST_ITEM){
- return ({index:this._player.playlist.currentIndex});
- };
- return ({});
- }
- protected function listenerCallbackComponent(_arg1:ComponentEvent):object{
- var _local2:object = {};
- if ((_arg1.component is IControlbarComponent)){
- _local2.component = "controlbar";
- } else {
- if ((_arg1.component is IPlaylistComponent)){
- _local2.component = "playlist";
- } else {
- if ((_arg1.component is IDisplayComponent)){
- _local2.component = "display";
- } else {
- if ((_arg1.component is IDockComponent)){
- _local2.component = "dock";
- };
- };
- };
- };
- _local2.boundingRect = {
- x:_arg1.boundingRect.x,
- y:_arg1.boundingRect.y,
- width:_arg1.boundingRect.width,
- height:_arg1.boundingRect.height
- };
- return (_local2);
- }
- protected function js_getBandwidth():number{
- return (this._player.config.bandwidth);
- }
- protected function js_getBuffer():number{
- return (this._playerBuffer);
- }
- protected function js_getDuration():number{
- return (((this._player.playlist.currentItem) ? this._player.playlist.currentItem.duration : 0));
- }
- protected function js_getFullscreen():boolean{
- return (this._player.config.fullscreen);
- }
- protected function js_getHeight():number{
- return (RootReference.stage.stageHeight);
- }
- protected function js_getLevel():number{
- return (((this._player.playlist.currentItem) ? this._player.playlist.currentItem.currentLevel : 0));
- }
- protected function js_getLockState():boolean{
- return (this._player.locked);
- }
- protected function js_getMute():boolean{
- return (this._player.config.mute);
- }
- protected function js_getPlaylist():array{
- var _local1:array = JavascriptSerialization.playlistToArray(this._player.playlist);
- var _local2:number = 0;
- while (_local2 < _local1.length) {
- _local1[_local2] = JavascriptSerialization.stripDots(_local1[_local2]);
- _local2++;
- };
- return (_local1);
- }
- protected function js_getPlaylistIndex():number{
- return (this._player.playlist.currentIndex);
- }
- protected function js_getPosition():number{
- return (this._playerPosition);
- }
- protected function js_getState():string{
- return (this._player.state);
- }
- protected function js_getWidth():number{
- return (RootReference.stage.stageWidth);
- }
- protected function js_getVersion():string{
- return (this._player.version);
- }
- protected function js_getVolume():number{
- return (this._player.config.volume);
- }
- protected function js_dockSetButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void{
- this._player.controls.dock.setButton(_arg1, _arg2, _arg3, _arg4);
- }
- protected function js_play(_arg1=null):void{
- if (_arg1 == null){
- this.playToggle();
- } else {
- if (string(_arg1).tolowercase() == "true"){
- this._player.play();
- } else {
- this._player.pause();
- };
- };
- }
- protected function js_pause(_arg1=null):void{
- if (_arg1 == null){
- this.playToggle();
- } else {
- if (string(_arg1).tolowercase() == "true"){
- this._player.pause();
- } else {
- this._player.play();
- };
- };
- }
- protected function playToggle():void{
- if ((((this._player.state == PlayerState.IDLE)) || ((this._player.state == PlayerState.PAUSED)))){
- this._player.play();
- } else {
- this._player.pause();
- };
- }
- protected function js_stop():void{
- this._player.stop();
- }
- protected function js_seek(_arg1:number=0):void{
- this._player.seek(_arg1);
- }
- protected function js_load(_arg1):void{
- this._player.load(_arg1);
- }
- protected function js_playlistItem(_arg1:number):void{
- this._player.playlistItem(_arg1);
- }
- protected function js_playlistNext():void{
- this._player.playlistNext();
- }
- protected function js_playlistPrev():void{
- this._player.playlistPrev();
- }
- protected function js_mute(_arg1=null):void{
- if (_arg1 == null){
- this._player.mute(!(this._player.config.mute));
- } else {
- if (string(_arg1).tolowercase() == "true"){
- this._player.mute(true);
- } else {
- this._player.mute(false);
- };
- };
- }
- protected function js_volume(_arg1:number):void{
- this._player.volume(_arg1);
- }
- protected function js_fullscreen(_arg1=null):void{
- if (_arg1 == null){
- this._player.fullscreen(!(this._player.config.fullscreen));
- } else {
- if (string(_arg1).tolowercase() == "true"){
- this._player.fullscreen(true);
- } else {
- this._player.fullscreen(false);
- };
- };
- }
- protected function setComponentVisibility(_arg1:IPlayerComponent, _arg2:boolean):void{
- if (_arg2){
- _arg1.show();
- } else {
- _arg1.hide();
- };
- }
- protected function js_showControlbar():void{
- this.setComponentVisibility(this._player.controls.controlbar, true);
- }
- protected function js_hideControlbar():void{
- this.setComponentVisibility(this._player.controls.controlbar, false);
- }
- protected function js_showDock():void{
- this.setComponentVisibility(this._player.controls.dock, true);
- }
- protected function js_hideDock():void{
- this.setComponentVisibility(this._player.controls.dock, false);
- }
- protected function js_showDisplay():void{
- this.setComponentVisibility(this._player.controls.display, true);
- }
- protected function js_hideDisplay():void{
- this.setComponentVisibility(this._player.controls.display, false);
- }
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.jeroenwijering.events.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class PlayerV4Emulation extends AbstractView {
- private static var instance:PlayerV4Emulation;
- private var _player:IPlayer;
- private var viewEventDispatcher:EventDispatcher;
- private var modelEventDispatcher:EventDispatcher;
- private var controllerEventDispatcher:EventDispatcher;
- private var id:string;
- private var client:string;
- private var version:string;
- public function PlayerV4Emulation(_arg1:IPlayer){
- this.viewEventDispatcher = new EventDispatcher();
- this.modelEventDispatcher = new EventDispatcher();
- this.controllerEventDispatcher = new EventDispatcher();
- this._player = _arg1;
- this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
- }
- public static function getInstance(_arg1:IPlayer):PlayerV4Emulation{
- if (!instance){
- instance = new PlayerV4Emulation(_arg1);
- };
- return (instance);
- }
- private function playerReady(_arg1:PlayerEvent):void{
- this.id = _arg1.id;
- this.client = _arg1.client;
- this.version = _arg1.version;
- dispatchEvent(new PlayerEvent(PlayerEvent.READY));
- this.setupListeners();
- }
- private function setupListeners():void{
- this._player.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.errorHandler);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.mediaBuffer);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_ERROR, this.mediaError);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_LOADED, this.mediaLoaded);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.mediaTime);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.mediaVolume);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.mediaMute);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_META, this.mediaMeta);
- this._player.addEventListener(MediaEvent.JWPLAYER_MEDIA_COMPLETE, this.mediaComplete);
- this._player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this.viewFullscreen);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_ITEM, this.viewItem);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_LOAD, this.viewLoad);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_MUTE, this.viewMute);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_NEXT, this.viewNext);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PAUSE, this.viewPause);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PLAY, this.viewPlay);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_PREV, this.viewPrev);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_SEEK, this.viewSeek);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_STOP, this.viewStop);
- this._player.addEventListener(ViewEvent.JWPLAYER_VIEW_VOLUME, this.viewVolume);
- this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistItem);
- this._player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistLoad);
- }
- private function errorHandler(_arg1:PlayerEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.error, {
- message:_arg1.message,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.error, {
- message:_arg1.message,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaBuffer(_arg1:MediaEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.BUFFER, {
- percentage:_arg1.bufferPercent,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaError(_arg1:MediaEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.error, {
- message:_arg1.message,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.error, {
- message:_arg1.message,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaLoaded(_arg1:MediaEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.loaded, {
- loaded:0,
- total:0,
- offset:0,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaTime(_arg1:MediaEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.time, {
- duration:_arg1.duration,
- position:_arg1.position,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaVolume(_arg1:MediaEvent):void{
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME, {
- percentage:_arg1.volume,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaMute(_arg1:MediaEvent):void{
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.MUTE, {
- state:_arg1.mute,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function mediaMeta(_arg1:MediaEvent):void{
- _arg1.metadata["id"] = this.id;
- _arg1.metadata["client"] = this.client;
- _arg1.metadata["version"] = this.version;
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.META, _arg1.metadata));
- }
- private function mediaComplete(_arg1:MediaEvent):void{
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.STATE, {
- id:this.id,
- oldstate:this._player.state,
- newstate:ModelStates.COMPLETED
- }));
- }
- private function stateHandler(_arg1:PlayerStateEvent):void{
- if ((((_arg1.newstate == PlayerState.IDLE)) && ((((_arg1.oldstate == PlayerState.BUFFERING)) || ((_arg1.oldstate == PlayerState.PLAYING)))))){
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.stop, {
- id:this.id,
- client:this.client,
- version:this.version
- }));
- };
- this.modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.STATE, {
- id:this.id,
- oldstate:_arg1.oldstate,
- newstate:_arg1.newstate
- }));
- }
- private function viewFullscreen(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.FULLSCREEN, {
- state:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewItem(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.ITEM, {
- index:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewLoad(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.load, {
- object:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewMute(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.MUTE, {
- state:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.MUTE, {
- state:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewNext(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.NEXT, {
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewPause(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.play, {
- state:false,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.play, {
- state:false,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewPlay(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.play, {
- state:true,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.play, {
- state:true,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewPrev(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.PREV, {
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewRedraw(_arg1:number, _arg2:number):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.REDRAW, {
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.RESIZE, {
- width:_arg1,
- height:_arg2,
- fullscreen:this._player.config.fullscreen,
- client:this.client,
- version:this.version
- }));
- }
- private function viewSeek(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.seek, {
- position:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.seek, {
- position:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewStop(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.stop, {
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function viewVolume(_arg1:ViewEvent):void{
- this.viewEventDispatcher.dispatchEvent(new ViewEvent(ViewEvent.VOLUME, {
- state:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME, {
- percentage:_arg1.data,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function playlistItem(_arg1:PlaylistEvent):void{
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.ITEM, {
- index:this._player.playlist.currentIndex,
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- private function playlistLoad(_arg1:PlaylistEvent):void{
- this.controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.PLAYLIST, {
- playlist:JavascriptSerialization.playlistToArray(this._player.playlist),
- id:this.id,
- client:this.client,
- version:this.version
- }));
- }
- override public function addModelListener(_arg1:string, _arg2:function):void{
- this.modelEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
- }
- override public function removeModelListener(_arg1:string, _arg2:function):void{
- this.modelEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
- }
- override public function addViewListener(_arg1:string, _arg2:function):void{
- this.viewEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
- }
- override public function removeViewListener(_arg1:string, _arg2:function):void{
- this.viewEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
- }
- override public function addControllerListener(_arg1:string, _arg2:function):void{
- this.controllerEventDispatcher.addEventListener(_arg1.touppercase(), _arg2);
- }
- override public function removeControllerListener(_arg1:string, _arg2:function):void{
- this.controllerEventDispatcher.removeEventListener(_arg1.touppercase(), _arg2);
- }
- override public function sendEvent(_arg1:string, _arg2:object=undefined):void{
- Logger.log(((("V4 emulator sending event: " + _arg1) + " ") + Strings.print_r(_arg2)));
- switch (_arg1){
- case ViewEvent.FULLSCREEN:
- this._player.fullscreen(_arg2);
- break;
- case ViewEvent.ITEM:
- this._player.playlistItem(number(_arg2));
- break;
- case ViewEvent.LINK:
- this.link(number(_arg2));
- break;
- case ViewEvent.load:
- this._player.load(_arg2);
- break;
- case ViewEvent.MUTE:
- if (((!((_arg2 === null))) && (!((_arg2 === ""))))){
- this._player.mute(((!((_arg2 === "false"))) && (!((_arg2 === 0)))));
- } else {
- this._player.mute(!(this._player.config.mute));
- };
- break;
- case ViewEvent.NEXT:
- this._player.playlistNext();
- break;
- case ViewEvent.play:
- if ((((_arg2 === null)) || ((_arg2 === "")))){
- if ((((this._player.state == PlayerState.PAUSED)) || ((this._player.state == PlayerState.IDLE)))){
- _arg2 = "true";
- } else {
- _arg2 = "false";
- };
- };
- if (((!((_arg2 === null))) && ((Strings.serialize(_arg2.tostring()) == false)))){
- this._player.pause();
- } else {
- this._player.play();
- };
- break;
- case ViewEvent.PREV:
- this._player.playlistPrev();
- break;
- case ViewEvent.REDRAW:
- this._player.redraw();
- break;
- case ViewEvent.seek:
- this._player.seek(number(_arg2));
- break;
- case ViewEvent.stop:
- this._player.stop();
- break;
- case ViewEvent.trace:
- Logger.log(_arg2);
- break;
- case ViewEvent.VOLUME:
- this._player.volume(number(_arg2));
- break;
- };
- }
- override public function get config():object{
- var _local3:string;
- var _local4:string;
- var _local5:PluginConfig;
- var _local6:string;
- var _local1:object = {};
- var _local2:xml = describeType(this._player.config);
- for each (_local3 in _local2.accessor.@name) {
- if (this._player.config[_local3] != null){
- _local1[_local3] = Strings.serialize(this._player.config[_local3].tostring());
- };
- };
- for each (_local4 in this._player.config.pluginIds) {
- _local5 = this._player.config.pluginConfig(_local4);
- for (_local6 in _local5) {
- _local1[((_local4 + ".") + _local6)] = _local5[_local6];
- };
- };
- switch (this._player.state){
- case PlayerState.BUFFERING:
- _local1["state"] = ModelStates.BUFFERING;
- break;
- case PlayerState.PLAYING:
- _local1["state"] = ModelStates.PLAYING;
- break;
- case PlayerState.PAUSED:
- _local1["state"] = ModelStates.PAUSED;
- break;
- case PlayerState.IDLE:
- if ((((this._player.playlist.currentIndex > 0)) && ((this._player.playlist.currentIndex == (this._player.playlist.length - 1))))){
- _local1["state"] = ModelStates.COMPLETED;
- } else {
- _local1["state"] = ModelStates.IDLE;
- };
- break;
- };
- _local1["fullscreen"] = this._player.config.fullscreen;
- _local1["version"] = this._player.version;
- _local1["item"] = this._player.playlist.currentIndex;
- _local1["level"] = ((this._player.playlist.currentItem) ? this._player.playlist.currentItem.currentLevel : 0);
- return (_local1);
- }
- override public function get playlist():array{
- return (JavascriptSerialization.playlistToArray(this._player.playlist));
- }
- override public function getPluginConfig(_arg1:object):object{
- if ((_arg1 is IPlugin)){
- return (this._player.config.pluginConfig((_arg1 as IPlugin).id));
- };
- if ((_arg1 is V4Plugin)){
- return (this._player.config.pluginConfig((_arg1 as V4Plugin).pluginId));
- };
- if (((_arg1 as DisplayObject).parent is V4Plugin)){
- return (this._player.config.pluginConfig((_arg1.parent as V4Plugin).pluginId));
- };
- if ((_arg1 is IDockComponent)){
- return (this._player.config.pluginConfig("dock"));
- };
- if ((_arg1 is IDisplayComponent)){
- return (this._player.config.pluginConfig("display"));
- };
- if ((_arg1 is IControlbarComponent)){
- return (this._player.config.pluginConfig("controlbar"));
- };
- if ((_arg1 is IPlaylistComponent)){
- return (this._player.config.pluginConfig("playlist"));
- };
- return (new PluginConfig(""));
- }
- public function resize(_arg1:number, _arg2:number):void{
- this.viewRedraw(_arg1, _arg2);
- }
- override public function getPlugin(_arg1:string):object{
- var _local2:object;
- switch (_arg1){
- case "dock":
- _local2 = (this._player.controls.dock as object);
- break;
- case "controlbar":
- _local2 = (this._player.controls.controlbar as object);
- break;
- case "display":
- _local2 = (this._player.controls.display as object);
- break;
- case "playlist":
- _local2 = (this._player.controls.playlist as object);
- break;
- default:
- try {
- _local2 = (this._player as object).getPlugin(_arg1);
- } catch(e:error) {
- };
- };
- return (_local2);
- }
- private function link(_arg1:number):void{
- if (isnan(_arg1)){
- _arg1 = this._player.playlist.currentIndex;
- };
- if ((((_arg1 >= 0)) && ((_arg1 < this._player.playlist.length)))){
- navigateToURL(new URLRequest(this._player.playlist.getItemAt(_arg1).link), this._player.config.linktarget);
- };
- }
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- public class PlayerVersion {
- protected static var _version:string = "5.8.2011";
- public static var id:string = "";
- public static function get version():string{
- return (_version);
- }
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- import com.longtailvideo.jwplayer.events.*;
- import com.jeroenwijering.events.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.external.*;
- public class JavascriptCompatibilityAPI extends JavascriptAPI {
- private var _emu:PlayerV4Emulation;
- private var controllerCallbacks:object;
- private var modelCallbacks:object;
- private var viewCallbacks:object;
- public function JavascriptCompatibilityAPI(_arg1:IPlayer){
- this.controllerCallbacks = {};
- this.modelCallbacks = {};
- this.viewCallbacks = {};
- this._emu = PlayerV4Emulation.getInstance(_arg1);
- super(_arg1);
- }
- override protected function setupJSListeners():void{
- super.setupJSListeners();
- try {
- ExternalInterface.addCallback("addControllerListener", this.addJSControllerListener);
- ExternalInterface.addCallback("addModelListener", this.addJSModelListener);
- ExternalInterface.addCallback("addViewListener", this.addJSViewListener);
- ExternalInterface.addCallback("removeControllerListener", this.removeJSControllerListener);
- ExternalInterface.addCallback("removeModelListener", this.removeJSModelListener);
- ExternalInterface.addCallback("removeViewListener", this.removeJSViewListener);
- ExternalInterface.addCallback("getConfig", this.getConfig);
- ExternalInterface.addCallback("getPlaylist", super.js_getPlaylist);
- ExternalInterface.addCallback("getPluginConfig", this.getJSPluginConfig);
- ExternalInterface.addCallback("loadPlugin", this.loadPlugin);
- ExternalInterface.addCallback("sendEvent", this.sendEvent);
- } catch(e:error) {
- Logger.log(("Could not start up JavasScript API: " + e.message));
- };
- }
- override protected function clearQueuedEvents():void{
- super.clearQueuedEvents();
- var _local1:PlayerEvent = new PlayerEvent("");
- this.forwardControllerEvents(new ControllerEvent(ControllerEvent.PLAYLIST, {
- playlist:JavascriptSerialization.playlistToArray(_player.playlist),
- id:_local1.id,
- client:_local1.client,
- version:_local1.version
- }));
- this.forwardControllerEvents(new ControllerEvent(ControllerEvent.ITEM, {
- index:_player.playlist.currentIndex,
- id:_local1.id,
- client:_local1.client,
- version:_local1.version
- }));
- }
- private function addJSControllerListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- if (!this.controllerCallbacks.hasOwnProperty(_arg1)){
- this.controllerCallbacks[_arg1] = [];
- };
- if ((this.controllerCallbacks[_arg1] as array).indexof(_arg2) < 0){
- (this.controllerCallbacks[_arg1] as array).push(_arg2);
- this._emu.addControllerListener(_arg1, this.forwardControllerEvents);
- };
- return (true);
- }
- private function removeJSControllerListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- var _local3:array = (this.controllerCallbacks[_arg1] as array);
- var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
- if (_local4 >= 0){
- _local3.splice(_local4, 1);
- this._emu.removeControllerListener(_arg1.touppercase(), this.forwardControllerEvents);
- return (true);
- };
- return (false);
- }
- private function addJSModelListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- if (!this.modelCallbacks.hasOwnProperty(_arg1)){
- this.modelCallbacks[_arg1] = [];
- };
- if ((this.modelCallbacks[_arg1] as array).indexof(_arg2) < 0){
- (this.modelCallbacks[_arg1] as array).push(_arg2);
- this._emu.addModelListener(_arg1, this.forwardModelEvents);
- };
- return (true);
- }
- private function removeJSModelListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- var _local3:array = (this.modelCallbacks[_arg1] as array);
- var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
- if (_local4 >= 0){
- _local3.splice(_local4, 1);
- this._emu.removeModelListener(_arg1.touppercase(), this.forwardModelEvents);
- return (true);
- };
- return (false);
- }
- private function addJSViewListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- if (!this.viewCallbacks.hasOwnProperty(_arg1)){
- this.viewCallbacks[_arg1] = [];
- };
- if ((this.viewCallbacks[_arg1] as array).indexof(_arg2) < 0){
- (this.viewCallbacks[_arg1] as array).push(_arg2);
- this._emu.addViewListener(_arg1.touppercase(), this.forwardViewEvents);
- };
- return (true);
- }
- private function removeJSViewListener(_arg1:string, _arg2:string):boolean{
- _arg1 = _arg1.touppercase();
- var _local3:array = (this.viewCallbacks[_arg1] as array);
- var _local4:number = ((_local3) ? _local3.indexof(_arg2) : -1);
- if (_local4 >= 0){
- _local3.splice(_local4, 1);
- this._emu.removeViewListener(_arg1.touppercase(), this.forwardViewEvents);
- return (true);
- };
- return (false);
- }
- private function getConfig():object{
- return (JavascriptSerialization.stripDots(this._emu.config));
- }
- private function getJSPluginConfig(_arg1:string):object{
- return (JavascriptSerialization.stripDots(_player.config.pluginConfig(_arg1)));
- }
- private function loadPlugin(_arg1:string):object{
- return ({error:"This function is no longer supported."});
- }
- private function sendEvent(_arg1:string, _arg2:object=null):void{
- this._emu.sendEvent(_arg1.touppercase(), _arg2);
- }
- private function forwardControllerEvents(_arg1:ControllerEvent):void{
- var evt:* = _arg1;
- setTimeout(function ():void{
- var _local1:string;
- if (controllerCallbacks.hasOwnProperty(evt.type)){
- for each (_local1 in controllerCallbacks[evt.type]) {
- if (ExternalInterface.available){
- ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
- };
- };
- };
- }, 1);
- }
- private function forwardModelEvents(_arg1:ModelEvent):void{
- var evt:* = _arg1;
- setTimeout(function ():void{
- var _local1:string;
- if (modelCallbacks.hasOwnProperty(evt.type)){
- for each (_local1 in modelCallbacks[evt.type]) {
- if (ExternalInterface.available){
- ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
- };
- };
- };
- }, 1);
- }
- private function forwardViewEvents(_arg1:ViewEvent):void{
- var evt:* = _arg1;
- setTimeout(function ():void{
- var _local1:string;
- if (viewCallbacks.hasOwnProperty(evt.type)){
- for each (_local1 in viewCallbacks[evt.type]) {
- if (ExternalInterface.available){
- ExternalInterface.call(_local1, JavascriptSerialization.stripDots(evt.data));
- };
- };
- };
- }, 1);
- }
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.player {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.controller.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class Player extends Sprite implements IPlayer, IGlobalEventDispatcher {
- protected var model:Model;
- protected var view:View;
- protected var controller:Controller;
- protected var _dispatcher:GlobalEventDispatcher;
- public function Player(){
- super();
- try {
- this.addEventListener(Event.ADDED_TO_STAGE, this.setupPlayer);
- } catch(err:error) {
- setupPlayer();
- };
- }
- protected function setupPlayer(_arg1:Event=null):void{
- try {
- this.removeEventListener(Event.ADDED_TO_STAGE, this.setupPlayer);
- } catch(err:error) {
- };
- new RootReference(this);
- this._dispatcher = new GlobalEventDispatcher();
- this.model = this.newModel();
- this.view = this.newView(this.model);
- this.controller = this.newController(this.model, this.view);
- this.controller.addEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady, false, -1);
- this.controller.setupPlayer();
- }
- protected function newModel():Model{
- return (new Model());
- }
- protected function newView(_arg1:Model):View{
- return (new View(this, _arg1));
- }
- protected function newController(_arg1:Model, _arg2:View):Controller{
- return (new Controller(this, _arg1, _arg2));
- }
- protected function playerReady(_arg1:PlayerEvent):void{
- this.controller.removeEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
- var _local2:JavascriptAPI = new JavascriptCompatibilityAPI(this);
- this.model.addGlobalListener(this.forward);
- this.view.addGlobalListener(this.forward);
- this.controller.addGlobalListener(this.forward);
- this.forward(_arg1);
- }
- protected function forward(_arg1:PlayerEvent):void{
- Logger.log(_arg1.tostring(), _arg1.type);
- this.dispatchEvent(_arg1);
- }
- public function get config():PlayerConfig{
- return (this.model.config);
- }
- public function get version():string{
- return (PlayerVersion.version);
- }
- public function get skin():ISkin{
- return (this.view.skin);
- }
- public function get state():string{
- return (this.model.state);
- }
- public function get playlist():IPlaylist{
- return (this.model.playlist);
- }
- public function get locked():boolean{
- return (this.controller.locking);
- }
- public function lock(_arg1:IPlugin, _arg2:function):void{
- this.controller.lockPlayback(_arg1, _arg2);
- }
- public function unlock(_arg1:IPlugin):boolean{
- return (this.controller.unlockPlayback(_arg1));
- }
- public function volume(_arg1:number):boolean{
- return (this.controller.setvolume(_arg1));
- }
- public function mute(_arg1:boolean):void{
- this.controller.mute(_arg1);
- }
- public function play():boolean{
- return (this.controller.play());
- }
- public function pause():boolean{
- return (this.controller.pause());
- }
- public function stop():boolean{
- return (this.controller.stop());
- }
- public function seek(_arg1:number):boolean{
- return (this.controller.seek(_arg1));
- }
- public function load(_arg1):boolean{
- return (this.controller.load(_arg1));
- }
- public function playlistItem(_arg1:number):boolean{
- return (this.controller.setPlaylistIndex(_arg1));
- }
- public function playlistNext():boolean{
- return (this.controller.next());
- }
- public function playlistPrev():boolean{
- return (this.controller.previous());
- }
- public function redraw():boolean{
- return (this.controller.redraw());
- }
- public function fullscreen(_arg1:boolean):void{
- this.controller.fullscreen(_arg1);
- }
- public function get controls():IPlayerComponents{
- return (this.view.components);
- }
- public function overrideComponent(_arg1:IPlayerComponent):void{
- this.view.overrideComponent(_arg1);
- }
- public function getPlugin(_arg1:string):object{
- return (this.view.getPlugin(_arg1));
- }
- override public function addChild(_arg1:DisplayObject):DisplayObject{
- return (null);
- }
- override public function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject{
- return (null);
- }
- override public function removeChild(_arg1:DisplayObject):DisplayObject{
- return (null);
- }
- override public function removeChildAt(_arg1:int):DisplayObject{
- return (null);
- }
- public function addGlobalListener(_arg1:function):void{
- this._dispatcher.addGlobalListener(_arg1);
- }
- public function removeGlobalListener(_arg1:function):void{
- this._dispatcher.removeGlobalListener(_arg1);
- }
- override public function dispatchEvent(_arg1:Event):boolean{
- this._dispatcher.dispatchEvent(_arg1);
- return (super.dispatchEvent(_arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.player
- package com.longtailvideo.jwplayer.view {
- import mx.core.*;
- import flash.utils.*;
- public class View_ErrorScreen extends MovieClipLoaderAsset {
- private static var bytes:ByteArray = null;
- public var dataClass:class;
- public function View_ErrorScreen(){
- this.dataClass = View_ErrorScreen_dataClass;
- super();
- initialWidth = (680 / 20);
- initialHeight = (680 / 20);
- }
- override public function get movieClipData():ByteArray{
- if (bytes == null){
- bytes = ByteArray(new this.dataClass());
- };
- return (bytes);
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- public interface IPlayerComponents {
- function get controlbar():IControlbarComponent;
- function get display():IDisplayComponent;
- function get dock():IDockComponent;
- function get playlist():IPlaylistComponent;
- function resize(_arg1:number, _arg2:number):void;
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view.skins {
- import mx.core.*;
- public class DefaultSkin_EmbeddedSkin_dataClass extends ByteArrayAsset {
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import flash.display.*;
- public class SkinBase extends EventDispatcher implements ISkin {
- protected var _skin:Sprite;
- public function SkinBase(){
- this._skin = new Sprite();
- }
- public function load(_arg1:string=null):void{
- dispatchEvent(new Event(Event.COMPLETE));
- }
- public function hasComponent(_arg1:string):boolean{
- return ((this._skin.getChildByName(_arg1) is DisplayObjectContainer));
- }
- public function componentChildren(_arg1:string):object{
- var _local5:DisplayObject;
- var _local2:object = {};
- var _local3:DisplayObjectContainer = DisplayObjectContainer(this._skin.getChildByName(_arg1));
- if (!_local3){
- return (_local2);
- };
- var _local4:number = 0;
- while (_local4 < this._skin.numChildren) {
- _local5 = this._skin.getChildAt(_local4);
- _local2[_local5.name] = _local5;
- _local4++;
- };
- return (_local2);
- }
- public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
- var _local3:DisplayObject;
- var _local4:DisplayObjectContainer = (this._skin.getChildByName(_arg1) as DisplayObjectContainer);
- if (_local4){
- _local3 = _local4.getChildByName(_arg2);
- };
- return (_local3);
- }
- public function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void{
- if (_arg2){
- _arg3.name = _arg2;
- };
- var _local4:DisplayObjectContainer = (this._skin.getChildByName(_arg1) as DisplayObjectContainer);
- if (!_local4){
- _local4 = new Sprite();
- _local4.name = _arg1;
- this._skin.addChild(_local4);
- };
- if (_local4.getChildByName(_arg3.name)){
- _local4.removeChild(_local4.getChildByName(_arg3.name));
- };
- _local4.addChild(_arg3);
- }
- public function getSkinProperties():SkinProperties{
- return (new SkinProperties());
- }
- protected function sendError(_arg1:string):void{
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1));
- }
- public function getSWFSkin():Sprite{
- return (null);
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- public dynamic class SkinProperties {
- public var layout:object;
- public var version:string = "";
- public var name:string = "";
- public var author:string = "";
- public function SkinProperties(){
- this.layout = {};
- super();
- this["backcolor"] = undefined;
- this["frontcolor"] = undefined;
- this["screencolor"] = undefined;
- this["lightcolor"] = undefined;
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import flash.display.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class PNGSkin extends SkinBase implements ISkin {
- public namespace skinNS = "http://developer.longtailvideo.com/trac/wiki/Skinning";
- protected var _urlPrefix:string;
- protected var _skinXML:xml;
- protected var _props:SkinProperties;
- protected var _loaders:Dictionary;
- protected var _components:object;
- protected var _errorState:boolean = false;
- public function PNGSkin(){
- this._props = new SkinProperties();
- this._loaders = new Dictionary();
- this._components = {};
- super();
- }
- override public function load(_arg1:string=null):void{
- var _local2:AssetLoader;
- if (Strings.extension(_arg1) == "xml"){
- this._urlPrefix = _arg1.substring(0, (_arg1.lastindexof("/") + 1));
- _local2 = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadComplete);
- _local2.addEventListener(ErrorEvent.error, this.loadError);
- _local2.load(_arg1);
- } else {
- if (_skin.numChildren == 0){
- sendError("PNG skin descriptor file must have a .xml extension");
- };
- };
- }
- protected function loadError(_arg1:ErrorEvent):void{
- sendError(_arg1.text);
- }
- protected function loadComplete(_arg1:Event):void{
- var evt:* = _arg1;
- var loader:* = AssetLoader(evt.target);
- try {
- this._skinXML = xml(loader.loadedObject);
- this.parseSkin();
- } catch(e:error) {
- sendError(e.message);
- };
- }
- protected function parseSkin():void{
- var attrib:* = null;
- var comp:* = null;
- var cbLayout:* = null;
- if (this._skinXML.localName() != "skin"){
- sendError("PNG skin descriptor file not correctly formatted");
- return;
- };
- for each (attrib in this._skinXML.attributes()) {
- this._props[attrib.localName()] = attrib.tostring();
- };
- this.parseConfig(this._skinXML.settings);
- for each (comp in this._skinXML.components.component) {
- this.parseConfig(comp.settings, [email protected]());
- this.loadElements([email protected](), comp..element);
- };
- cbLayout = ((this._skinXML.components.component.(@name == "controlbar").layout as XMLList)[0] as xml);
- if (cbLayout){
- this.parseControlbarLayout(cbLayout);
- };
- }
- protected function parseControlbarLayout(_arg1:xml):void{
- var _local2:xml;
- var _local3:array;
- var _local4:xml;
- this._props.layout["controlbar"] = {};
- for each (_local2 in _arg1.group) {
- _local3 = new array();
- for each (_local4 in _local2.*) {
- _local3.push({
- type:_local4.localName(),
- name:[email protected](),
- element:[email protected](),
- width:(((_local4.localName() == "divider")) ? number([email protected]()) : null)
- });
- };
- this._props.layout["controlbar"][[email protected]().tolowercase()] = _local3;
- };
- }
- protected function parseConfig(_arg1:XMLList, _arg2:string=""):void{
- var _local3:xml;
- for each (_local3 in _arg1.setting) {
- if (_arg2){
- this._props[((_arg2 + ".") + [email protected]())] = [email protected]();
- } else {
- if (this._props.hasOwnProperty([email protected]())){
- this._props[[email protected]()] = [email protected]();
- };
- };
- };
- }
- protected function loadElements(_arg1:string, _arg2:XMLList):void{
- var _local3:xml;
- var _local4:AssetLoader;
- if (!_arg1){
- return;
- };
- for each (_local3 in _arg2) {
- _local4 = new AssetLoader();
- this._loaders[_local4] = {
- componentName:_arg1,
- elementName:[email protected]()
- };
- _local4.addEventListener(Event.COMPLETE, this.elementHandler);
- _local4.addEventListener(ErrorEvent.error, this.elementError);
- _local4.load((((this._urlPrefix + _arg1) + "/") + [email protected]()));
- };
- }
- protected function elementHandler(_arg1:Event):void{
- var elementInfo:* = null;
- var loader:* = null;
- var bitmap:* = null;
- var clip:* = null;
- var evt:* = _arg1;
- try {
- elementInfo = this._loaders[evt.target];
- loader = (evt.target as AssetLoader);
- bitmap = (loader.loadedObject as Bitmap);
- if ((loader.loadedObject is Bitmap)){
- this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], (loader.loadedObject as Bitmap));
- } else {
- if ((loader.loadedObject is movieclip)){
- clip = (loader.loadedObject as movieclip);
- if ((((((((clip.totalFrames == 1)) && ((clip.numChildren == 1)))) && ((clip.getChildAt(0) is movieclip)))) && (((clip.getChildAt(0) as movieclip).totalFrames > 1)))){
- this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], (clip.getChildAt(0) as movieclip));
- } else {
- this.addSkinElement(elementInfo["componentName"], elementInfo["elementName"], clip);
- };
- };
- };
- delete this._loaders[evt.target];
- } catch(e:error) {
- if (_loaders[evt.target]){
- delete _loaders[evt.target];
- };
- };
- this.checkComplete();
- }
- protected function elementError(_arg1:ErrorEvent):void{
- if (this._loaders[_arg1.target]){
- delete this._loaders[_arg1.target];
- Logger.log(("Skin element not loaded: " + _arg1.text));
- this.checkComplete();
- } else {
- if (!this._errorState){
- this._errorState = true;
- sendError(_arg1.text);
- };
- };
- }
- protected function checkComplete():void{
- var _local2:object;
- if (this._errorState){
- return;
- };
- var _local1:number = 0;
- for each (_local2 in this._loaders) {
- _local1++;
- };
- if (_local1 > 0){
- return;
- };
- dispatchEvent(new Event(Event.COMPLETE));
- }
- override public function getSkinProperties():SkinProperties{
- return (this._props);
- }
- override public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
- var _local3:Sprite;
- var _local4:Bitmap;
- var _local5:Sprite;
- if (((this._components[_arg1]) && (this._components[_arg1][_arg2]))){
- _local3 = (this._components[_arg1][_arg2] as Sprite);
- if ((_local3.getChildAt(0) is Bitmap)){
- _local4 = new Bitmap((_local3.getChildAt(0) as Bitmap).bitmapData);
- _local5 = new Sprite();
- _local5.addChild(_local4);
- _local4.name = "bitmap";
- return (_local5);
- };
- return (_local3);
- };
- return (null);
- }
- override public function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void{
- var _local4:Sprite;
- if (!this._components[_arg1]){
- this._components[_arg1] = {};
- };
- if ((_arg3 is movieclip)){
- this._components[_arg1][_arg2] = _arg3;
- } else {
- _local4 = new Sprite();
- _local4.addChild(_arg3);
- this._components[_arg1][_arg2] = _local4;
- };
- }
- override public function hasComponent(_arg1:string):boolean{
- return (this._components.hasOwnProperty(_arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import flash.events.*;
- import flash.display.*;
- import mx.core.*;
- public class DefaultSkin extends SWFSkin {
- private var EmbeddedSkin:class;
- public function DefaultSkin(){
- this.EmbeddedSkin = DefaultSkin_EmbeddedSkin;
- super();
- }
- override public function load(_arg1:string=""):void{
- var embeddedLoader:* = null;
- var notUsed:string = _arg1;
- var skinObj:* = (new this.EmbeddedSkin() as MovieClipLoaderAsset);
- try {
- embeddedLoader = Loader(skinObj.getChildAt(0));
- embeddedLoader.contentLoaderInfo.addEventListener(Event.INIT, this.loadComplete);
- embeddedLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
- } catch(e:error) {
- sendError(e.message);
- };
- }
- override protected function loadComplete(_arg1:Event):void{
- var loader:* = null;
- var skinClip:* = null;
- var evt:* = _arg1;
- try {
- loader = LoaderInfo(evt.target);
- skinClip = movieclip(loader.content);
- overwriteSkin(skinClip.getChildByName("player"));
- loader.removeEventListener(Event.INIT, this.loadComplete);
- loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loadError);
- dispatchEvent(new Event(Event.COMPLETE));
- } catch(e:error) {
- sendError(("DefaultSkin: " + e.message));
- };
- }
- override protected function loadError(_arg1:ErrorEvent):void{
- sendError(("DefaultSkin: " + _arg1.text));
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import flash.display.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class SWFSkin extends SkinBase implements ISkin {
- private var props:SkinProperties;
- public function SWFSkin(_arg1:DisplayObject=null){
- this.props = new SkinProperties();
- if (_arg1){
- this.overwriteSkin(_arg1);
- };
- }
- protected function overwriteSkin(_arg1:DisplayObject):void{
- var newSkin:* = _arg1;
- if ((newSkin is Sprite)){
- _skin = (newSkin as Sprite);
- } else {
- if (newSkin != null){
- _skin = new Sprite();
- _skin.addChild(newSkin);
- };
- };
- if (_skin.getChildByName("controlbar")){
- this.props["controlbar.size"] = _skin.getChildByName("controlbar").height;
- try {
- this.props["controlbar.margin"] = (((_skin.getChildByName("display") as DisplayObjectContainer).getChildByName("back").width - _skin.getChildByName("controlbar").width) / 2);
- } catch(e:error) {
- props["controlbar.margin"] = 0;
- };
- };
- }
- override public function load(_arg1:string=null):void{
- var _local2:AssetLoader;
- if (_arg1){
- _local2 = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadComplete);
- _local2.addEventListener(ErrorEvent.error, this.loadError);
- _local2.load(_arg1, DisplayObject);
- } else {
- if (_skin.numChildren == 0){
- sendError("Skin must load from URL if skin is empty.");
- };
- };
- }
- protected function loadComplete(_arg1:Event):void{
- var _local2:AssetLoader = AssetLoader(_arg1.target);
- this.overwriteSkin(DisplayObjectContainer(_local2.loadedObject).getChildByName("player"));
- dispatchEvent(new Event(Event.COMPLETE));
- }
- protected function loadError(_arg1:ErrorEvent):void{
- sendError(_arg1.text);
- }
- override public function getSkinProperties():SkinProperties{
- return (this.props);
- }
- override public function getSkinElement(_arg1:string, _arg2:string):DisplayObject{
- var _local4:class;
- var _local5:*;
- var _local6:DisplayObjectContainer;
- if (_arg1 == "dock"){
- try {
- _local4 = (_skin.loaderInfo.applicationDomain.getDefinition("dockbutton") as class);
- _local5 = new (_local4)();
- _local5.transform = _skin.transform;
- _local5.filters = _skin.filters;
- _local5.cacheAsBitmap = _skin.cacheAsBitmap;
- _local5.opaqueBackground = _skin.opaqueBackground;
- return (((_local5 as Sprite).getChildByName("back") as Sprite));
- } catch(e:error) {
- };
- } else {
- if (_arg1 == "playlist"){
- if ((((_arg2 == "masker")) || ((_arg2 == "background")))){
- if (_arg2 == "background"){
- _arg2 = "back";
- };
- _local6 = (_skin.getChildByName(_arg1) as DisplayObjectContainer);
- if (_local6){
- return (_local6.getChildByName(_arg2));
- };
- };
- };
- };
- var _local3:DisplayObject = super.getSkinElement(_arg1, _arg2);
- if (((_local3) && (!((_local3 is textfield))))){
- _local3 = Draw.clone((_local3 as Sprite));
- };
- return (_local3);
- }
- public function getTranslatedSkinElement(_arg1:string, _arg2:string):DisplayObject{
- var _local4:number;
- var _local5:number;
- var _local6:string;
- var _local7:string;
- var _local8:movieclip;
- var _local9:string;
- var _local10:string;
- var _local3:DisplayObject = super.getSkinElement(_arg1, _arg2);
- switch (_arg1){
- case "controlbar":
- _local4 = _arg2.indexof("Button");
- _local5 = _arg2.indexof("Slider");
- if (_local4 > 0){
- _local6 = _arg2.substr(_local4, _arg2.length);
- _local7 = _arg2.substr(0, (_local4 + 6));
- switch (_local6){
- case "Button":
- _local3 = this.getSubElement("icon", _local3);
- break;
- case "ButtonBack":
- _local8 = (super.getSkinElement(_arg1, _local7) as movieclip);
- if (_local8){
- (_local8.getChildByName("icon") as DisplayObject).alpha = 0;
- _local3 = _local8;
- };
- break;
- };
- } else {
- if (_local5 > 0){
- _local9 = _arg2.substr(_local5, _arg2.length);
- _local10 = _arg2.substr(0, (_local5 + 6));
- _local3 = super.getSkinElement(_arg1, _local10);
- switch (_local9){
- case "SliderRail":
- _local3 = this.getSubElement("rail", _local3);
- break;
- case "SliderBuffer":
- if (_arg2 == "volumeSliderBuffer"){
- _local3 = null;
- } else {
- _local3 = this.getSubElement("mark", _local3);
- };
- break;
- case "SliderProgress":
- if (_arg2 == "volumeSliderProgress"){
- _local3 = null;
- } else {
- _local3 = this.getSubElement("done", _local3);
- };
- break;
- case "SliderThumb":
- _local3 = this.getSubElement("icon", _local3);
- break;
- };
- } else {
- if ((((_arg2 == "back")) || ((_arg2 == "shade")))){
- super.getSkinElement(_arg1, _arg2);
- };
- };
- };
- break;
- case "display":
- switch (_arg2){
- case "errorIcon":
- if (_local3["icn"]){
- _local3 = _local3["icn"];
- };
- break;
- };
- };
- return (_local3);
- }
- private function getSubElement(_arg1:string, _arg2:DisplayObject):DisplayObject{
- var _local3:DisplayObject;
- if (_arg2){
- _local3 = _arg2[_arg1];
- };
- return (_local3);
- }
- override public function getSWFSkin():Sprite{
- return (_skin);
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import mx.core.*;
- import flash.utils.*;
- public class DefaultSkin_EmbeddedSkin extends MovieClipLoaderAsset {
- private static var bytes:ByteArray = null;
- public var dataClass:class;
- public function DefaultSkin_EmbeddedSkin(){
- this.dataClass = DefaultSkin_EmbeddedSkin_dataClass;
- super();
- initialWidth = (8800 / 20);
- initialHeight = (6000 / 20);
- }
- override public function get movieClipData():ByteArray{
- if (bytes == null){
- bytes = ByteArray(new this.dataClass());
- };
- return (bytes);
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view.skins {
- import flash.events.*;
- import flash.utils.*;
- import flash.net.*;
- import com.nochump.util.zip.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ZIPSkin extends PNGSkin {
- private var _zipFile:ZipFile;
- override public function load(_arg1:string=null):void{
- var _local2:URLLoader;
- if (Strings.extension(_arg1) == "zip"){
- _urlPrefix = _arg1.substring((_arg1.lastindexof("/") + 1), _arg1.lastindexof("."));
- _local2 = new URLLoader();
- _local2.dataFormat = URLLoaderDataFormat.BINARY;
- _local2.addEventListener(Event.COMPLETE, this.loadComplete);
- _local2.addEventListener(IOErrorEvent.IO_ERROR, loadError);
- _local2.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadError);
- _local2.load(new URLRequest(_arg1));
- } else {
- if (_skin.numChildren == 0){
- sendError("ZIP skin descriptor file must have a .zip extension");
- };
- };
- }
- override protected function loadComplete(_arg1:Event):void{
- var data:* = null;
- var zipEntry:* = null;
- var evt:* = _arg1;
- try {
- data = ((evt.target as URLLoader).data as ByteArray);
- this._zipFile = new ZipFile(data);
- zipEntry = this.getXMLEntry(this._zipFile, _urlPrefix);
- if (!zipEntry){
- sendError("No XML file found in skin ZIP");
- return;
- };
- _urlPrefix = zipEntry.name.substring(0, zipEntry.name.lastindexof("/"));
- _skinXML = xml(string(this._zipFile.getInput(zipEntry)));
- parseSkin();
- } catch(e:error) {
- sendError(e.message);
- };
- }
- protected function getXMLEntry(_arg1:ZipFile, _arg2:string=""):ZipEntry{
- var _local3:ZipEntry = _arg1.getEntry((_arg2 + ".xml"));
- if (_local3){
- return (_local3);
- };
- _local3 = _arg1.getEntry((((_arg2 + "/") + _arg2) + ".xml"));
- if (_local3){
- return (_local3);
- };
- for each (_local3 in _arg1.entries) {
- if (Strings.extension(_local3.name) == "xml"){
- if (xml(string(_arg1.getInput(_local3))).localName() == "skin"){
- return (_local3);
- };
- };
- };
- return (null);
- }
- override protected function loadElements(_arg1:string, _arg2:XMLList):void{
- var element:* = null;
- var file:* = null;
- var zipEntry:* = null;
- var newLoader:* = null;
- var component:* = _arg1;
- var elements:* = _arg2;
- if (!component){
- return;
- };
- for each (element in elements) {
- file = ((component + "/") + [email protected]());
- if (_urlPrefix){
- file = ((_urlPrefix + "/") + file);
- };
- zipEntry = this._zipFile.getEntry(file);
- if (zipEntry){
- try {
- newLoader = new AssetLoader();
- _loaders[newLoader] = {
- componentName:component,
- elementName:[email protected]()
- };
- newLoader.addEventListener(Event.COMPLETE, elementHandler);
- newLoader.addEventListener(ErrorEvent.error, elementError);
- newLoader.loadBytes(this._zipFile.getInput(zipEntry));
- } catch(err:error) {
- sendError(((((("Error loading ZIP skin " + component) + "'s ") + element.tostring()) + ": ") + err.message));
- };
- };
- };
- }
- }
- }//package com.longtailvideo.jwplayer.view.skins
- package com.longtailvideo.jwplayer.view {
- import mx.core.*;
- import flash.utils.*;
- public class View_LoadingScreen extends MovieClipLoaderAsset {
- private static var bytes:ByteArray = null;
- public var dataClass:class;
- public function View_LoadingScreen(){
- this.dataClass = View_LoadingScreen_dataClass;
- super();
- initialWidth = (2000 / 20);
- initialHeight = (300 / 20);
- }
- override public function get movieClipData():ByteArray{
- if (bytes == null){
- bytes = ByteArray(new this.dataClass());
- };
- return (bytes);
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class Logo extends movieclip {
- protected var defaults:object;
- protected var _player:IPlayer;
- protected var timeout:uint;
- protected var loader:Loader;
- protected var animations:Animations;
- protected var _alreadyShown:boolean = false;
- protected var _width:number;
- protected var _height:number;
- public function Logo(_arg1:IPlayer){
- this.defaults = {
- prefix:"http://l.longtailvideo.com/",
- file:"logo.png",
- link:"http://www.longtailvideo.com/players/jw-flv-player/",
- linktarget:"_blank",
- margin:8,
- out:0.5,
- over:1,
- timeout:5,
- hide:"true",
- position:"bottom-left"
- };
- super();
- this.animations = new Animations(this);
- this._player = _arg1;
- _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- this.setupDefaults();
- this.setupMouseEvents();
- this.loadFile();
- }
- protected function setupDefaults():void{
- }
- protected function setupMouseEvents():void{
- this.mouseChildren = false;
- this.buttonMode = true;
- if (this.getConfigParam("link")){
- addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- addEventListener(MouseEvent.CLICK, this.clickHandler);
- } else {
- this.mouseEnabled = false;
- };
- }
- protected function loadFile():void{
- var _local1:RegExp = /(\d+)\.(\d+)\./;
- var _local2:array = _local1.exec(this._player.version);
- var _local3:string = this.getConfigParam("prefix");
- if (((this.getConfigParam("file")) && (_local3))){
- try {
- if (RootReference.root.loaderInfo.url.indexof("https://") == 0){
- _local3 = _local3.replace("http://", "https://secure");
- };
- } catch(e:error) {
- };
- this.defaults["file"] = (((((_local3 + _local2[1]) + "/") + _local2[2]) + "/") + this.getConfigParam("file"));
- };
- if (((this.getConfigParam("file")) && ((RootReference.root.loaderInfo.url.indexof("http") == 0)))){
- this.loader = new Loader();
- this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
- this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this.loader.load(new URLRequest(this.getConfigParam("file")));
- };
- }
- protected function loaderHandler(_arg1:Event):void{
- if ((((this.getConfigParam("hide").tostring() == "true")) && (!((((this._player.state == PlayerState.BUFFERING)) || ((this._player.state == PlayerState.PLAYING))))))){
- visible = false;
- };
- if ((this.loader is DisplayObject)){
- addChild(this.loader);
- this.resize(this._width, this._height);
- this.outHandler();
- } else {
- Logger.log("Logo was not a display object");
- };
- }
- protected function errorHandler(_arg1:ErrorEvent):void{
- Logger.log(("Failed to load logo: " + _arg1.text));
- }
- protected function clickHandler(_arg1:MouseEvent):void{
- this._player.pause();
- this._player.fullscreen(false);
- var _local2:string = this.getConfigParam("link");
- if (_local2){
- navigateToURL(new URLRequest(Strings.cleanLink(_local2)), this.getConfigParam("linktarget"));
- };
- }
- protected function outHandler(_arg1:MouseEvent=null):void{
- alpha = this.getConfigParam("out");
- }
- protected function overHandler(_arg1:MouseEvent):void{
- if (this.getConfigParam("link")){
- alpha = this.getConfigParam("over");
- };
- }
- protected function stateHandler(_arg1:PlayerStateEvent):void{
- switch (this._player.state){
- case PlayerState.BUFFERING:
- if (!this._alreadyShown){
- clearTimeout(this.timeout);
- this._alreadyShown = true;
- this.show();
- };
- break;
- case PlayerState.IDLE:
- this._alreadyShown = false;
- break;
- };
- }
- protected function show():void{
- if (this.getConfigParam("hide").tostring() == "true"){
- visible = true;
- alpha = 0;
- this.animations.fade(this.getConfigParam("out"), 0.1);
- this.timeout = setTimeout(this.hide, (this.getConfigParam("timeout") * 1000));
- mouseEnabled = true;
- };
- }
- protected function hide():void{
- if (this.getConfigParam("hide").tostring() == "true"){
- mouseEnabled = false;
- this.animations.fade(0, 0.1);
- };
- }
- public function resize(_arg1:number, _arg2:number):void{
- this._width = _arg1;
- this._height = _arg2;
- var _local3:DisplayObject = ((this.loader) ? this.loader : null);
- var _local4:number = this.getConfigParam("margin");
- var _local5:string = (this.getConfigParam("position") as string).tolowercase();
- if (_local3){
- if (_local5.indexof("right") >= 0){
- _local3.x = ((this._width - _local3.width) - _local4);
- } else {
- _local3.x = _local4;
- };
- if (_local5.indexof("bottom") >= 0){
- _local3.y = ((this._height - _local3.height) - _local4);
- } else {
- _local3.y = _local4;
- };
- };
- }
- protected function getConfigParam(_arg1:string){
- return (this.defaults[_arg1]);
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.accessibility.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class DockComponent extends CoreComponent implements IDockComponent {
- public var defaults:object;
- private var buttons:array;
- private var timeout:number;
- private var animations:Animations;
- private var currentTab:number = 400;
- private var dimensions:Rectangle;
- public function DockComponent(_arg1:IPlayer){
- this.defaults = {align:"right"};
- super(_arg1, "dock");
- this.animations = new Animations(this);
- this.buttons = new array();
- if (_arg1.config.dock){
- _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
- RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
- RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
- if (this.hideOnIdle){
- alpha = 0;
- };
- } else {
- visible = false;
- };
- }
- public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function, _arg4:string=null):movieclip{
- var _local5:DockButton = new DockButton();
- if (_arg4){
- _local5.name = _arg4;
- };
- if ((_player.skin is SWFSkin)){
- _local5.colorize = true;
- };
- var _local6:AccessibilityProperties = new AccessibilityProperties();
- _local6.name = ((_arg4) ? _arg4 : _arg1.name);
- _local5.accessibilityProperties = _local6;
- _local5.tabenabled = true;
- _local5.tabchildren = false;
- _local5.tabindex = this.currentTab++;
- _local5.setOutIcon(_arg1);
- _local5.outBackground = (getSkinElement("button") as Sprite);
- _local5.overBackground = (getSkinElement("buttonOver") as Sprite);
- _local5.assetColor = ((fontColor) ? fontColor : player.config.backcolor);
- _local5.outColor = player.config.frontcolor;
- _local5.overColor = player.config.lightcolor;
- _local5.clickFunction = _arg3;
- _local5.init();
- _local5.text = _arg2;
- addChild(_local5);
- this.buttons.push(_local5);
- this.resize(getConfigParam("width"), getConfigParam("height"));
- return (_local5);
- }
- public function removeButton(_arg1:string):void{
- var _local2:number = 0;
- while (_local2 < this.buttons.length) {
- if (this.buttons[_local2].name == _arg1){
- this.buttons.splice(_local2, 1);
- removeChild(getChildAt(_local2));
- break;
- };
- _local2++;
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- var _local3:Rectangle;
- var _local4:Rectangle;
- var _local5:number;
- var _local6:number;
- var _local7:number;
- var _local8:number;
- var _local9:number;
- var _local10:number;
- var _local11:DisplayObject;
- if (this.buttons.length > 0){
- _local5 = 10;
- _local6 = ((_arg1 - this.buttons[0].width) - _local5);
- _local7 = _local5;
- _local8 = -1;
- if (getConfigParam("position") == "left"){
- _local8 = 1;
- _local6 = _local5;
- };
- _local9 = 0;
- while (_local9 < this.buttons.length) {
- _local10 = math.floor((_local7 / _arg2));
- _local11 = (this.buttons[_local9] as DisplayObject);
- if (((_local7 + _local11.height) + _local5) > ((_local10 + 1) * _arg2)){
- _local7 = (((_local10 + 1) * _arg2) + _local5);
- _local10 = math.floor((_local7 / _arg2));
- };
- _local11.y = (_local7 % _arg2);
- _local11.x = (_local6 + (((_local11.width + _local5) * _local10) * _local8));
- if (((!(_local3)) || ((((_local11.x <= _local3.x)) && ((_local11.y <= _local3.y)))))){
- _local3 = new Rectangle(_local11.x, _local11.y, _local11.width, _local11.height);
- };
- if (((!(_local4)) || ((((_local11.x >= _local4.x)) && ((_local11.y >= _local4.y)))))){
- _local4 = new Rectangle(_local11.x, _local11.y, _local11.width, _local11.height);
- };
- _local7 = (_local7 + (_local11.height + _local5));
- if ((_local11 is DockButton)){
- (_local11 as DockButton).centerText();
- };
- _local9++;
- };
- };
- if (((_local3) && (_local4))){
- this.dimensions = new Rectangle(_local3.x, _local3.y, ((_local4.x - _local3.x) + _local4.width), ((_local4.y - _local3.y) + _local4.height));
- } else {
- this.dimensions = new Rectangle();
- };
- if (_fullscreen != _player.config.fullscreen){
- _fullscreen = _player.config.fullscreen;
- _sentShow = false;
- };
- this.stateHandler();
- }
- private function get hideOnIdle():boolean{
- return ((string(_player.config.pluginConfig("controlbar")["idlehide"]) == "true"));
- }
- private function startFader():void{
- if (!isnan(this.timeout)){
- clearTimeout(this.timeout);
- };
- this.timeout = setTimeout(this.moveTimeout, 2000);
- }
- private function mouseLeftStage(_arg1:Event=null):void{
- this.moveTimeout();
- }
- private function moveHandler(_arg1:Event=null):void{
- clearTimeout(this.timeout);
- if (hidden){
- return;
- };
- if ((((((player.state == PlayerState.BUFFERING)) || ((player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- this.startFader();
- if (alpha < 1){
- sendShow();
- this.animations.fade(1);
- };
- };
- }
- private function moveTimeout():void{
- if (hidden){
- return;
- };
- if ((((((player.state == PlayerState.BUFFERING)) || ((player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- sendHide();
- this.animations.fade(0);
- };
- }
- public function setButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void{
- var _local7:DisplayObject;
- var _local8:DockJSButton;
- var _local5:number = -1;
- var _local6:number = 0;
- while (_local6 < this.buttons.length) {
- if (this.buttons[_local6].name == _arg1){
- _local5 = _local6;
- break;
- };
- _local6++;
- };
- if (_local5 == -1){
- if (!_arg3){
- return;
- };
- _local7 = (getSkinElement("button") as DisplayObject);
- this.currentTab++;
- _local8 = new DockJSButton(_arg1, _local7, this.currentTab);
- _local8.setClickFunction(_arg2);
- _local8.loadOutIcon(_arg3);
- if (_arg4){
- _local8.loadOverIcon(_arg4);
- };
- addChild(_local8);
- this.buttons.push(_local8);
- this.resize(getConfigParam("width"), getConfigParam("height"));
- } else {
- if (_arg2){
- this.buttons[_local5].setClickFunction(_arg2);
- if (_arg3){
- this.buttons[_local5].loadOutIcon(_arg3);
- };
- if (_arg4){
- this.buttons[_local5].loadOverIcon(_arg4);
- };
- } else {
- removeChild(getChildAt(_local5));
- this.buttons.splice(_local5, 1);
- };
- };
- }
- private function stateHandler(_arg1:PlayerStateEvent=undefined):void{
- switch (player.state){
- case PlayerState.PLAYING:
- case PlayerState.BUFFERING:
- this.startFader();
- break;
- default:
- clearTimeout(this.timeout);
- if (!hidden){
- if (this.hideOnIdle){
- this.moveTimeout();
- } else {
- sendShow();
- this.animations.fade(1);
- };
- };
- };
- }
- override public function show():void{
- if (((player.config.dock) && (hidden))){
- _hiding = false;
- this.visible = true;
- sendShow();
- };
- }
- override public function hide():void{
- if (((player.config.dock) && (!(hidden)))){
- _hiding = true;
- this.visible = false;
- sendHide();
- };
- }
- override protected function get displayRect():Rectangle{
- if (this.dimensions){
- return (this.dimensions);
- };
- return (super.displayRect);
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.accessibility.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.system.*;
- public class PlaylistComponent extends CoreComponent implements IPlaylistComponent {
- private var buttons:array;
- private var buttonheight:number;
- private var active:number;
- private var proportion:number;
- private var scrollInterval:number;
- private var image:array;
- private var back:ColorTransform;
- private var front:ColorTransform;
- private var light:ColorTransform;
- private var list:Sprite;
- private var button:Sprite;
- private var listmask:Sprite;
- private var slider:Sprite;
- private var background:Sprite;
- private var skin:ISkin;
- private var skinLoaded:boolean = false;
- private var pendingResize:Rectangle;
- private var pendingBuild:boolean = false;
- private var imageLoaderMap:Dictionary;
- private var colorizableFields:array;
- public function PlaylistComponent(_arg1:IPlayer){
- var _local2:DefaultSkin;
- this.colorizableFields = ["title", "duration", "description", "author", "tags"];
- super(_arg1, "playlist");
- this.imageLoaderMap = new Dictionary();
- this.buttons = [];
- _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
- _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistHandler);
- _arg1.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.playlistHandler);
- _arg1.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- if ((((_player.skin is SWFSkin)) && (!(_player.skin.hasComponent("playlist"))))){
- _local2 = new DefaultSkin();
- _local2.addEventListener(Event.COMPLETE, this.continueSetup);
- this.skin = _local2;
- _local2.load();
- } else {
- this.skinLoaded = true;
- this.skin = _player.skin;
- this.continueSetup();
- };
- }
- protected function continueSetup(_arg1:Event=null):void{
- var _local3:Sprite;
- this.skinLoaded = true;
- this.background = new Sprite();
- this.background.graphics.beginfill(0, 0);
- this.background.graphics.drawRect(0, 0, 1, 1);
- var _local2:DisplayObject = (this.getSkinElement("background") as Sprite);
- if (_local2){
- this.background.addChild(_local2);
- };
- if (backgroundcolor){
- _local3 = new Sprite();
- _local3.graphics.beginfill(backgroundcolor.color, 1);
- _local3.graphics.drawRect(0, 0, ((_local2) ? _local2.width : 1), ((_local2) ? _local2.height : 1));
- _local3.graphics.endfill();
- this.background.addChildAt(_local3, 0);
- };
- this.background.name = "background";
- this.addElement(this.background);
- this.slider = this.buildSlider();
- this.slider.buttonMode = true;
- this.slider.mouseChildren = false;
- this.slider.addEventListener(MouseEvent.MOUSE_DOWN, this.sdownHandler);
- this.slider.addEventListener(MouseEvent.MOUSE_OVER, this.soverHandler);
- this.slider.addEventListener(MouseEvent.MOUSE_OUT, this.soutHandler);
- this.slider.visible = false;
- this.addElement(this.slider);
- this.listmask = (this.getSkinElement("masker") as Sprite);
- if (!this.listmask){
- this.listmask = new Sprite();
- this.listmask.graphics.beginfill(0xFF0000, 1);
- this.listmask.graphics.drawRect(0, 0, 1, 1);
- this.listmask.graphics.endfill();
- };
- this.addElement(this.listmask);
- this.list = (this.getSkinElement("list") as Sprite);
- if (!this.list){
- this.list = new Sprite();
- this.button = (this.buildButton() as Sprite);
- this.addElement(this.button, this.list);
- } else {
- this.button = (this.list.getChildByName("button") as Sprite);
- };
- this.buttonheight = this.button.height;
- this.button.visible = false;
- this.list.mask = this.listmask;
- this.list.addEventListener(MouseEvent.CLICK, this.clickHandler);
- this.list.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- this.list.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- this.addElement(this.list);
- this.addEventListener(MouseEvent.MOUSE_WHEEL, this.wheelHandler);
- try {
- this.image = new array(this.button.getChildByName("image").width, this.button.getChildByName("image").height);
- } catch(err:error) {
- };
- if (this.button.getChildByName("back")){
- this.setColors();
- };
- if (this.pendingBuild){
- this.buildPlaylist(true);
- };
- if (this.pendingResize){
- this.resize(this.pendingResize.width, this.pendingResize.height);
- };
- }
- private function buildSlider():Sprite{
- var _local4:Sprite;
- var _local5:Sprite;
- var _local6:Sprite;
- var _local1:Sprite = (this.getSkinElement("slider") as Sprite);
- if (!_local1){
- _local1 = new Sprite();
- _local4 = this.buildSliderElement("back", "sliderBackground");
- this.addElement(_local4, _local1);
- _local5 = this.buildSliderElement("rail", "sliderRail", 7, 22);
- this.addElement(_local5, _local1);
- _local6 = this.buildSliderElement("icon", "sliderThumb", 5, 54);
- this.addElement(_local6, _local1, ((_local5.width - _local6.width) / 2));
- };
- var _local2:Sprite = this.buildSliderElement("captop", "sliderCapTop");
- this.addElement(_local2, _local1);
- var _local3:Sprite = this.buildSliderElement("capbottom", "sliderCapBottom");
- this.addElement(_local3, _local1);
- return (_local1);
- }
- private function buildSliderElement(_arg1:string, _arg2:string, _arg3:number=0, _arg4:number=0):Sprite{
- var _local5:Sprite = (this.getSkinElement(_arg2) as Sprite);
- if (!_local5){
- _local5 = new Sprite();
- if ((_arg3 * _arg4) > 0){
- _local5.graphics.beginfill(0, 1);
- _local5.graphics.drawRect(0, 0, _arg3, _arg4);
- _local5.graphics.endfill();
- };
- };
- try {
- _local5.name = _arg1;
- } catch(e:error) {
- };
- return (_local5);
- }
- private function buildButton():movieclip{
- var _local1:movieclip = new movieclip();
- var _local2:Sprite = (this.getSkinElement("itemActive") as Sprite);
- if (_local2){
- _local2.name = "backActive";
- _local2.visible = false;
- this.addElement(_local2, _local1, 0, 0);
- };
- var _local3:Sprite = (this.getSkinElement("itemOver") as Sprite);
- if (_local3){
- _local3.name = "backOver";
- _local3.visible = false;
- this.addElement(_local3, _local1, 0, 0);
- };
- var _local4:Sprite = (this.getSkinElement("item") as Sprite);
- if (!_local4){
- _local4 = new Sprite();
- _local4.graphics.beginfill(0, 1);
- _local4.graphics.drawRect(0, 0, 470, 100);
- _local4.graphics.endfill();
- };
- _local4.name = "back";
- this.addElement(_local4, _local1, 0, 0);
- var _local5:movieclip = new movieclip();
- var _local6:Sprite = (this.getSkinElement("itemImage") as Sprite);
- var _local7:number = 5;
- _local5.name = "image";
- _local5.graphics.beginfill(0, 0);
- if (_local6){
- _local6.name = "imageBackground";
- _local5.addChild(_local6);
- _local6.x = (_local6.y = ((_local4.height - _local6.height) / 2));
- _local5.graphics.drawRect(0, 0, (_local6.width + (2 * _local6.x)), _local4.height);
- _local7 = 0;
- } else {
- _local5.graphics.drawRect(0, 0, ((4 * _local4.height) / 3), _local4.height);
- };
- _local5.graphics.endfill();
- _local5["stacker.noresize"] = true;
- this.addElement(_local5, _local1, 0, 0);
- var _local8:textformat = new textformat();
- _local8.size = ((fontSize) ? fontSize : 13);
- _local8.font = ((fontFace) ? fontFace : "_sans");
- _local8.bold = ((!(fontWeight)) || ((fontWeight == "bold")));
- _local8.italic = (fontStyle == "italic");
- var _local9:textfield = new textfield();
- _local9.name = "title";
- _local9.defaultTextFormat = _local8;
- _local9.wordwrap = true;
- _local9.multiline = true;
- _local9.width = 300;
- _local9.height = 20;
- this.addElement(_local9, _local1, (_local5.width + _local7), 3);
- var _local10:textformat = new textformat();
- _local10.size = ((fontSize) ? (fontSize - 2) : 11);
- _local10.leading = 1;
- _local10.font = ((fontFace) ? fontFace : "_sans");
- _local10.bold = (fontWeight == "bold");
- _local10.italic = (fontStyle == "italic");
- var _local11:textfield = new textfield();
- _local11.name = "description";
- _local11.wordwrap = true;
- _local11.multiline = true;
- _local11.width = 335;
- _local11.height = (_local4.height - 22);
- _local11.defaultTextFormat = _local10;
- if (_local4.height > 40){
- this.addElement(_local11, _local1, ((_local5.width + _local7) + 1), 22);
- };
- var _local12:textfield = new textfield();
- _local12.name = "duration";
- _local12.width = 40;
- _local12.height = 20;
- _local8.align = TextFormatAlign.right;
- _local8.size = ((fontSize) ? (fontSize - 1) : 11);
- _local8.rightmargin = 5;
- _local12.defaultTextFormat = _local8;
- this.addElement(_local12, _local1, ((_local9.x + _local9.width) - 2), 4);
- _local4.width = _local1.width;
- if (_local3){
- _local3.width = _local1.width;
- };
- if (_local2){
- _local2.width = _local1.width;
- };
- return (_local1);
- }
- private function addElement(_arg1:DisplayObject, _arg2:DisplayObjectContainer=null, _arg3:number=0, _arg4:number=0):void{
- if (!_arg2){
- _arg2 = this;
- };
- _arg1.x = _arg3;
- _arg2.addChild(_arg1);
- _arg1.y = _arg4;
- }
- private function get overColor():color{
- return (((getConfigParam("overcolor")) ? new color(string(getConfigParam("overcolor"))) : null));
- }
- private function get activeColor():color{
- return (((getConfigParam("activecolor")) ? new color(string(getConfigParam("activecolor"))) : null));
- }
- private function overHandler(_arg1:MouseEvent):void{
- var _local6:string;
- var _local2:number = number(_arg1.target.name);
- if (((fontColor) && (this.overColor))){
- for each (_local6 in this.colorizableFields) {
- if (((this.getButton(_local2).getChildByName(_local6)) && ((this.getButton(_local2).getChildByName(_local6) is textfield)))){
- (this.getButton(_local2).getChildByName(_local6) as textfield).textcolor = this.overColor.color;
- };
- };
- } else {
- if (((this.front) && (this.back))){
- for each (_local6 in this.colorizableFields) {
- if (((this.getButton(_local2).getChildByName(_local6)) && ((this.getButton(_local2).getChildByName(_local6) is textfield)))){
- (this.getButton(_local2).getChildByName(_local6) as textfield).textcolor = this.back.color;
- };
- };
- };
- };
- var _local3:DisplayObject = this.getButton(_local2).getChildByName("backOver");
- var _local4:DisplayObject = this.getButton(_local2).getChildByName("back");
- var _local5:DisplayObject = this.getButton(_local2).getChildByName("backActive");
- if (this.swfSkinned){
- if (((this.front) && (this.back))){
- _local4.transform.colorTransform = this.light;
- };
- } else {
- if (_local3){
- _local3.visible = true;
- _local4.visible = false;
- if (_local5){
- _local5.visible = false;
- };
- };
- };
- }
- private function outHandler(_arg1:MouseEvent):void{
- var _local3:string;
- var _local4:Sprite;
- var _local5:textfield;
- var _local6:DisplayObject;
- var _local7:DisplayObject;
- var _local8:DisplayObject;
- var _local2:number = number(_arg1.target.name);
- for each (_local3 in this.colorizableFields) {
- _local4 = this.getButton(_local2);
- if (((_local4) && (_local4.getChildByName(_local3)))){
- _local5 = (this.getButton(_local2).getChildByName(_local3) as textfield);
- if (_local5){
- if ((((_local2 == this.active)) && (((this.activeColor) || (((this.light) && (this.swfSkinned))))))){
- _local5.textcolor = ((this.activeColor) ? this.activeColor.color : ((fontColor) ? fontColor.color : this.light.color));
- } else {
- if (((fontColor) && (this.overColor))){
- _local5.textcolor = fontColor.color;
- } else {
- if (((this.front) && (this.back))){
- _local5.textcolor = this.front.color;
- };
- };
- };
- };
- _local6 = this.getButton(_local2).getChildByName("backOver");
- _local7 = this.getButton(_local2).getChildByName("back");
- _local8 = this.getButton(_local2).getChildByName("backActive");
- if (this.swfSkinned){
- if (((this.front) && (this.back))){
- _local7.transform.colorTransform = this.back;
- };
- } else {
- if (_local6){
- _local6.visible = false;
- if (_local8){
- _local7.visible = !((_local2 == this.active));
- _local8.visible = (_local2 == this.active);
- } else {
- _local7.visible = true;
- };
- };
- };
- };
- };
- }
- private function get _playlist():array{
- var _local1:array = [];
- var _local2:number = 0;
- while (_local2 < _player.playlist.length) {
- if (_player.playlist.getItemAt(_local2)["ova.hidden"]){
- } else {
- _local1.push(_player.playlist.getItemAt(_local2));
- };
- _local2++;
- };
- return (_local1);
- }
- private function translateUIToModelPlaylistIndex(_arg1:number):number{
- var _local2:number = 0;
- while (_local2 < _player.playlist.length) {
- if (_player.playlist.getItemAt(_local2).hasOwnProperty("ova.hidden")){
- } else {
- if (_arg1 == 0){
- return (_local2);
- };
- _arg1--;
- };
- _local2++;
- };
- return (0);
- }
- private function translateModelToUIPlaylistIndex(_arg1:number):number{
- var _local2:number = _arg1;
- var _local3:number = 0;
- while (_local3 < _arg1) {
- if (_player.playlist.getItemAt(_local3).hasOwnProperty("ova.hidden")){
- _local2--;
- };
- _local3++;
- };
- return (_local2);
- }
- private function buildPlaylist(_arg1:boolean):void{
- var _local6:number;
- var _local7:movieclip;
- var _local8:Stacker;
- if (!this.skinLoaded){
- this.pendingBuild = true;
- return;
- };
- var _local2:number = getConfigParam("width");
- var _local3:number = getConfigParam("height");
- this.listmask.height = _local3;
- this.listmask.width = _local2;
- this.proportion = ((this._playlist.length * this.buttonheight) / _local3);
- if (this.proportion > 1.01){
- _local2 = (_local2 - this.slider.width);
- this.layoutSlider();
- } else {
- this.slider.visible = false;
- };
- if (_arg1){
- this.list.y = this.listmask.y;
- _local6 = 0;
- while (_local6 < this.buttons.length) {
- this.list.removeChild(this.getButton(_local6));
- _local6++;
- };
- this.buttons = [];
- this.imageLoaderMap = new Dictionary();
- } else {
- if (this.proportion > 1){
- this.scrollEase();
- };
- };
- var _local4:number = 500;
- var _local5:number = 0;
- while (_local5 < this._playlist.length) {
- if (((_arg1) || ((this.buttons.length == 0)))){
- if (this.swfSkinned){
- _local7 = (Draw.clone(this.button, true) as movieclip);
- } else {
- _local7 = this.buildButton();
- this.list.addChild(_local7);
- };
- _local7.tabenabled = true;
- _local7.tabchildren = false;
- var _temp1 = _local4;
- _local4 = (_local4 + 1);
- _local7.tabindex = _temp1;
- _local8 = new Stacker(_local7);
- _local7.y = (_local5 * this.buttonheight);
- _local7.buttonMode = true;
- _local7.mouseChildren = false;
- _local7.name = _local5.tostring();
- this.buttons.push({
- c:_local7,
- s:_local8
- });
- this.setContents(_local5);
- };
- if (this.buttons[_local5]){
- (this.buttons[_local5].s as Stacker).rearrange(_local2);
- };
- _local5++;
- };
- }
- private function layoutSlider():void{
- var _local1:DisplayObject;
- var _local2:DisplayObject;
- var _local3:number;
- this.slider.visible = true;
- this.slider.x = (getConfigParam("width") - this.slider.width);
- if ((player.skin is PNGSkin)){
- _local1 = this.slider.getChildByName("captop");
- _local2 = this.slider.getChildByName("capbottom");
- this.slider.getChildByName("back").y = _local1.height;
- this.slider.getChildByName("rail").y = _local1.height;
- this.slider.getChildByName("icon").y = _local1.height;
- this.slider.getChildByName("back").height = ((getConfigParam("height") - _local2.height) - _local1.height);
- this.slider.getChildByName("rail").height = ((getConfigParam("height") - _local2.height) - _local1.height);
- this.slider.getChildByName("icon").height = math.round((this.slider.getChildByName("rail").height / this.proportion));
- _local2.y = (getConfigParam("height") - _local2.height);
- } else {
- _local3 = ((getConfigParam("height") - this.slider.height) - this.slider.y);
- this.slider.getChildByName("back").height = (this.slider.getChildByName("back").height + _local3);
- this.slider.getChildByName("rail").height = (this.slider.getChildByName("rail").height + _local3);
- this.slider.getChildByName("icon").height = math.round((this.slider.getChildByName("rail").height / this.proportion));
- };
- }
- private function scrollEase(_arg1:number=-1, _arg2:number=-1):void{
- if (_arg1 != -1){
- this.slider.getChildByName("icon").y = math.round((_arg1 - ((_arg1 - this.slider.getChildByName("icon").y) / 1.5)));
- this.list.y = math.round((_arg2 - ((_arg2 - this.list.y) / 1.5)));
- };
- if ((((this.list.y > 0)) || ((this.slider.getChildByName("icon").y < this.slider.getChildByName("rail").y)))){
- this.list.y = this.listmask.y;
- this.slider.getChildByName("icon").y = this.slider.getChildByName("rail").y;
- } else {
- 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))))){
- this.slider.getChildByName("icon").y = ((this.slider.getChildByName("rail").y + this.slider.getChildByName("rail").height) - this.slider.getChildByName("icon").height);
- this.list.y = ((this.listmask.y + this.listmask.height) - this.list.height);
- };
- };
- }
- private function scrollHandler():void{
- var _local1:number = (this.slider.mouseY - this.slider.getChildByName("rail").y);
- var _local2:number = (_local1 - (this.slider.getChildByName("icon").height / 2));
- var _local3:number = ((this.listmask.y + (this.listmask.height / 2)) - (this.proportion * _local1));
- this.scrollEase(_local2, _local3);
- }
- private function setColors():void{
- if (_player.config.backcolor){
- this.back = new ColorTransform();
- this.back.color = _player.config.backcolor.color;
- if (this.swfSkinned){
- this.background.transform.colorTransform = this.back;
- this.slider.getChildByName("back").transform.colorTransform = this.back;
- };
- };
- if (_player.config.frontcolor){
- this.front = new ColorTransform();
- this.front.color = _player.config.frontcolor.color;
- try {
- if (this.swfSkinned){
- this.slider.getChildByName("icon").transform.colorTransform = this.front;
- this.slider.getChildByName("rail").transform.colorTransform = this.front;
- };
- } catch(err:error) {
- };
- if (this.swfSkinned){
- if (_player.config.lightcolor){
- this.light = new ColorTransform();
- this.light.color = _player.config.lightcolor.color;
- } else {
- this.light = this.front;
- };
- };
- };
- }
- private function setContents(_arg1:number):void{
- var _local9:string;
- var _local10:Sprite;
- var _local11:Loader;
- var _local12:AccessibilityProperties;
- var _local2:PlaylistItem = this._playlist[_arg1];
- var _local3:Sprite = this.getButton(_arg1);
- var _local4:textfield = (_local3.getChildByName("title") as textfield);
- var _local5:textfield = (_local3.getChildByName("description") as textfield);
- var _local6:textfield = (_local3.getChildByName("duration") as textfield);
- var _local7:textfield = (_local3.getChildByName("author") as textfield);
- var _local8:textfield = (_local3.getChildByName("tags") as textfield);
- if (((_local2.image) || (_local2["playlist.image"]))){
- _local9 = ((_local2["playlist.image"]) ? _local2["playlist.image"] : _local2.image);
- if (((!((getConfigParam("thumbs") == false))) && (!((_player.config.playlist == "none"))))){
- _local10 = (_local3.getChildByName("image") as Sprite);
- if (_local10){
- _local10.alpha = 0;
- _local11 = new Loader();
- this.imageLoaderMap[_local11] = _arg1;
- _local11.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
- _local11.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- _local11.load(new URLRequest(_local9), new LoaderContext(true));
- };
- };
- };
- if (((_local6) && (_local2.duration))){
- if (_local2.duration > 0){
- _local6.htmltext = (("<b>" + Strings.digits(_local2.duration)) + "</b>");
- if (fontColor){
- _local6.textcolor = fontColor.color;
- } else {
- if (this.front){
- _local6.textcolor = this.front.color;
- };
- };
- } else {
- _local6.visible = false;
- };
- };
- try {
- _local12 = new AccessibilityProperties();
- _local12.name = _local2.title;
- _local12.description = _local2.description;
- _local3.accessibilityProperties = _local12;
- if (_local5){
- _local5.htmltext = _local2.description;
- };
- if (_local4){
- _local4.htmltext = (("<b>" + _local2.title) + "</b>");
- };
- if (_local7){
- _local7.htmltext = _local2.author;
- };
- if (_local8){
- _local8.htmltext = _local2.tags;
- };
- if (fontColor){
- if (_local5){
- _local5.textcolor = fontColor.color;
- };
- if (_local4){
- _local4.textcolor = fontColor.color;
- };
- if (_local7){
- _local7.textcolor = fontColor.color;
- };
- if (_local8){
- _local8.textcolor = fontColor.color;
- };
- } else {
- if (this.front){
- if (_local5){
- _local5.textcolor = this.front.color;
- };
- if (_local4){
- _local4.textcolor = this.front.color;
- };
- if (_local7){
- _local7.textcolor = this.front.color;
- };
- if (_local8){
- _local8.textcolor = this.front.color;
- };
- };
- };
- } catch(e:error) {
- };
- _local10 = (_local3.getChildByName("image") as movieclip);
- if (((_local10) && (((!(((_local2.image) || (_local2["playlist.image"])))) || ((getConfigParam("thumbs") == false)))))){
- if (!_local10.getChildByName("imageBackground")){
- _local3.getChildByName("image").visible = false;
- };
- };
- if (((this.back) && (this.swfSkinned))){
- _local3.getChildByName("back").transform.colorTransform = this.back;
- };
- }
- private function loaderHandler(_arg1:Event):void{
- var ldr:* = null;
- var button:* = null;
- var img:* = null;
- var bg:* = null;
- var msk:* = null;
- var evt:* = _arg1;
- try {
- ldr = (evt.target as LoaderInfo).loader;
- if ((ldr in this.imageLoaderMap)){
- button = this.getButton(this.imageLoaderMap[ldr]);
- delete this.imageLoaderMap[ldr];
- img = (button.getChildByName("image") as Sprite);
- bg = (img.getChildByName("imageBackground") as Sprite);
- img.alpha = 1;
- if (bg){
- msk = this.getSkinElement("itemImage");
- msk.x = bg.x;
- msk.y = bg.y;
- msk.cacheAsBitmap = true;
- button.addChild(msk);
- ldr.x = bg.x;
- ldr.y = bg.y;
- } else {
- msk = Draw.rect(button, "0xFF0000", img.width, img.height, img.x, img.y);
- };
- img.addChild(ldr);
- img.cacheAsBitmap = true;
- img.mask = msk;
- try {
- Draw.smooth((ldr.content as Bitmap));
- } catch(e:error) {
- Logger.log(("Could not smooth thumbnail image: " + e.message));
- };
- Stretcher.stretch(ldr, this.image[0], this.image[1], Stretcher.FILL);
- };
- } catch(err:error) {
- Logger.log(("Error loading playlist image: " + err.message));
- };
- }
- private function errorHandler(_arg1:Event):void{
- var ldr:* = null;
- var button:* = null;
- var img:* = null;
- var evt:* = _arg1;
- try {
- ldr = (evt.target as LoaderInfo).loader;
- button = this.getButton(this.imageLoaderMap[ldr]);
- if (button){
- img = (button.getChildByName("image") as Sprite);
- if (!img.getChildByName("imageBackground")){
- img.visible = false;
- };
- if (this.proportion > 1.01){
- (this.buttons[this.imageLoaderMap[ldr]].s as Stacker).rearrange((getConfigParam("width") - this.slider.width));
- } else {
- (this.buttons[this.imageLoaderMap[ldr]].s as Stacker).rearrange(getConfigParam("width"));
- };
- };
- } catch(err:error) {
- Logger.log(((("Error loading playlist image " + ldr.contentLoaderInfo.url) + ": ") + err.message));
- };
- }
- private function wheelHandler(_arg1:MouseEvent):void{
- }
- private function sdownHandler(_arg1:MouseEvent):void{
- clearinterval(this.scrollInterval);
- RootReference.stage.addEventListener(MouseEvent.MOUSE_UP, this.supHandler);
- this.scrollHandler();
- this.scrollInterval = setinterval(this.scrollHandler, 50);
- }
- private function soutHandler(_arg1:MouseEvent):void{
- if (((this.front) && (this.swfSkinned))){
- this.slider.getChildByName("icon").transform.colorTransform = this.front;
- };
- }
- private function soverHandler(_arg1:MouseEvent):void{
- if (((this.front) && (this.swfSkinned))){
- this.slider.getChildByName("icon").transform.colorTransform = this.light;
- };
- }
- private function supHandler(_arg1:MouseEvent):void{
- clearinterval(this.scrollInterval);
- RootReference.stage.removeEventListener(MouseEvent.MOUSE_UP, this.supHandler);
- }
- private function clickHandler(_arg1:MouseEvent):void{
- var _local2:number = this.translateUIToModelPlaylistIndex(number(_arg1.target.name));
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_ITEM, _local2));
- _player.playlistItem(_local2);
- }
- override public function resize(_arg1:number, _arg2:number):void{
- if (this.skinLoaded){
- setConfigParam("width", _arg1);
- setConfigParam("height", _arg2);
- this.background.width = _arg1;
- this.background.height = _arg2;
- this.buildPlaylist(false);
- if (PlayerLayoutManager.testPosition(getConfigParam("position"))){
- visible = true;
- } else {
- if (getConfigParam("position") == "over"){
- this.stateHandler();
- } else {
- visible = false;
- };
- };
- if (((visible) && ((getConfigParam("visible") === false)))){
- visible = false;
- };
- } else {
- this.pendingResize = new Rectangle(0, 0, _arg1, _arg2);
- };
- }
- protected function itemHandler(_arg1:PlaylistEvent=null):void{
- var _local3:string;
- var _local4:string;
- var _local5:DisplayObject;
- var _local6:DisplayObject;
- var _local7:DisplayObject;
- var _local8:DisplayObject;
- var _local9:DisplayObject;
- var _local10:DisplayObject;
- if (this._playlist.length == 0){
- return;
- };
- var _local2:number = this.translateModelToUIPlaylistIndex(_player.playlist.currentIndex);
- if (!this.skinLoaded){
- return;
- };
- clearinterval(this.scrollInterval);
- if (this.proportion > 1.01){
- this.scrollInterval = setinterval(this.scrollEase, 50, ((_local2 * this.buttonheight) / this.proportion), ((-(_local2) * this.buttonheight) + this.listmask.y));
- };
- if (((((this.light) && (this.swfSkinned))) || (this.activeColor))){
- for each (_local3 in this.colorizableFields) {
- if (this.getButton(_local2).getChildByName(_local3)){
- try {
- (this.getButton(_local2).getChildByName(_local3) as textfield).textcolor = ((this.swfSkinned) ? this.light.color : this.activeColor.color);
- } catch(err:error) {
- };
- };
- };
- };
- if (!isnan(this.active)){
- if (((this.front) || (fontColor))){
- for each (_local4 in this.colorizableFields) {
- if (this.getButton(this.active).getChildByName(_local4)){
- try {
- (this.getButton(this.active).getChildByName(_local4) as textfield).textcolor = ((fontColor) ? fontColor.color : this.front.color);
- } catch(err:error) {
- };
- };
- };
- };
- if (this.swfSkinned){
- if (this.back){
- this.getButton(_local2).getChildByName("back").transform.colorTransform = this.back;
- };
- } else {
- _local5 = this.getButton(this.active).getChildByName("backOver");
- _local6 = this.getButton(this.active).getChildByName("back");
- _local7 = this.getButton(this.active).getChildByName("backActive");
- _local6.visible = true;
- if (_local5){
- _local5.visible = false;
- };
- if (_local7){
- _local7.visible = false;
- };
- };
- };
- this.active = _local2;
- if (!this.swfSkinned){
- _local8 = this.getButton(_local2).getChildByName("backOver");
- _local9 = this.getButton(_local2).getChildByName("back");
- _local10 = this.getButton(_local2).getChildByName("backActive");
- if (_local10){
- _local10.visible = true;
- _local9.visible = false;
- if (_local8){
- _local8.visible = false;
- };
- };
- };
- }
- protected function playlistHandler(_arg1:PlaylistEvent=null):void{
- clearinterval(this.scrollInterval);
- this.active = undefined;
- this.buildPlaylist(true);
- if (this.background){
- this.resize(this.background.width, this.background.height);
- };
- }
- protected function stateHandler(_arg1:PlayerStateEvent=null):void{
- if (getConfigParam("position") == "over"){
- if ((((((player.state == PlayerState.PLAYING)) || ((player.state == PlayerState.PAUSED)))) || ((player.state == PlayerState.BUFFERING)))){
- visible = false;
- } else {
- visible = true;
- };
- };
- }
- private function getButton(_arg1:number):Sprite{
- if (this.buttons[_arg1]){
- return ((this.buttons[_arg1].c as Sprite));
- };
- return (new Sprite());
- }
- private function get swfSkinned():boolean{
- if ((this.skin is SWFSkin)){
- return (this.skin.hasComponent("playlist"));
- };
- return (false);
- }
- override protected function getSkinElement(_arg1:string):DisplayObject{
- return (this.skin.getSkinElement(_name, _arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import flash.display.*;
- import flash.geom.*;
- import flash.text.*;
- public class DockButton extends ComponentButton {
- protected var _assetColor:color;
- protected var _text:textfield;
- private var _colorize:boolean;
- private var _outBackground:Sprite;
- private var _overBackground:Sprite;
- public function DockButton():void{
- var _local1:textformat = new textformat();
- _local1.align = TextFormatAlign.CENTER;
- _local1.font = "_sans";
- _local1.size = 11;
- this._text = new textfield();
- this._text.defaultTextFormat = _local1;
- this._text.x = 0;
- this._text.y = 30;
- this._text.width = 50;
- this._text.height = 20;
- }
- override public function init():void{
- var _local1:Sprite;
- if (((!(this._overBackground)) && (!(this._outBackground)))){
- this.setupBackground();
- setBackground(this._outBackground);
- } else {
- if (this._outBackground){
- if (((this._colorize) && (_outColor))){
- this._outBackground.transform.colorTransform = this.createColorTransform(_outColor);
- };
- setBackground(this._outBackground);
- } else {
- if (!_background){
- _local1 = new Sprite();
- _local1.graphics.clear();
- _local1.graphics.beginfill(((_outColor) ? _outColor.color : 0), 0.55);
- _local1.graphics.drawRect(0, 0, 50, 50);
- _local1.graphics.endfill();
- setBackground(_local1);
- };
- };
- };
- super.init();
- _imageLayer.addChild(this._text);
- if (this._assetColor){
- this._text.textcolor = this._assetColor.color;
- } else {
- this._text.textcolor = 0xFFFFFF;
- };
- mouseChildren = false;
- buttonMode = true;
- }
- protected function createColorTransform(_arg1:color):ColorTransform{
- var _local2:ColorTransform = new ColorTransform();
- if (_arg1){
- _local2.color = _arg1.color;
- };
- return (_local2);
- }
- private function setupBackground():void{
- this._outBackground = new Sprite();
- this._outBackground.graphics.clear();
- this._outBackground.graphics.beginfill(((_outColor) ? _outColor.color : 0), 0.55);
- this._outBackground.graphics.drawRect(0, 0, 50, 50);
- this._outBackground.graphics.endfill();
- this._overBackground = new Sprite();
- this._overBackground.graphics.clear();
- this._overBackground.graphics.beginfill(((_overColor) ? _overColor.color : 0), 0.55);
- this._overBackground.graphics.drawRect(0, 0, 50, 50);
- this._overBackground.graphics.endfill();
- }
- public function centerText():void{
- this._text.width = _background.width;
- this._text.y = ((_background.height / 2) + (((_background.height / 2) - this._text.height) / 2));
- }
- override protected function centerIcon(_arg1:DisplayObject):void{
- if (_arg1){
- if (_background){
- _arg1.x = ((_background.width - _arg1.width) / 2);
- _arg1.y = ((_background.height - (_arg1.height * 1.5)) / 2);
- } else {
- _arg1.x = 0;
- _arg1.y = 0;
- };
- };
- }
- override protected function outHandler(_arg1:MouseEvent):void{
- if (this._outBackground){
- setBackground(this._outBackground);
- } else {
- if (this._colorize){
- _background.transform.colorTransform = this.createColorTransform(_outColor);
- };
- };
- }
- override protected function overHandler(_arg1:MouseEvent):void{
- if (this._overBackground){
- setBackground(this._overBackground);
- } else {
- if (this._colorize){
- _background.transform.colorTransform = this.createColorTransform(_overColor);
- };
- };
- }
- override protected function clickHandler(_arg1:MouseEvent):void{
- super.clickHandler(_arg1);
- }
- public function set assetColor(_arg1:color):void{
- this._assetColor = _arg1;
- }
- public function set colorize(_arg1:boolean):void{
- this._colorize = _arg1;
- }
- public function set outBackground(_arg1:Sprite):void{
- this._outBackground = _arg1;
- }
- public function set overBackground(_arg1:Sprite):void{
- this._overBackground = _arg1;
- }
- public function set text(_arg1:string):void{
- this._text.text = _arg1;
- this.centerText();
- }
- public function get field():textfield{
- return (this._text);
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import flash.events.*;
- import flash.display.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.external.*;
- public class DockJSButton extends ComponentButton {
- private var _click:string;
- private var _overLoader:Loader;
- private var _outLoader:Loader;
- private var _lastOver:string;
- private var _lastOut:string;
- public function DockJSButton(_arg1:string, _arg2:DisplayObject, _arg3:number):void{
- this.name = _arg1;
- setBackground(_arg2);
- this.tabenabled = true;
- this.tabchildren = false;
- this.tabindex = _arg3;
- this.buttonMode = true;
- this._outLoader = new Loader();
- this._outLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this._loadOutHandler);
- this._outLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._overLoader = new Loader();
- this._overLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this._loadOverHandler);
- this._overLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- }
- private function errorHandler(_arg1:ErrorEvent):void{
- Logger.log(("Dock image could not be loaded: " + _arg1.text));
- }
- public function loadOutIcon(_arg1:string):void{
- if ((((((this._lastOut == _arg1)) && (this._outLoader))) && ((this._outLoader.contentLoaderInfo.bytesloaded == this._outLoader.contentLoaderInfo.bytestotal)))){
- this._loadOutHandler();
- } else {
- this._lastOut = _arg1;
- this._outLoader.load(new URLRequest(_arg1));
- };
- }
- private function _loadOutHandler(_arg1:Event=null):void{
- setOutIcon(this._outLoader);
- init();
- }
- public function loadOverIcon(_arg1:string):void{
- if ((((((this._lastOver == _arg1)) && (this._overLoader))) && ((this._overLoader.contentLoaderInfo.bytesloaded == this._overLoader.contentLoaderInfo.bytestotal)))){
- this._loadOutHandler();
- } else {
- this._lastOver = _arg1;
- this._overLoader.load(new URLRequest(_arg1));
- };
- }
- private function _loadOverHandler(_arg1:Event=null):void{
- setOverIcon(this._overLoader);
- }
- private function _onClick(_arg1:MouseEvent):void{
- ExternalInterface.call(this._click, name);
- }
- public function setClickFunction(_arg1:string):void{
- this._click = _arg1;
- clickFunction = this._onClick;
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class DisplayComponent extends CoreComponent implements IDisplayComponent {
- protected var _icon:DisplayObject;
- protected var _iconArea:Rectangle;
- protected var _background:movieclip;
- protected var _overlay:Sprite;
- protected var _text:textfield;
- protected var _textBack:Sprite;
- protected var _icons:object;
- protected var _rotateInterval:number;
- protected var _bufferIcon:Sprite;
- protected var _rotate:boolean = true;
- protected var _youtubeMask:movieclip;
- protected var _bufferRotationTime:number = 100;
- protected var _bufferRotationAngle:number = 15;
- protected var _bufferStateTimer:Timer;
- protected var _playStateTimer:Timer;
- protected var _previousState:string;
- public function DisplayComponent(_arg1:IPlayer){
- super(_arg1, "display");
- this.addListeners();
- this.setupDisplayObjects();
- this.setupIcons();
- if (!isnan(getConfigParam("bufferrotation"))){
- this._bufferRotationAngle = number(getConfigParam("bufferrotation"));
- };
- if (!isnan(getConfigParam("bufferinterval"))){
- this._bufferRotationTime = number(getConfigParam("bufferinterval"));
- };
- this._bufferStateTimer = new Timer(50, 1);
- this._bufferStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.showBufferIcon);
- this._playStateTimer = new Timer(50, 1);
- this._playStateTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.showPlayIcon);
- }
- private function itemHandler(_arg1:PlaylistEvent):void{
- this._playStateTimer.delay = ((this._icon) ? 10 : 50);
- this._playStateTimer.start();
- if (this.background){
- if (((_player.playlist.currentItem) && ((_player.playlist.currentItem.provider == "youtube")))){
- this.background.mask = this._youtubeMask;
- } else {
- this.background.mask = null;
- };
- };
- }
- private function addListeners():void{
- player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.stateHandler);
- player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- player.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.errorHandler);
- player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
- addEventListener(MouseEvent.CLICK, this.clickHandler);
- this.buttonMode = true;
- }
- private function setupDisplayObjects():void{
- this._background = new movieclip();
- this.background.name = "background";
- addChildAt(this.background, 0);
- this.background.graphics.beginfill(0, 0);
- this.background.graphics.drawRect(0, 0, 1, 1);
- this.background.graphics.endfill();
- this._overlay = new Sprite();
- this._overlay.name = "overlay";
- addChildAt(this._overlay, 1);
- this._textBack = new Sprite();
- this._textBack.name = "textBackground";
- this._textBack.graphics.beginfill(0, 0.8);
- this._textBack.graphics.drawRect(0, 0, 1, 1);
- this._textBack.visible = false;
- this._overlay.addChild(this._textBack);
- this._text = new textfield();
- this.text.gridFitType = GridFitType.NONE;
- this.text.defaultTextFormat = new textformat("_sans", null, 0xFFFFFF);
- this._overlay.addChild(this.text);
- this._youtubeMask = new movieclip();
- }
- protected function setupIcons():void{
- this._icons = {};
- this.setupIcon("buffer");
- this.setupIcon("play");
- this.setupIcon("mute");
- }
- protected function centerIcon(_arg1:Sprite):void{
- var _local2:number;
- if (_arg1){
- _local2 = 0;
- while (_local2 < _arg1.numChildren) {
- _arg1.getChildAt(_local2).x = (-(math.round(_arg1.getChildAt(_local2).width)) / 2);
- _arg1.getChildAt(_local2).y = (-(math.round(_arg1.getChildAt(_local2).height)) / 2);
- _local2++;
- };
- };
- }
- protected function setupIcon(_arg1:string):void{
- var bufferBitmap:* = null;
- var name:* = _arg1;
- var iconElement:* = (getSkinElement((name + "Icon")) as Sprite);
- var iconOver:* = (getSkinElement((name + "IconOver")) as Sprite);
- if (!iconElement){
- return;
- };
- if ((_player.skin is PNGSkin)){
- if (iconElement.getChildByName("bitmap")){
- this.centerIcon(iconElement);
- iconElement.name = "out";
- };
- if (((iconOver) && (iconOver.getChildByName("bitmap")))){
- this.centerIcon(iconOver);
- iconOver.name = "over";
- };
- };
- if (name == "buffer"){
- if ((player.skin is PNGSkin)){
- if ((((iconElement is movieclip)) && (((iconElement as movieclip).totalFrames > 1)))){
- this._rotate = false;
- } else {
- try {
- this._bufferIcon = iconElement;
- bufferBitmap = (this._bufferIcon.getChildByName("bitmap") as Bitmap);
- if (bufferBitmap){
- Draw.smooth(bufferBitmap);
- } else {
- this.centerIcon(iconElement);
- };
- } catch(e:error) {
- _rotate = false;
- };
- };
- } else {
- this._rotate = false;
- };
- };
- var back:* = (getSkinElement("background") as Sprite);
- if (back){
- if ((_player.skin is PNGSkin)){
- this.centerIcon(back);
- };
- } else {
- back = new Sprite();
- };
- if (((((iconOver) && ((player.skin is PNGSkin)))) && (!((name == "buffer"))))){
- iconOver.visible = false;
- back.addChild(iconOver);
- back.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- back.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- };
- back.addChild(iconElement);
- if ((((player.skin is PNGSkin)) && (!(iconElement.getChildByName("bitmap"))))){
- if (((!((name == "buffer"))) || (!(this._rotate)))){
- this.centerIcon(back);
- };
- } else {
- back.x = (back.y = (iconElement.x = (iconElement.y = 0)));
- };
- this._icons[name] = back;
- }
- protected function overHandler(_arg1:MouseEvent):void{
- var _local2:Sprite = (this._icon as Sprite);
- if (_local2){
- this.setIconHover(_local2, true);
- };
- }
- protected function outHandler(_arg1:MouseEvent):void{
- var _local2:Sprite = (this._icon as Sprite);
- if (_local2){
- this.setIconHover(_local2, false);
- };
- }
- protected function setIconHover(_arg1:Sprite, _arg2:boolean):void{
- var _local3:DisplayObject = _arg1.getChildByName("over");
- var _local4:DisplayObject = _arg1.getChildByName("out");
- if (((_local3) && (_local4))){
- _local3.visible = _arg2;
- _local4.visible = !(_arg2);
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- this._background.width = _arg1;
- this._background.height = _arg2;
- this._youtubeMask.graphics.clear();
- this._youtubeMask.graphics.beginfill(0xAA00, 0.3);
- this._youtubeMask.graphics.drawRect(0, 0, _arg1, (_arg2 - 100));
- this._youtubeMask.graphics.endfill();
- this.positionIcon();
- this.positionText();
- this.stateHandler();
- }
- public function setIcon(_arg1:DisplayObject):void{
- var _local2:boolean;
- var _local3:boolean;
- try {
- if (((this._icon) && ((this._icon.parent == this._overlay)))){
- this._overlay.removeChild(this._icon);
- this._icon = null;
- _local3 = !(_hiding);
- } else {
- _local2 = !(_hiding);
- };
- } catch(err:error) {
- };
- if (_fullscreen != _player.config.fullscreen){
- _fullscreen = _player.config.fullscreen;
- _local2 = true;
- };
- if (((((_arg1) && (_player.config.icons))) && ((((getConfigParam("icons") === true)) || ((typeof(getConfigParam("icons")) == "undefined")))))){
- if ((_arg1 is Sprite)){
- this.setIconHover((_arg1 as Sprite), false);
- };
- this._icon = _arg1;
- this._overlay.addChild(this._icon);
- this.positionIcon();
- this._iconArea = this._icon.getRect(this._overlay);
- if (_local2){
- sendShow();
- };
- } else {
- if (_local3){
- sendHide();
- };
- this._iconArea = null;
- };
- }
- private function positionIcon():void{
- if (this._icon){
- this._icon.x = (this.background.scaleX / 2);
- this._icon.y = (this.background.scaleY / 2);
- };
- }
- public function setText(_arg1:string):void{
- if ((((this._icon is Sprite)) && (((this._icon as Sprite).getChildByName("txt") is textfield)))){
- ((this._icon as Sprite).getChildByName("txt") as textfield).text = ((_arg1) ? _arg1 : "");
- this.text.text = "";
- } else {
- this.text.text = ((_arg1) ? _arg1 : "");
- };
- this.positionText();
- }
- private function positionText():void{
- if (this.text.text){
- this.text.visible = true;
- this._textBack.visible = true;
- if (this.text.width > (this.background.scaleX * 0.75)){
- this.text.width = (this.background.scaleX * 0.75);
- this.text.wordwrap = true;
- } else {
- this.text.autosize = TextFormatAlign.CENTER;
- };
- this.text.x = ((this.background.scaleX - this.text.textwidth) / 2);
- if (((this._icon) && (contains(this._icon)))){
- this.text.y = ((this._icon.y + (this._icon.height / 2)) + 10);
- } else {
- this.text.y = ((this.background.scaleY - this.text.textheight) / 2);
- };
- this._textBack.y = (this.text.y - 2);
- this._textBack.width = getConfigParam("width");
- this._textBack.height = (this.text.height + 4);
- } else {
- this.text.visible = false;
- this._textBack.visible = false;
- };
- }
- protected function setDisplay(_arg1:DisplayObject, _arg2:string=null):void{
- this.setIcon(_arg1);
- this.setText(((_arg2)!=null) ? _arg2 : this.text.text);
- }
- protected function clearDisplay():void{
- this.setDisplay(null, "");
- }
- protected function stateHandler(_arg1:PlayerEvent=null):void{
- if (((!((this._previousState == player.state))) || (!((_arg1 is PlayerStateEvent))))){
- this.clearRotation();
- this._bufferStateTimer.reset();
- this._playStateTimer.reset();
- this._bufferStateTimer.delay = ((this._icon) ? 10 : 200);
- this._playStateTimer.delay = ((this._icon) ? 10 : 10);
- switch (player.state){
- case PlayerState.BUFFERING:
- this._bufferStateTimer.start();
- break;
- case PlayerState.PAUSED:
- case PlayerState.IDLE:
- this._playStateTimer.start();
- break;
- default:
- if (((player.config.mute) && (getConfigParam("showmute")))){
- this.setDisplay(this._icons["mute"]);
- } else {
- this.clearDisplay();
- };
- };
- };
- }
- protected function showBufferIcon(_arg1:TimerEvent):void{
- this.setDisplay(this._icons["buffer"], "");
- if (this._rotate){
- this.startRotation();
- };
- }
- protected function showPlayIcon(_arg1:TimerEvent):void{
- this.setDisplay(this._icons["play"]);
- }
- protected function startRotation():void{
- if (((!(this._rotateInterval)) && (!(((this._bufferRotationAngle % 360) == 0))))){
- this._rotateInterval = setinterval(this.updateRotation, this._bufferRotationTime);
- };
- }
- protected function updateRotation():void{
- if (this._bufferIcon){
- this._bufferIcon.rotation = (this._bufferIcon.rotation + this._bufferRotationAngle);
- };
- }
- protected function clearRotation():void{
- if (this._bufferIcon){
- this._bufferIcon.rotation = 0;
- };
- if (this._rotateInterval){
- clearinterval(this._rotateInterval);
- this._rotateInterval = undefined;
- };
- }
- protected function errorHandler(_arg1:PlayerEvent):void{
- this.setDisplay(null, _arg1.message);
- }
- protected function clickHandler(_arg1:MouseEvent):void{
- var _local2:string;
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_CLICK));
- if (_player.config.displayclick == "link"){
- _local2 = _player.playlist.currentItem.link;
- if (_local2){
- navigateToURL(new URLRequest(Strings.cleanLink(_local2)), _player.config.linktarget);
- };
- } else {
- if ((((player.state == PlayerState.PLAYING)) || ((player.state == PlayerState.BUFFERING)))){
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_PAUSE));
- } else {
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_PLAY));
- };
- };
- }
- protected function get text():textfield{
- return (this._text);
- }
- protected function get background():movieclip{
- return (this._background);
- }
- override public function hide():void{
- if (this._overlay){
- this._overlay.visible = false;
- };
- if (!_hiding){
- if (this._icon){
- sendShow();
- };
- _hiding = true;
- };
- }
- override public function show():void{
- if (this._overlay){
- this._overlay.visible = true;
- };
- if (_hiding){
- if (this._icon){
- sendHide();
- };
- _hiding = false;
- };
- }
- override protected function get displayRect():Rectangle{
- return (((this._iconArea) ? this._iconArea : super.displayRect));
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import flash.display.*;
- import flash.text.*;
- public class ControlbarLayoutManager {
- protected var _controlbar:ControlbarComponent;
- protected var _currentLeft:number;
- protected var _currentRight:number;
- protected var _height:number;
- protected var _tabLeft:number;
- protected var _tabRight:number;
- public function ControlbarLayoutManager(_arg1:ControlbarComponent){
- this._controlbar = _arg1;
- }
- public function resize(_arg1:number, _arg2:number):void{
- var _local3:RegExp;
- var _local4:object;
- if (((_arg1) && (_arg2))){
- this._height = _arg2;
- this._currentLeft = 0;
- if (this._controlbar.getButton("capLeft")){
- this._currentLeft = (this._currentLeft + this._controlbar.getButton("capLeft").width);
- };
- this._currentRight = _arg1;
- if (this._controlbar.getButton("capRight")){
- this._currentRight = (this._currentRight - this._controlbar.getButton("capRight").width);
- };
- _local3 = /\[(.*)\]\[(.*)\]\[(.*)\]/;
- _local4 = _local3.exec(this._controlbar.layout);
- this._tabLeft = 300;
- this._tabRight = 399;
- this.position(_local4[1], "left");
- this.position(_local4[3], "right");
- this.positionCenter(_local4[2]);
- };
- }
- private function position(_arg1:string, _arg2:string):void{
- var _local5:string;
- var _local6:array;
- var _local7:number;
- var _local8:array;
- var _local9:number;
- var _local10:string;
- var _local11:DisplayObject;
- var _local3:array = _arg1.split(/(<[^>]*>)/);
- if (_arg2 == "right"){
- _local3 = _local3.reverse();
- };
- var _local4:number = 0;
- while (_local4 < _local3.length) {
- _local5 = _local3[_local4];
- if (_local5){
- _local6 = /<(.*)>/.exec(_local5);
- if (_local6){
- if (isnan(_local6[1])){
- this.place(this._controlbar.getButton(_local6[1]), _arg2);
- } else {
- _local7 = number(_local6[1]);
- if (_arg2 == "left"){
- this._currentLeft = (this._currentLeft + _local7);
- } else {
- if (_arg2 == "right"){
- this._currentRight = (this._currentRight - _local7);
- };
- };
- };
- } else {
- _local8 = _local5.split(" ");
- if (_arg2 == "right"){
- _local8 = _local8.reverse();
- };
- _local9 = 0;
- while (_local9 < _local8.length) {
- _local10 = _local8[_local9];
- _local11 = this._controlbar.getButton(_local8[_local9]);
- this.place(this._controlbar.getButton(_local8[_local9]), _arg2);
- _local9++;
- };
- };
- };
- _local4++;
- };
- }
- private function place(_arg1:DisplayObject, _arg2:string):void{
- var _local3:Sprite = (_arg1 as Sprite);
- if (_arg2 == "left"){
- if (((_local3) && (_local3.buttonMode))){
- _local3.tabindex = this._tabLeft++;
- };
- this.placeLeft(_arg1);
- } else {
- if (_arg2 == "right"){
- if (((_local3) && (_local3.buttonMode))){
- _local3.tabindex = this._tabRight--;
- };
- this.placeRight(_arg1);
- };
- };
- }
- private function placeLeft(_arg1:DisplayObject):void{
- var _local2:DisplayObjectContainer;
- if (_arg1){
- _arg1.visible = true;
- if (!this._controlbar.contains(_arg1)){
- this._controlbar.addChild(_arg1);
- };
- _local2 = (_arg1 as DisplayObjectContainer);
- if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
- this._currentLeft = (this._currentLeft + 5);
- } else {
- if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
- this._currentLeft = (this._currentLeft + 5);
- };
- };
- _arg1.x = this._currentLeft;
- _arg1.y = ((this._height - _arg1.height) / 2);
- this._currentLeft = (this._currentLeft + _arg1.width);
- if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
- this._currentLeft = (this._currentLeft + 5);
- } else {
- if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
- this._currentLeft = (this._currentLeft + 5);
- };
- };
- };
- }
- private function placeRight(_arg1:DisplayObject):void{
- var _local2:DisplayObjectContainer;
- if (_arg1){
- _arg1.visible = true;
- if (!this._controlbar.contains(_arg1)){
- this._controlbar.addChild(_arg1);
- };
- _local2 = (_arg1 as DisplayObjectContainer);
- if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
- this._currentRight = (this._currentRight - 5);
- } else {
- if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
- this._currentRight = (this._currentRight - 5);
- };
- };
- this._currentRight = (this._currentRight - _arg1.width);
- _arg1.x = this._currentRight;
- _arg1.y = ((this._height - _arg1.height) / 2);
- if (((_local2) && ((_local2.getChildByName("text") is textfield)))){
- this._currentRight = (this._currentRight - 5);
- } else {
- if ((((_arg1 is Slider)) && (((_arg1 as Slider).capsWidth == 0)))){
- this._currentRight = (this._currentRight - 5);
- };
- };
- };
- }
- private function positionCenter(_arg1:string):void{
- var _local9:array;
- var _local10:number;
- var _local11:DisplayObject;
- var _local2:RegExp = /\W/;
- var _local3:array = _arg1.split(_local2);
- var _local4:array = _arg1.split(/<[^\>]*>/);
- var _local5:DisplayObject = this._controlbar.getButton("divider");
- var _local6:number = 0;
- if (_local5){
- _local6 = (_local5.width * (_local4.length - 1));
- };
- var _local7:number = (((this._currentRight - this._currentLeft) - _local6) / _local3.length);
- var _local8:number = 0;
- while (_local8 < _local4.length) {
- if (_local8 > 0){
- this.placeLeft(_local5);
- };
- _local9 = (_local4[_local8] as string).split(" ");
- _local10 = 0;
- while (_local10 < _local9.length) {
- _local11 = this._controlbar.getButton(_local9[_local10]);
- if (_local11){
- if ((_local11 is ComponentButton)){
- (_local11 as ComponentButton).resize(_local7, _local11.height);
- } else {
- if ((_local11 is Slider)){
- (_local11 as Slider).resize(_local7, _local11.height);
- };
- };
- _local11.visible = true;
- if (!this._controlbar.contains(_local11)){
- this._controlbar.addChild(_local11);
- };
- _local11.x = this._currentLeft;
- _local11.y = ((this._height - _local11.height) / 2);
- };
- _local10++;
- };
- _local8++;
- };
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import flash.geom.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class Slider extends Sprite {
- protected var _rail:Sprite;
- protected var _buffer:Sprite;
- protected var _progress:Sprite;
- protected var _thumb:Sprite;
- protected var _capLeft:Sprite;
- protected var _capRight:Sprite;
- protected var _clickArea:Sprite;
- protected var _currentThumb:number = 0;
- protected var _currentProgress:number = 0;
- protected var _currentBuffer:number = 0;
- protected var _front:ColorTransform;
- protected var _light:ColorTransform;
- protected var _width:number;
- protected var _height:number;
- protected var _dragging:boolean;
- protected var _lock:boolean;
- protected var _bufferOffset:number = 0;
- public function Slider(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObject, _arg4:DisplayObject, _arg5:DisplayObject=null, _arg6:DisplayObject=null){
- if (((!(_arg1)) || (!(_arg3)))){
- throw (new ArgumentError("Required slider elements missing"));
- };
- this.buttonMode = true;
- this.mouseChildren = true;
- this._rail = this.addElement(_arg1, "rail", true);
- this._buffer = this.addElement(_arg2, "buffer");
- this._progress = this.addElement(_arg3, "progress");
- this._thumb = this.addElement(_arg4, "thumb");
- this._capLeft = this.addElement(_arg5, "capleft", true);
- this._capRight = this.addElement(_arg6, "capright", true);
- this._clickArea = this.addElement(null, "clickarea", true);
- this._clickArea.addEventListener(MouseEvent.MOUSE_DOWN, this.downHandler);
- this._clickArea.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- this._clickArea.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- }
- private function addElement(_arg1:DisplayObject, _arg2:string, _arg3:boolean=false):Sprite{
- if (!_arg1){
- _arg1 = new Sprite();
- };
- _arg1.visible = _arg3;
- addChild(_arg1);
- _arg1.name = _arg2;
- return ((_arg1 as Sprite));
- }
- protected function setThumb(_arg1:number):void{
- this._currentThumb = _arg1;
- }
- public function setProgress(_arg1:number):void{
- if (isnan(_arg1)){
- _arg1 = 0;
- };
- this._currentProgress = _arg1;
- if (this._progress){
- this._progress.visible = true;
- };
- this.setThumb(_arg1);
- this.resize(this.width, this.height);
- }
- public function setBuffer(_arg1:number, _arg2:number=nan):void{
- if (!isnan(_arg1)){
- this._currentBuffer = math.min(math.max(_arg1, 0), 100);
- };
- if (!isnan(_arg2)){
- this._bufferOffset = math.min(math.max(_arg2, 0), 100);
- };
- if (this._buffer){
- this._buffer.visible = (this._currentBuffer > 0);
- };
- this.resize(this.width, this.height);
- }
- public function resize(_arg1:number, _arg2:number):void{
- var _local3:number = this.scaleX;
- this.scaleX = 1;
- this._width = (((_arg1 * _local3) - this._capLeft.width) - this._capRight.width);
- this._height = _arg2;
- this._capLeft.x = 0;
- this._capRight.x = (_arg1 - this._capRight.width);
- var _local4:DisplayObject = this._rail.getChildByName("bitmap");
- if (_local4){
- _local4.width = this._width;
- _local4.x = this._capLeft.width;
- this.resizeElement(_local4);
- };
- var _local5:DisplayObject = this._buffer.getChildByName("bitmap");
- if (_local5){
- _local5.width = (this._width * (1 - (this._bufferOffset / 100)));
- _local5.x = (this._capLeft.width + ((this._width * this._bufferOffset) / 100));
- this.resizeElement(_local5, this._currentBuffer);
- };
- var _local6:DisplayObject = this._progress.getChildByName("bitmap");
- if (((_local6) && (!(this._dragging)))){
- _local6.width = this._width;
- _local6.x = this._capLeft.width;
- this.resizeElement(_local6, this._currentProgress);
- };
- if (((this._thumb) && (!(this._dragging)))){
- this._thumb.x = (this._capLeft.width + (((this._width - this._thumb.width) * this._currentThumb) / 100));
- };
- this._clickArea.graphics.clear();
- this._clickArea.graphics.beginfill(0, 0);
- this._clickArea.graphics.drawRect(this._capLeft.width, 0, this._width, _arg2);
- this.verticalCenter();
- }
- private function resizeElement(_arg1:DisplayObject, _arg2:number=100):void{
- var _local3:Sprite;
- if (_arg1){
- if (((this._width) && (this._height))){
- if (_arg1.mask){
- _local3 = (_arg1.mask as Sprite);
- } else {
- _local3 = new Sprite();
- _local3.name = "mask";
- addChild(_local3);
- _arg1.mask = _local3;
- };
- _local3.x = _arg1.x;
- _local3.graphics.clear();
- _local3.graphics.beginfill(0xFF, 0);
- _local3.graphics.drawRect(0, 0, ((_arg1.width * _arg2) / 100), _arg1.height);
- _local3.graphics.endfill();
- };
- };
- }
- private function verticalCenter():void{
- var _local2:DisplayObject;
- var _local1:number = 0;
- var _local3:number = 0;
- while (_local3 < numChildren) {
- _local2 = getChildAt(_local3);
- if (_local2.height > _local1){
- _local1 = _local2.height;
- };
- _local3++;
- };
- _local3 = 0;
- while (_local3 < numChildren) {
- _local2 = getChildAt(_local3);
- _local2.y = ((_local1 - _local2.height) / 2);
- _local3++;
- };
- }
- private function downHandler(_arg1:MouseEvent):void{
- var _local2:Rectangle;
- if (((this._thumb) && (!(this._lock)))){
- _local2 = new Rectangle(this._capLeft.width, this._thumb.y, (this._rail.width - this._thumb.width), 0);
- this._thumb.startdrag(true, _local2);
- this._dragging = true;
- RootReference.stage.addEventListener(MouseEvent.MOUSE_UP, this.upHandler);
- };
- }
- private function upHandler(_arg1:MouseEvent):void{
- RootReference.stage.removeEventListener(MouseEvent.MOUSE_UP, this.upHandler);
- this._thumb.stopdrag();
- this._dragging = false;
- var _local2:number = ((this._thumb.x - this._capLeft.width) / (this._rail.width - this._thumb.width));
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_CLICK, _local2));
- this.setThumb((_local2 * 100));
- }
- private function outHandler(_arg1:MouseEvent):void{
- }
- private function overHandler(_arg1:MouseEvent):void{
- }
- public function reset():void{
- this.setBuffer(0);
- this.setProgress(0);
- }
- public function lock():void{
- this._lock = true;
- }
- public function unlock():void{
- this._lock = false;
- }
- public function get thumbVisible():boolean{
- return (this._thumb.visible);
- }
- public function set thumbVisible(_arg1:boolean):void{
- this._thumb.visible = _arg1;
- }
- public function get capsWidth():number{
- return ((this._capLeft.width + this._capRight.width));
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- public class CoreComponent extends movieclip implements IGlobalEventDispatcher, IPlayerComponent {
- private var _dispatcher:IGlobalEventDispatcher;
- protected var _player:IPlayer;
- protected var _name:string;
- protected var _hiding:boolean = false;
- protected var _fullscreen:boolean = false;
- protected var _sentShow:boolean = false;
- protected var _sentHide:boolean = false;
- protected var _playerReady:boolean = false;
- protected var _showOnReady:boolean = false;
- public function CoreComponent(_arg1:IPlayer, _arg2:string){
- this._dispatcher = new GlobalEventDispatcher();
- this._player = _arg1;
- this._name = _arg2;
- super();
- this._player.addEventListener(PlayerEvent.JWPLAYER_READY, this.readyHandler);
- }
- protected function readyHandler(_arg1:PlayerEvent):void{
- this._playerReady = true;
- if (this._showOnReady){
- this.sendShow();
- };
- }
- public function hide():void{
- if (!this._hiding){
- this._hiding = true;
- this.visible = false;
- this.sendHide();
- };
- }
- public function show():void{
- if (this._hiding){
- this._hiding = false;
- this.visible = true;
- this.sendShow();
- };
- }
- protected function sendShow():void{
- if (!this._sentShow){
- if (this._playerReady){
- this.dispatchEvent(new ComponentEvent(ComponentEvent.JWPLAYER_COMPONENT_SHOW, this, this.displayRect));
- this._sentShow = true;
- this._sentHide = false;
- } else {
- this._showOnReady = true;
- };
- };
- }
- protected function sendHide():void{
- if (!this._sentHide){
- this.dispatchEvent(new ComponentEvent(ComponentEvent.JWPLAYER_COMPONENT_HIDE, this, this.displayRect));
- this._sentShow = false;
- this._sentHide = true;
- };
- }
- public function resize(_arg1:number, _arg2:number):void{
- this._fullscreen = this._player.config.fullscreen;
- }
- protected function get player():IPlayer{
- return (this._player);
- }
- protected function getSkinElement(_arg1:string):DisplayObject{
- return (this.player.skin.getSkinElement(this._name, _arg1));
- }
- protected function getConfigParam(_arg1:string){
- return (this.player.config.pluginConfig(this._name)[_arg1]);
- }
- protected function setConfigParam(_arg1:string, _arg2):void{
- this.player.config.pluginConfig(this._name)[_arg1] = _arg2;
- }
- protected function get backgroundcolor():color{
- return (((this.getConfigParam("backgroundcolor")) ? new color(string(this.getConfigParam("backgroundcolor"))) : null));
- }
- protected function get fontColor():color{
- return (((this.getConfigParam("fontcolor")) ? new color(string(this.getConfigParam("fontcolor"))) : null));
- }
- protected function get fontSize():number{
- return (((this.getConfigParam("fontsize")) ? number(this.getConfigParam("fontsize")) : 0));
- }
- protected function get fontFace():string{
- return (this.getConfigParam("font"));
- }
- protected function get fontWeight():string{
- return (((this.getConfigParam("fontweight")) ? string(this.getConfigParam("fontweight")).tolowercase() : ""));
- }
- protected function get fontStyle():string{
- return (((this.getConfigParam("fontstyle")) ? string(this.getConfigParam("fontstyle")).tolowercase() : ""));
- }
- protected function get hidden():boolean{
- return (this._hiding);
- }
- protected function get displayRect():Rectangle{
- if (this.parent){
- return (this.getbounds(this.parent));
- };
- return (new Rectangle(0, 0, 0, 0));
- }
- public function addGlobalListener(_arg1:function):void{
- this._dispatcher.addGlobalListener(_arg1);
- }
- public function removeGlobalListener(_arg1:function):void{
- this._dispatcher.removeGlobalListener(_arg1);
- }
- override public function dispatchEvent(_arg1:Event):boolean{
- this._dispatcher.dispatchEvent(_arg1);
- return (super.dispatchEvent(_arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.ui.*;
- import flash.accessibility.*;
- import flash.utils.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ControlbarComponentV4 extends CoreComponent implements IControlbarComponent {
- private var skin:Sprite;
- private var stacker:Stacker;
- private var hiding:number;
- private var scrubber:movieclip;
- private var front:ColorTransform;
- private var light:ColorTransform;
- private var BUTTONS:object;
- private var SLIDERS:object;
- private var clonee:movieclip;
- private var blocking:boolean;
- private var controlbarConfig:PluginConfig;
- private var animations:Animations;
- private var lastInsert:movieclip;
- public function ControlbarComponentV4(_arg1:IPlayer){
- this.SLIDERS = {
- timeSlider:ViewEvent.JWPLAYER_VIEW_SEEK,
- volumeSlider:ViewEvent.JWPLAYER_VIEW_VOLUME
- };
- super(_arg1, "controlbar");
- this.animations = new Animations(this);
- this.controlbarConfig = _player.config.pluginConfig("controlbar");
- if ((((this.controlbarConfig["position"] == "over")) && (this.hideOnIdle))){
- alpha = 0;
- };
- if (!this.controlbarConfig["margin"]){
- this.controlbarConfig["margin"] = 0;
- };
- this.BUTTONS = {
- playButton:ViewEvent.JWPLAYER_VIEW_PLAY,
- pauseButton:ViewEvent.JWPLAYER_VIEW_PAUSE,
- stopButton:ViewEvent.JWPLAYER_VIEW_STOP,
- prevButton:ViewEvent.JWPLAYER_VIEW_PREV,
- nextButton:ViewEvent.JWPLAYER_VIEW_NEXT,
- fullscreenButton:ViewEvent.JWPLAYER_VIEW_FULLSCREEN,
- normalscreenButton:ViewEvent.JWPLAYER_VIEW_FULLSCREEN,
- muteButton:ViewEvent.JWPLAYER_VIEW_MUTE,
- unmuteButton:ViewEvent.JWPLAYER_VIEW_MUTE
- };
- this.skin = (_player.skin.getSWFSkin().getChildByName("controlbar") as Sprite);
- this.skin.x = 0;
- this.skin.y = 0;
- this.skin.tabchildren = (this.tabchildren = true);
- this.skin.tabenabled = (this.tabenabled = false);
- addChild(this.skin);
- _player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.timeHandler);
- _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.muteHandler);
- _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.volumeHandler);
- _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.timeHandler);
- _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.itemHandler);
- _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.itemHandler);
- _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
- RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
- RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
- RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
- this.stacker = new Stacker((this.skin as movieclip));
- try {
- this.getSkinComponent("linkButton").visible = false;
- } catch(e:error) {
- };
- this.setButtons();
- this.setColors();
- this.itemHandler();
- this.muteHandler();
- this.stateHandler();
- this.timeHandler();
- this.volumeHandler();
- }
- public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
- var _local4:movieclip;
- var _local5:AccessibilityProperties;
- var _local6:number;
- if (((this.getSkinComponent("linkButton")) && (this.getSkinElementChild("linkButton", "back")))){
- _local4 = (Draw.clone((this.getSkinComponent("linkButton") as movieclip)) as movieclip);
- _local4.name = (_arg2 + "Button");
- _local4.visible = true;
- _local4.tabenabled = true;
- _local5 = new AccessibilityProperties();
- _local5.name = _arg2;
- _local4.accessibilityProperties = _local5;
- this.skin.addChild(_local4);
- _local6 = math.round(((_local4.height - _arg1.height) / 2));
- Draw.clear(_local4["icon"]);
- _local4["icon"].addChild(_arg1);
- _arg1.x = (_arg1.y = 0);
- _local4["icon"].x = (_local4["icon"].y = _local6);
- _local4["back"].width = (_arg1.width + (2 * _local6));
- _local4.buttonMode = true;
- _local4.mouseChildren = false;
- _local4.addEventListener(MouseEvent.CLICK, _arg3);
- if (this.front){
- _local4["icon"].transform.colorTransform = this.front;
- _local4.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- _local4.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- };
- if (this.lastInsert){
- this.stacker.insert(_local4, this.lastInsert);
- } else {
- this.stacker.insert(_local4, (this.getSkinComponent("linkButton") as movieclip));
- };
- this.lastInsert = _local4;
- };
- return (_local4);
- }
- public function removeButton(_arg1:string):void{
- var _local2:DisplayObject = this.getSkinComponent(_arg1);
- if (_local2){
- _local2.visible = false;
- this.stacker.rearrange();
- this.skin.removeChild(this.getSkinComponent(_arg1));
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- if (!((PlayerLayoutManager.testPosition(this.controlbarConfig["position"])) || ((this.controlbarConfig["position"] == "over")))){
- this.skin.visible = false;
- return;
- };
- var _local3:number = _arg1;
- var _local4:number = this.controlbarConfig["margin"];
- if ((((this.controlbarConfig["position"] == "over")) || ((_player.config.fullscreen == true)))){
- x = (_local4 + player.config.pluginConfig("display")["x"]);
- y = (((_arg2 - this.skin.height) - _local4) + player.config.pluginConfig("display")["y"]);
- _local3 = (_arg1 - (2 * _local4));
- };
- try {
- this.getSkinComponent("fullscreenButton").visible = false;
- this.getSkinComponent("normalscreenButton").visible = false;
- if (((stage["displayState"]) && ((_player.config.height > 40)))){
- if (_player.config.fullscreen){
- this.getSkinComponent("fullscreenButton").visible = false;
- this.getSkinComponent("normalscreenButton").visible = true;
- } else {
- this.getSkinComponent("fullscreenButton").visible = true;
- this.getSkinComponent("normalscreenButton").visible = false;
- };
- };
- } catch(err:error) {
- };
- this.stacker.rearrange(_local3);
- this.stateHandler();
- this.fixTime();
- if (!_player.config.fullscreen){
- mouse.show();
- };
- if (_fullscreen != _player.config.fullscreen){
- _fullscreen = _player.config.fullscreen;
- _sentShow = false;
- };
- if (((visible) && ((alpha > 0)))){
- sendShow();
- };
- }
- public function getButton(_arg1:string):DisplayObject{
- return (null);
- }
- public function block(_arg1:boolean):void{
- this.blocking = _arg1;
- this.timeHandler();
- }
- private function clickHandler(_arg1:MouseEvent):void{
- var _local4:ViewEvent;
- var _local2:string = this.BUTTONS[_arg1.target.name];
- var _local3:object;
- if (((((!((this.blocking == true))) || ((_local2 == ViewEvent.JWPLAYER_VIEW_FULLSCREEN)))) || ((_local2 == ViewEvent.JWPLAYER_VIEW_MUTE)))){
- switch (_local2){
- case ViewEvent.JWPLAYER_VIEW_FULLSCREEN:
- _local3 = boolean(!(_player.config.fullscreen));
- break;
- case ViewEvent.JWPLAYER_VIEW_PAUSE:
- _local3 = boolean((((_player.state == PlayerState.IDLE)) || ((_player.state == PlayerState.PAUSED))));
- break;
- case ViewEvent.JWPLAYER_VIEW_MUTE:
- _local3 = boolean(!(_player.config.mute));
- break;
- };
- _local4 = new ViewEvent(_local2, _local3);
- dispatchEvent(_local4);
- };
- }
- private function downHandler(_arg1:MouseEvent):void{
- var _local2:Rectangle;
- if (!_player.locked){
- this.scrubber = movieclip(_arg1.target);
- if (((!((this.blocking == true))) || ((this.scrubber.name == "volumeSlider")))){
- _local2 = new Rectangle(this.scrubber.rail.x, this.scrubber.icon.y, (this.scrubber.rail.width - this.scrubber.icon.width), 0);
- this.scrubber.icon.startdrag(true, _local2);
- stage.addEventListener(MouseEvent.MOUSE_UP, this.upHandler);
- } else {
- this.scrubber = null;
- };
- };
- }
- private function itemHandler(_arg1:PlaylistEvent=null):void{
- try {
- if (((((_player.playlist) && ((_player.playlist.length > 1)))) && ((_player.config.playlist.tolowercase() == "none")))){
- this.getSkinComponent("prevButton").visible = (this.getSkinComponent("nextButton").visible = true);
- } else {
- this.getSkinComponent("prevButton").visible = (this.getSkinComponent("nextButton").visible = false);
- };
- } catch(err:error) {
- };
- this.timeHandler();
- this.stacker.rearrange();
- this.fixTime();
- }
- private function muteHandler(_arg1:MediaEvent=null):void{
- if (_player.config.mute == true){
- try {
- this.getSkinComponent("muteButton").visible = false;
- this.getSkinComponent("unmuteButton").visible = true;
- } catch(err:error) {
- };
- try {
- this.getSkinElementChild("volumeSlider", "mark").visible = false;
- this.getSkinElementChild("volumeSlider", "icon").x = this.getSkinElementChild("volumeSlider", "rail").x;
- } catch(err:error) {
- };
- } else {
- try {
- this.getSkinComponent("muteButton").visible = true;
- this.getSkinComponent("unmuteButton").visible = false;
- } catch(err:error) {
- };
- try {
- this.getSkinElementChild("volumeSlider", "mark").visible = true;
- this.volumeHandler();
- } catch(err:error) {
- };
- };
- }
- private function outHandler(_arg1:MouseEvent):void{
- if (((this.front) && (_arg1.target["icon"]))){
- _arg1.target["icon"].transform.colorTransform = this.front;
- } else {
- _arg1.target.gotoandplay("out");
- };
- }
- private function overHandler(_arg1:MouseEvent):void{
- if (((this.front) && (_arg1.target["icon"]))){
- _arg1.target["icon"].transform.colorTransform = this.light;
- } else {
- _arg1.target.gotoandplay("over");
- };
- }
- private function setButtons():void{
- var _local1:DisplayObject;
- var _local2:string;
- var _local3:string;
- for (_local2 in this.BUTTONS) {
- _local1 = this.getSkinComponent(_local2);
- if (_local1){
- _local1.addEventListener(MouseEvent.CLICK, this.clickHandler);
- _local1.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- _local1.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- if ((_local1 is movieclip)){
- (_local1 as movieclip).mouseChildren = false;
- (_local1 as movieclip).buttonMode = true;
- };
- };
- };
- for (_local3 in this.SLIDERS) {
- _local1 = this.getSkinComponent(_local3);
- if (_local1){
- this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_DOWN, this.downHandler);
- this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- this.getSkinComponent(_local3).addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- if ((_local1 is movieclip)){
- (_local1 as movieclip).mouseChildren = false;
- (_local1 as movieclip).tabenabled = false;
- (_local1 as movieclip).buttonMode = true;
- };
- };
- };
- }
- private function setColors():void{
- var _local1:ColorTransform;
- var _local2:string;
- var _local3:string;
- if (((_player.config.backcolor) && (this.getSkinElementChild("playButton", "icon")))){
- _local1 = new ColorTransform();
- _local1.color = _player.config.backcolor.color;
- this.getSkinComponent("back").transform.colorTransform = _local1;
- };
- if (_player.config.frontcolor){
- try {
- this.front = new ColorTransform();
- this.front.color = _player.config.frontcolor.color;
- for (_local2 in this.BUTTONS) {
- if (this.getSkinComponent(_local2)){
- this.getSkinElementChild(_local2, "icon").transform.colorTransform = this.front;
- };
- };
- for (_local3 in this.SLIDERS) {
- if (this.getSkinComponent(_local3)){
- this.getSkinElementChild(_local3, "icon").transform.colorTransform = this.front;
- this.getSkinElementChild(_local3, "mark").transform.colorTransform = this.front;
- this.getSkinElementChild(_local3, "rail").transform.colorTransform = this.front;
- };
- };
- (this.getSkinComponent("elapsedText") as textfield).textcolor = this.front.color;
- (this.getSkinComponent("totalText") as textfield).textcolor = this.front.color;
- } catch(err:error) {
- };
- };
- if (_player.config.lightcolor){
- this.light = new ColorTransform();
- this.light.color = _player.config.lightcolor.color;
- } else {
- this.light = this.front;
- };
- if (this.light){
- try {
- this.getSkinElementChild("timeSlider", "done").transform.colorTransform = this.light;
- this.getSkinElementChild("volumeSlider", "mark").transform.colorTransform = this.light;
- } catch(err:error) {
- };
- };
- }
- private function get fadeOnTimeout():boolean{
- return ((((this.controlbarConfig["position"] == "over")) || (((_player.config.fullscreen) && (!((this.controlbarConfig["position"] == "none")))))));
- }
- private function get hideOnIdle():boolean{
- return ((string(this.controlbarConfig["idlehide"]) == "true"));
- }
- private function startFader():void{
- if (((this.fadeOnTimeout) && (!(hidden)))){
- if (!isnan(this.hiding)){
- clearTimeout(this.hiding);
- };
- this.hiding = setTimeout(this.moveTimeout, 2000);
- };
- }
- private function stopFader():void{
- if (hidden){
- return;
- };
- if (alpha == 0){
- sendShow();
- this.animations.fade(1, 0.5);
- };
- if (!isnan(this.hiding)){
- clearTimeout(this.hiding);
- mouse.show();
- };
- }
- private function moveHandler(_arg1:Event=null):void{
- this.stopFader();
- if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- this.startFader();
- };
- }
- private function moveTimeout(_arg1:Event=null):void{
- if (!hidden){
- if (alpha > 0){
- sendHide();
- this.animations.fade(0, 0.5);
- };
- if (_player.config.fullscreen){
- mouse.hide();
- };
- };
- }
- private function mouseLeftStage(_arg1:Event=null):void{
- if (((this.fadeOnTimeout) && (!(hidden)))){
- if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- sendHide();
- this.animations.fade(0);
- };
- };
- }
- private function stateHandler(_arg1:PlayerEvent=null):void{
- switch (_player.state){
- case PlayerState.BUFFERING:
- case PlayerState.PLAYING:
- if (this.getSkinComponent("playButton")){
- this.getSkinComponent("playButton").visible = false;
- this.getSkinComponent("pauseButton").visible = true;
- this.startFader();
- };
- break;
- case PlayerState.IDLE:
- this.timeHandler();
- case PlayerState.PAUSED:
- if (this.getSkinComponent("playButton")){
- this.getSkinComponent("playButton").visible = true;
- this.getSkinComponent("pauseButton").visible = false;
- };
- if (this.hideOnIdle){
- this.mouseLeftStage();
- } else {
- this.stopFader();
- };
- break;
- };
- }
- private function timeHandler(_arg1:MediaEvent=null):void{
- var xps:* = nan;
- var evt = _arg1;
- var dur:* = 0;
- var pos:* = 0;
- if (evt){
- if (evt.duration >= 0){
- dur = evt.duration;
- };
- if (evt.position >= 0){
- pos = evt.position;
- };
- } else {
- if ((((_player.playlist.length > 0)) && (_player.playlist.currentItem))){
- if (_player.playlist.currentItem.duration >= 0){
- dur = _player.playlist.currentItem.duration;
- };
- };
- };
- var pct:* = (pos / dur);
- if (isnan(pct)){
- pct = 1;
- };
- try {
- (this.getSkinComponent("elapsedText") as textfield).text = Strings.digits(pos);
- (this.getSkinComponent("totalText") as textfield).text = Strings.digits(dur);
- } catch(err:error) {
- Logger.log(err);
- };
- try {
- xps = math.round((pct * (this.getSkinElementChild("timeSlider", "rail").width - this.getSkinElementChild("timeSlider", "icon").width)));
- this.bufferHandler(evt);
- if (dur > 0){
- this.getSkinElementChild("timeSlider", "icon").visible = !((_player.state == PlayerState.IDLE));
- this.getSkinElementChild("timeSlider", "mark").visible = !((_player.state == PlayerState.IDLE));
- if (((!(this.scrubber)) || (!((this.scrubber.name == "timeSlider"))))){
- this.getSkinElementChild("timeSlider", "icon").x = xps;
- this.getSkinElementChild("timeSlider", "done").width = xps;
- };
- this.getSkinElementChild("timeSlider", "done").visible = !((_player.state == PlayerState.IDLE));
- } else {
- if (_player.state != PlayerState.PLAYING){
- this.getSkinElementChild("timeSlider", "icon").visible = false;
- this.getSkinElementChild("timeSlider", "mark").visible = false;
- this.getSkinElementChild("timeSlider", "done").visible = false;
- };
- };
- } catch(err:error) {
- };
- }
- private function bufferHandler(_arg1:MediaEvent):void{
- var evt:* = _arg1;
- if (((!(evt)) || ((evt.bufferPercent < 0)))){
- return;
- };
- var mark:* = this.getSkinElementChild("timeSlider", "mark");
- var railWidth:* = this.getSkinElementChild("timeSlider", "rail").width;
- var markWidth:* = (((_player.state == PlayerState.IDLE)) ? 0 : math.round(((evt.bufferPercent / 100) * railWidth)));
- var offset:* = (evt.offset / evt.duration);
- try {
- mark.x = (((evt.duration > 0)) ? math.round((railWidth * offset)) : 0);
- mark.width = markWidth;
- mark.visible = !((_player.state == PlayerState.IDLE));
- } catch(e:error) {
- Logger.log(e);
- };
- }
- private function fixTime():void{
- var _local1:number;
- try {
- _local1 = this.getSkinComponent("timeSlider").scaleX;
- this.getSkinComponent("timeSlider").scaleX = 1;
- this.getSkinElementChild("timeSlider", "icon").x = (_local1 * this.getSkinElementChild("timeSlider", "icon").x);
- this.getSkinElementChild("timeSlider", "mark").x = (_local1 * this.getSkinElementChild("timeSlider", "mark").x);
- this.getSkinElementChild("timeSlider", "mark").width = (_local1 * this.getSkinElementChild("timeSlider", "mark").width);
- this.getSkinElementChild("timeSlider", "rail").width = (_local1 * this.getSkinElementChild("timeSlider", "rail").width);
- this.getSkinElementChild("timeSlider", "done").x = (_local1 * this.getSkinElementChild("timeSlider", "done").x);
- this.getSkinElementChild("timeSlider", "done").width = (_local1 * this.getSkinElementChild("timeSlider", "done").width);
- } catch(err:error) {
- };
- }
- private function upHandler(_arg1:MouseEvent):void{
- var _local5:MediaEvent;
- var _local2:number = 0;
- var _local3:string = this.scrubber.name;
- stage.removeEventListener(MouseEvent.MOUSE_UP, this.upHandler);
- this.scrubber.icon.stopdrag();
- if ((((((_local3 == "timeSlider")) && (_player.playlist))) && (_player.playlist.currentItem))){
- _local2 = _player.playlist.currentItem.duration;
- } else {
- if (_local3 == "volumeSlider"){
- _local2 = 100;
- };
- };
- var _local4:number = (((this.scrubber.icon.x - this.scrubber.rail.x) / (this.scrubber.rail.width - this.scrubber.icon.width)) * _local2);
- this.scrubber = null;
- if (_local3 == "volumeSlider"){
- _local5 = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME);
- _local5.volume = math.round(_local4);
- this.volumeHandler(_local5);
- };
- dispatchEvent(new ViewEvent(this.SLIDERS[_local3], math.round(_local4)));
- }
- private function volumeHandler(_arg1:MediaEvent=null):void{
- var _local2:movieclip;
- try {
- _local2 = (this.getSkinComponent("volumeSlider") as movieclip);
- _local2.mark.width = ((_player.config.volume * (_local2.rail.width - (_local2.icon.width / 2))) / 100);
- _local2.icon.x = (_local2.mark.x + ((_player.config.volume * (_local2.rail.width - _local2.icon.width)) / 100));
- } catch(err:error) {
- };
- }
- private function getSkinComponent(_arg1:string):DisplayObject{
- return ((this.skin.getChildByName(_arg1) as DisplayObject));
- }
- private function getSkinElementChild(_arg1:string, _arg2:string):DisplayObject{
- return ((this.skin.getChildByName(_arg1) as movieclip).getChildByName(_arg2));
- }
- override public function show():void{
- if (((!((getConfigParam("position") == "none"))) && (_hiding))){
- _hiding = false;
- this.visible = true;
- sendShow();
- };
- }
- override public function hide():void{
- if (((!((getConfigParam("position") == "none"))) && (!(_hiding)))){
- _hiding = true;
- this.visible = false;
- sendHide();
- };
- }
- override protected function get displayRect():Rectangle{
- if (((((this.parent) && ((getConfigParam("position") == "over")))) || (_fullscreen))){
- return (getbounds(this.parent));
- };
- return (new Rectangle(0, 0, 0, 0));
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ComponentButton extends movieclip {
- protected static var currentTabIndex:number = 100;
- protected var _background:DisplayObject;
- protected var _clickFunction:function;
- protected var _imageLayer:Sprite;
- protected var _outColor:color;
- protected var _outIcon:DisplayObject;
- protected var _overColor:color;
- protected var _overIcon:DisplayObject;
- protected var _enabled:boolean = true;
- public function ComponentButton(){
- this.tabenabled = true;
- this.tabchildren = false;
- this.tabindex = currentTabIndex++;
- this.buttonMode = true;
- }
- public function init():void{
- if (this._background){
- this.nameDisplayObject("backgroundLayer", this._background);
- addChild(this._background);
- this._background.x = 0;
- this._background.y = 0;
- };
- this._imageLayer = new Sprite();
- this._imageLayer.buttonMode = true;
- this._imageLayer.mouseChildren = false;
- this.nameDisplayObject("imageLayer", this._imageLayer);
- addChild(this._imageLayer);
- this._imageLayer.x = 0;
- this._imageLayer.y = 0;
- this.setImage(this._outIcon);
- addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
- addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
- addEventListener(MouseEvent.CLICK, this.clickHandler);
- }
- protected function outHandler(_arg1:MouseEvent):void{
- if (this._overIcon){
- if (this._imageLayer.contains(this._overIcon)){
- this._imageLayer.removeChild(this._overIcon);
- };
- this.setImage(this._outIcon);
- };
- }
- protected function overHandler(_arg1:MouseEvent):void{
- if (this._overIcon){
- if (this._imageLayer.contains(this._outIcon)){
- this._imageLayer.removeChild(this._outIcon);
- };
- this.setImage(this._overIcon);
- };
- }
- protected function clickHandler(_arg1:MouseEvent):void{
- var event:* = _arg1;
- if (this._enabled){
- try {
- this._clickFunction(event);
- } catch(error:error) {
- Logger.log(error.message);
- };
- };
- }
- protected function setImage(_arg1:DisplayObject):void{
- if (_arg1){
- if (this._imageLayer.contains(_arg1)){
- this._imageLayer.removeChild(_arg1);
- };
- this._imageLayer.addChild(_arg1);
- this.centerIcon(_arg1);
- };
- }
- public function setBackground(_arg1:DisplayObject=null):void{
- if (this._background){
- removeChild(this._background);
- };
- if (_arg1){
- this._background = _arg1;
- this.nameDisplayObject("backgroundLayer", this._background);
- addChild(this._background);
- setChildIndex(this._background, 0);
- this._background.x = 0;
- this._background.y = 0;
- };
- }
- public function setOutIcon(_arg1:DisplayObject=null):void{
- if (_arg1){
- this._outIcon = _arg1;
- };
- }
- public function setOverIcon(_arg1:DisplayObject=null):void{
- if (_arg1){
- this._overIcon = _arg1;
- };
- }
- public function resize(_arg1:number, _arg2:number):void{
- }
- protected function centerIcon(_arg1:DisplayObject):void{
- if (_arg1){
- if (this._background){
- _arg1.x = ((this._background.width - _arg1.width) / 2);
- _arg1.y = ((this._background.height - _arg1.height) / 2);
- } else {
- _arg1.x = 0;
- _arg1.y = 0;
- };
- };
- }
- public function set outColor(_arg1:color):void{
- this._outColor = _arg1;
- }
- public function set overColor(_arg1:color):void{
- this._overColor = _arg1;
- }
- public function set clickFunction(_arg1:function):void{
- this._clickFunction = _arg1;
- }
- override public function set enabled(_arg1:boolean):void{
- this._enabled = _arg1;
- }
- override public function get enabled():boolean{
- return (this._enabled);
- }
- private function nameDisplayObject(_arg1:string, _arg2:DisplayObject):void{
- try {
- _arg2.name = _arg1;
- } catch(error:error) {
- };
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view.components {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.ui.*;
- import flash.accessibility.*;
- import flash.utils.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ControlbarComponent extends CoreComponent implements IControlbarComponent {
- protected var _buttons:object;
- protected var _customButtons:array;
- protected var _removedButtons:array;
- protected var _dividers:array;
- protected var _dividerElements:object;
- protected var _defaultLayout:string = "[play|stop|prev|next|elapsed][time][duration|blank|fullscreen|mute volume]";
- protected var _currentLayout:string;
- protected var _layoutManager:ControlbarLayoutManager;
- protected var _width:number;
- protected var _height:number;
- protected var _timeSlider:Slider;
- protected var _volSlider:Slider;
- protected var _bgColorSheet:Sprite;
- protected var animations:Animations;
- protected var _fadingOut:number;
- public function ControlbarComponent(_arg1:IPlayer){
- this._buttons = {};
- this._customButtons = [];
- this._removedButtons = [];
- super(_arg1, "controlbar");
- this.animations = new Animations(this);
- if ((((getConfigParam("position") == "over")) && (this.hideOnIdle))){
- alpha = 0;
- visible = false;
- };
- this._layoutManager = new ControlbarLayoutManager(this);
- this._dividers = [];
- this._dividerElements = {divider:this.setupDivider("divider")};
- this.setupBackground();
- this.setupDefaultButtons();
- this.addEventListeners();
- this.updateControlbarState();
- this.settime(0, 0);
- this.updateVolumeSlider();
- }
- private function setupDivider(_arg1:string):object{
- return ({
- copies:[],
- index:0
- });
- }
- private function addEventListeners():void{
- player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistHandler);
- player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.playlistHandler);
- player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistHandler);
- player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, this.stateHandler);
- player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, this.updateVolumeSlider);
- player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, this.mediaHandler);
- player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.mediaHandler);
- player.addEventListener(PlayerEvent.JWPLAYER_LOCKED, this.lockHandler);
- player.addEventListener(PlayerEvent.JWPLAYER_UNLOCKED, this.lockHandler);
- RootReference.stage.addEventListener(Event.MOUSE_LEAVE, this.mouseLeftStage);
- RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
- RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, this.moveHandler);
- }
- private function lockHandler(_arg1:PlayerEvent):void{
- if (_player.locked){
- if (this._timeSlider){
- this._timeSlider.lock();
- };
- if (this._volSlider){
- this._volSlider.lock();
- };
- } else {
- if (this._timeSlider){
- this._timeSlider.unlock();
- };
- if (this._volSlider){
- this._volSlider.unlock();
- };
- };
- }
- private function playlistHandler(_arg1:PlaylistEvent):void{
- if (this._timeSlider){
- this._timeSlider.reset();
- };
- this.updateControlbarState();
- this.redraw();
- }
- private function get fadeOnTimeout():boolean{
- return ((((getConfigParam("position") == "over")) || (((_player.config.fullscreen) && (!((getConfigParam("position") == "none")))))));
- }
- private function get hideOnIdle():boolean{
- return ((string(getConfigParam("idlehide")) == "true"));
- }
- private function startFader():void{
- if (((this.fadeOnTimeout) && (!(hidden)))){
- if (!isnan(this._fadingOut)){
- clearTimeout(this._fadingOut);
- };
- this._fadingOut = setTimeout(this.moveTimeout, 2000);
- };
- }
- private function stopFader():void{
- if (hidden){
- return;
- };
- if (alpha == 0){
- sendShow();
- this.animations.fade(1, 0.5);
- };
- if (!isnan(this._fadingOut)){
- clearTimeout(this._fadingOut);
- mouse.show();
- };
- }
- private function moveHandler(_arg1:Event=null):void{
- this.stopFader();
- if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- this.startFader();
- };
- }
- private function moveTimeout(_arg1:Event=null):void{
- if (!hidden){
- if (alpha > 0){
- sendHide();
- this.animations.fade(0, 0.5);
- };
- if (_fullscreen){
- mouse.hide();
- };
- };
- }
- private function mouseLeftStage(_arg1:Event=null):void{
- if (((this.fadeOnTimeout) && (!(hidden)))){
- if ((((((_player.state == PlayerState.BUFFERING)) || ((_player.state == PlayerState.PLAYING)))) || (this.hideOnIdle))){
- if (_arg1){
- sendHide();
- };
- this.animations.fade(0);
- };
- };
- }
- private function stateHandler(_arg1:PlayerEvent=null):void{
- switch (_player.state){
- case PlayerState.BUFFERING:
- case PlayerState.PLAYING:
- this.startFader();
- break;
- case PlayerState.PAUSED:
- case PlayerState.IDLE:
- if (this.hideOnIdle){
- this.mouseLeftStage();
- } else {
- this.stopFader();
- };
- break;
- };
- this.updateControlbarState();
- this.redraw();
- }
- private function parseStructuredLayout(_arg1:object):string{
- var _local3:string;
- var _local4:array;
- var _local5:boolean;
- var _local6:object;
- var _local2 = "";
- this.getTextField("elapsed").visible = false;
- this.getTextField("duration").visible = false;
- for each (_local3 in ["left", "center", "right"]) {
- _local2 = (_local2 + "[");
- _local4 = (_arg1[_local3] as array);
- if (_local4){
- _local5 = true;
- for each (_local6 in _local4) {
- if (_local6["type"] == "divider"){
- if (_local6["element"]){
- _local2 = (_local2 + (("<" + _local6["element"]) + ">"));
- if (!this._dividerElements[_local6["element"]]){
- this._dividerElements[_local6["element"]] = this.setupDivider(_local6["element"]);
- };
- } else {
- if (_local6["width"] > 0){
- _local2 = (_local2 + (("<" + _local6["width"]) + ">"));
- } else {
- _local2 = (_local2 + "|");
- };
- };
- _local5 = true;
- } else {
- if (_local6["type"] == "text"){
- this.getTextField(_local6["name"]).visible = true;
- };
- if (!_local5){
- _local2 = (_local2 + " ");
- };
- _local2 = (_local2 + _local6["name"]);
- _local5 = false;
- };
- };
- };
- _local2 = (_local2 + "]");
- };
- return (_local2);
- }
- private function updateControlbarState():void{
- var _local3:string;
- var _local1:string = this._defaultLayout;
- var _local2:object = _player.skin.getSkinProperties().layout["controlbar"];
- if (_local2){
- _local1 = this.parseStructuredLayout(_local2);
- };
- this.removeInactive(_local1);
- _local1 = _local1.replace("blank", this._customButtons.join("|"));
- _local1 = this.removeButtonFromLayout("blank", _local1);
- for each (_local3 in this._removedButtons) {
- _local1 = this.removeButtonFromLayout(_local3, _local1);
- };
- if (player.state == PlayerState.PLAYING){
- _local1 = _local1.replace("play", "pause");
- this.hideButton("play");
- } else {
- if (player.state == PlayerState.IDLE){
- if (this._timeSlider){
- this._timeSlider.reset();
- this._timeSlider.thumbVisible = false;
- if (_player.playlist.currentItem){
- this.settime(0, _player.playlist.currentItem.duration);
- };
- };
- this.hideButton("pause");
- } else {
- this.hideButton("pause");
- };
- };
- if ((((player.playlist.length <= 1)) || (!((player.config.playlist.tolowercase() == "none"))))){
- _local1 = _local1.replace("|prev|next", "");
- this.hideButton("prev");
- this.hideButton("next");
- };
- if (player.config.mute){
- _local1 = _local1.replace("mute", "unmute");
- this.hideButton("mute");
- } else {
- this.hideButton("unmute");
- };
- if (player.config.fullscreen){
- _local1 = _local1.replace("fullscreen", "normalscreen");
- this.hideButton("fullscreen");
- } else {
- this.hideButton("normalscreen");
- };
- this._currentLayout = this.removeInactive(_local1);
- }
- private function removeInactive(_arg1:string):string{
- var _local4:string;
- var _local2:array = this._defaultLayout.match(/\W*([A-Za-z0-9]+?)\W/g);
- var _local3:number = 0;
- while (_local3 < _local2.length) {
- _local4 = (_local2[_local3] as string).replace(/\W/g, "");
- if (!this._buttons[_local4]){
- _arg1 = this.removeButtonFromLayout(_local4, _arg1);
- };
- _local3++;
- };
- return (_arg1);
- }
- private function removeButtonFromLayout(_arg1:string, _arg2:string):string{
- _arg2 = _arg2.replace(_arg1, "");
- _arg2 = _arg2.replace(/\|+/g, "|");
- return (_arg2);
- }
- private function mediaHandler(_arg1:MediaEvent):void{
- var _local3:number;
- var _local2:Slider = this._timeSlider;
- switch (_arg1.type){
- case MediaEvent.JWPLAYER_MEDIA_BUFFER:
- case MediaEvent.JWPLAYER_MEDIA_TIME:
- if (_local2){
- _local2.setProgress(((_arg1.position / _arg1.duration) * 100));
- _local2.thumbVisible = (_arg1.duration > 0);
- if (_arg1.bufferPercent > 0){
- _local3 = ((_arg1.offset / _arg1.duration) * 100);
- _local2.setBuffer((_arg1.bufferPercent / (1 - (_local3 / 100))), _local3);
- };
- if (_arg1.position > 0){
- this.settime(_arg1.position, _arg1.duration);
- };
- };
- break;
- default:
- _local2.reset();
- };
- }
- private function updateVolumeSlider(_arg1:MediaEvent=null):void{
- var _local3:number;
- var _local2:Slider = this._volSlider;
- if (_local2){
- _local3 = (getSkinElement("volumeSliderRail").width + _local2.capsWidth);
- if (!_player.config.mute){
- _local2.setBuffer(100);
- _local2.setProgress(_player.config.volume);
- _local2.thumbVisible = true;
- _local2.resize(_local3, _local2.height);
- } else {
- _local2.reset();
- _local2.thumbVisible = false;
- _local2.resize(_local3, _local2.height);
- };
- };
- }
- private function settime(_arg1:number, _arg2:number):void{
- if (_arg1 < 0){
- _arg1 = 0;
- };
- if (_arg2 < 0){
- _arg2 = 0;
- };
- var _local3:textfield = this.getTextField("elapsed");
- if (_local3){
- _local3.text = Strings.digits(_arg1);
- };
- var _local4:textfield = this.getTextField("duration");
- if (_local4){
- _local4.text = Strings.digits(_arg2);
- };
- }
- private function setupBackground():void{
- var _local4:Sprite;
- var _local1:DisplayObject = getSkinElement("background");
- var _local2:DisplayObject = getSkinElement("capLeft");
- var _local3:DisplayObject = getSkinElement("capRight");
- if (!_local1){
- _local4 = new Sprite();
- _local4.name = "background";
- _local4.graphics.beginfill(0, 0);
- _local4.graphics.drawRect(0, 0, 1, 1);
- _local4.graphics.endfill();
- _local1 = (_local4 as DisplayObject);
- };
- if (!_local2){
- _local2 = new Sprite();
- };
- if (!_local3){
- _local3 = new Sprite();
- };
- this._bgColorSheet = new Sprite();
- if (backgroundcolor){
- this._bgColorSheet.graphics.beginfill(backgroundcolor.color, 1);
- this._bgColorSheet.graphics.drawRect(0, 0, 1, 1);
- this._bgColorSheet.graphics.endfill();
- };
- addChildAt(this._bgColorSheet, 0);
- this._buttons["background"] = _local1;
- addChild(_local1);
- this._height = _local1.height;
- player.config.pluginConfig("controlbar")["size"] = _local1.height;
- if (_local2){
- this._buttons["capLeft"] = _local2;
- addChild(_local2);
- };
- if (_local3){
- this._buttons["capRight"] = _local3;
- addChild(_local3);
- };
- }
- private function setupDefaultButtons():void{
- this.addComponentButton("play", ViewEvent.JWPLAYER_VIEW_PLAY);
- this.addComponentButton("pause", ViewEvent.JWPLAYER_VIEW_PAUSE);
- this.addComponentButton("prev", ViewEvent.JWPLAYER_VIEW_PREV);
- this.addComponentButton("next", ViewEvent.JWPLAYER_VIEW_NEXT);
- this.addComponentButton("stop", ViewEvent.JWPLAYER_VIEW_STOP);
- this.addComponentButton("fullscreen", ViewEvent.JWPLAYER_VIEW_FULLSCREEN, true);
- this.addComponentButton("normalscreen", ViewEvent.JWPLAYER_VIEW_FULLSCREEN, false);
- this.addComponentButton("unmute", ViewEvent.JWPLAYER_VIEW_MUTE, false);
- this.addComponentButton("mute", ViewEvent.JWPLAYER_VIEW_MUTE, true);
- this.addTextField("elapsed");
- this.addTextField("duration");
- this.addSlider("time", ViewEvent.JWPLAYER_VIEW_CLICK, this.seekHandler);
- this._timeSlider = this.getSlider("time");
- this.addSlider("volume", ViewEvent.JWPLAYER_VIEW_CLICK, this.volumeHandler);
- this._volSlider = this.getSlider("volume");
- }
- private function addComponentButton(_arg1:string, _arg2:string, _arg3=null):void{
- var name:* = _arg1;
- var event:* = _arg2;
- var eventData = _arg3;
- var button:* = new ComponentButton();
- button.name = name;
- button.setOutIcon(getSkinElement((name + "Button")));
- button.setOverIcon(getSkinElement((name + "ButtonOver")));
- button.setBackground(getSkinElement((name + "ButtonBack")));
- button.clickFunction = function ():void{
- forward(new ViewEvent(event, eventData));
- };
- if (((((getSkinElement((name + "Button"))) || (getSkinElement((name + "ButtonOver"))))) || (getSkinElement((name + "ButtonBack"))))){
- button.init();
- this.addButtonDisplayObject(button, name);
- };
- }
- private function addSlider(_arg1:string, _arg2:string, _arg3:function, _arg4:number=0):void{
- var slider:* = null;
- var name:* = _arg1;
- var event:* = _arg2;
- var callback:* = _arg3;
- var margin:int = _arg4;
- try {
- slider = new Slider(getSkinElement((name + "SliderRail")), getSkinElement((name + "SliderBuffer")), getSkinElement((name + "SliderProgress")), getSkinElement((name + "SliderThumb")), getSkinElement((name + "SliderCapLeft")), getSkinElement((name + "SliderCapRight")));
- slider.addEventListener(event, callback);
- slider.name = name;
- slider.tabenabled = false;
- this._buttons[name] = slider;
- } catch(e:error) {
- Logger.log((("Could not create " + name) + "slider"));
- };
- }
- private function addTextField(_arg1:string):void{
- var _local2:textformat = new textformat();
- if (fontColor){
- _local2.color = fontColor.color;
- } else {
- if (_player.config.frontcolor){
- _local2.color = _player.config.frontcolor.color;
- };
- };
- _local2.size = ((fontSize) ? fontSize : 10);
- _local2.font = ((fontFace) ? fontFace : "_sans");
- _local2.bold = ((!(fontWeight)) || ((fontWeight == "bold")));
- _local2.italic = ((fontStyle) && ((fontStyle == "italic")));
- var _local3:textfield = new textfield();
- _local3.defaultTextFormat = _local2;
- _local3.selectable = false;
- _local3.autosize = TextFieldAutoSize.left;
- _local3.name = "text";
- var _local4:Sprite = new Sprite();
- _local4.name = _arg1;
- var _local5:DisplayObject = getSkinElement((_arg1 + "Background"));
- if (_local5){
- _local5.name = "back";
- _local5.x = (_local5.y = 0);
- _local4.addChild(_local5);
- };
- _local4.addChild(_local3);
- addChild(_local4);
- this._buttons[_arg1] = _local4;
- }
- private function forward(_arg1:ViewEvent):void{
- dispatchEvent(_arg1);
- }
- private function volumeHandler(_arg1:ViewEvent):void{
- var _local3:MediaEvent;
- var _local2:number = math.round((_arg1.data * 100));
- if (!_player.locked){
- _local3 = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME);
- _local3.volume = _local2;
- this.updateVolumeSlider(_local3);
- };
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_VOLUME, _local2));
- }
- private function seekHandler(_arg1:ViewEvent):void{
- var _local2:number = 0;
- try {
- _local2 = player.playlist.currentItem.duration;
- } catch(err:error) {
- };
- var _local3:number = math.round((_local2 * _arg1.data));
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_SEEK, _local3));
- }
- private function addButtonDisplayObject(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
- var _local5:movieclip;
- var _local4:AccessibilityProperties = new AccessibilityProperties();
- _local4.name = _arg2;
- if ((_arg1 is ComponentButton)){
- _arg1.name = _arg2;
- this._buttons[_arg2] = _arg1;
- _arg1.accessibilityProperties = _local4;
- return ((_arg1 as ComponentButton));
- };
- if (_arg1){
- _local5 = new movieclip();
- if (_arg3 != null){
- _local5.addEventListener(MouseEvent.CLICK, _arg3);
- };
- _local5.name = _arg2;
- _local5.accessibilityProperties = _local4;
- _local5.addChild(_arg1);
- this._buttons[_arg2] = _local5;
- return (_local5);
- };
- return (null);
- }
- protected function get buttonColor():color{
- return (((getConfigParam("buttoncolor")) ? new color(string(getConfigParam("buttoncolor"))) : null));
- }
- public function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip{
- var _local6:Sprite;
- var _local7:DisplayObject;
- var _local8:number;
- var _local9:ColorTransform;
- if (this._customButtons.indexof(_arg2) < 0){
- this._customButtons.push(_arg2);
- };
- if (this._removedButtons.indexof(_arg2) >= 0){
- this._removedButtons.splice(this._removedButtons.indexof(_arg2), 1);
- };
- _arg1.x = (_arg1.y = 0);
- var _local4:ComponentButton = new ComponentButton();
- _local4.name = _arg2;
- _local4.clickFunction = _arg3;
- var _local5:DisplayObject = getSkinElement("blankButton");
- if (_local5){
- _local6 = new Sprite();
- _local7 = _arg1;
- if (((this.buttonColor) || (_player.config.frontcolor))){
- _local9 = new ColorTransform();
- _local9.color = ((this.buttonColor) ? this.buttonColor.color : _player.config.frontcolor.color);
- _local7.transform.colorTransform = _local9;
- };
- _local8 = math.round(((_local5.height - _local7.height) / 2));
- _local5.width = (_local7.width + (2 * _local8));
- _local6.addChild(_local5);
- _local6.addChild(_local7);
- _local7.x = (_local7.y = _local8);
- _local4.setOutIcon(_local6);
- _local4.init();
- return (this.addButtonDisplayObject(_local4, _arg2));
- };
- return (null);
- }
- public function removeButton(_arg1:string):void{
- if ((((this._buttons[_arg1] is DisplayObject)) && (this.contains((this._buttons[_arg1] as DisplayObject))))){
- removeChild(this._buttons[_arg1]);
- this._buttons[_arg1] = null;
- this._defaultLayout = this.removeButtonFromLayout(_arg1, this._defaultLayout);
- this._currentLayout = this.removeButtonFromLayout(_arg1, this._currentLayout);
- if (this._removedButtons.indexof(_arg1) < 0){
- this._removedButtons.push(_arg1);
- };
- this.redraw();
- };
- }
- private function hideButton(_arg1:string):void{
- if (this._buttons[_arg1]){
- this._buttons[_arg1].visible = false;
- };
- }
- public function getButton(_arg1:string):DisplayObject{
- var _local2:object;
- var _local3:DisplayObject;
- if (this._dividerElements[_arg1]){
- _local2 = this._dividerElements[_arg1];
- if (_local2.index >= _local2.copies.length){
- _local2.copies.push(getSkinElement(_arg1));
- };
- _local3 = (_local2.copies[_local2.index++] as DisplayObject);
- return (_local3);
- };
- return (this._buttons[_arg1]);
- }
- private function getTextField(_arg1:string):textfield{
- var _local2:Sprite = (this.getButton(_arg1) as Sprite);
- if (_local2){
- return ((_local2.getChildByName("text") as textfield));
- };
- return (null);
- }
- public function getSlider(_arg1:string):Slider{
- return ((this.getButton(_arg1) as Slider));
- }
- override public function resize(_arg1:number, _arg2:number):void{
- var _local4:number;
- if (getConfigParam("position") == "none"){
- visible = false;
- return;
- };
- this._width = _arg1;
- if ((((getConfigParam("position") == "over")) || ((_player.config.fullscreen == true)))){
- _local4 = (((getConfigParam("margin") == null)) ? 0 : getConfigParam("margin"));
- x = (_local4 + player.config.pluginConfig("display")["x"]);
- y = (((_arg2 - this.background.height) - _local4) + player.config.pluginConfig("display")["y"]);
- this._width = (_arg1 - (2 * _local4));
- };
- var _local3:number = this._width;
- _local3 = (_local3 - this.capLeft.width);
- this.capLeft.x = 0;
- _local3 = (_local3 - this.capRight.width);
- this.capRight.x = (this._width - this.capRight.width);
- this.background.width = _local3;
- this.background.x = this.capLeft.width;
- setChildIndex(this.capLeft, (numChildren - 1));
- setChildIndex(this.capRight, (numChildren - 1));
- this._bgColorSheet.width = this._width;
- this._bgColorSheet.height = this.background.height;
- if (_fullscreen != _player.config.fullscreen){
- _fullscreen = _player.config.fullscreen;
- _sentShow = false;
- this.stopFader();
- };
- if (!_fullscreen){
- mouse.show();
- };
- if (((visible) && ((alpha > 0)))){
- sendShow();
- };
- this.stateHandler();
- this.redraw();
- }
- private function redraw():void{
- if (((!(_player.config.fullscreen)) && ((_player.config.height <= 40)))){
- this._currentLayout = this._currentLayout.replace("fullscreen", "");
- };
- this.clearDividers();
- this.alignTextFields();
- this._layoutManager.resize(this._width, this._height);
- }
- private function clearDividers():void{
- var _local1:object;
- var _local2:number;
- var _local3:DisplayObject;
- for each (_local1 in this._dividerElements) {
- _local1.index = 0;
- _local2 = 0;
- while (_local2 < _local1.copies.length) {
- _local3 = (_local1.copies[_local2] as DisplayObject);
- if (((_local3) && (_local3.parent))){
- _local3.parent.removeChild(_local3);
- };
- _local2++;
- };
- };
- }
- private function alignTextFields():void{
- var _local1:string;
- var _local2:Sprite;
- var _local3:DisplayObject;
- var _local4:DisplayObject;
- for each (_local1 in ["elapsed", "duration"]) {
- _local2 = (this.getButton(_local1) as Sprite);
- _local2.tabenabled = false;
- _local2.buttonMode = false;
- _local3 = _local2.getChildByName("text");
- _local4 = _local2.getChildByName("back");
- if (((_local3) && (_local4))){
- if (_local3.width > _local4.width){
- _local3.x = 0;
- _local4.x = ((_local3.width - _local4.width) / 2);
- } else {
- _local4.x = 0;
- _local3.x = ((_local4.width - _local3.width) / 2);
- };
- if (_local3.height > _local4.height){
- _local3.y = 0;
- _local4.y = ((_local3.height - _local4.height) / 2);
- } else {
- _local4.y = 0;
- _local3.y = ((_local4.height - _local3.height) / 2);
- };
- };
- };
- }
- public function get layout():string{
- return (this._currentLayout.replace(/\|/g, "<divider>"));
- }
- override public function show():void{
- if (((!((getConfigParam("position") == "none"))) && (_hiding))){
- _hiding = false;
- this.visible = true;
- sendShow();
- };
- }
- override public function hide():void{
- if (((!((getConfigParam("position") == "none"))) && (!(_hiding)))){
- _hiding = true;
- this.visible = false;
- sendHide();
- };
- }
- private function get background():DisplayObject{
- if (this._buttons["background"]){
- return (this._buttons["background"]);
- };
- return (new Sprite());
- }
- private function get capLeft():DisplayObject{
- if (this._buttons["capLeft"]){
- return (this._buttons["capLeft"]);
- };
- return (new Sprite());
- }
- private function get capRight():DisplayObject{
- if (this._buttons["capRight"]){
- return (this._buttons["capRight"]);
- };
- return (new Sprite());
- }
- }
- }//package com.longtailvideo.jwplayer.view.components
- package com.longtailvideo.jwplayer.view {
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- public class PlayerLayoutManager {
- public static var left:string = "left";
- public static var right:string = "right";
- public static var TOP:string = "top";
- public static var BOTTOM:string = "bottom";
- public static var NONE:string = "none";
- private var _player:IPlayer;
- private var toLayout:array;
- private var noLayout:array;
- private var remainingSpace:Rectangle;
- public function PlayerLayoutManager(_arg1:IPlayer){
- this._player = _arg1;
- }
- public static function testPosition(_arg1:string):string{
- if (!_arg1){
- return ("");
- };
- switch (_arg1.tolowercase()){
- case left:
- case right:
- case TOP:
- case BOTTOM:
- return (_arg1.tolowercase());
- default:
- return ("");
- };
- }
- public function resize(_arg1:number, _arg2:number):void{
- var _local3:string;
- this.toLayout = [];
- this.noLayout = [];
- this.remainingSpace = new Rectangle(0, 0, _arg1, _arg2);
- for each (_local3 in this._player.config.pluginIds) {
- this.addLayout(_local3);
- };
- this.addLayout("playlist");
- this.addLayout("controlbar");
- this.addLayout("display");
- this.addLayout("dock");
- this.generateLayout();
- }
- private function pluginSize(_arg1:PluginConfig):number{
- var _local2:string = string(_arg1["size"]);
- var _local3:string = _arg1["position"];
- if (!isnan(_arg1["size"])){
- return (number(_arg1["size"]));
- };
- if (_local2.indexof("%") == (_local2.length - 1)){
- _local2 = _local2.substr(0, (_local2.length - 1));
- } else {
- if (_local2.indexof("pct") == (_local2.length - 3)){
- _local2 = _local2.substr(0, (_local2.length - 3));
- } else {
- return (0);
- };
- };
- if ((((_local3 == left)) || ((_local3 == right)))){
- return (((this.remainingSpace.width * number(_local2)) / 100));
- };
- return (((this.remainingSpace.height * number(_local2)) / 100));
- }
- private function addLayout(_arg1:string):void{
- var _local2:PluginConfig = this._player.config.pluginConfig(_arg1);
- if (((((!(this._player.config.fullscreen)) && (testPosition(_local2["position"])))) && ((this.pluginSize(_local2) > 0)))){
- this.toLayout.push(_local2);
- } else {
- this.noLayout.push(_local2);
- };
- }
- private function fitsLayout(_arg1:PluginConfig):boolean{
- var _local2:PluginConfig;
- var _local3:PluginConfig;
- switch (testPosition(_arg1["position"])){
- case BOTTOM:
- case TOP:
- _local2 = this._player.config.pluginConfig("controlbar");
- if (((!((_arg1["id"] == "controlbar"))) && ((((testPosition(_local2["position"]) == TOP)) || ((testPosition(_local2["position"]) == BOTTOM)))))){
- return ((((this.remainingSpace.height - this.pluginSize(_local2)) > this.pluginSize(_arg1)) > 0));
- };
- return (((this.remainingSpace.height > this.pluginSize(_arg1)) > 0));
- case left:
- case right:
- _local3 = this._player.config.pluginConfig("playlist");
- if (((!((_arg1["id"] == "playlist"))) && ((((testPosition(_local3["position"]) == left)) || ((testPosition(_local3["position"]) == right)))))){
- return ((((this.remainingSpace.width - this.pluginSize(_local3)) > this.pluginSize(_arg1)) > 0));
- };
- return (((this.remainingSpace.width > this.pluginSize(_arg1)) > 0));
- };
- return (false);
- }
- protected function generateLayout():void{
- var _local4:PluginConfig;
- if (this.toLayout.length == 0){
- for each (_local4 in this.noLayout) {
- _local4["visible"] = !(((this._player.config.fullscreen) && (testPosition(_local4["position"]))));
- this.assignSpace(_local4, this.remainingSpace);
- };
- this._player.config.width = this.remainingSpace.width;
- this._player.config.height = this.remainingSpace.height;
- return;
- };
- var _local1:PluginConfig = (this.toLayout.shift() as PluginConfig);
- var _local2:Rectangle = new Rectangle();
- var _local3:number = this.pluginSize(_local1);
- if (this.fitsLayout(_local1)){
- switch (testPosition(_local1["position"])){
- case left:
- _local2.x = this.remainingSpace.x;
- _local2.y = this.remainingSpace.y;
- _local2.width = _local3;
- _local2.height = this.remainingSpace.height;
- this.remainingSpace.width = (this.remainingSpace.width - _local3);
- this.remainingSpace.x = (this.remainingSpace.x + _local3);
- break;
- case right:
- _local2.x = ((this.remainingSpace.x + this.remainingSpace.width) - _local3);
- _local2.y = this.remainingSpace.y;
- _local2.width = _local3;
- _local2.height = this.remainingSpace.height;
- this.remainingSpace.width = (this.remainingSpace.width - _local3);
- break;
- case TOP:
- _local2.x = this.remainingSpace.x;
- _local2.y = this.remainingSpace.y;
- _local2.width = this.remainingSpace.width;
- _local2.height = _local3;
- this.remainingSpace.height = (this.remainingSpace.height - _local3);
- this.remainingSpace.y = (this.remainingSpace.y + _local3);
- break;
- case BOTTOM:
- _local2.x = this.remainingSpace.x;
- _local2.y = ((this.remainingSpace.y + this.remainingSpace.height) - _local3);
- _local2.width = this.remainingSpace.width;
- _local2.height = _local3;
- this.remainingSpace.height = (this.remainingSpace.height - _local3);
- break;
- };
- _local1["visible"] = true;
- this.assignSpace(_local1, _local2);
- } else {
- this.noLayout.push(_local1);
- };
- this.generateLayout();
- }
- protected function assignSpace(_arg1:PluginConfig, _arg2:Rectangle):void{
- _arg1["width"] = _arg2.width;
- _arg1["height"] = _arg2.height;
- _arg1["x"] = _arg2.x;
- _arg1["y"] = _arg2.y;
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.ui.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.system.*;
- public class RightclickMenu extends GlobalEventDispatcher {
- protected var _player:IPlayer;
- protected var context:contextmenu;
- protected var about:contextmenuitem;
- protected var debug:contextmenuitem;
- protected var fullscreen:contextmenuitem;
- protected var stretching:contextmenuitem;
- public function RightclickMenu(_arg1:IPlayer, _arg2:movieclip){
- this._player = _arg1;
- this.context = new contextmenu();
- this.context.hidebuiltinitems();
- _arg2.contextmenu = this.context;
- this.initializeMenu();
- }
- protected function addItem(_arg1:contextmenuitem, _arg2:function):void{
- _arg1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, _arg2);
- _arg1.separatorbefore = true;
- this.context.customitems.push(_arg1);
- }
- public function initializeMenu():void{
- this.setAboutText();
- this.addItem(this.about, this.aboutHandler);
- try {
- this.fullscreen = new contextmenuitem("Toggle Fullscreen...");
- this.addItem(this.fullscreen, this.fullscreenHandler);
- } catch(err:error) {
- };
- this.stretching = new contextmenuitem((("Stretching is " + this._player.config.stretching) + "..."));
- this.addItem(this.stretching, this.stretchHandler);
- if ((((capabilities.isdebugger == true)) || (!((this._player.config.debug == Logger.NONE))))){
- this.debug = new contextmenuitem((("Logging to " + this._player.config.debug) + "..."));
- this.addItem(this.debug, this.debugHandler);
- };
- }
- protected function setAboutText():void{
- this.about = new contextmenuitem((("About JW Player " + this._player.version) + "..."));
- }
- protected function aboutHandler(_arg1:ContextMenuEvent):void{
- navigateToURL(new URLRequest("http://www.longtailvideo.com/players/jw-flv-player"), "_top");
- }
- protected function debugHandler(_arg1:ContextMenuEvent):void{
- var _local2:array = new array(Logger.NONE, Logger.ARTHROPOD, Logger.CONSOLE, Logger.trace);
- var _local3:number = _local2.indexof(this._player.config.debug);
- _local3 = ((_local3)==(_local2.length - 1)) ? 0 : (_local3 + 1);
- this.debug.caption = (("Logging to " + _local2[_local3]) + "...");
- this.setCookie("debug", _local2[_local3]);
- this._player.config.debug = _local2[_local3];
- }
- protected function fullscreenHandler(_arg1:ContextMenuEvent):void{
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, !(this._player.config.fullscreen)));
- }
- protected function stretchHandler(_arg1:ContextMenuEvent):void{
- var _local2:array = new array(Stretcher.UNIFORM, Stretcher.FILL, Stretcher.EXACTFIT, Stretcher.NONE);
- var _local3:number = _local2.indexof(this._player.config.stretching);
- if ((_local3 == (_local2.length - 1))){
- _local3 = 0;
- } else {
- _local3++;
- };
- this._player.config.stretching = _local2[_local3];
- this.stretching.caption = (("Stretching is " + _local2[_local3]) + "...");
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_REDRAW));
- }
- protected function setCookie(_arg1:string, _arg2):void{
- Configger.saveCookie(_arg1, _arg2);
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view.interfaces {
- import flash.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- public interface ISkin extends IEventDispatcher {
- function load(_arg1:string=null):void;
- function hasComponent(_arg1:string):boolean;
- function getSkinElement(_arg1:string, _arg2:string):DisplayObject;
- function getSWFSkin():Sprite;
- function addSkinElement(_arg1:string, _arg2:string, _arg3:DisplayObject):void;
- function getSkinProperties():SkinProperties;
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view.interfaces {
- import flash.display.*;
- public interface IDockComponent extends IPlayerComponent {
- function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function, _arg4:string=null):movieclip;
- function removeButton(_arg1:string):void;
- function setButton(_arg1:string, _arg2:string=null, _arg3:string=null, _arg4:string=null):void;
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view.interfaces {
- public interface IPlaylistComponent extends IPlayerComponent {
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view.interfaces {
- import flash.display.*;
- public interface IDisplayComponent extends IPlayerComponent {
- function setIcon(_arg1:DisplayObject):void;
- function setText(_arg1:string):void;
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view.interfaces {
- import flash.display.*;
- public interface IControlbarComponent extends IPlayerComponent {
- function addButton(_arg1:DisplayObject, _arg2:string, _arg3:function=null):movieclip;
- function removeButton(_arg1:string):void;
- function getButton(_arg1:string):DisplayObject;
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view.interfaces {
- import com.longtailvideo.jwplayer.events.*;
- public interface IPlayerComponent extends IGlobalEventDispatcher {
- function resize(_arg1:number, _arg2:number):void;
- function get height():number;
- function get width():number;
- function get x():number;
- function set x(_arg1:number):void;
- function get y():number;
- function set y(_arg1:number):void;
- function show():void;
- function hide():void;
- }
- }//package com.longtailvideo.jwplayer.view.interfaces
- package com.longtailvideo.jwplayer.view {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.longtailvideo.jwplayer.view.components.*;
- public class PlayerComponents implements IPlayerComponents {
- private var _controlbar:IControlbarComponent;
- private var _display:IDisplayComponent;
- private var _dock:IDockComponent;
- private var _playlist:IPlaylistComponent;
- private var _config:PlayerConfig;
- private var _skin:ISkin;
- private var _player:IPlayer;
- public function PlayerComponents(_arg1:IPlayer){
- this._player = _arg1;
- this._skin = _arg1.skin;
- this._config = _arg1.config;
- if ((this._skin is SWFSkin)){
- this._controlbar = new ControlbarComponentV4(this._player);
- } else {
- this._controlbar = new ControlbarComponent(this._player);
- };
- this._display = new DisplayComponent(this._player);
- this._playlist = new PlaylistComponent(this._player);
- this._dock = new DockComponent(this._player);
- }
- public function get controlbar():IControlbarComponent{
- return (this._controlbar);
- }
- public function get display():IDisplayComponent{
- return (this._display);
- }
- public function get dock():IDockComponent{
- return (this._dock);
- }
- public function get playlist():IPlaylistComponent{
- return (this._playlist);
- }
- public function resize(_arg1:number, _arg2:number):void{
- this.resizeComponent(this._display, this._config.pluginConfig("display"));
- this.resizeComponent(this._controlbar, this._config.pluginConfig("controlbar"));
- this.resizeComponent(this._playlist, this._config.pluginConfig("playlist"));
- this.resizeComponent(this._dock, this._config.pluginConfig("dock"));
- }
- private function resizeComponent(_arg1:IPlayerComponent, _arg2:PluginConfig):void{
- _arg1.x = _arg2["x"];
- _arg1.y = _arg2["y"];
- _arg1.resize(_arg2["width"], _arg2["height"]);
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.geom.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.text.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.system.*;
- import flash.external.*;
- public class View extends GlobalEventDispatcher {
- protected var _player:IPlayer;
- protected var _model:Model;
- protected var _skin:ISkin;
- protected var _components:IPlayerComponents;
- protected var _fullscreen:boolean = false;
- protected var _preserveAspect:boolean = false;
- protected var _normalScreen:Rectangle;
- protected var stage:stage;
- protected var _root:movieclip;
- protected var _maskedLayers:movieclip;
- protected var _backgroundLayer:movieclip;
- protected var _mediaLayer:movieclip;
- protected var _imageLayer:movieclip;
- protected var _componentsLayer:movieclip;
- protected var _pluginsLayer:movieclip;
- protected var _plugins:object;
- protected var _displayMasker:movieclip;
- protected var _image:Loader;
- protected var _logo:Logo;
- protected var layoutManager:PlayerLayoutManager;
- protected var LoadingScreen:class;
- protected var ErrorScreen:class;
- protected var loaderScreen:Sprite;
- protected var loaderAnim:DisplayObject;
- protected var currentLayer:number = 0;
- protected var firstIndex:number = -1;
- protected var nextLastIndex:number = -1;
- protected var lastIndex:number = -1;
- private var imageDelay:Timer;
- private var mediaDelay:Timer;
- private var _lastImage:string;
- public function View(_arg1:IPlayer, _arg2:Model){
- this.LoadingScreen = View_LoadingScreen;
- this.ErrorScreen = View_ErrorScreen;
- this.imageDelay = new Timer(100, 1);
- this.mediaDelay = new Timer(100, 1);
- super();
- this._player = _arg1;
- this._model = _arg2;
- RootReference.stage.scalemode = StageScaleMode.NO_SCALE;
- RootReference.stage.stage.align = StageAlign.TOP_LEFT;
- this.loaderScreen = new Sprite();
- this.loaderScreen.name = "loaderScreen";
- this.loaderAnim = (new this.LoadingScreen() as DisplayObject);
- this.loaderAnim.alpha = 0.8;
- this.loaderAnim.visible = false;
- this.loaderScreen.addChild(this.loaderAnim);
- RootReference.stage.addChildAt(this.loaderScreen, 0);
- if (RootReference.stage.stageWidth > 0){
- this.resizeStage();
- } else {
- RootReference.stage.addEventListener(Event.RESIZE, this.resizeStage);
- RootReference.stage.addEventListener(Event.ADDED_TO_STAGE, this.resizeStage);
- };
- this._root = new movieclip();
- this._normalScreen = new Rectangle();
- }
- protected function resizeStage(_arg1:Event=null):void{
- var evt = _arg1;
- try {
- RootReference.stage.removeEventListener(Event.RESIZE, this.resizeStage);
- RootReference.stage.removeEventListener(Event.ADDED_TO_STAGE, this.resizeStage);
- } catch(err:error) {
- Logger.log(("Can't add stage resize handlers: " + err.message));
- };
- this.loaderScreen.graphics.clear();
- this.loaderScreen.graphics.beginfill(0, 0);
- this.loaderScreen.graphics.drawRect(0, 0, RootReference.stage.stageWidth, RootReference.stage.stageHeight);
- this.loaderScreen.graphics.endfill();
- this.loaderAnim.x = ((RootReference.stage.stageWidth - this.loaderAnim.width) / 2);
- this.loaderAnim.y = ((RootReference.stage.stageHeight - this.loaderAnim.height) / 2);
- }
- public function get skin():ISkin{
- return (this._skin);
- }
- public function set skin(_arg1:ISkin):void{
- this._skin = _arg1;
- }
- public function setupView():void{
- RootReference.stage.addChildAt(this._root, 0);
- this._root.visible = false;
- this.setupLayers();
- this.setupComponents();
- RootReference.stage.addEventListener(Event.RESIZE, this.resizeHandler);
- RootReference.stage.addEventListener(FocusEvent.FOCUS_OUT, this.keyFocusOutHandler);
- RootReference.stage.addEventListener(FocusEvent.FOCUS_IN, this.keyFocusInHandler);
- this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_LOADED, this.mediaLoaded);
- this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.itemHandler);
- this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this.itemHandler);
- this._model.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, this.stateHandler);
- this.layoutManager = new PlayerLayoutManager(this._player);
- this.setupRightClick();
- this.redraw();
- }
- protected function keyFocusOutHandler(_arg1:FocusEvent):void{
- var _local2:Sprite = (_arg1.target as Sprite);
- if (!_local2){
- return;
- };
- this.lastIndex = this.nextLastIndex;
- this.nextLastIndex = _local2.tabindex;
- }
- protected function keyFocusInHandler(_arg1:FocusEvent):void{
- var _local2:Sprite = (_arg1.target as Sprite);
- if (!_local2){
- return;
- };
- if ((((((this.firstIndex >= 0)) && ((_local2.tabindex == this.firstIndex)))) && ((this.nextLastIndex > this.lastIndex)))){
- _arg1.preventDefault();
- RootReference.stage.focus = null;
- if (ExternalInterface.available){
- ExternalInterface.call((("(function() { try { document.getElementById('" + PlayerVersion.id) + "').blur(); } catch(e) {} })"));
- };
- this.firstIndex = -1;
- this.lastIndex = -1;
- this.nextLastIndex = -1;
- } else {
- if (this.firstIndex < 0){
- this.firstIndex = _local2.tabindex;
- };
- };
- }
- protected function setupRightClick():void{
- var _local1:RightclickMenu = new RightclickMenu(this._player, this._root);
- _local1.addGlobalListener(this.forward);
- }
- public function completeView(_arg1:boolean=false, _arg2:string=""):void{
- var _local3:DisplayObject;
- var _local4:textfield;
- if (!_arg1){
- this._root.visible = true;
- this.loaderScreen.parent.removeChild(this.loaderScreen);
- } else {
- this.loaderScreen.removeChild(this.loaderAnim);
- _local3 = (new this.ErrorScreen() as DisplayObject);
- _local4 = new textfield();
- _local4.defaultTextFormat = new textformat("_sans", 12, 0xFFFFFF);
- _local4.text = _arg2;
- _local4.width = (this.loaderScreen.width - 60);
- _local4.wordwrap = true;
- _local4.height = (_local4.textheight + 10);
- _local3.x = ((this.loaderScreen.width - _local3.width) / 2);
- _local3.y = ((((this.loaderScreen.height - _local3.height) - _local4.height) - 10) / 2);
- _local4.x = ((this.loaderScreen.width - _local4.width) / 2);
- _local4.y = ((_local3.y + _local3.height) + 10);
- this.loaderScreen.addChild(_local3);
- this.loaderScreen.addChild(_local4);
- };
- }
- protected function setupLayers():void{
- this._maskedLayers = this.setupLayer("masked", this.currentLayer++);
- this._backgroundLayer = this.setupLayer("background", 0, this._maskedLayers);
- this.setupBackground();
- this._mediaLayer = this.setupLayer("media", 1, this._maskedLayers);
- this._mediaLayer.visible = false;
- this._imageLayer = this.setupLayer("image", 1, this._maskedLayers);
- this._image = new Loader();
- this._image.contentLoaderInfo.addEventListener(Event.COMPLETE, this.imageComplete);
- this._image.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.imageError);
- this._imageLayer.addChild(this._image);
- this.imageDelay.addEventListener(TimerEvent.TIMER_COMPLETE, this.showImage);
- this.mediaDelay.addEventListener(TimerEvent.TIMER_COMPLETE, this.showMedia);
- this.setupLogo();
- this._componentsLayer = this.setupLayer("components", this.currentLayer++);
- this._pluginsLayer = this.setupLayer("plugins", this.currentLayer++);
- this._plugins = {};
- }
- protected function setupLogo():void{
- this._logo = new Logo(this._player);
- }
- protected function setupLayer(_arg1:string, _arg2:number, _arg3:DisplayObjectContainer=null):movieclip{
- var _local4:movieclip = new movieclip();
- if (_arg3){
- _arg3.addChildAt(_local4, _arg2);
- } else {
- this._root.addChildAt(_local4, _arg2);
- };
- _local4.name = _arg1;
- _local4.x = 0;
- _local4.y = 0;
- return (_local4);
- }
- protected function setupBackground():void{
- var _local2:color;
- var _local1:movieclip = new movieclip();
- _local1.name = "background";
- this._backgroundLayer.addChild(_local1);
- if (this._model.config.screencolor){
- _local2 = this._model.config.screencolor;
- } else {
- if (this._model.config.pluginConfig("display").hasOwnProperty("backgroundcolor")){
- _local2 = new color(string(this._model.config.pluginConfig("display")["backgroundcolor"]));
- };
- };
- _local1.graphics.beginfill(((_local2) ? _local2.color : 0), ((_local2) ? 1 : 0));
- _local1.graphics.drawRect(0, 0, 1, 1);
- _local1.graphics.endfill();
- }
- protected function setupDisplayMask():void{
- this._displayMasker = new movieclip();
- this._displayMasker.graphics.beginfill(0, 1);
- this._displayMasker.graphics.drawRect(0, 0, this._player.config.width, this._player.config.height);
- this._displayMasker.graphics.endfill();
- this._maskedLayers.mask = this._displayMasker;
- }
- protected function setupComponents():void{
- var _local1:number = 0;
- this._components = new PlayerComponents(this._player);
- var _temp1 = _local1;
- _local1 = (_local1 + 1);
- this.setupComponent(this._components.display, _temp1);
- var _temp2 = _local1;
- _local1 = (_local1 + 1);
- this.setupComponent(this._components.playlist, _temp2);
- var _temp3 = _local1;
- _local1 = (_local1 + 1);
- this.setupComponent(this._logo, _temp3);
- var _temp4 = _local1;
- _local1 = (_local1 + 1);
- this.setupComponent(this._components.controlbar, _temp4);
- var _temp5 = _local1;
- _local1 = (_local1 + 1);
- this.setupComponent(this._components.dock, _temp5);
- }
- protected function setupComponent(_arg1, _arg2:number):void{
- if ((_arg1 is IGlobalEventDispatcher)){
- (_arg1 as IGlobalEventDispatcher).addGlobalListener(this.forward);
- };
- if ((_arg1 is DisplayObject)){
- this._componentsLayer.addChildAt((_arg1 as DisplayObject), _arg2);
- };
- }
- protected function resizeHandler(_arg1:Event):void{
- this._fullscreen = (RootReference.stage.displayState == StageDisplayState.FULL_SCREEN);
- if (this._model.fullscreen != this._fullscreen){
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this._fullscreen));
- };
- dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_RESIZE, {
- width:RootReference.stage.stageWidth,
- height:RootReference.stage.stageHeight
- }));
- this.redraw();
- }
- public function fullscreen(_arg1:boolean=true):void{
- var mode:boolean = _arg1;
- try {
- RootReference.stage.displayState = ((mode) ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL);
- } catch(e:error) {
- Logger.log(("Could not enter fullscreen mode: " + e.message));
- };
- }
- public function redraw():void{
- var plug:* = null;
- var plugDisplay:* = null;
- var cfg:* = null;
- this.layoutManager.resize(RootReference.stage.stageWidth, RootReference.stage.stageHeight);
- this._components.resize(this._player.config.width, this._player.config.height);
- if (!this._fullscreen){
- this._normalScreen.width = this._player.config.width;
- this._normalScreen.height = this._player.config.height;
- };
- this.resizeBackground();
- this.resizeMasker();
- this._imageLayer.x = (this._mediaLayer.x = this._components.display.x);
- this._imageLayer.y = (this._mediaLayer.y = this._components.display.y);
- if (this._preserveAspect){
- if (((!(this._fullscreen)) && (!((this._player.config.stretching == Stretcher.EXACTFIT))))){
- this._preserveAspect = false;
- };
- } else {
- if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
- this._preserveAspect = true;
- };
- };
- this.resizeImage(this._player.config.width, this._player.config.height);
- this.resizeMedia(this._player.config.width, this._player.config.height);
- if (this._logo){
- this._logo.x = this._components.display.x;
- this._logo.y = this._components.display.y;
- this._logo.resize(this._player.config.width, this._player.config.height);
- };
- var i:* = 0;
- while (i < this._pluginsLayer.numChildren) {
- plug = (this._pluginsLayer.getChildAt(i) as IPlugin);
- plugDisplay = (plug as DisplayObject);
- if (((plug) && (plugDisplay))){
- cfg = this._player.config.pluginConfig(plug.id);
- if (cfg["visible"]){
- plugDisplay.visible = true;
- plugDisplay.x = cfg["x"];
- plugDisplay.y = cfg["y"];
- try {
- plug.resize(cfg.width, cfg.height);
- } catch(e:error) {
- Logger.log(((("There was an error resizing plugin '" + plug.id) + "': ") + e.message));
- };
- } else {
- plugDisplay.visible = false;
- };
- };
- i = (i + 1);
- };
- PlayerV4Emulation.getInstance(this._player).resize(this._player.config.width, this._player.config.height);
- }
- protected function resizeMedia(_arg1:number, _arg2:number):void{
- if ((((this._mediaLayer.numChildren > 0)) && (this._model.media.display))){
- if (((this._preserveAspect) && (this._model.media.stretchMedia))){
- if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
- this._model.media.resize(this._normalScreen.width, this._normalScreen.height);
- Stretcher.stretch(this._mediaLayer, _arg1, _arg2, Stretcher.UNIFORM);
- } else {
- this._model.media.resize(_arg1, _arg2);
- this._mediaLayer.scaleX = (this._mediaLayer.scaleY = 1);
- this._mediaLayer.x = (this._mediaLayer.y = 0);
- };
- } else {
- this._model.media.resize(_arg1, _arg2);
- this._mediaLayer.x = (this._mediaLayer.y = 0);
- };
- this._mediaLayer.x = (this._mediaLayer.x + this._components.display.x);
- this._mediaLayer.y = (this._mediaLayer.y + this._components.display.y);
- };
- }
- protected function resizeImage(_arg1:number, _arg2:number):void{
- if (this._imageLayer.numChildren > 0){
- if (this._preserveAspect){
- if (((this._fullscreen) && ((this._player.config.stretching == Stretcher.EXACTFIT)))){
- Stretcher.stretch(this._image, this._normalScreen.width, this._normalScreen.height, this._player.config.stretching);
- Stretcher.stretch(this._imageLayer, _arg1, _arg2, Stretcher.UNIFORM);
- } else {
- Stretcher.stretch(this._image, _arg1, _arg2, this._player.config.stretching);
- Stretcher.stretch(this._imageLayer, _arg1, _arg2, Stretcher.NONE);
- this._imageLayer.x = (this._imageLayer.y = 0);
- };
- } else {
- Stretcher.stretch(this._image, _arg1, _arg2, this._player.config.stretching);
- this._imageLayer.x = (this._imageLayer.y = 0);
- };
- this._imageLayer.x = (this._imageLayer.x + this._components.display.x);
- this._imageLayer.y = (this._imageLayer.y + this._components.display.y);
- };
- }
- protected function resizeBackground():void{
- var _local1:DisplayObject = this._backgroundLayer.getChildByName("background");
- _local1.width = RootReference.stage.stageWidth;
- _local1.height = RootReference.stage.stageHeight;
- _local1.x = 0;
- _local1.y = 0;
- }
- protected function resizeMasker():void{
- if (this._displayMasker == null){
- this.setupDisplayMask();
- };
- this._displayMasker.graphics.clear();
- this._displayMasker.graphics.beginfill(0, 1);
- this._displayMasker.graphics.drawRect(this._components.display.x, this._components.display.y, this._player.config.width, this._player.config.height);
- this._displayMasker.graphics.endfill();
- }
- public function get components():IPlayerComponents{
- return (this._components);
- }
- public function overrideComponent(_arg1:IPlayerComponent):void{
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "overrideComponent not implemented"));
- }
- public function addPlugin(_arg1:string, _arg2:IPlugin):void{
- var plugDO:* = null;
- var id:* = _arg1;
- var plugin:* = _arg2;
- try {
- plugDO = (plugin as DisplayObject);
- if (((!(this._plugins[id])) && (!((plugDO == null))))){
- this._plugins[id] = plugDO;
- this._pluginsLayer.addChild(plugDO);
- };
- if (this._player.config.pluginIds.indexof(id) < 0){
- this._player.config.plugins = (this._player.config.plugins + ("," + id));
- };
- } catch(e:error) {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
- };
- }
- public function removePlugin(_arg1:IPlugin):void{
- var _local2:string = _arg1.id.tolowercase();
- if (((_local2) && ((this._plugins[_local2] is IPlugin)))){
- this._pluginsLayer.removeChild(this._plugins[_local2]);
- delete this._plugins[_local2];
- };
- }
- public function loadedPlugins():array{
- var _local2:string;
- var _local1:array = [];
- for (_local2 in this._plugins) {
- if ((this._plugins[_local2] is IPlugin)){
- _local1.push(_local2);
- };
- };
- return (_local1);
- }
- public function getPlugin(_arg1:string):IPlugin{
- return ((this._plugins[_arg1] as IPlugin));
- }
- public function bringPluginToFront(_arg1:string):void{
- var _local2:IPlugin = this.getPlugin(_arg1);
- this._pluginsLayer.setChildIndex((_local2 as DisplayObject), (this._pluginsLayer.numChildren - 1));
- }
- protected function mediaLoaded(_arg1:MediaEvent):void{
- var _local2:DisplayObject = this._model.media.display;
- if (((_local2) && (!((_local2.parent == this._mediaLayer))))){
- while (this._mediaLayer.numChildren) {
- this._mediaLayer.removeChildAt(0);
- };
- this._mediaLayer.addChild(this._model.media.display);
- this.resizeMedia(this._player.config.width, this._player.config.height);
- };
- }
- protected function itemHandler(_arg1:PlaylistEvent):void{
- if (((this._model.playlist.currentItem) && (this._model.playlist.currentItem.image))){
- if (this._lastImage != this._model.playlist.currentItem.image){
- this._lastImage = this._model.playlist.currentItem.image;
- this.loadImage(this._lastImage);
- };
- };
- }
- protected function loadImage(_arg1:string):void{
- this._image.load(new URLRequest(_arg1), new LoaderContext(true));
- }
- protected function imageComplete(_arg1:Event):void{
- var evt:* = _arg1;
- if (this._image){
- this.resizeImage(this._player.config.width, this._player.config.height);
- try {
- Draw.smooth((this._image.content as Bitmap));
- } catch(e:error) {
- Logger.log(("Could not smooth preview image: " + e.message));
- };
- };
- }
- protected function imageError(_arg1:ErrorEvent):void{
- Logger.log(("Error loading preview image: " + _arg1.text));
- }
- protected function showImage(_arg1:TimerEvent):void{
- this._imageLayer.visible = true;
- this._mediaLayer.visible = false;
- }
- protected function showMedia(_arg1:TimerEvent):void{
- this._mediaLayer.visible = boolean(this._model.media.display);
- this._imageLayer.visible = !(boolean(this._model.media.display));
- }
- protected function stateHandler(_arg1:PlayerStateEvent):void{
- this.imageDelay.reset();
- this.mediaDelay.reset();
- switch (_arg1.newstate){
- case PlayerState.IDLE:
- this.imageDelay.start();
- break;
- case PlayerState.PLAYING:
- case PlayerState.PAUSED:
- this.mediaDelay.start();
- break;
- };
- }
- protected function forward(_arg1:Event):void{
- if ((_arg1 is PlayerEvent)){
- dispatchEvent(_arg1);
- };
- }
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import mx.core.*;
- public class View_ErrorScreen_dataClass extends ByteArrayAsset {
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.view {
- import mx.core.*;
- public class View_LoadingScreen_dataClass extends ByteArrayAsset {
- }
- }//package com.longtailvideo.jwplayer.view
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.utils.*;
- public class ParserFactory {
- public static function getParser(_arg1:xml):IPlaylistParser{
- var list:* = _arg1;
- try {
- switch (list.localName().tostring().tolowercase()){
- case "asx":
- return (new ASXParser());
- case "feed":
- return (new ATOMParser());
- case "playlist":
- return (new XSPFParser());
- case "rss":
- return (new RSSParser());
- case "smil":
- return (new SMILParser());
- };
- } catch(e:error) {
- Logger.log("ParserFactory: Could not determine playlist type");
- return (null);
- };
- return (null);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.utils.*;
- public class MediaParser {
- private static const PREFIX:string = "media";
- public static function parseGroup(_arg1:xml, _arg2:object):object{
- var _local4:xml;
- var _local3:boolean;
- for each (_local4 in _arg1.children()) {
- if (_local4.namespace().prefix == MediaParser.PREFIX){
- switch (_local4.localName().tolowercase()){
- case "content":
- if (!_local3){
- _arg2["file"] = Strings.xmlAttribute(_local4, "url");
- };
- if ([email protected]() > 0){
- _arg2["duration"] = Strings.seconds(Strings.xmlAttribute(_local4, "duration"));
- };
- if ([email protected]() > 0){
- _arg2["start"] = Strings.seconds(Strings.xmlAttribute(_local4, "start"));
- };
- if (_local4.children().length() > 0){
- _arg2 = MediaParser.parseGroup(_local4, _arg2);
- };
- if (((((([email protected]() > 0)) || (([email protected]() > 0)))) || (([email protected]() > 0)))){
- if (!_arg2.levels){
- _arg2.levels = new array();
- };
- _arg2.levels.push({
- width:Strings.xmlAttribute(_local4, "width"),
- bitrate:Strings.xmlAttribute(_local4, "bitrate"),
- file:Strings.xmlAttribute(_local4, "url")
- });
- };
- break;
- case "title":
- _arg2["title"] = _local4.text().tostring();
- break;
- case "description":
- _arg2["description"] = _local4.text().tostring();
- break;
- case "keywords":
- _arg2["tags"] = _local4.text().tostring();
- break;
- case "thumbnail":
- _arg2["image"] = Strings.xmlAttribute(_local4, "url");
- break;
- case "credit":
- _arg2["author"] = _local4.text().tostring();
- break;
- case "player":
- if ([email protected]("youtube.com") > 0){
- _local3 = true;
- _arg2["file"] = Strings.xmlAttribute(_local4, "url");
- };
- break;
- case "group":
- _arg2 = MediaParser.parseGroup(_local4, _arg2);
- break;
- };
- };
- };
- return (_arg2);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class XSPFParser implements IPlaylistParser {
- public function parse(_arg1:xml):array{
- var _local3:xml;
- var _local4:xml;
- var _local2:array = new array();
- for each (_local3 in _arg1.children()) {
- if (_local3.localName().tolowercase() == "tracklist"){
- for each (_local4 in _local3.children()) {
- _local2.push(this.parseItem(_local4));
- };
- };
- };
- return (_local2);
- }
- public function parseItem(_arg1:xml):PlaylistItem{
- var _local3:xml;
- var _local4:xml;
- var _local2:object = new object();
- for each (_local3 in _arg1.children()) {
- if (!_local3.localName()){
- break;
- };
- switch (_local3.localName().tolowercase()){
- case "location":
- _local2["file"] = _local3.text().tostring();
- break;
- case "title":
- _local2["title"] = _local3.text().tostring();
- break;
- case "annotation":
- _local2["description"] = _local3.text().tostring();
- break;
- case "info":
- _local2["link"] = _local3.text().tostring();
- break;
- case "image":
- _local2["image"] = _local3.text().tostring();
- break;
- case "creator":
- _local2["author"] = _local3.text().tostring();
- break;
- case "duration":
- _local2["duration"] = Strings.seconds(_local3.text());
- break;
- case "meta":
- _local2[Strings.xmlAttribute(_local3, "rel")] = _local3.text().tostring();
- break;
- case "extension":
- for each (_local4 in _local3.children()) {
- _local2[_local4.localName().tolowercase()] = _local4.text().tostring();
- };
- break;
- };
- };
- _local2 = JWParser.parseEntry(_arg1, _local2);
- return (new PlaylistItem(_local2));
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ATOMParser implements IPlaylistParser {
- public function parse(_arg1:xml):array{
- var _local3:xml;
- var _local2:array = new array();
- for each (_local3 in _arg1.children()) {
- if (_local3.localName().tolowercase() == "entry"){
- _local2.push(this.parseItem(_local3));
- };
- };
- return (_local2);
- }
- public function parseItem(_arg1:xml):PlaylistItem{
- var _local3:xml;
- var _local2:object = new object();
- for each (_local3 in _arg1.children()) {
- switch (_local3.localName().tolowercase()){
- case "author":
- _local2["author"] = _local3.children()[0].text().tostring();
- break;
- case "title":
- _local2["title"] = _local3.text().tostring();
- break;
- case "summary":
- _local2["description"] = _local3.text().tostring();
- break;
- case "link":
- if (Strings.xmlAttribute(_local3, "rel") == "alternate"){
- _local2["link"] = Strings.xmlAttribute(_local3, "href");
- } else {
- if (Strings.xmlAttribute(_local3, "rel") == "enclosure"){
- _local2["file"] = Strings.xmlAttribute(_local3, "href");
- };
- };
- break;
- case "published":
- _local2["date"] = _local3.text().tostring();
- break;
- };
- };
- _local2 = MediaParser.parseGroup(_arg1, _local2);
- _local2 = JWParser.parseEntry(_arg1, _local2);
- return (new PlaylistItem(_local2));
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class SMILParser implements IPlaylistParser {
- public function parse(_arg1:xml):array{
- var _local4:xml;
- var _local2:array = new array();
- var _local3:xml = _arg1.children()[1].children()[0];
- if (_local3.localName().tolowercase() == "seq"){
- for each (_local4 in _local3.children()) {
- _local2.push(new PlaylistItem(this.parseSeq(_local4)));
- };
- } else {
- _local2.push(this.parseItem(_local3));
- };
- return (_local2);
- }
- public function parseItem(_arg1:xml):PlaylistItem{
- return (new PlaylistItem(this.parsePar(_arg1)));
- }
- public function parseSeq(_arg1:xml):object{
- var _local2:object = new object();
- switch (_arg1.localName().tolowercase()){
- case "par":
- _local2 = this.parsePar(_arg1);
- break;
- case "img":
- case "video":
- case "audio":
- _local2 = this.parseAttributes(_arg1, _local2);
- break;
- };
- return (_local2);
- }
- public function parsePar(_arg1:xml):object{
- var _local3:xml;
- var _local2:object = new object();
- for each (_local3 in _arg1.children()) {
- switch (_local3.localName().tolowercase()){
- case "anchor":
- _local2["link"] = Strings.xmlAttribute(_local3, "href");
- break;
- case "img":
- if (_local2["file"]){
- _local2["image"] = Strings.xmlAttribute(_local3, "src");
- break;
- };
- _local2 = this.parseAttributes(_local3, _local2);
- break;
- case "video":
- case "audio":
- _local2 = this.parseAttributes(_local3, _local2);
- break;
- };
- };
- _local2 = JWParser.parseEntry(_arg1, _local2);
- return (_local2);
- }
- public function parseAttributes(_arg1:xml, _arg2:object):object{
- var _local4:string;
- var _local3:number = 0;
- while (_local3 < _arg1.attributes().length()) {
- _local4 = _arg1.attributes()[_local3].name().tostring();
- switch (_local4){
- case "begin":
- _arg2["start"] = Strings.seconds(Strings.xmlAttribute(_arg1, "begin"));
- break;
- case "src":
- _arg2["file"] = Strings.xmlAttribute(_arg1, "src");
- break;
- case "dur":
- _arg2["duration"] = Strings.seconds(Strings.xmlAttribute(_arg1, "dur"));
- break;
- case "alt":
- _arg2["description"] = Strings.xmlAttribute(_arg1, "alt");
- break;
- default:
- _arg2[_local4] = _arg1.attributes()[_local3].tostring();
- };
- _local3++;
- };
- return (_arg2);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class LoadbalanceParser {
- public static function parse(_arg1:xml):array{
- var _local6:xml;
- var _local7:PlaylistItemLevel;
- var _local2:array = new array();
- var _local3:xml = _arg1.children()[0].children()[0];
- var _local4:string = Strings.xmlAttribute(_local3, "base");
- var _local5:xml = _arg1.children()[1].children()[0];
- if (_local5.localName().tolowercase() == "switch"){
- for each (_local6 in _local5.children()) {
- _local7 = new PlaylistItemLevel(Strings.xmlAttribute(_local6, "src"), (number(Strings.xmlAttribute(_local6, "system-bitrate")) / 1000), number(Strings.xmlAttribute(_local6, "width")), _local4);
- _local2.push(_local7);
- };
- } else {
- _local2.push({
- file:Strings.xmlAttribute(_local5, "src"),
- streamer:_local4
- });
- };
- return (_local2);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class RSSParser implements IPlaylistParser {
- public function parse(_arg1:xml):array{
- var _local3:xml;
- var _local4:xml;
- var _local2:array = new array();
- for each (_local3 in _arg1.children()) {
- if (_local3.localName().tolowercase() == "channel"){
- for each (_local4 in _local3.children()) {
- if (_local4.localName().tolowercase() == "item"){
- _local2.push(this.parseItem(_local4));
- };
- };
- };
- };
- return (_local2);
- }
- public function parseItem(_arg1:xml):PlaylistItem{
- var _local3:xml;
- var _local2:object = new object();
- for each (_local3 in _arg1.children()) {
- switch (_local3.localName().tolowercase()){
- case "enclosure":
- _local2["file"] = Strings.xmlAttribute(_local3, "url");
- break;
- case "title":
- _local2["title"] = _local3.text().tostring();
- break;
- case "pubdate":
- _local2["date"] = _local3.text().tostring();
- break;
- case "description":
- _local2["description"] = _local3.text().tostring();
- break;
- case "link":
- _local2["link"] = _local3.text().tostring();
- break;
- case "category":
- if (_local2["tags"]){
- _local2["tags"] = (_local2["tags"] + _local3.text().tostring());
- } else {
- _local2["tags"] = _local3.text().tostring();
- };
- break;
- };
- };
- _local2 = ItunesParser.parseEntry(_arg1, _local2);
- _local2 = MediaParser.parseGroup(_arg1, _local2);
- _local2 = JWParser.parseEntry(_arg1, _local2);
- return (new PlaylistItem(_local2));
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.utils.*;
- public class ItunesParser {
- private static const PREFIX:string = "itunes";
- public static function parseEntry(_arg1:xml, _arg2:object):object{
- var _local3:xml;
- for each (_local3 in _arg1.children()) {
- if (_local3.namespace().prefix == ItunesParser.PREFIX){
- switch (_local3.localName().tolowercase()){
- case "author":
- _arg2["author"] = _local3.text().tostring();
- break;
- case "duration":
- _arg2["duration"] = Strings.seconds(_local3.text().tostring());
- break;
- case "summary":
- _arg2["description"] = _local3.text().tostring();
- break;
- case "keywords":
- _arg2["tags"] = _local3.text().tostring();
- break;
- };
- };
- };
- return (_arg2);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- public interface IPlaylistParser {
- function parse(_arg1:xml):array;
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class ASXParser implements IPlaylistParser {
- public function parse(_arg1:xml):array{
- var _local3:xml;
- var _local2:array = new array();
- for each (_local3 in _arg1.children()) {
- if (_local3.localName().tolowercase() == "entry"){
- _local2.push(this.parseItem(_local3));
- };
- };
- return (_local2);
- }
- public function parseItem(_arg1:xml):PlaylistItem{
- var _local3:xml;
- var _local2:object = new object();
- for each (_local3 in _arg1.children()) {
- if (!_local3.localName()){
- break;
- };
- switch (_local3.localName().tolowercase()){
- case "ref":
- _local2["file"] = Strings.xmlAttribute(_local3, "href");
- break;
- case "title":
- _local2["title"] = _local3.text().tostring();
- break;
- case "moreinfo":
- _local2["link"] = Strings.xmlAttribute(_local3, "href");
- break;
- case "abstract":
- _local2["description"] = _local3.text().tostring();
- break;
- case "author":
- _local2["author"] = _local3.text().tostring();
- break;
- case "duration":
- _local2["duration"] = Strings.seconds(Strings.xmlAttribute(_local3, "value"));
- break;
- case "starttime":
- _local2["start"] = Strings.seconds(Strings.xmlAttribute(_local3, "value"));
- break;
- case "param":
- _local2[Strings.xmlAttribute(_local3, "name")] = Strings.xmlAttribute(_local3, "value");
- break;
- };
- };
- _local2 = JWParser.parseEntry(_arg1, _local2);
- return (new PlaylistItem(_local2));
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.parsers {
- import com.longtailvideo.jwplayer.utils.*;
- public class JWParser {
- private static const PREFIX:string = "jwplayer";
- private static var extensions:object = {
- 3g2:"video",
- 3gp:"video",
- aac:"video",
- f4b:"video",
- f4p:"video",
- f4v:"video",
- flv:"video",
- gif:"image",
- jpg:"image",
- jpeg:"image",
- m4a:"video",
- m4v:"video",
- mov:"video",
- mp3:"sound",
- mp4:"video",
- png:"image",
- rbs:"sound",
- sdp:"video",
- swf:"image",
- vp6:"video",
- webm:"video",
- ogg:"video",
- ogv:"video"
- };
- public static function parseEntry(_arg1:xml, _arg2:object):object{
- var _local3:xml;
- for each (_local3 in _arg1.children()) {
- if (_local3.namespace().prefix == JWParser.PREFIX){
- _arg2[_local3.localName()] = Strings.serialize(_local3.text().tostring());
- };
- if (((!(_arg2["file"])) && ((string(_arg2["link"]).tolowercase().indexof("youtube") > -1)))){
- _arg2["file"] = _arg2["link"];
- };
- };
- return (_arg2);
- }
- public static function getProvider(_arg1:object):string{
- var _local2:string;
- if (_arg1["type"]){
- return (_arg1["type"]);
- };
- if (isYouTube(_arg1["file"])){
- return ("youtube");
- };
- if (((_arg1["streamer"]) && ((_arg1["streamer"].indexof("rtmp") == 0)))){
- return ("rtmp");
- };
- if (((_arg1["streamer"]) && ((_arg1["streamer"].indexof("http") == 0)))){
- return ("http");
- };
- _local2 = Strings.extension(_arg1["file"]);
- if (extensions.hasOwnProperty(_local2)){
- return (extensions[_local2]);
- };
- return ("");
- }
- private static function isYouTube(_arg1:string):boolean{
- if (!_arg1){
- return (false);
- };
- if (_arg1.indexof("youtube.com/w") > -1){
- return (true);
- };
- if (_arg1.indexof("youtube.com/v") > -1){
- return (true);
- };
- if (_arg1.indexof("youtu.be") > -1){
- return (true);
- };
- return (false);
- }
- }
- }//package com.longtailvideo.jwplayer.parsers
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- public class MediaEvent extends PlayerEvent {
- public static var JWPLAYER_MEDIA_BUFFER:string = "jwplayerMediaBuffer";
- public static var SCALEENGINE_BUFFER_STATUS:string = "ScaleEngineBufferStatus";
- public static var JWPLAYER_MEDIA_BUFFER_FULL:string = "jwplayerMediaBufferFull";
- public static var JWPLAYER_MEDIA_ERROR:string = "jwplayerMediaError";
- public static var JWPLAYER_MEDIA_LOADED:string = "jwplayerMediaLoaded";
- public static var JWPLAYER_MEDIA_COMPLETE:string = "jwplayerMediaComplete";
- public static var JWPLAYER_MEDIA_SEEK:string = "jwplayerMediaSeek";
- public static var JWPLAYER_MEDIA_TIME:string = "jwplayerMediaTime";
- public static var JWPLAYER_MEDIA_VOLUME:string = "jwplayerMediaVolume";
- public static var JWPLAYER_MEDIA_META:string = "jwplayerMediaMeta";
- public static var JWPLAYER_MEDIA_MUTE:string = "jwplayerMediaMute";
- public var bufferPercent:number = -1;
- public var duration:number = -1;
- public var metadata:object = null;
- public var position:number = -1;
- public var offset:number = 0;
- public var volume:number = -1;
- public var mute:boolean = false;
- public function MediaEvent(_arg1:string){
- super(_arg1);
- }
- override public function clone():Event{
- var _local1:MediaEvent = new MediaEvent(this.type);
- _local1.bufferPercent = this.bufferPercent;
- _local1.duration = this.duration;
- _local1.metadata = this.metadata;
- _local1.position = this.position;
- _local1.offset = this.offset;
- _local1.volume = this.volume;
- _local1.mute = this.mute;
- return (_local1);
- }
- override public function tostring():string{
- var _local3:string;
- var _local1 = (("[MediaEvent type=\"" + type) + "\"");
- var _local2:MediaEvent = new MediaEvent("");
- for (_local3 in this.metadata) {
- _local1 = (_local1 + ((((" " + _local3) + "=\"") + this.metadata[_local3]) + "\""));
- };
- if (this.bufferPercent != _local2.bufferPercent){
- _local1 = (_local1 + ((" bufferPercent=\"" + this.bufferPercent) + "\""));
- };
- if (this.duration != _local2.duration){
- _local1 = (_local1 + ((" duration=\"" + this.duration) + "\""));
- };
- if (this.position != _local2.position){
- _local1 = (_local1 + ((" position=\"" + this.position) + "\""));
- };
- if (this.offset != _local2.offset){
- _local1 = (_local1 + ((" offset=\"" + this.offset) + "\""));
- };
- if (this.volume != _local2.volume){
- _local1 = (_local1 + ((" volume=\"" + this.volume) + "\""));
- };
- if (this.mute != _local2.mute){
- _local1 = (_local1 + ((" mute=\"" + this.mute) + "\""));
- };
- if (message != _local2.message){
- _local1 = (_local1 + ((" message=\"" + message) + "\""));
- };
- _local1 = (_local1 + ((" id=\"" + id) + "\""));
- _local1 = (_local1 + ((" client=\"" + client) + "\""));
- _local1 = (_local1 + ((" version=\"" + version) + "\""));
- _local1 = (_local1 + "]");
- return (_local1);
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import flash.events.*;
- import flash.geom.*;
- public class ComponentEvent extends PlayerEvent {
- public static var JWPLAYER_COMPONENT_SHOW:string = "jwplayerComponentShow";
- public static var JWPLAYER_COMPONENT_HIDE:string = "jwplayerComponentHide";
- public var component:IPlayerComponent;
- public var boundingRect:Rectangle;
- public function ComponentEvent(_arg1:string, _arg2:IPlayerComponent, _arg3:Rectangle=null){
- super(_arg1);
- this.component = _arg2;
- if (_arg3){
- this.boundingRect = _arg3;
- } else {
- this.boundingRect = new Rectangle(_arg2.x, _arg2.y, _arg2.width, _arg2.height);
- };
- }
- override public function clone():Event{
- return (new ComponentEvent(this.type, this.component));
- }
- override public function tostring():string{
- return ((((((((((((((("[ComponentEvent type=\"" + type) + "\"") + " component=\"") + this.component) + "\"") + " boundingRect=") + this.boundingRect.tostring()) + " id=") + id) + " client=") + client) + " version=") + version) + "]"));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- public interface IGlobalEventDispatcher extends IEventDispatcher {
- function addGlobalListener(_arg1:function):void;
- function removeGlobalListener(_arg1:function):void;
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- public class PlayerStateEvent extends PlayerEvent {
- public static var JWPLAYER_PLAYER_STATE:string = "jwplayerPlayerState";
- public var newstate:string = "";
- public var oldstate:string = "";
- public function PlayerStateEvent(_arg1:string, _arg2:string, _arg3:string){
- super(_arg1);
- this.newstate = _arg2;
- this.oldstate = _arg3;
- }
- override public function clone():Event{
- return (new PlayerStateEvent(this.type, this.newstate, this.oldstate));
- }
- override public function tostring():string{
- return (((((((((((((((((((((("[PlayerStateEvent type=\"" + type) + "\"") + " oldstate=\"") + this.oldstate) + "\"") + " newstate=\"") + this.newstate) + "\"") + " id=\"") + id) + "\"") + " client=\"") + client) + "\"") + " version=\"") + version) + "\"") + " message=\"") + message) + "\"") + "]"));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- public class PlaylistEvent extends PlayerEvent {
- public static var JWPLAYER_PLAYLIST_LOADED:string = "jwplayerPlaylistLoaded";
- public static var JWPLAYER_PLAYLIST_UPDATED:string = "jwplayerPlaylistUpdated";
- public static var JWPLAYER_PLAYLIST_ITEM:string = "jwplayerPlaylistItem";
- private var _playlist:IPlaylist;
- public function PlaylistEvent(_arg1:string, _arg2:IPlaylist){
- this._playlist = _arg2;
- super(_arg1);
- }
- override public function tostring():string{
- return ((((((((((((((((((("[PlaylistEvent type=\"" + type) + "\"") + " index=\"") + this._playlist.currentIndex) + "\"") + " id=\"") + id) + "\"") + " client=\"") + client) + "\"") + " version=\"") + version) + "\"") + " message=\"") + message) + "\"") + "]"));
- }
- override public function clone():Event{
- return (new PlaylistEvent(this.type, this._playlist));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- public class ViewEvent extends PlayerEvent {
- public static var JWPLAYER_RESIZE:string = "jwplayerResize";
- public static var JWPLAYER_VIEW_PLAY:string = "jwplayerViewPlay";
- public static var JWPLAYER_VIEW_PAUSE:string = "jwplayerViewPause";
- public static var JWPLAYER_VIEW_STOP:string = "jwplayerViewStop";
- public static var JWPLAYER_VIEW_NEXT:string = "jwplayerViewNext";
- public static var JWPLAYER_VIEW_PREV:string = "jwplayerViewPrev";
- public static var JWPLAYER_VIEW_MUTE:string = "jwplayerViewMute";
- public static var JWPLAYER_VIEW_FULLSCREEN:string = "jwplayerViewFullscreen";
- public static var JWPLAYER_VIEW_ITEM:string = "jwplayerViewItem";
- public static var JWPLAYER_VIEW_VOLUME:string = "jwplayerViewVolume";
- public static var JWPLAYER_VIEW_LOAD:string = "jwplayerViewLoad";
- public static var JWPLAYER_VIEW_REDRAW:string = "jwplayerViewRedraw";
- public static var JWPLAYER_VIEW_SEEK:string = "jwplayerViewSeek";
- public static var JWPLAYER_VIEW_CLICK:string = "jwplayerViewClick";
- public var data;
- public function ViewEvent(_arg1:string, _arg2=null){
- super(_arg1);
- this.data = _arg2;
- }
- override public function clone():Event{
- return (new ViewEvent(this.type, this.data));
- }
- override public function tostring():string{
- return ((((((((((((("[ViewEvent type=\"" + type) + "\"") + " data=\"") + this.data) + "\"") + " id=") + id) + " client=") + client) + " version=") + version) + "]"));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- import flash.utils.*;
- public class GlobalEventDispatcher extends EventDispatcher implements IGlobalEventDispatcher {
- private var _globalListeners:Dictionary;
- private var _dispatcher:IEventDispatcher;
- public function GlobalEventDispatcher(){
- this._globalListeners = new Dictionary();
- super();
- }
- public function addGlobalListener(_arg1:function):void{
- this._globalListeners[_arg1] = true;
- }
- public function removeGlobalListener(_arg1:function):void{
- delete this._globalListeners[_arg1];
- }
- override public function dispatchEvent(_arg1:Event):boolean{
- var _local2:*;
- var _local3:function;
- for (_local2 in this._globalListeners) {
- if ((_local2 is function)){
- _local3 = (_local2 as function);
- _local3(_arg1);
- };
- };
- return (super.dispatchEvent(_arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.events {
- import flash.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.system.*;
- import flash.external.*;
- public class PlayerEvent extends Event {
- public static var JWPLAYER_READY:string = "jwplayerReady";
- public static var JWPLAYER_LOCKED:string = "jwplayerLocked";
- public static var JWPLAYER_UNLOCKED:string = "jwplayerUnlocked";
- public static var JWPLAYER_ERROR:string = "jwplayerError";
- public static var JWPLAYER_FULLSCREEN:string = "jwplayerFullscreen";
- public var id:string;
- public var client:string;
- public var version:string;
- public var message:string;
- public function PlayerEvent(_arg1:string, _arg2:string=undefined){
- super(_arg1, false, false);
- try {
- this.id = ((PlayerVersion.id) ? PlayerVersion.id : ExternalInterface.objectID);
- } catch(e:error) {
- };
- this.client = ("FLASH " + capabilities.version);
- this.version = PlayerVersion.version;
- this.message = _arg2;
- }
- override public function tostring():string{
- return (((((((((((((((("[PlayerEvent type=\"" + type) + "\"") + " id=\"") + this.id) + "\"") + " client=\"") + this.client) + "\"") + " version=\"") + this.version) + "\"") + " message=\"") + this.message) + "\"") + "]"));
- }
- override public function clone():Event{
- return (new PlayerEvent(this.type, this.message));
- }
- }
- }//package com.longtailvideo.jwplayer.events
- package com.longtailvideo.jwplayer.utils {
- import flash.events.*;
- import flash.net.*;
- public class Configger extends EventDispatcher {
- private var _config:object;
- public function Configger(){
- this._config = {};
- super();
- }
- public static function saveCookie(_arg1:string, _arg2):void{
- var _local3:sharedobject;
- try {
- _local3 = sharedobject.getlocal("com.jeroenwijering", "/");
- _local3.data[_arg1] = _arg2;
- _local3.flush();
- } catch(err:error) {
- };
- }
- public function get config():object{
- return (this._config);
- }
- public function loadConfig():void{
- this.loadCookies();
- if (this.xmlConfig){
- this.loadXML(this.xmlConfig);
- } else {
- this.loadFlashvars(RootReference.root.loaderInfo.parameters);
- };
- }
- public function get xmlConfig():string{
- return (RootReference.root.loaderInfo.parameters["config"]);
- }
- public function loadXML(_arg1:string):void{
- var _local2:URLLoader = new URLLoader();
- _local2.addEventListener(IOErrorEvent.IO_ERROR, this.xmlFail);
- _local2.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.xmlFail);
- _local2.addEventListener(Event.COMPLETE, this.loadComplete);
- _local2.load(new URLRequest(_arg1));
- }
- public function loadFlashvars(_arg1:object):void{
- var param:* = null;
- var params:* = _arg1;
- try {
- for (param in params) {
- this.setConfigParam(param, params[param]);
- };
- dispatchEvent(new Event(Event.COMPLETE));
- } catch(e:error) {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
- };
- }
- private function loadCookies():void{
- var _local1:sharedobject;
- try {
- _local1 = sharedobject.getlocal("com.jeroenwijering", "/");
- this.writeCookieData(_local1.data);
- } catch(err:error) {
- };
- }
- private function writeCookieData(_arg1:object):void{
- var _local2:string;
- for (_local2 in _arg1) {
- this.setConfigParam(_local2.tolowercase(), _arg1[_local2]);
- };
- }
- private function loadComplete(_arg1:Event):void{
- var _local2:xml = xml((_arg1.target as URLLoader).data);
- if ((((_local2.name().tostring().tolowercase() == "config")) && ((_local2.children().length() > 0)))){
- this.parsexml(_local2);
- this.loadFlashvars(RootReference.root.loaderInfo.parameters);
- } else {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "Config was empty"));
- };
- }
- private function xmlFail(_arg1:ErrorEvent):void{
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
- }
- private function parsexml(_arg1:xml):void{
- var _local2:xml;
- for each (_local2 in _arg1.children()) {
- if (_local2.name() == "pluginconfig"){
- this.parsePluginConfig(_local2);
- } else {
- this.setConfigParam(_local2.name().tostring(), _local2.tostring());
- };
- };
- }
- private function parsePluginConfig(_arg1:xml):void{
- var _local2:xml;
- var _local3:xml;
- for each (_local2 in _arg1.plugin) {
- for each (_local3 in _local2.children()) {
- this.setConfigParam(((_local2.@name + ".") + _local3.name()), _local3.tostring());
- };
- };
- }
- private function setConfigParam(_arg1:string, _arg2:string):void{
- if (_arg1 != "fullscreen"){
- this._config[_arg1.tolowercase()] = Strings.serialize(Strings.trim(_arg2));
- };
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.display.*;
- import flash.system.*;
- public class RootReference {
- public static var root:DisplayObject;
- private static var _stage:stage;
- public function RootReference(_arg1:DisplayObject){
- if (!RootReference.root){
- RootReference.root = _arg1.root;
- RootReference.stage = _arg1.stage;
- try {
- Security.allowdomain("*");
- } catch(e:error) {
- };
- };
- }
- public static function get stage():stage{
- return (_stage);
- }
- public static function set stage(_arg1:stage):void{
- _stage = _arg1;
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import flash.net.*;
- import flash.external.*;
- public class Logger {
- public static const ARTHROPOD:string = "arthropod";
- private static const CONNECTION:localconnection = new localconnection();
- private static const CONNECTION_NAME:string = "app#com.carlcalderon.Arthropod.161E714B6C1A76DE7B9865F88B32FCCE8FABA7B5.1:arthropod";
- public static const CONSOLE:string = "console";
- public static const NONE:string = "none";
- public static const trace:string = "trace";
- private static var _config:PlayerConfig;
- public static function log(_arg1, _arg2:string="log"):void{
- var message:* = _arg1;
- var type:string = _arg2;
- try {
- if (message == undefined){
- send(type.touppercase());
- } else {
- if ((message is string)){
- send((((type.touppercase() + " (") + message) + ")"));
- } else {
- if ((((((message is boolean)) || ((message is number)))) || ((message is array)))){
- send((((type.touppercase() + " (") + message.tostring()) + ")"));
- } else {
- Logger.object(message, type);
- };
- };
- };
- } catch(err:error) {
- };
- }
- private static function object(_arg1:object, _arg2:string):void{
- var _local3 = (_arg2.touppercase() + " (");
- Strings.print_r(_arg1);
- _local3 = (_local3 + ")");
- Logger.send(_local3);
- }
- private static function send(_arg1:string):void{
- var text:* = _arg1;
- var debug:* = ((_config) ? _config.debug : trace);
- switch (debug){
- case ARTHROPOD:
- try {
- CONNECTION.send(CONNECTION_NAME, "debug", "CDC309AF", text, 0xCCCCCC);
- } catch(e:error) {
- };
- break;
- case CONSOLE:
- if (ExternalInterface.available){
- ExternalInterface.call("console.log", text);
- };
- break;
- case trace:
- break;
- case NONE:
- break;
- default:
- if (ExternalInterface.available){
- ExternalInterface.call(_config.debug, text);
- };
- };
- }
- public static function setConfig(_arg1:PlayerConfig):void{
- _config = _arg1;
- }
- private static function localConnectionEventHandler(_arg1:Event):void{
- }
- CONNECTION.addEventListener(AsyncErrorEvent.ASYNC_ERROR, localConnectionEventHandler);
- CONNECTION.addEventListener(SecurityErrorEvent.SECURITY_ERROR, localConnectionEventHandler);
- CONNECTION.addEventListener(StatusEvent.status, localConnectionEventHandler);
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.events.*;
- import flash.display.*;
- public class Animations {
- private var _tgt:movieclip;
- private var _spd:number;
- private var _end:number;
- private var _xps:number;
- private var _yps:number;
- private var _str:string;
- public function Animations(_arg1:movieclip){
- this._tgt = _arg1;
- }
- public function fade(_arg1:number=1, _arg2:number=0.25):void{
- this._end = _arg1;
- if (this._tgt.alpha > this._end){
- this._spd = -(math.abs(_arg2));
- } else {
- this._spd = math.abs(_arg2);
- };
- this._tgt.addEventListener(Event.ENTER_FRAME, this.fadeHandler);
- }
- private function fadeHandler(_arg1:Event):void{
- if ((((((this._tgt.alpha >= (this._end - this._spd))) && ((this._spd > 0)))) || ((((this._tgt.alpha <= (this._end + this._spd))) && ((this._spd < 0)))))){
- this._tgt.removeEventListener(Event.ENTER_FRAME, this.fadeHandler);
- this._tgt.alpha = this._end;
- if (this._end == 0){
- this._tgt.visible = false;
- };
- } else {
- this._tgt.visible = true;
- this._tgt.alpha = (this._tgt.alpha + this._spd);
- };
- }
- public function ease(_arg1:number, _arg2:number, _arg3:number=2):void{
- this._spd = _arg3;
- if (!_arg1){
- this._xps = this._tgt.x;
- } else {
- this._xps = _arg1;
- };
- if (!_arg2){
- this._yps = this._tgt.y;
- } else {
- this._yps = _arg2;
- };
- this._tgt.addEventListener(Event.ENTER_FRAME, this.easeHandler);
- }
- private function easeHandler(_arg1:Event):void{
- if ((((math.abs((this._tgt.x - this._xps)) < 1)) && ((math.abs((this._tgt.y - this._yps)) < 1)))){
- this._tgt.removeEventListener(Event.ENTER_FRAME, this.easeHandler);
- this._tgt.x = this._xps;
- this._tgt.y = this._yps;
- } else {
- this._tgt.x = (this._xps - ((this._xps - this._tgt.x) / this._spd));
- this._tgt.y = (this._yps - ((this._yps - this._tgt.y) / this._spd));
- };
- }
- public function write(_arg1:string, _arg2:number=1.5):void{
- this._str = _arg1;
- this._spd = _arg2;
- this._tgt.tf.text = "";
- this._tgt.addEventListener(Event.ENTER_FRAME, this.writeHandler);
- }
- private function writeHandler(_arg1:Event):void{
- var _local2:number = math.floor(((this._str.length - this._tgt.tf.text.length) / this._spd));
- this._tgt.tf.text = this._str.substr(0, (this._str.length - _local2));
- if (this._tgt.tf.text == this._str){
- this._tgt.tf.htmltext = this._str;
- this._tgt.removeEventListener(Event.ENTER_FRAME, this.easeHandler);
- };
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.display.*;
- import flash.utils.*;
- public class Draw {
- public static function clone(_arg1:DisplayObject, _arg2:boolean=false):DisplayObject{
- var cls:* = null;
- var idx:* = nan;
- var tgt:* = _arg1;
- var adc:boolean = _arg2;
- var nam:* = getQualifiedClassName(tgt);
- if (nam == "flash.display::MovieClip"){
- return (tgt);
- };
- if (((tgt.hasOwnProperty("bitmapData")) && ((tgt["bitmapData"] is BitmapData)))){
- return (new Bitmap(tgt["bitmapData"]));
- };
- try {
- cls = (tgt.loaderInfo.applicationDomain.getDefinition(nam) as class);
- } catch(e:error) {
- cls = object(tgt).constructor;
- };
- var dup:* = new (cls)();
- dup.transform = tgt.transform;
- dup.filters = tgt.filters;
- dup.cacheAsBitmap = tgt.cacheAsBitmap;
- dup.opaqueBackground = tgt.opaqueBackground;
- dup.name = tgt.name;
- if (adc == true){
- idx = tgt.parent.getChildIndex(tgt);
- tgt.parent.addChildAt(dup, (idx + 1));
- };
- return (dup);
- }
- public static function clear(_arg1:DisplayObjectContainer):void{
- var _local2:number = _arg1.numChildren;
- var _local3:number = 0;
- while (_local3 < _local2) {
- _arg1.removeChildAt(0);
- _local3++;
- };
- _arg1.scaleX = (_arg1.scaleY = 1);
- }
- public static function rect(_arg1:Sprite, _arg2:string, _arg3:number, _arg4:number, _arg5:number=0, _arg6:number=0, _arg7:number=1):Sprite{
- var _local8:Sprite = new Sprite();
- _local8.x = _arg5;
- _local8.y = _arg6;
- _local8.graphics.beginfill(uint(("0x" + _arg2)), _arg7);
- _local8.graphics.drawRect(0, 0, _arg3, _arg4);
- _arg1.addChild(_local8);
- return (_local8);
- }
- public static function smooth(_arg1:Bitmap):void{
- try {
- _arg1.smoothing = true;
- } catch(err:error) {
- };
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import com.longtailvideo.jwplayer.model.*;
- import flash.utils.*;
- public class JavascriptSerialization {
- public static function playlistToArray(_arg1:IPlaylist):array{
- var _local2:array = [];
- var _local3:number = 0;
- while (_local3 < _arg1.length) {
- _local2.push(playlistItemToObject(_arg1.getItemAt(_local3)));
- _local3++;
- };
- return (_local2);
- }
- public static function playlistItemToObject(_arg1:PlaylistItem):object{
- var _local3:string;
- var _local4:PlaylistItemLevel;
- var _local5:object;
- var _local6:string;
- var _local2:object = {
- author:_arg1.author,
- date:_arg1.date,
- description:_arg1.description,
- duration:_arg1.duration,
- file:_arg1.file,
- image:_arg1.image,
- link:_arg1.link,
- mediaid:_arg1.mediaid,
- provider:_arg1.provider,
- start:_arg1.start,
- streamer:_arg1.streamer,
- tags:_arg1.tags,
- title:_arg1.title,
- type:_arg1.provider
- };
- for (_local3 in _arg1) {
- _local2[_local3] = _arg1[_local3];
- };
- if (_arg1.levels.length > 0){
- _local2["levels"] = [];
- for each (_local4 in _arg1.levels) {
- _local5 = {
- url:_local4.file,
- bitrate:_local4.bitrate,
- width:_local4.width
- };
- for (_local6 in _local4) {
- _local5[_local6] = _local4[_local6];
- };
- _local2["levels"].push(_local5);
- };
- };
- return (_local2);
- }
- public static function stripDots(_arg1){
- var _local2:*;
- var _local4:string;
- var _local5:string;
- var _local6:number;
- var _local3:string = getQualifiedClassName(_arg1);
- switch (getQualifiedClassName(_arg1)){
- case "Object":
- case "com.longtailvideo.jwplayer.model::PlaylistItem":
- case "com.longtailvideo.jwplayer.model::PlaylistItemLevel":
- case "com.longtailvideo.jwplayer.plugins::PluginConfig":
- _local2 = {};
- for (_local4 in _arg1) {
- _local5 = _local4.replace(".", "__dot__");
- _local5 = _local5.replace("-", "_");
- _local2[_local5] = stripDots(_arg1[_local4]);
- };
- break;
- case "Array":
- _local2 = [];
- _local6 = 0;
- while (_local6 < (_arg1 as array).length) {
- _local2[_local6] = stripDots(_arg1[_local6]);
- _local6++;
- };
- break;
- default:
- _local2 = _arg1;
- };
- return (_local2);
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import com.longtailvideo.jwplayer.model.*;
- import flash.utils.*;
- public class TypeChecker {
- public static function getType(_arg1:object, _arg2:string):string{
- var type:* = null;
- var object:* = _arg1;
- var property:* = _arg2;
- var description:* = describeType(object);
- if ((description.accessor as XMLList).length()){
- type = description.accessor.(@name == property).@type;
- } else {
- type = description.variable.(@name == property).@type;
- };
- return (type.replace(/(.+::)(.*)/, "$2"));
- }
- public static function guessType(_arg1:string):string{
- var _local2:array = ["true", "false", "t", "f"];
- if (_local2.indexof(_arg1.tolowercase().replace(" ", "")) >= 0){
- return ("Boolean");
- };
- if (_arg1.search(/^(#|0x)[0-9a-fA-F]{3,6}/) >= 0){
- return ("Color");
- };
- if (_arg1 === ""){
- return ("String");
- };
- if (!isnan(number(_arg1))){
- return ("Number");
- };
- return ("String");
- }
- public static function fromString(_arg1:string, _arg2:string=null){
- if (_arg2 == null){
- _arg2 = guessType(_arg1);
- };
- switch (_arg2.tolowercase()){
- case "color":
- if (_arg1.length > 0){
- return (new color(stringToColor(_arg1)));
- };
- return (null);
- case "number":
- return (number(_arg1));
- case "boolean":
- if (_arg1.tolowercase() == "true"){
- return (true);
- };
- if (_arg1 == "1"){
- return (true);
- };
- return (false);
- };
- return (_arg1);
- }
- public static function stringToColor(_arg1:string):uint{
- switch (_arg1.tolowercase()){
- case "blue":
- return (0xFF);
- case "green":
- return (0xFF00);
- case "red":
- return (0xFF0000);
- case "cyan":
- return (0xFFFF);
- case "magenta":
- return (0xFF00FF);
- case "yellow":
- return (0xFFFF00);
- case "black":
- return (0);
- case "white":
- return (0xFFFFFF);
- default:
- _arg1 = _arg1.replace(/(#|0x)?([0-9A-F]{3,6})$/gi, "$2");
- if (_arg1.length == 3){
- _arg1 = (((((_arg1.charat(0) + _arg1.charat(0)) + _arg1.charat(1)) + _arg1.charat(1)) + _arg1.charat(2)) + _arg1.charat(2));
- };
- return (uint(("0x" + _arg1)));
- };
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- public dynamic class NetClient {
- private var callback:object;
- public function NetClient(_arg1:object):void{
- this.callback = _arg1;
- }
- private function forward(_arg1:object, _arg2:string):void{
- var _local4:object;
- _arg1["type"] = _arg2;
- var _local3:object = new object();
- for (_local4 in _arg1) {
- _local3[_local4] = _arg1[_local4];
- };
- this.callback.onClientData(_local3);
- }
- public function close(... _args):void{
- this.forward({close:true}, "close");
- }
- public function onBWCheck(... _args):number{
- return (0);
- }
- public function onBWDone(... _args):void{
- if (_args.length > 0){
- this.forward({bandwidth:_args[0]}, "bandwidth");
- };
- }
- public function onCaption(_arg1:string, _arg2:number):void{
- this.forward({
- captions:_arg1,
- speaker:_arg2
- }, "caption");
- }
- public function onCaptionInfo(_arg1:object):void{
- this.forward(_arg1, "captioninfo");
- }
- public function onCuePoint(_arg1:object):void{
- this.forward(_arg1, "cuepoint");
- }
- public function onFCSubscribe(_arg1:object):void{
- this.forward(_arg1, "fcsubscribe");
- }
- public function onHeaderData(_arg1:object):void{
- var _local5:string;
- var _local6:string;
- var _local2:object = new object();
- var _local3 = "-";
- var _local4 = "_";
- for (_local5 in _arg1) {
- _local6 = _local5.replace("-", "_");
- _local2[_local6] = _arg1[_local5];
- };
- this.forward(_local2, "headerdata");
- }
- public function onid3(... _args):void{
- this.forward(_args[0], "id3");
- }
- public function onImageData(_arg1:object):void{
- this.forward(_arg1, "imagedata");
- }
- public function onLastSecond(_arg1:object):void{
- this.forward(_arg1, "lastsecond");
- }
- public function onMetaData(_arg1:object, ... _args):void{
- if (((_args) && ((_args.length > 0)))){
- _args.splice(0, 0, _arg1);
- this.forward({arguments:_args}, "metadata");
- } else {
- this.forward(_arg1, "metadata");
- };
- }
- public function onPlayStatus(... _args):void{
- var _local2:object;
- for each (_local2 in _args) {
- if (((_local2) && (_local2.hasOwnProperty("code")))){
- if (_local2.code == "NetStream.Play.Complete"){
- this.forward(_local2, "complete");
- } else {
- this.forward(_local2, "playstatus");
- };
- };
- };
- }
- public function onSDES(... _args):void{
- this.forward(_args[0], "sdes");
- }
- public function onXMPData(... _args):void{
- this.forward(_args[0], "xmp");
- }
- public function onXMP(... _args):void{
- this.onXMPData(_args);
- }
- public function RtmpSampleAccess(... _args):void{
- this.forward(_args[0], "rtmpsampleaccess");
- }
- public function onTextData(_arg1:object):void{
- this.forward(_arg1, "textdata");
- }
- public function onFI(_arg1:object):void{
- this.forward(_arg1, "timecode");
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.events.*;
- import flash.display.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.system.*;
- public class AssetLoader extends EventDispatcher {
- private var _loaderExtensions:array;
- private var _loader:Loader;
- private var _urlLoader:URLLoader;
- private var _errorState:boolean;
- private var LoadedClass:class;
- public var loadedObject;
- public function AssetLoader(){
- this._loaderExtensions = ["swf", "png", "gif", "jpg", "jpeg"];
- super();
- }
- public function load(_arg1:string, _arg2:class=null):void{
- this._errorState = false;
- this.LoadedClass = _arg2;
- var _local3:string = Strings.extension(_arg1);
- if (this._loaderExtensions.indexof(_local3.tolowercase()) >= 0){
- this.useLoader(_arg1);
- } else {
- this.useURLLoader(_arg1);
- };
- }
- public function loadBytes(_arg1:ByteArray):void{
- this.loader.loadBytes(_arg1);
- }
- protected function useLoader(_arg1:string):void{
- var context:* = null;
- var location:* = _arg1;
- if (RootReference.root.loaderInfo.url.indexof("http") == 0){
- context = new LoaderContext(true, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
- this.loader.load(new URLRequest(location), context);
- } else {
- try {
- this.loader.load(new URLRequest(location));
- } catch(e:error) {
- dispatchEvent(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, e.message));
- };
- };
- }
- protected function loadComplete(_arg1:Event):void{
- var evt:* = _arg1;
- try {
- if (this.LoadedClass){
- this.loadedObject = ((evt.target as LoaderInfo).content as this.LoadedClass);
- } else {
- this.loadedObject = (evt.target as LoaderInfo).content;
- };
- this.dispatchEvent(new Event(Event.COMPLETE));
- } catch(e:error) {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
- };
- }
- protected function loadStatus(_arg1:HTTPStatusEvent):void{
- switch (_arg1.status){
- case 400:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 400; Bad request."));
- break;
- case 401:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 401; Unauthorized."));
- break;
- case 403:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 403; Forbidden."));
- break;
- case 404:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 404; Not Found."));
- break;
- case 500:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 500; Internal Server Error."));
- break;
- case 503:
- this.loadError(new ErrorEvent(ErrorEvent.error, false, false, "HTTP Status 503; Service Unavailable."));
- break;
- };
- }
- protected function loadError(_arg1:ErrorEvent):void{
- this.dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
- this._errorState = true;
- }
- protected function get loader():Loader{
- if (!this._loader){
- this._loader = new Loader();
- this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loadComplete);
- this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
- this._loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loadError);
- };
- return (this._loader);
- }
- protected function useURLLoader(_arg1:string):void{
- this.urlLoader.load(new URLRequest(_arg1));
- }
- protected function urlLoadComplete(_arg1:Event):void{
- var evt:* = _arg1;
- try {
- if (this.LoadedClass){
- this.loadedObject = this.LoadedClass((evt.target as URLLoader).data);
- } else {
- this.loadedObject = (evt.target as URLLoader).data;
- };
- this.dispatchEvent(new Event(Event.COMPLETE));
- } catch(e:error) {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
- };
- }
- protected function get urlLoader():URLLoader{
- if (!this._urlLoader){
- this._urlLoader = new URLLoader();
- this._urlLoader.addEventListener(Event.COMPLETE, this.urlLoadComplete);
- this._urlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.loadError);
- this._urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.loadStatus);
- this._urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loadError);
- };
- return (this._urlLoader);
- }
- override public function dispatchEvent(_arg1:Event):boolean{
- if (!this._errorState){
- return (super.dispatchEvent(_arg1));
- };
- return (false);
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.display.*;
- public class Stacker {
- public var clip:movieclip;
- private var stack:array;
- private var _width:number;
- private var latest:number = 0;
- public function Stacker(_arg1:movieclip):void{
- this.clip = _arg1;
- this.analyze();
- }
- private function analyze():void{
- var _local2:DisplayObject;
- this._width = this.clip.width;
- this.stack = new array();
- var _local1:number = 0;
- while (_local1 < this.clip.numChildren) {
- _local2 = this.clip.getChildAt(_local1);
- this.stack.push({
- c:_local2,
- x:_local2.x,
- n:_local2.name,
- w:_local2.width,
- nr:_local2.hasOwnProperty("stacker.noresize")
- });
- _local1++;
- };
- this.stack.sorton(["x", "n"], [array.NUMERIC, array.CASEINSENSITIVE]);
- }
- private function overlaps(_arg1:number):boolean{
- var _local2:number = this.stack[_arg1].x;
- var _local3:number = (this.stack[_arg1].x + this.stack[_arg1].w);
- var _local4:number = 0;
- while (_local4 < this.stack.length) {
- 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)))){
- return (true);
- };
- _local4++;
- };
- return (false);
- }
- public function rearrange(_arg1:number=undefined):void{
- var _local6:number;
- if (_arg1){
- this.latest = _arg1;
- };
- var _local2:number = (this.latest - this.width);
- var _local3:number = 0;
- var _local4:number = 0;
- while (_local4 < this.stack.length) {
- if (this.stack[_local4].x > (this.width / 2)){
- this.stack[_local4].c.x = (this.stack[_local4].x + _local2);
- if ((((this.stack[_local4].c.visible == false)) && ((this.overlaps(_local4) == false)))){
- if (_local4 < (this.stack.length - 1)){
- _local2 = (_local2 - (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
- } else {
- _local2 = (_local2 - (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
- };
- };
- } else {
- this.stack[_local4].c.x = (this.stack[_local4].x - _local3);
- if ((((this.stack[_local4].c.visible == false)) && ((this.overlaps(_local4) == false)))){
- if (this.stack[(_local4 - 1)].w > (this.width / 4)){
- _local3 = (_local3 + (this.stack[_local4].w + this.stack[_local4].x));
- } else {
- _local3 = (_local3 + (((this.stack[_local4].w + this.stack[_local4].x) - this.stack[(_local4 - 1)].x) - this.stack[(_local4 - 1)].w));
- };
- };
- };
- if ((((this.stack[_local4].w > (this.width / 4))) && (!(this.stack[_local4].nr)))){
- this.stack[_local4].c.width = math.abs(((this.stack[_local4].w + _local2) + _local3));
- } else {
- if ((this.stack[_local4].c is InteractiveObject)){
- this.stack[_local4].c.tabindex = (_local4 + 1);
- };
- };
- _local4++;
- };
- var _local5:number = ((this.latest - this.width) - _local2);
- if (_local5 > 0){
- _local6 = 0;
- while (_local6 < this.stack.length) {
- if (this.stack[_local6].x > (this.width / 2)){
- this.stack[_local6].c.x = (this.stack[_local6].c.x + _local5);
- };
- if ((((this.stack[_local6].w > (this.width / 4))) && ((this.stack[_local6].w < this.width)))){
- this.stack[_local6].c.width = (this.stack[_local6].c.width + _local5);
- };
- _local6++;
- };
- };
- }
- public function get width():number{
- return (this._width);
- }
- public function insert(_arg1:movieclip, _arg2:movieclip):void{
- var _local3:number = 0;
- var _local4:number = 0;
- while (_local4 < this.stack.length) {
- if (this.stack[_local4].w >= this._width){
- this.stack[_local4].w = (this.stack[_local4].w + _arg1.width);
- };
- if ((((this.stack[_local4].c == _arg2)) && (!(_local3)))){
- _local3 = _local4;
- this.stack.splice(_local4, 0, {
- c:_arg1,
- x:this.stack[_local4].x,
- n:_arg1.name,
- w:_arg1.width
- });
- } else {
- if (_local3){
- this.stack[_local4].x = (this.stack[_local4].x + _arg1.width);
- };
- };
- _local4++;
- };
- this._width = (this._width + _arg1.width);
- this.rearrange();
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import com.adobe.serialization.json.*;
- public class Strings {
- public static function decode(_arg1:string):string{
- if (_arg1.indexof("asfunction") == -1){
- return (unescape(_arg1));
- };
- return ("");
- }
- public static function digits(_arg1:number):string{
- var _local2:number = math.floor((_arg1 / 60));
- var _local3:number = math.floor((_arg1 % 60));
- var _local4:string = ((Strings.zero(_local2) + ":") + Strings.zero(_local3));
- return (_local4);
- }
- public static function seconds(_arg1:string):number{
- _arg1 = _arg1.replace(",", ".");
- var _local2:array = _arg1.split(":");
- var _local3:number = 0;
- if (_arg1.substr(-2) == "ms"){
- _local3 = (number(_arg1.substr(0, (_arg1.length - 2))) / 1000);
- } else {
- if (_arg1.substr(-1) == "s"){
- _local3 = number(_arg1.substr(0, (_arg1.length - 1)));
- } else {
- if (_arg1.substr(-1) == "m"){
- _local3 = (number(_arg1.substr(0, (_arg1.length - 1))) * 60);
- } else {
- if (_arg1.substr(-1) == "h"){
- _local3 = (number(_arg1.substr(0, (_arg1.length - 1))) * 3600);
- } else {
- if (_local2.length > 1){
- _local3 = number(_local2[(_local2.length - 1)]);
- _local3 = (_local3 + (number(_local2[(_local2.length - 2)]) * 60));
- if (_local2.length == 3){
- _local3 = (_local3 + (number(_local2[(_local2.length - 3)]) * 3600));
- };
- } else {
- _local3 = number(_arg1);
- };
- };
- };
- };
- };
- return (_local3);
- }
- public static function serialize(_arg1:string):object{
- var jsonString:* = null;
- var val:* = _arg1;
- if (val == null){
- return (null);
- };
- if (val == "true"){
- return (true);
- };
- if (val == "false"){
- return (false);
- };
- if (val.indexof("[[JSON]]") == 0){
- jsonString = val.substring(8, val.length);
- try {
- return (new JSONDecoder(jsonString, false).getValue());
- } catch(e:error) {
- Logger.log(((("Error parsing JSON string: " + e.message) + ". String: ") + jsonString));
- };
- return (jsonString);
- };
- if (((((isnan(number(val))) || ((val.length > 5)))) || ((val.length == 0)))){
- return (val);
- };
- return (number(val));
- }
- public static function strip(_arg1:string):string{
- var _local4:number;
- var _local2:array = _arg1.split("\n");
- _arg1 = _local2.join("");
- _local2 = _arg1.split("\r");
- _arg1 = _local2.join("");
- var _local3:number = _arg1.indexof("<");
- while (_local3 != -1) {
- _local4 = _arg1.indexof(">", (_local3 + 1));
- if ((_local4 == -1)){
- _local4 = (_arg1.length - 1);
- };
- _arg1 = ((_arg1.substr(0, _local3) + " ") + _arg1.substr((_local4 + 1), _arg1.length));
- _local3 = _arg1.indexof("<", _local3);
- };
- return (_arg1);
- }
- public static function zero(_arg1:number):string{
- if (_arg1 < 10){
- return (("0" + _arg1));
- };
- return (("" + _arg1));
- }
- public static function extension(_arg1:string):string{
- if (((_arg1) && ((_arg1.lastindexof(".") > 0)))){
- if (_arg1.lastindexof("?") > 0){
- _arg1 = string(_arg1.split("?")[0]);
- };
- return (_arg1.substring((_arg1.lastindexof(".") + 1), _arg1.length).tolowercase());
- };
- return ("");
- }
- public static function print_r(_arg1:object):string{
- var _local3:object;
- var _local2 = "";
- if (typeof(_arg1) == "object"){
- _local2 = (_local2 + "{");
- };
- for (_local3 in _arg1) {
- if (typeof(_arg1[_local3]) == "object"){
- _local2 = (_local2 + (_local3 + ": "));
- } else {
- _local2 = (_local2 + ((_local3 + ": ") + _arg1[_local3]));
- };
- _local2 = (_local2 + (print_r(_arg1[_local3]) + ", "));
- };
- if (_local2 != "{"){
- _local2 = _local2.substr(0, (_local2.length - 2));
- };
- if (typeof(_arg1) == "object"){
- _local2 = (_local2 + "}");
- };
- return (_local2);
- }
- public static function trim(_arg1:string):string{
- return (_arg1.replace(/^\s+/, "").replace(/\s+$/, ""));
- }
- public static function xmlAttribute(_arg1:xml, _arg2:string):string{
- var _local3:xml;
- for each (_local3 in _arg1.attributes()) {
- if (_local3.name().tostring().tolowercase() == _arg2.tolowercase()){
- return (_local3.tostring());
- };
- };
- return ("");
- }
- public static function getAbsolutePath(_arg1:string, _arg2:string=null):string{
- var _local5:array;
- if (_arg2 == null){
- return (_arg1);
- };
- if (isAbsolutePath(_arg1)){
- return (_arg1);
- };
- var _local3:string = _arg2.substring(0, (_arg2.indexof("://") + 3));
- var _local4:string = _arg2.substring(_local3.length, _arg2.indexof("/", (_local3.length + 1)));
- if (_arg1.indexof("/") === 0){
- _local5 = _arg1.split("/");
- } else {
- _arg2 = _arg2.split("?")[0];
- _arg2 = _arg2.substring(((_local3.length + _local4.length) + 1), _arg2.lastindexof("/"));
- _local5 = _arg2.split("/").concat(_arg1.split("/"));
- };
- var _local6:array = [];
- var _local7:int;
- while (_local7 < _local5.length) {
- if (((((!(_local5[_local7])) || ((_local5[_local7] === undefined)))) || ((_local5[_local7] == ".")))){
- } else {
- if (_local5[_local7] == ".."){
- _local6.pop();
- } else {
- _local6.push(_local5[_local7]);
- };
- };
- _local7++;
- };
- return ((((_local3 + _local4) + "/") + _local6.join("/")));
- }
- public static function isAbsolutePath(_arg1:string):boolean{
- var _local2:int = _arg1.indexof("://");
- var _local3:int = _arg1.indexof("?");
- return ((((_local2 > 0)) && ((((_local3 < 0)) || ((_local3 > _local2))))));
- }
- public static function cleanLink(_arg1:string):string{
- return (_arg1.replace(/^(javascript|asfunction|vbscript)\:/, ""));
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.utils {
- import flash.display.*;
- public class Stretcher {
- public static var EXACTFIT:string = "exactfit";
- public static var FILL:string = "fill";
- public static var NONE:string = "none";
- public static var UNIFORM:string = "uniform";
- public static function stretch(_arg1:DisplayObject, _arg2:number, _arg3:number, _arg4:string="uniform"):void{
- var _local5:number = (_arg2 / _arg1.width);
- var _local6:number = (_arg3 / _arg1.height);
- switch (_arg4.tolowercase()){
- case Stretcher.EXACTFIT:
- _arg1.width = _arg2;
- _arg1.height = _arg3;
- break;
- case Stretcher.FILL:
- if (_local5 > _local6){
- _arg1.width = (_arg1.width * _local5);
- _arg1.height = (_arg1.height * _local5);
- } else {
- _arg1.width = (_arg1.width * _local6);
- _arg1.height = (_arg1.height * _local6);
- };
- break;
- case Stretcher.NONE:
- _arg1.scaleX = 1;
- _arg1.scaleY = 1;
- break;
- case Stretcher.UNIFORM:
- default:
- if (_local5 > _local6){
- _arg1.width = (_arg1.width * _local6);
- _arg1.height = (_arg1.height * _local6);
- } else {
- _arg1.width = (_arg1.width * _local5);
- _arg1.height = (_arg1.height * _local5);
- };
- };
- _arg1.x = math.round(((_arg2 / 2) - (_arg1.width / 2)));
- _arg1.y = math.round(((_arg3 / 2) - (_arg1.height / 2)));
- if (_arg1.width > 0){
- _arg1.width = math.ceil(_arg1.width);
- };
- if (_arg1.height > 0){
- _arg1.height = math.ceil(_arg1.height);
- };
- }
- }
- }//package com.longtailvideo.jwplayer.utils
- package com.longtailvideo.jwplayer.controller {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.utils.*;
- public class TaskQueue extends EventDispatcher {
- private var activeTask:function = null;
- private var taskIndex:number = -1;
- private var taskSuccess:Dictionary;
- private var taskFailure:Dictionary;
- private var taskOrder:array;
- private var continueOnFailure:boolean;
- private var failureState:boolean = false;
- private var completed:boolean = false;
- public function TaskQueue(_arg1:boolean=false){
- this.taskOrder = [];
- this.taskSuccess = new Dictionary();
- this.taskFailure = new Dictionary();
- this.continueOnFailure = _arg1;
- }
- public function queueTask(_arg1:function, _arg2:function=null, _arg3:function=null):void{
- this.taskOrder.push(_arg1);
- if (_arg2 != null){
- this.taskSuccess[_arg1] = _arg2;
- this.taskFailure[_arg1] = _arg3;
- };
- }
- public function runTasks():void{
- if (this.activeTask == null){
- this.nextTask();
- };
- }
- public function success(_arg1:Event=null):void{
- var _local2:function;
- if (!this.failureState){
- _local2 = (this.taskSuccess[this.activeTask] as function);
- if (_local2 != null){
- _local2(_arg1);
- };
- this.nextTask();
- };
- }
- public function failure(_arg1:Event):void{
- var _local2:function = (this.taskFailure[this.activeTask] as function);
- if (_local2 != null){
- _local2(_arg1);
- };
- if ((_arg1 is ErrorEvent)){
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + ErrorEvent(_arg1).text)));
- } else {
- if ((((_arg1 is PlayerEvent)) && ((_arg1 as PlayerEvent).message))){
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + PlayerEvent(_arg1).message)));
- } else {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, ((("Task Queue failed at step " + this.taskIndex) + ": ") + _arg1.tostring())));
- };
- };
- if (this.continueOnFailure){
- this.nextTask();
- } else {
- this.failureState = true;
- };
- }
- private function nextTask():void{
- if (this.taskOrder.length > 0){
- this.activeTask = (this.taskOrder.shift() as function);
- this.taskIndex++;
- this.activeTask();
- } else {
- if (!this.completed){
- this.completed = true;
- dispatchEvent(new Event(Event.COMPLETE));
- };
- };
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- import com.longtailvideo.jwplayer.plugins.*;
- public class LockManager {
- private var _queue:array;
- public function LockManager(){
- this._queue = [];
- super();
- }
- public function lock(_arg1:IPlugin, _arg2:function):boolean{
- var _local3:object = {};
- _local3["plugin"] = _arg1;
- _local3["callback"] = _arg2;
- this._queue.push(_local3);
- return (true);
- }
- public function unlock(_arg1:IPlugin):boolean{
- var _local2:object;
- if (this.locked()){
- _local2 = this._queue[0];
- if (_local2["plugin"] == _arg1){
- this._queue.shift();
- this.executeCallback();
- return (true);
- };
- };
- return (false);
- }
- public function executeCallback():void{
- var _local1:object;
- var _local2:function;
- if (this.locked()){
- _local1 = this._queue[0];
- _local2 = (_local1["callback"] as function);
- _local2();
- };
- }
- public function locked():boolean{
- return ((this._queue.length > 0));
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- import flash.events.*;
- import com.longtailvideo.jwplayer.media.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class MediaProviderLoader extends EventDispatcher {
- private var repository:string = "http://providers.longtailvideo.com/5/";
- public var loadedSource:MediaProvider;
- public function loadSource(_arg1:string):void{
- var _local2:AssetLoader = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadHandler);
- _local2.addEventListener(ErrorEvent.error, this.loadHandler);
- if (_arg1.substr((_arg1.length - 4), 4) == ".swf"){
- _local2.load(_arg1);
- } else {
- _local2.load(((this.repository + _arg1) + ".swf"));
- };
- }
- private function loadHandler(_arg1:Event):void{
- var evt:* = _arg1;
- var loader:* = (evt.target as AssetLoader);
- try {
- this.loadedSource = (loader.loadedObject as MediaProvider);
- if (this.loadedSource){
- dispatchEvent(new Event(Event.COMPLETE));
- } else {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, "Loaded file is not a valid media provider."));
- };
- } catch(e:error) {
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, e.message));
- };
- }
- private function loadError(_arg1:ErrorEvent):void{
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1.text));
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.jeroenwijering.events.*;
- import com.longtailvideo.jwplayer.parsers.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class Controller extends GlobalEventDispatcher {
- protected var _player:IPlayer;
- protected var _model:Model;
- protected var _view:View;
- protected var _setupComplete:boolean = false;
- protected var _setupFinalized:boolean = false;
- protected var _unlockAutostart:boolean = false;
- protected var _lockingResume:boolean = false;
- protected var _lockManager:LockManager;
- protected var _unlockAndLoad:boolean;
- protected var _playlistReady:boolean = false;
- protected var _queuedSeek:number = -1;
- protected var _idleSeek:number = -1;
- protected var cdns:object;
- protected var _delayedItem:PlaylistItem;
- protected var _mediaLoader:MediaProviderLoader;
- public function Controller(_arg1:IPlayer, _arg2:Model, _arg3:View){
- this.cdns = {
- bitgravity:{
- http.startparam:"starttime",
- provider:"http"
- },
- edgecast:{
- http.startparam:"ec_seek",
- provider:"http"
- },
- flvseek:{
- http.startparam:"fs",
- provider:"http"
- },
- highwinds:{
- rtmp.loadbalance:true,
- provider:"rtmp"
- },
- lighttpd:{
- http.startparam:"start",
- provider:"http"
- },
- vdox:{
- rtmp.loadbalance:true,
- provider:"rtmp"
- }
- };
- super();
- this._player = _arg1;
- this._model = _arg2;
- this._view = _arg3;
- this._lockManager = new LockManager();
- }
- public function setupPlayer():void{
- var _local1:PlayerSetup = new PlayerSetup(this._player, this._model, this._view);
- _local1.addEventListener(Event.COMPLETE, this.setupComplete);
- _local1.addEventListener(ErrorEvent.error, this.setupError);
- this.addViewListeners();
- _local1.setupPlayer();
- }
- protected function addViewListeners():void{
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PLAY, this.playHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PAUSE, this.pauseHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_STOP, this.stopHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_NEXT, this.nextHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_PREV, this.prevHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_SEEK, this.seekHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_MUTE, this.muteHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_VOLUME, this.volumeHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, this.fullscreenHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_LOAD, this.loadHandler);
- this._view.addEventListener(ViewEvent.JWPLAYER_VIEW_REDRAW, this.redrawHandler);
- }
- protected function playHandler(_arg1:ViewEvent):void{
- this.play();
- }
- protected function stopHandler(_arg1:ViewEvent):void{
- this.stop();
- }
- protected function pauseHandler(_arg1:ViewEvent):void{
- this.pause();
- }
- protected function nextHandler(_arg1:ViewEvent):void{
- this.next();
- }
- protected function prevHandler(_arg1:ViewEvent):void{
- this.previous();
- }
- protected function seekHandler(_arg1:ViewEvent):void{
- this.seek(_arg1.data);
- }
- protected function muteHandler(_arg1:ViewEvent):void{
- this.mute(_arg1.data);
- }
- protected function volumeHandler(_arg1:ViewEvent):void{
- this.setvolume(_arg1.data);
- }
- protected function fullscreenHandler(_arg1:ViewEvent):void{
- this.fullscreen(_arg1.data);
- }
- protected function loadHandler(_arg1:ViewEvent):void{
- this.load(_arg1.data);
- }
- protected function redrawHandler(_arg1:ViewEvent):void{
- this.redraw();
- }
- protected function setupComplete(_arg1:Event):void{
- this._setupComplete = true;
- RootReference.stage.dispatchEvent(new Event(Event.RESIZE));
- this._view.completeView();
- this.finalizeSetup();
- }
- protected function setupError(_arg1:ErrorEvent):void{
- Logger.log(("STARTUP: Error occurred during player startup: " + _arg1.text));
- this._view.completeView(true, _arg1.text);
- dispatchEvent(_arg1.clone());
- }
- protected function finalizeSetup():void{
- if (((((!(this.locking)) && (this._setupComplete))) && (!(this._setupFinalized)))){
- this._setupFinalized = true;
- this._player.addEventListener(ErrorEvent.error, this.errorHandler);
- this._model.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.playlistLoadHandler, false, -1);
- this._model.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this.playlistItemHandler, false, 1000);
- this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_COMPLETE, this.completeHandler, false);
- this._model.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, this.timeHandler);
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_READY));
- if (this._model.playlist.length > 0){
- this._model.dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this._model.playlist));
- };
- };
- }
- protected function playlistLoadHandler(_arg1:PlaylistEvent=null):void{
- this._playlistReady = true;
- if (this._model.config.shuffle){
- this.shuffleItem();
- } else {
- if (this._model.config.item >= this._model.playlist.length){
- this._model.config.item = (this._model.playlist.length - 1);
- };
- this._model.playlist.currentIndex = this._model.config.item;
- };
- if (this._model.config.autostart){
- if (this.locking){
- this._unlockAutostart = true;
- } else {
- this.play();
- };
- };
- }
- protected function shuffleItem():void{
- this._model.playlist.currentIndex = math.floor((math.random() * this._model.playlist.length));
- }
- protected function playlistItemHandler(_arg1:PlaylistEvent):void{
- this._model.config.item = this._model.playlist.currentIndex;
- this.load(this._model.playlist.currentItem);
- }
- protected function errorHandler(_arg1:ErrorEvent):void{
- this._delayedItem = null;
- this._mediaLoader = null;
- this.errorState(_arg1.text);
- }
- protected function errorState(_arg1:string=""):void{
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, _arg1));
- }
- protected function completeHandler(_arg1:MediaEvent):void{
- switch (this._model.config.repeat){
- case RepeatOptions.SINGLE:
- this.play();
- break;
- case RepeatOptions.ALWAYS:
- if ((((this._model.playlist.currentIndex == (this._model.playlist.length - 1))) && (!(this._model.config.shuffle)))){
- this._model.playlist.currentIndex = 0;
- this.play();
- } else {
- this.next();
- };
- break;
- case RepeatOptions.list:
- if ((((this._model.playlist.currentIndex == (this._model.playlist.length - 1))) && (!(this._model.config.shuffle)))){
- this._lockingResume = false;
- this._model.playlist.currentIndex = 0;
- } else {
- this.next();
- };
- break;
- };
- }
- public function get locking():boolean{
- return (this._lockManager.locked());
- }
- public function lockPlayback(_arg1:IPlugin, _arg2:function):void{
- var _local3:boolean = this.locking;
- if (this._lockManager.lock(_arg1, _arg2)){
- if ((((this._player.state == PlayerState.PLAYING)) || ((this._player.state == PlayerState.BUFFERING)))){
- this._model.media.pause();
- this._lockingResume = true;
- };
- if (!_local3){
- Logger.log((_arg1.id + " locking playback"), "LOCK");
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_LOCKED));
- this._lockManager.executeCallback();
- };
- };
- }
- public function unlockPlayback(_arg1:IPlugin):boolean{
- if (this._lockManager.unlock(_arg1)){
- if (!this.locking){
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_UNLOCKED));
- };
- if (((this._setupComplete) && (!(this._setupFinalized)))){
- this.finalizeSetup();
- };
- if (!this.locking){
- if (this._unlockAndLoad){
- this.load(this._player.playlist.currentItem);
- this._unlockAndLoad = false;
- };
- if (((this._lockingResume) || (this._unlockAutostart))){
- this._lockingResume = false;
- this.play();
- if (this._unlockAutostart){
- this._unlockAutostart = false;
- };
- };
- return (true);
- };
- };
- return (false);
- }
- public function setvolume(_arg1:number):boolean{
- if (this.locking){
- return (false);
- };
- if (this._model.media){
- this.mute(false);
- this._model.config.volume = _arg1;
- this._model.media.setvolume(_arg1);
- this.setCookie("volume", _arg1);
- return (true);
- };
- return (false);
- }
- public function mute(_arg1:boolean):boolean{
- if (this.locking){
- return (false);
- };
- if (((_arg1) && (!(this._model.mute)))){
- this._model.mute = true;
- this.setCookie("mute", true);
- return (true);
- };
- if (((!(_arg1)) && (this._model.mute))){
- this._model.mute = false;
- this.setCookie("mute", false);
- return (true);
- };
- return (false);
- }
- public function play():boolean{
- if (!this._playlistReady){
- Logger.log("Attempted to begin playback before playlist is ready");
- return (false);
- };
- if (this._mediaLoader){
- this._delayedItem = this._model.playlist.currentItem;
- return (false);
- };
- if (this.locking){
- return (false);
- };
- if (this._model.playlist.currentItem){
- switch (this._player.state){
- case PlayerState.IDLE:
- this._model.media.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL, this.bufferFullHandler);
- this._model.media.load(this._model.playlist.currentItem);
- break;
- case PlayerState.PAUSED:
- if (this._queuedSeek >= 0){
- this._model.media.seek(this._queuedSeek);
- this._queuedSeek = -1;
- } else {
- this._model.media.play();
- };
- break;
- };
- };
- return (true);
- }
- public function pause():boolean{
- if (this.locking){
- return (false);
- };
- if (!this._model.media){
- return (false);
- };
- switch (this._model.media.state){
- case PlayerState.PLAYING:
- case PlayerState.BUFFERING:
- this._model.media.pause();
- return (true);
- };
- return (false);
- }
- public function stop():boolean{
- if (this.locking){
- return (false);
- };
- if (!this._model.media){
- return (false);
- };
- switch (this._model.media.state){
- case PlayerState.PLAYING:
- case PlayerState.BUFFERING:
- case PlayerState.PAUSED:
- this._model.media.stop();
- return (true);
- };
- return (false);
- }
- public function next():boolean{
- if (this.locking){
- this._unlockAndLoad = true;
- return (false);
- };
- this._lockingResume = true;
- this.stop();
- if (this._model.config.shuffle){
- this.shuffleItem();
- } else {
- if (this._model.playlist.currentIndex == (this._model.playlist.length - 1)){
- this._player.playlist.currentIndex = 0;
- } else {
- this._player.playlist.currentIndex = (this._player.playlist.currentIndex + 1);
- };
- };
- this.play();
- return (true);
- }
- public function previous():boolean{
- if (this.locking){
- this._unlockAndLoad = true;
- return (false);
- };
- this._lockingResume = true;
- this.stop();
- if (this._model.config.shuffle){
- this.shuffleItem();
- } else {
- if (this._model.playlist.currentIndex <= 0){
- this._model.playlist.currentIndex = (this._model.playlist.length - 1);
- } else {
- this._player.playlist.currentIndex = (this._player.playlist.currentIndex - 1);
- };
- };
- this.play();
- return (true);
- }
- public function setPlaylistIndex(_arg1:number):boolean{
- if (this.locking){
- this._unlockAndLoad = true;
- return (false);
- };
- this._lockingResume = true;
- if ((((0 <= _arg1)) && ((_arg1 < this._player.playlist.length)))){
- this.stop();
- this._player.playlist.currentIndex = _arg1;
- this.play();
- return (true);
- };
- return (false);
- }
- public function seek(_arg1:number):boolean{
- if (this.locking){
- return (false);
- };
- if (((!(this._model.media)) || ((_arg1 == -1)))){
- return (false);
- };
- switch (this._model.media.state){
- case PlayerState.PLAYING:
- case PlayerState.PAUSED:
- this._model.seek(_arg1);
- return (true);
- case PlayerState.IDLE:
- this._model.playlist.currentItem.start = _arg1;
- this._idleSeek = _arg1;
- this.play();
- return (true);
- case PlayerState.BUFFERING:
- this._queuedSeek = _arg1;
- break;
- };
- return (false);
- }
- public function load(_arg1):boolean{
- if (this.locking){
- this._unlockAndLoad = true;
- return (false);
- };
- if (this._model.state != ModelStates.IDLE){
- this._model.media.stop();
- };
- if ((_arg1 is PlaylistItem)){
- return (this.loadPlaylistItem((_arg1 as PlaylistItem)));
- };
- if ((_arg1 is string)){
- return (this.loadString((_arg1 as string)));
- };
- if ((_arg1 is number)){
- return (this.loadNumber((_arg1 as number)));
- };
- if ((_arg1 is array)){
- return (this.loadArray((_arg1 as array)));
- };
- if ((_arg1 is object)){
- return (this.loadObject((_arg1 as object)));
- };
- return (false);
- }
- protected function loadPlaylistItem(_arg1:PlaylistItem):boolean{
- var item:* = _arg1;
- if (this.locking){
- this._lockingResume = true;
- return (false);
- };
- if (!this._model.playlist.contains(item)){
- this._model.playlist.load(item);
- return (false);
- };
- try {
- if (((!(item.streamer)) && (this._model.config.streamer))){
- item.streamer = this._model.config.streamer;
- };
- if (!item.provider){
- item.provider = JWParser.getProvider(item);
- };
- if (((!(this.setProvider(item))) && (item.file))){
- this._model.playlist.load(item.file);
- } else {
- if (this._mediaLoader){
- this._model.setActiveMediaProvider("default");
- dispatchEvent(new PlayerStateEvent(PlayerStateEvent.JWPLAYER_PLAYER_STATE, PlayerState.BUFFERING, PlayerState.IDLE));
- };
- };
- } catch(err:error) {
- Logger.log(err.message, "ERROR");
- return (false);
- };
- Logger.log(("Loading PlaylistItem: " + item.tostring()), "LOAD");
- return (true);
- }
- protected function loadString(_arg1:string):boolean{
- this._model.playlist.load(new PlaylistItem({file:_arg1}));
- return (true);
- }
- protected function loadArray(_arg1:array):boolean{
- if (_arg1.length > 0){
- this._model.playlist.load(_arg1);
- return (true);
- };
- return (false);
- }
- protected function loadNumber(_arg1:number):boolean{
- if ((((_arg1 >= 0)) && ((_arg1 < this._model.playlist.length)))){
- this._model.playlist.currentIndex = _arg1;
- return (this.loadPlaylistItem(this._model.playlist.currentItem));
- };
- return (false);
- }
- protected function loadObject(_arg1:object):boolean{
- if (((_arg1.hasOwnProperty("file")) || (_arg1.hasOwnProperty("levels")))){
- this._model.playlist.load(new PlaylistItem(_arg1));
- return (true);
- };
- return (false);
- }
- protected function setProvider(_arg1:PlaylistItem):boolean{
- var _local2:string = _arg1.provider;
- if (_local2){
- if (this.cdns.hasOwnProperty(_local2)){
- this._model.config.setConfig(this.cdns[_local2]);
- _local2 = this.cdns[_local2]["provider"];
- };
- if (!this._model.hasMediaProvider(_local2)){
- this._mediaLoader = new MediaProviderLoader();
- this._mediaLoader.addEventListener(Event.COMPLETE, this.mediaSourceLoaded);
- this._mediaLoader.addEventListener(ErrorEvent.error, this.errorHandler);
- this._mediaLoader.loadSource(_local2);
- return (true);
- };
- this._model.setActiveMediaProvider(_local2);
- return (true);
- };
- return (false);
- }
- protected function mediaSourceLoaded(_arg1:Event):void{
- var _local2:MediaProviderLoader = this._mediaLoader;
- this._mediaLoader = null;
- if (this._delayedItem){
- this._model.setMediaProvider(this._delayedItem.provider, _local2.loadedSource);
- this._model.setActiveMediaProvider(this._delayedItem.provider);
- this._delayedItem = null;
- this.play();
- } else {
- this._model.setMediaProvider(this._model.playlist.currentItem.provider, _local2.loadedSource);
- this._model.setActiveMediaProvider(this._model.playlist.currentItem.provider);
- };
- }
- private function bufferFullHandler(_arg1:MediaEvent):void{
- if (!this.locking){
- if (this._queuedSeek >= 0){
- this._model.media.seek(this._queuedSeek);
- this._queuedSeek = -1;
- } else {
- this._model.media.play();
- };
- } else {
- this._lockingResume = true;
- };
- }
- private function timeHandler(_arg1:MediaEvent):void{
- if ((((this._idleSeek > 0)) && ((_arg1.position >= this._idleSeek)))){
- this._model.playlist.currentItem.start = 0;
- this._idleSeek = -1;
- };
- }
- public function redraw():boolean{
- if (this.locking){
- return (false);
- };
- this._view.redraw();
- return (true);
- }
- public function fullscreen(_arg1:boolean):boolean{
- this._view.fullscreen(_arg1);
- this._model.fullscreen = _arg1;
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_FULLSCREEN, _arg1.tostring()));
- return (true);
- }
- protected function setCookie(_arg1:string, _arg2):void{
- Configger.saveCookie(_arg1, _arg2);
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- import flash.events.*;
- import flash.display.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class PluginLoader extends EventDispatcher {
- public var plugins:object;
- private var loaders:Dictionary;
- public function PluginLoader(){
- this.loaders = new Dictionary();
- this.plugins = {};
- }
- protected function get pluginRepository():string{
- try {
- if (RootReference.root.loaderInfo.url.indexof("https://") == 0){
- return ("https://secureplugins.longtailvideo.com/");
- };
- } catch(e:error) {
- };
- return ("http://plugins.longtailvideo.com/");
- }
- public function loadPlugins(_arg1:string):void{
- var _local2:array;
- var _local3:string;
- if (_arg1){
- _local2 = _arg1.replace(/\s*/g, "").split(",");
- for each (_local3 in _local2) {
- if (_local3){
- this.loadLocalPlugin(_local3);
- };
- };
- } else {
- dispatchEvent(new Event(Event.COMPLETE));
- };
- }
- private function loadLocalPlugin(_arg1:string):void{
- var _local2:AssetLoader;
- if (_arg1.indexof("/") >= 0){
- _local2 = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
- _local2.addEventListener(ErrorEvent.error, this.loadLocalFailed);
- this.loaders[_local2] = _arg1;
- _local2.load(_arg1);
- } else {
- this.loadV5Plugin(_arg1);
- };
- }
- private function loadLocalFailed(_arg1:ErrorEvent):void{
- var _local2:AssetLoader = (_arg1.target as AssetLoader);
- var _local3:string = this.loaders[_local2];
- _local2.removeEventListener(ErrorEvent.error, this.loadLocalFailed);
- delete this.loaders[_local2];
- this.checkComplete();
- }
- private function loadV5Plugin(_arg1:string):void{
- var _local2:AssetLoader = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
- _local2.addEventListener(ErrorEvent.error, this.loadV5Failed);
- var _local3:array = _arg1.substr((_arg1.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-");
- var _local4:string = _local3[0];
- var _local5:string = (((_local3.length > 1)) ? ("-" + _local3[1]) : "");
- var _local6 = ((((((this.pluginRepository + "5/") + _local4) + "/") + _local4) + _local5) + ".swf");
- this.loaders[_local2] = _arg1;
- _local2.load(_local6);
- }
- private function loadV5Failed(_arg1:ErrorEvent):void{
- var _local2:AssetLoader = (_arg1.target as AssetLoader);
- var _local3:string = (this.loaders[_local2] as string);
- _local2.removeEventListener(ErrorEvent.error, this.loadV5Failed);
- delete this.loaders[_local2];
- this.loadV4Plugin(_local3);
- }
- private function loadV4Plugin(_arg1:string):void{
- var _local2:AssetLoader = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loadSuccess);
- _local2.addEventListener(ErrorEvent.error, this.loadV4Failed);
- this.loaders[_local2] = _arg1;
- if (Strings.extension(_arg1) == "swf"){
- _arg1 = _arg1.substring(0, (_arg1.length - 4));
- };
- _local2.load((((this.pluginRepository + "4/") + _arg1) + ".swf"));
- }
- private function loadV4Failed(_arg1:ErrorEvent):void{
- var _local2:AssetLoader = (_arg1.target as AssetLoader);
- delete this.loaders[_local2];
- this.checkComplete();
- }
- private function loadSuccess(_arg1:Event):void{
- var _local2:AssetLoader = (_arg1.target as AssetLoader);
- var _local3:string = (this.loaders[_local2] as string);
- var _local4:string = _local3.substr((_local3.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-")[0];
- this.plugins[_local4] = (_local2.loadedObject as DisplayObject);
- _local2.removeEventListener(Event.COMPLETE, this.loadSuccess);
- delete this.loaders[_local2];
- this.checkComplete();
- }
- private function checkComplete():void{
- var _local2:string;
- var _local1:boolean;
- for each (_local2 in this.loaders) {
- _local1 = true;
- };
- if (!_local1){
- dispatchEvent(new Event(Event.COMPLETE));
- };
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.view.interfaces.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import com.longtailvideo.jwplayer.view.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.view.skins.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.jeroenwijering.events.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class PlayerSetup extends EventDispatcher {
- protected var _player:IPlayer;
- protected var _model:Model;
- protected var _view:View;
- protected var tasker:TaskQueue;
- protected var confHash:object;
- protected var confPlaylist:array;
- public function PlayerSetup(_arg1:IPlayer, _arg2:Model, _arg3:View){
- this._player = _arg1;
- this._model = _arg2;
- this._view = _arg3;
- }
- public function setupPlayer():void{
- this.tasker = new TaskQueue(false);
- this.tasker.addEventListener(Event.COMPLETE, this.setupTasksComplete);
- this.tasker.addEventListener(ErrorEvent.error, this.setupTasksFailed);
- this.tasker.queueTask(this.loadConfig, this.loadConfigComplete);
- this.tasker.queueTask(this.loadSkin, this.loadSkinComplete);
- this.tasker.queueTask(this.setupMediaProviders);
- this.tasker.queueTask(this.setupView);
- this.tasker.queueTask(this.loadPlugins, this.loadPluginsComplete);
- this.tasker.queueTask(this.loadPlaylist, this.loadPlaylistComplete);
- this.tasker.queueTask(this.initPlugins);
- this.tasker.runTasks();
- }
- protected function setupTasksComplete(_arg1:Event):void{
- this.complete();
- }
- protected function setupTasksFailed(_arg1:ErrorEvent):void{
- this.error(_arg1.text);
- }
- protected function complete():void{
- dispatchEvent(new Event(Event.COMPLETE));
- }
- protected function error(_arg1:string):void{
- dispatchEvent(new ErrorEvent(ErrorEvent.error, false, false, _arg1));
- }
- protected function loadConfig():void{
- var configger:* = new Configger();
- configger.addEventListener(Event.COMPLETE, this.tasker.success);
- configger.addEventListener(ErrorEvent.error, this.tasker.failure);
- try {
- configger.loadConfig();
- } catch(e:error) {
- error(e.message);
- };
- }
- protected function loadConfigComplete(_arg1:Event):void{
- this.confHash = (_arg1.target as Configger).config;
- if (((this.confHash["playlist"]) && ((this.confHash["playlist"] is array)))){
- this.confPlaylist = this.confHash["playlist"];
- delete this.confHash["playlist"];
- };
- }
- protected function loadSkin(_arg1:ErrorEvent=null):void{
- var _local2:ISkin;
- if (((((this.confHash) && (this.confHash["skin"]))) && ((_arg1 == null)))){
- if (Strings.extension(this.confHash["skin"]) == "swf"){
- _local2 = new SWFSkin();
- } else {
- if (Strings.extension(this.confHash["skin"]) == "zip"){
- _local2 = new ZIPSkin();
- } else {
- if (Strings.extension(this.confHash["skin"]) == "xml"){
- _local2 = new PNGSkin();
- } else {
- Logger.log(("Could not load skin " + this.confHash["skin"]));
- };
- };
- };
- };
- if (_local2){
- _local2.addEventListener(ErrorEvent.error, this.loadSkin);
- } else {
- if (_arg1){
- Logger.log(("Error loading skin: " + _arg1.text));
- (_arg1.target as EventDispatcher).removeEventListener(ErrorEvent.error, this.loadSkin);
- };
- _local2 = new DefaultSkin();
- _local2.addEventListener(ErrorEvent.error, this.tasker.failure);
- };
- _local2.addEventListener(Event.COMPLETE, this.tasker.success);
- _local2.load(this.confHash["skin"]);
- }
- protected function loadSkinComplete(_arg1:Event=null):void{
- var _local2:ISkin;
- var _local3:SkinProperties;
- if (_arg1){
- _local2 = (_arg1.target as ISkin);
- _local2.removeEventListener(Event.COMPLETE, this.tasker.success);
- _local2.removeEventListener(ErrorEvent.error, this.tasker.failure);
- _local2.removeEventListener(ErrorEvent.error, this.loadSkin);
- _local3 = _local2.getSkinProperties();
- this._model.config.setConfig(_local3);
- this._model.config.setConfig(this.confHash);
- this._view.skin = _local2;
- } else {
- this._model.config.setConfig(this.confHash);
- };
- Logger.setConfig(this._model.config);
- }
- protected function setupMediaProviders():void{
- this._model.setupMediaProviders();
- this.tasker.success();
- }
- protected function setupView():void{
- try {
- this._view.setupView();
- } catch(e:error) {
- tasker.failure(new ErrorEvent(ErrorEvent.error, false, false, ("View setup failed: " + e.message)));
- };
- this.tasker.success();
- }
- protected function loadPlugins():void{
- var _local1:PluginLoader;
- if (this._model.config.plugins){
- _local1 = new PluginLoader();
- _local1.addEventListener(Event.COMPLETE, this.tasker.success);
- _local1.addEventListener(ErrorEvent.error, this.tasker.failure);
- _local1.loadPlugins(this._model.config.plugins);
- } else {
- this.tasker.success();
- };
- }
- protected function loadPluginsComplete(_arg1:Event=null):void{
- var _local2:PluginLoader;
- var _local3:string;
- var _local4:DisplayObject;
- var _local5:object;
- var _local6:PluginConfig;
- var _local7:string;
- if (_arg1){
- _local2 = (_arg1.target as PluginLoader);
- for (_local3 in _local2.plugins) {
- _local4 = (_local2.plugins[_local3] as DisplayObject);
- if ((_local4 is IPlugin)){
- this._view.addPlugin(_local3, (_local4 as IPlugin));
- } else {
- if ((_local4 is PluginInterface)){
- if ((_local4 as object).hasOwnProperty("config")){
- _local5 = (_local4 as object).config;
- _local6 = this._model.config.pluginConfig(_local3);
- for (_local7 in _local5) {
- if (!_local6.hasOwnProperty(_local7)){
- _local6[_local7] = _local5[_local7];
- };
- };
- _local6["width"] = this._player.controls.display.width;
- _local6["height"] = this._player.controls.display.height;
- _local6["visible"] = true;
- };
- this._view.addPlugin(_local3, new V4Plugin((_local4 as PluginInterface), _local3));
- };
- };
- };
- };
- }
- protected function loadPlaylist():void{
- this._model.playlist.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.tasker.success);
- this._model.playlist.addEventListener(PlayerEvent.JWPLAYER_ERROR, this.tasker.failure);
- if (((this.confPlaylist) && ((this.confPlaylist.length > 0)))){
- this._model.playlist.load(this.confPlaylist);
- } else {
- if (this._model.config.playlistfile){
- this._model.playlist.load(this._model.config.playlistfile);
- } else {
- if (this._model.config.singleItem.file){
- this._model.playlist.load(this._model.config.singleItem);
- } else {
- this.tasker.success();
- };
- };
- };
- }
- protected function loadPlaylistComplete(_arg1:Event=null):void{
- this._model.playlist.removeEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this.tasker.success);
- this._model.playlist.removeEventListener(PlayerEvent.JWPLAYER_ERROR, this.tasker.failure);
- }
- protected function initPlugins():void{
- var pluginId:* = null;
- var plugin:* = null;
- for each (pluginId in this._view.loadedPlugins()) {
- try {
- plugin = this._view.getPlugin(pluginId);
- plugin.initPlugin(this._player, this._model.config.pluginConfig(pluginId));
- } catch(e:error) {
- Logger.log(("Error initializing plugin: " + e.message));
- if (plugin){
- _view.removePlugin(plugin);
- };
- };
- };
- this.tasker.success();
- }
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.controller {
- public class RepeatOptions {
- public static const list:string = "list";
- public static const ALWAYS:string = "always";
- public static const SINGLE:string = "single";
- public static const NONE:string = "none";
- }
- }//package com.longtailvideo.jwplayer.controller
- package com.longtailvideo.jwplayer.model {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.media.*;
- import com.longtailvideo.jwplayer.parsers.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class Playlist extends GlobalEventDispatcher implements IPlaylist {
- private var list:array;
- private var index:number;
- private var lastItem:PlaylistItem = null;
- private var playlistLoader:AssetLoader;
- public function Playlist(){
- this.list = [];
- this.index = -1;
- this.playlistLoader = new AssetLoader();
- this.playlistLoader.addEventListener(Event.COMPLETE, this.playlistLoaded);
- this.playlistLoader.addEventListener(ErrorEvent.error, this.playlistLoadError);
- }
- public function load(_arg1:object):void{
- var _local3:number;
- var _local4:PlaylistItem;
- var _local5:PlaylistItem;
- var _local6:PlaylistItem;
- var _local2:array = [];
- if ((_arg1 is array)){
- _local3 = 0;
- while (_local3 < (_arg1 as array).length) {
- if (!(_arg1[_local3] is PlaylistItem)){
- _local4 = new PlaylistItem(_arg1[_local3]);
- _arg1[_local3] = _local4;
- };
- try {
- if ((_arg1[_local3] as PlaylistItem).file){
- _local2.push((_arg1[_local3] as PlaylistItem));
- };
- } catch(e:error) {
- };
- _local3++;
- };
- } else {
- if ((_arg1 is PlaylistItem)){
- _local5 = (_arg1 as PlaylistItem);
- if (JWParser.getProvider(_local5)){
- _local2.push(_local5);
- } else {
- this.load(_local5.file);
- return;
- };
- } else {
- if ((_arg1 is Playlist)){
- _local3 = 0;
- while (_local3 < (_arg1 as Playlist).length) {
- _local2.push((_arg1 as Playlist).getItemAt(_local3));
- _local3++;
- };
- } else {
- if ((((_arg1 is string)) && (!((_arg1 == ""))))){
- this.playlistLoader.load(string(_arg1), xml);
- return;
- };
- this.playlistError("Incorrect playlist type");
- return;
- };
- };
- };
- if (_local2.length > 0){
- for each (_local6 in _local2) {
- if (!_local6.provider){
- _local6.provider = JWParser.getProvider(_local6);
- };
- if ((((_local6.provider == "youtube")) && (!(_local6.image)))){
- _local6.image = (("http://i.ytimg.com/vi/" + YouTubeMediaProvider.getID(_local6.file)) + "/0.jpg");
- };
- };
- this.list = _local2;
- this.index = 0;
- dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, this));
- } else {
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, "Loaded playlist is empty"));
- };
- }
- protected function playlistLoaded(_arg1:Event):void{
- var _local4:array;
- var _local2:xml = (this.playlistLoader.loadedObject as xml);
- var _local3:IPlaylistParser = ParserFactory.getParser(_local2);
- if (_local3){
- _local4 = _local3.parse(_local2);
- if (_local4.length > 0){
- this.load(_local4);
- } else {
- this.playlistError("XML could not be parsed or playlist was empty");
- };
- } else {
- this.playlistError("Playlist file did not contain a valid playlist");
- };
- }
- protected function playlistLoadError(_arg1:ErrorEvent):void{
- this.playlistError(_arg1.text);
- }
- protected function playlistError(_arg1:string):void{
- if (_arg1.indexof("Error #2048") >= 0){
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, "Playlist could not be loaded due to crossdomain policy restrictions."));
- } else {
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, ("Playlist could not be loaded: " + _arg1)));
- };
- }
- public function getItemAt(_arg1:number):PlaylistItem{
- try {
- return (this.list[_arg1]);
- } catch(e:error) {
- };
- return (null);
- }
- public function insertItem(_arg1:PlaylistItem, _arg2:number=-1):void{
- if ((((_arg2 >= 0)) && ((_arg2 < this.list.length)))){
- this.list.splice(_arg2, 0, _arg1);
- } else {
- this.list.push(_arg1);
- };
- dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this));
- if (this.index < 0){
- this.currentIndex = (this.list.length - 1);
- };
- }
- public function removeItemAt(_arg1:number):void{
- if ((((((_arg1 >= 0)) && ((_arg1 < this.list.length)))) && ((this.list.length > 0)))){
- this.list.splice(_arg1, 1);
- dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, this));
- };
- if (this.index >= this.list.length){
- this.currentIndex = (this.list.length - 1);
- };
- }
- public function get currentIndex():number{
- return (this.index);
- }
- public function set currentIndex(_arg1:number):void{
- if (_arg1 > this.list.length){
- _arg1 = 0;
- };
- if (_arg1 >= 0){
- this.index = _arg1;
- if (this.getItemAt(_arg1) != this.lastItem){
- this.lastItem = this.currentItem;
- dispatchEvent(new PlaylistEvent(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, this));
- };
- } else {
- this.lastItem = null;
- this.index = -1;
- };
- }
- public function get currentItem():PlaylistItem{
- return ((((this.index >= 0)) ? this.getItemAt(this.index) : null));
- }
- public function get length():number{
- return (this.list.length);
- }
- public function contains(_arg1:PlaylistItem):boolean{
- var _local2:number = 0;
- while (_local2 < this.length) {
- if (this.getItemAt(_local2) == _arg1){
- return (true);
- };
- _local2++;
- };
- return (false);
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- import com.longtailvideo.jwplayer.plugins.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import com.longtailvideo.jwplayer.utils.*;
- public dynamic class PlayerConfig extends EventDispatcher {
- protected var _singleItem:PlaylistItem;
- protected var _playlistfile:string = null;
- protected var _autostart:boolean = false;
- protected var _bandwidth:number = 1500;
- protected var _bufferlength:number = 3;
- protected var _displaytitle:boolean = true;
- protected var _se_livestream:boolean = false;
- protected var _se_disabledynamic:boolean = false;
- protected var _fullscreen:boolean = false;
- protected var _item:number = 0;
- protected var _linktarget:string = "_blank";
- protected var _levels:array = null;
- protected var _mute:boolean = false;
- protected var _repeat:string = "none";
- protected var _shuffle:boolean = false;
- protected var _smoothing:boolean = true;
- protected var _stretching:string = "uniform";
- protected var _volume:number = 90;
- protected var _backcolor:color = null;
- protected var _frontcolor:color = null;
- protected var _lightcolor:color = null;
- protected var _screencolor:color = null;
- protected var _controlbar:string = "bottom";
- protected var _dock:boolean = true;
- protected var _height:number = 400;
- protected var _icons:boolean = true;
- protected var _logo:string = null;
- protected var _playlist:string = "none";
- protected var _playlistsize:string = "180";
- protected var _skin:string = null;
- protected var _width:number = 280;
- protected var _plugins:string = "";
- protected var _pluginConfig:object;
- protected var _id:string = "";
- protected var _playerready:string = "";
- protected var _debug:string;
- public function PlayerConfig():void{
- this._singleItem = new PlaylistItem();
- this._pluginConfig = {};
- this._debug = Logger.NONE;
- super();
- this.controlbar = this._controlbar;
- this.playlist = this._playlist;
- this.playlistsize = this._playlistsize;
- this.logo = this._logo;
- }
- public function setConfig(_arg1:object):void{
- var _local2:string;
- var _local3:number;
- var _local4:object;
- for (_local2 in _arg1) {
- if (_local2.indexof(".") > 0){
- this.setPluginProperty(_local2, _arg1[_local2]);
- this._singleItem[_local2.tolowercase()] = _arg1[_local2];
- } else {
- if (this._singleItem.hasOwnProperty(_local2)){
- if ((((((_local2 == "file")) && ((Strings.extension(_arg1[_local2]) == "xml")))) && (!(_arg1["provider"])))){
- this.setproperty("playlistfile", _arg1[_local2]);
- } else {
- if (_local2 == "levels"){
- if ((_arg1[_local2] is array)){
- _local3 = 0;
- while (_local3 < (_arg1[_local2] as array).length) {
- _local4 = _arg1[_local2][_local3];
- this._singleItem.addLevel(new PlaylistItemLevel(_local4.file, _local4.bitrate, _local4.width, _local4.streamer));
- _local3++;
- };
- };
- } else {
- this._singleItem[_local2.tolowercase()] = _arg1[_local2];
- };
- };
- } else {
- if (_arg1[_local2.tolowercase()] != null){
- this.setproperty(_local2, _arg1[_local2]);
- };
- };
- };
- };
- }
- protected function setproperty(_arg1:string, _arg2):void{
- if (((hasOwnProperty(_arg1)) && ((_arg2 is string)))){
- try {
- this[_arg1] = TypeChecker.fromString(_arg2, TypeChecker.getType(this, _arg1));
- } catch(e:error) {
- };
- } else {
- this[_arg1] = _arg2;
- };
- }
- protected function setPluginProperty(_arg1:string, _arg2):void{
- var _local3:string = _arg1.substring(0, _arg1.indexof(".")).tolowercase();
- var _local4:string = _arg1.substring((_arg1.indexof(".") + 1), _arg1.length).tolowercase();
- if (((_local3) && (_local4))){
- if (!this._pluginConfig.hasOwnProperty(_local3)){
- this._pluginConfig[_local3] = new PluginConfig(_local3);
- };
- if ((_arg2 is string)){
- this._pluginConfig[_local3][_local4] = TypeChecker.fromString(_arg2);
- } else {
- this._pluginConfig[_local3][_local4] = _arg2;
- };
- };
- }
- protected function playlistItem(_arg1:string):string{
- try {
- return (this._singleItem[_arg1].tostring());
- } catch(e:error) {
- };
- return ("");
- }
- public function get playlistfile():string{
- return (this._playlistfile);
- }
- public function set playlistfile(_arg1:string):void{
- this._playlistfile = _arg1;
- }
- public function get author():string{
- return (this.playlistItem("author"));
- }
- public function get date():string{
- return (this.playlistItem("date"));
- }
- public function get description():string{
- return (this.playlistItem("description"));
- }
- public function get duration():string{
- return (this.playlistItem("duration"));
- }
- public function get file():string{
- return (this.playlistItem("file"));
- }
- public function get image():string{
- return (this.playlistItem("image"));
- }
- public function get link():string{
- return (this.playlistItem("link"));
- }
- public function get mediaid():string{
- return (this.playlistItem("mediaid"));
- }
- public function get start():string{
- return (this.playlistItem("start"));
- }
- public function get streamer():string{
- return (this.playlistItem("streamer"));
- }
- public function get tags():string{
- return (this.playlistItem("tags"));
- }
- public function get title():string{
- return (this.playlistItem("title"));
- }
- public function get provider():string{
- return (this.playlistItem("provider"));
- }
- public function get type():string{
- return (this.playlistItem("provider"));
- }
- public function get singleItem():PlaylistItem{
- return (this._singleItem);
- }
- public function get backcolor():color{
- return (this._backcolor);
- }
- public function set backcolor(_arg1:color):void{
- this._backcolor = _arg1;
- }
- public function get frontcolor():color{
- return (this._frontcolor);
- }
- public function set frontcolor(_arg1:color):void{
- this._frontcolor = _arg1;
- }
- public function get lightcolor():color{
- return (this._lightcolor);
- }
- public function set lightcolor(_arg1:color):void{
- this._lightcolor = _arg1;
- }
- public function get screencolor():color{
- return (this._screencolor);
- }
- public function set screencolor(_arg1:color):void{
- this._screencolor = _arg1;
- }
- public function get controlbar():string{
- if (((this._pluginConfig["controlbar"]) && (this._pluginConfig["controlbar"].hasOwnProperty("position")))){
- return (this._pluginConfig["controlbar"]["position"]);
- };
- return (this._controlbar);
- }
- public function set controlbar(_arg1:string):void{
- this.setPluginProperty("controlbar.position", _arg1.tolowercase());
- }
- public function get dock():boolean{
- return (this._dock);
- }
- public function set dock(_arg1:boolean):void{
- this._dock = _arg1;
- }
- public function get height():number{
- return (this._height);
- }
- public function set height(_arg1:number):void{
- this._height = _arg1;
- }
- public function get icons():boolean{
- return (this._icons);
- }
- public function set icons(_arg1:boolean):void{
- this._icons = _arg1;
- }
- public function get logo():string{
- if (((this._pluginConfig["logo"]) && (this._pluginConfig["logo"].hasOwnProperty("file")))){
- return (this._pluginConfig["logo"]["file"]);
- };
- return (this._logo);
- }
- public function set logo(_arg1:string):void{
- if (_arg1 != null){
- this.setPluginProperty("logo.file", _arg1.tolowercase());
- };
- }
- public function get playlist():string{
- if (((this._pluginConfig["playlist"]) && (this._pluginConfig["playlist"].hasOwnProperty("position")))){
- return (((this._pluginConfig["playlist"]) && (this._pluginConfig["playlist"]["position"])));
- };
- return (this._playlist);
- }
- public function set playlist(_arg1:string):void{
- this.setPluginProperty("playlist.position", _arg1.tolowercase());
- }
- public function get playlistsize():string{
- return (this._playlistsize);
- }
- public function set playlistsize(_arg1:string):void{
- this._playlistsize = _arg1;
- this.setPluginProperty("playlist.size", _arg1.tostring());
- }
- public function get skin():string{
- return (this._skin);
- }
- public function set skin(_arg1:string):void{
- this._skin = _arg1;
- }
- public function get width():number{
- return (this._width);
- }
- public function set width(_arg1:number):void{
- this._width = _arg1;
- }
- public function get autostart():boolean{
- return (this._autostart);
- }
- public function set autostart(_arg1:boolean):void{
- this._autostart = _arg1;
- }
- public function get bandwidth():number{
- return (this._bandwidth);
- }
- public function set bandwidth(_arg1:number):void{
- this._bandwidth = _arg1;
- }
- public function get bufferlength():number{
- return (this._bufferlength);
- }
- public function set bufferlength(_arg1:number):void{
- this._bufferlength = _arg1;
- }
- public function get se_livestream():boolean{
- return (this._se_livestream);
- }
- public function set se_livestream(_arg1:boolean):void{
- this._se_livestream = _arg1;
- }
- public function get se_disabledynamic():boolean{
- return (this._se_disabledynamic);
- }
- public function set se_disabledynamic(_arg1:boolean):void{
- this._se_disabledynamic = _arg1;
- }
- public function get displaytitle():boolean{
- return (this._displaytitle);
- }
- public function set displaytitle(_arg1:boolean):void{
- this._displaytitle = _arg1;
- }
- public function get fullscreen():boolean{
- return (this._fullscreen);
- }
- public function set fullscreen(_arg1:boolean):void{
- this._fullscreen = _arg1;
- }
- public function get item():number{
- return (this._item);
- }
- public function set item(_arg1:number):void{
- this._item = _arg1;
- }
- public function get linktarget():string{
- return (this._linktarget);
- }
- public function set linktarget(_arg1:string):void{
- this._linktarget = _arg1;
- }
- public function get mute():boolean{
- return (this._mute);
- }
- public function set mute(_arg1:boolean):void{
- this._mute = _arg1;
- }
- public function get repeat():string{
- return (this._repeat);
- }
- public function set repeat(_arg1:string):void{
- this._repeat = _arg1.tolowercase();
- }
- public function get shuffle():boolean{
- return (this._shuffle);
- }
- public function set shuffle(_arg1:boolean):void{
- this._shuffle = _arg1;
- }
- public function get smoothing():boolean{
- return (this._smoothing);
- }
- public function set smoothing(_arg1:boolean):void{
- this._smoothing = _arg1;
- }
- public function get stretching():string{
- return (this._stretching);
- }
- public function set stretching(_arg1:string):void{
- this._stretching = _arg1.tolowercase();
- }
- public function get volume():number{
- return (this._volume);
- }
- public function set volume(_arg1:number):void{
- this._volume = _arg1;
- }
- public function get plugins():string{
- return (this._plugins);
- }
- public function set plugins(_arg1:string):void{
- this._plugins = _arg1;
- }
- public function get debug():string{
- return (this._debug);
- }
- public function set debug(_arg1:string):void{
- if (_arg1 != "0"){
- this._debug = _arg1;
- };
- }
- public function pluginConfig(_arg1:string):PluginConfig{
- var _local2:PluginConfig;
- var _local3:PluginConfig;
- _arg1 = _arg1.tolowercase();
- if (this._pluginConfig.hasOwnProperty(_arg1)){
- return ((this._pluginConfig[_arg1] as PluginConfig));
- };
- if (((this[_arg1]) && ((getQualifiedClassName(this[_arg1]) == "Object")))){
- _local2 = new PluginConfig(_arg1, this[_arg1]);
- this._pluginConfig[_arg1] = _local2;
- return (_local2);
- };
- _local3 = new PluginConfig(_arg1);
- this._pluginConfig[_arg1] = _local3;
- return (_local3);
- }
- public function get pluginIds():array{
- var _local2:string;
- var _local3:string;
- var _local1:array = [];
- for each (_local2 in this._plugins.split(",")) {
- _local3 = (_local2.substr((_local2.lastindexof("/") + 1)).replace(/(.*)\.swf$/i, "$1").split("-")[0] as string).tolowercase();
- if (_local3){
- _local1.push(_local3);
- };
- };
- return (_local1);
- }
- public function get id():string{
- return (this._id);
- }
- public function set id(_arg1:string):void{
- PlayerVersion.id = (this._id = _arg1);
- }
- public function get playerready():string{
- return (this._playerready);
- }
- public function set playerready(_arg1:string):void{
- this._playerready = _arg1;
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- import com.longtailvideo.jwplayer.utils.*;
- public class color {
- private var _color:uint;
- public function color(_arg1){
- if ((_arg1 is string)){
- this._color = TypeChecker.stringToColor(_arg1);
- } else {
- if ((((_arg1 is uint)) || ((_arg1 is number)))){
- this._color = _arg1;
- } else {
- throw (new error("Color must be a String, Number or uint"));
- };
- };
- }
- public function tostring():string{
- var _local1:string = ((this._color)==0) ? "000000" : this._color.tostring(16);
- while (_local1.length < 6) {
- _local1 = ("0" + _local1);
- };
- return (("0x" + _local1));
- }
- public function get color():uint{
- return (this._color);
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- import com.longtailvideo.jwplayer.events.*;
- public interface IPlaylist extends IGlobalEventDispatcher {
- function load(_arg1:object):void;
- function getItemAt(_arg1:number):PlaylistItem;
- function insertItem(_arg1:PlaylistItem, _arg2:number=-1):void;
- function removeItemAt(_arg1:number):void;
- function contains(_arg1:PlaylistItem):boolean;
- function get currentIndex():number;
- function set currentIndex(_arg1:number):void;
- function get currentItem():PlaylistItem;
- function get length():number;
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.longtailvideo.jwplayer.media.*;
- public class Model extends GlobalEventDispatcher {
- protected var _config:PlayerConfig;
- protected var _playlist:IPlaylist;
- protected var _fullscreen:boolean = false;
- protected var _currentMedia:MediaProvider;
- protected var _mediaSources:object;
- public function Model(){
- this._playlist = new Playlist();
- this._playlist.addGlobalListener(this.forwardEvents);
- this._config = new PlayerConfig();
- this._mediaSources = {};
- }
- public function get config():PlayerConfig{
- return (this._config);
- }
- public function set config(_arg1:PlayerConfig):void{
- this._config = _arg1;
- }
- public function get media():MediaProvider{
- return (this._currentMedia);
- }
- public function get state():string{
- return (((this._currentMedia) ? this._currentMedia.state : PlayerState.IDLE));
- }
- public function get playlist():IPlaylist{
- return (this._playlist);
- }
- public function get fullscreen():boolean{
- return (this._fullscreen);
- }
- public function set fullscreen(_arg1:boolean):void{
- this._fullscreen = _arg1;
- this._config.fullscreen = _arg1;
- }
- public function get mute():boolean{
- return (this._config.mute);
- }
- public function set mute(_arg1:boolean):void{
- this._config.mute = _arg1;
- this._currentMedia.mute(_arg1);
- }
- public function setupMediaProviders():void{
- this.setMediaProvider("default", new MediaProvider("default"));
- this.setMediaProvider("video", new VideoMediaProvider());
- this.setMediaProvider("http", new HTTPMediaProvider());
- this.setMediaProvider("rtmp", new RTMPMediaProvider());
- this.setMediaProvider("sound", new SoundMediaProvider());
- this.setMediaProvider("image", new ImageMediaProvider());
- this.setMediaProvider("youtube", new YouTubeMediaProvider());
- this.setActiveMediaProvider("default");
- }
- public function seek(_arg1:number):void{
- var _local2:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_SEEK);
- _local2.position = this.media.position;
- _local2.offset = _arg1;
- dispatchEvent(_local2);
- this.media.seek(_arg1);
- }
- public function hasMediaProvider(_arg1:string):boolean{
- return ((this._mediaSources[this.url2type(_arg1)] is MediaProvider));
- }
- public function setMediaProvider(_arg1:string, _arg2:MediaProvider):void{
- if (!this.hasMediaProvider(_arg1)){
- this._mediaSources[this.url2type(_arg1)] = _arg2;
- _arg2.initializeMediaProvider(this.config);
- };
- }
- public function setActiveMediaProvider(_arg1:string):boolean{
- if (!this.hasMediaProvider(_arg1)){
- _arg1 = "video";
- };
- var _local2:MediaProvider = (this._mediaSources[this.url2type(_arg1)] as MediaProvider);
- if (this._currentMedia != _local2){
- if (this._currentMedia){
- this._currentMedia.stop();
- this._currentMedia.removeGlobalListener(this.forwardEvents);
- };
- _local2.addGlobalListener(this.forwardEvents);
- this._currentMedia = _local2;
- };
- return (true);
- }
- protected function forwardEvents(_arg1:Event):void{
- if ((_arg1 is PlayerEvent)){
- if (_arg1.type == MediaEvent.JWPLAYER_MEDIA_ERROR){
- dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, (_arg1 as MediaEvent).message));
- };
- dispatchEvent(_arg1);
- };
- }
- protected function url2type(_arg1:string):string{
- if (_arg1.tolowercase() == "audio"){
- return ("sound");
- };
- return (_arg1.substring((_arg1.lastindexof("/") + 1), _arg1.length).replace(".swf", "").tolowercase());
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- public dynamic class PlaylistItemLevel {
- public var file:string = "";
- public var bitrate:number = 0;
- public var width:number = 0;
- public var streamer:string = "";
- public var blacklisted:boolean = false;
- public function PlaylistItemLevel(_arg1:string, _arg2:number, _arg3:number, _arg4:string=""){
- this.file = _arg1;
- this.streamer = _arg4;
- this.bitrate = _arg2;
- this.width = _arg3;
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.model {
- import com.longtailvideo.jwplayer.utils.*;
- public dynamic class PlaylistItem {
- public var author:string = "";
- public var date:string = "";
- public var description:string = "";
- public var image:string = "";
- public var link:string = "";
- public var mediaid:string = "";
- public var tags:string = "";
- public var title:string = "";
- protected var _duration:number = -1;
- protected var _file:string = "";
- protected var _provider:string = "";
- protected var _start:number = 0;
- protected var _streamer:string = "";
- protected var _currentLevel:number = -1;
- protected var _levels:array;
- public function PlaylistItem(_arg1:object=null){
- var _local2:string;
- var _local3:array;
- var _local4:object;
- var _local5:PlaylistItemLevel;
- var _local6:string;
- this._levels = [];
- super();
- for (_local2 in _arg1) {
- if ((((_local2 == "levels")) && ((_arg1[_local2] is array)))){
- _local3 = (_arg1[_local2] as array);
- for each (_local4 in _local3) {
- if (_local4["file"]){
- _local5 = new PlaylistItemLevel(_local4["file"], number(_local4["bitrate"]), number(_local4["width"]), _local4["streamer"]);
- for (_local6 in _local4) {
- switch (_local6){
- case "file":
- case "bitrate":
- case "width":
- case "streamer":
- break;
- default:
- _local5[_local6] = _local4[_local6];
- };
- };
- this.addLevel(_local5);
- };
- };
- } else {
- this[_local2] = _arg1[_local2];
- };
- };
- }
- public function get file():string{
- var _local1:PlaylistItemLevel;
- if ((((((this._levels.length > 0)) && ((this._currentLevel > -1)))) && ((this._currentLevel < this._levels.length)))){
- _local1 = (this._levels[this._currentLevel] as PlaylistItemLevel);
- return (((_local1.file) ? _local1.file : this._file));
- };
- return (this._file);
- }
- public function set file(_arg1:string):void{
- this._file = _arg1;
- }
- public function get streamer():string{
- var _local1:PlaylistItemLevel;
- if ((((((this._levels.length > 0)) && ((this._currentLevel > -1)))) && ((this._currentLevel < this._levels.length)))){
- _local1 = (this._levels[this._currentLevel] as PlaylistItemLevel);
- return (((_local1.streamer) ? _local1.streamer : this._streamer));
- };
- return (this._streamer);
- }
- public function set streamer(_arg1:string):void{
- this._streamer = _arg1;
- }
- public function get levels():array{
- return (this._levels);
- }
- public function addLevel(_arg1:PlaylistItemLevel):void{
- var _local2:number;
- var _local3:PlaylistItemLevel;
- if (this.validExtension(_arg1.file)){
- if (this._currentLevel < 0){
- this._currentLevel = 0;
- };
- _local2 = 0;
- while (_local2 < this._levels.length) {
- _local3 = (this._levels[_local2] as PlaylistItemLevel);
- if (_arg1.bitrate > _local3.bitrate){
- this._levels.splice(_local2, 0, _arg1);
- return;
- };
- if (((((isnan(_arg1.bitrate)) || ((_arg1.bitrate == _local3.bitrate)))) && ((_arg1.width > _local3.width)))){
- this._levels.splice(_local2, 0, _arg1);
- return;
- };
- _local2++;
- };
- this._levels.push(_arg1);
- };
- }
- public function clearLevels():void{
- this._levels = new array();
- }
- public function blacklistLevel(_arg1:number, _arg2:boolean=true):void{
- if (this.levels[_arg1]){
- this.levels[_arg1].blacklisted = _arg2;
- };
- }
- protected function validExtension(_arg1:string):boolean{
- switch (Strings.extension(_arg1)){
- case "ogv":
- case "ogg":
- case "webm":
- return (false);
- default:
- return (true);
- };
- }
- public function get currentLevel():number{
- return (this._currentLevel);
- }
- public function getLevel(_arg1:number, _arg2:number):number{
- var _local4:PlaylistItemLevel;
- var _local3:number = 0;
- while (_local3 < this._levels.length) {
- _local4 = (this._levels[_local3] as PlaylistItemLevel);
- if (((((((isnan(_local4.bitrate)) || ((_arg1 >= (_local4.bitrate * 1.5))))) && (((isnan(_local4.width)) || ((_arg2 >= (_local4.width * 0.67))))))) && (!(_local4.blacklisted)))){
- return (_local3);
- };
- _local3++;
- };
- return ((this._levels.length - 1));
- }
- public function setLevel(_arg1:number):void{
- if ((((_arg1 >= 0)) && ((_arg1 < this._levels.length)))){
- this._currentLevel = _arg1;
- } else {
- throw (new error("Level index out of bounds"));
- };
- }
- public function tostring():string{
- return (((((("[PlaylistItem" + ((this.file) ? (" file=" + this.file) : "")) + ((this.streamer) ? (" streamer=" + this.streamer) : "")) + ((this.provider) ? (" provider=" + this.provider) : "")) + ((this.levels.length) ? (" level=" + this.currentLevel.tostring()) : "")) + "]"));
- }
- public function get start():number{
- return (this._start);
- }
- public function set start(_arg1):void{
- this._start = Strings.seconds(string(_arg1));
- if ((((this._start > this._duration)) && ((this._duration > 0)))){
- this._duration = (this._duration + this._start);
- };
- }
- public function get duration():number{
- return (this._duration);
- }
- public function set duration(_arg1):void{
- this._duration = Strings.seconds(string(_arg1));
- if ((((this._start > this._duration)) && ((this._duration > 0)))){
- this._duration = (this._duration + this._start);
- };
- }
- public function get provider():string{
- return (this._provider);
- }
- public function set provider(_arg1):void{
- this._provider = ((_arg1)=="audio") ? "sound" : _arg1;
- }
- public function get type():string{
- return (this._provider);
- }
- public function set type(_arg1:string):void{
- this.provider = _arg1;
- }
- }
- }//package com.longtailvideo.jwplayer.model
- package com.longtailvideo.jwplayer.plugins {
- public dynamic class PluginConfig {
- private var _id:string;
- public function PluginConfig(_arg1:string, _arg2:object=null){
- var _local3:string;
- super();
- this._id = _arg1.tolowercase();
- if (_arg2){
- for (_local3 in _arg2) {
- this[_local3] = _arg2[_local3];
- };
- };
- }
- public function get id():string{
- return (this._id);
- }
- }
- }//package com.longtailvideo.jwplayer.plugins
- package com.longtailvideo.jwplayer.plugins {
- import com.longtailvideo.jwplayer.player.*;
- public interface IPlugin {
- function initPlugin(_arg1:IPlayer, _arg2:PluginConfig):void;
- function resize(_arg1:number, _arg2:number):void;
- function get id():string;
- }
- }//package com.longtailvideo.jwplayer.plugins
- package com.longtailvideo.jwplayer.plugins {
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.jeroenwijering.events.*;
- public class V4Plugin extends Sprite implements IPlugin {
- private var plug:PluginInterface;
- public var pluginId:string;
- public function V4Plugin(_arg1:PluginInterface, _arg2:string){
- this.plug = _arg1;
- this.pluginId = _arg2;
- addChild((this.plug as DisplayObject));
- }
- public function initPlugin(_arg1:IPlayer, _arg2:PluginConfig):void{
- if ((this.plug as object).hasOwnProperty("config")){
- (this.plug as object).config = _arg2;
- };
- var _local3:PlayerV4Emulation = PlayerV4Emulation.getInstance(_arg1);
- this.plug.initializePlugin(_local3);
- }
- public function resize(_arg1:number, _arg2:number):void{
- this.x = 0;
- this.y = 0;
- }
- public function get id():string{
- return (this.pluginId);
- }
- }
- }//package com.longtailvideo.jwplayer.plugins
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.media.*;
- public class HTTPMediaProvider extends MediaProvider {
- protected var _connection:netconnection;
- protected var _stream:netstream;
- protected var _video:video;
- protected var _transformer:SoundTransform;
- protected var _positionInterval:uint;
- protected var _meta:boolean;
- protected var _keyframes:object;
- protected var _byteoffset:number = 0;
- protected var _timeoffset:number = 0;
- protected var _mp4:boolean;
- private var _startparam:string = "start";
- private var _bufferFull:boolean;
- private var _bufferingComplete:boolean;
- private var _bandwidthSwitch:boolean = true;
- private var _bandwidthChecked:boolean;
- private var _bandwidthDelay:number = 2000;
- private var _bandwidthTimeout:uint;
- private var _dvroffset:number = 0;
- private var _dvrloaded:number = 0;
- private var _framerate:number = 30;
- private var _droppedFrames:array;
- private var _droppedFramesInterval:number;
- public function HTTPMediaProvider(){
- super("http");
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- this._connection = new netconnection();
- this._connection.connect(null);
- this._stream = new netstream(this._connection);
- this._stream.checkPolicyFile = true;
- this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
- this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
- this._stream.buffertime = config.bufferlength;
- this._stream.client = new NetClient(this);
- this._transformer = new SoundTransform();
- this._video = new video(320, 240);
- this._video.smoothing = config.smoothing;
- this._video.attachNetStream(this._stream);
- }
- protected function convertSeekpoints(_arg1:object):object{
- var _local3:string;
- var _local2:object = new object();
- _local2.times = new array();
- _local2.filepositions = new array();
- for (_local3 in _arg1) {
- _local2.times[_local3] = number(_arg1[_local3]["time"]);
- _local2.filepositions[_local3] = number(_arg1[_local3]["offset"]);
- };
- return (_local2);
- }
- protected function errorHandler(_arg1:ErrorEvent):void{
- error(_arg1.text);
- }
- private function checkBandwidth(_arg1:number):void{
- var _local4:object;
- var _local2:number = this._stream.bytesloaded;
- var _local3:number = ((math.ceil(((_local2 - _arg1) / 0x0400)) * 8) / (this._bandwidthDelay / 1000));
- if (_local2 < this._stream.bytestotal){
- if (_local3 > 0){
- config.bandwidth = _local3;
- Configger.saveCookie("bandwidth", _local3);
- _local4 = {bandwidth:_local3};
- if (item.duration > 0){
- _local4.bitrate = math.ceil((((this._stream.bytestotal / 0x0400) * 8) / item.duration));
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local4});
- };
- if (this._bandwidthSwitch){
- this._bandwidthSwitch = false;
- this._bandwidthChecked = false;
- if (item.currentLevel != item.getLevel(config.bandwidth, config.width)){
- this.load(item);
- return;
- };
- };
- clearTimeout(this._bandwidthTimeout);
- this._bandwidthTimeout = setTimeout(this.checkBandwidth, this._bandwidthDelay, _local2);
- };
- }
- private function checkFramedrop():void{
- var _local2:number;
- this._droppedFrames.push(this._stream.info.droppedFrames);
- var _local1:number = this._droppedFrames.length;
- if ((((_local1 > 5)) && ((state == PlayerState.PLAYING)))){
- _local2 = ((this._droppedFrames[(_local1 - 1)] - this._droppedFrames[(_local1 - 6)]) / 5);
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{droppedFrames:_local2}});
- };
- }
- protected function getOffset(_arg1:number, _arg2:boolean=false):number{
- if (!this._keyframes){
- return (0);
- };
- var _local3:number = 0;
- while (_local3 < (this._keyframes.times.length - 1)) {
- if ((((this._keyframes.times[_local3] <= _arg1)) && ((this._keyframes.times[(_local3 + 1)] >= _arg1)))){
- break;
- };
- _local3++;
- };
- if (_arg2 == true){
- return (this._keyframes.times[_local3]);
- };
- return (this._keyframes.filepositions[_local3]);
- }
- protected function geturl():string{
- var _local1:string = Strings.getAbsolutePath(item.file, config["netstreambasepath"]);
- var _local2:number = this._byteoffset;
- if ((getConfigProperty("startparam") as string)){
- this._startparam = getConfigProperty("startparam");
- };
- if (item.streamer){
- if (item.streamer.indexof("/") >= 0){
- _local1 = item.streamer;
- _local1 = this.getURLConcat(_local1, "file", item.file);
- } else {
- this._startparam = item.streamer;
- };
- };
- if (((this._mp4) || ((this._startparam == "starttime")))){
- _local2 = (math.ceil((this._timeoffset * 100)) / 100);
- this._mp4 = true;
- };
- if (((((!(this._mp4)) || ((_local2 > 0)))) && (!(getConfigProperty("dvr"))))){
- _local1 = this.getURLConcat(_local1, this._startparam, _local2);
- };
- if (((config["token"]) || (item["token"]))){
- _local1 = this.getURLConcat(_local1, "token", ((item["token"]) ? item["token"] : config["token"]));
- };
- return (_local1);
- }
- private function getURLConcat(_arg1:string, _arg2:string, _arg3):string{
- if (_arg1.indexof("?") > -1){
- return (((((_arg1 + "&") + _arg2) + "=") + _arg3));
- };
- return (((((_arg1 + "?") + _arg2) + "=") + _arg3));
- }
- private function initDVR(_arg1:number):void{
- this._dvroffset = _arg1;
- this._dvrloaded = (new date().valueof() - (config.bufferlength * 1000));
- super.resize(_width, _height);
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{dvroffset:this._dvroffset}});
- }
- override public function load(_arg1:PlaylistItem):void{
- if (_item != _arg1){
- _item = _arg1;
- media = this._video;
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
- this._bufferFull = false;
- this._bufferingComplete = false;
- if (item.levels.length > 0){
- item.setLevel(item.getLevel(config.bandwidth, config.width));
- };
- this._stream.play(this.geturl());
- clearinterval(this._positionInterval);
- this._positionInterval = setinterval(this.positionInterval, 100);
- this._droppedFrames = new array();
- clearinterval(this._droppedFramesInterval);
- this._droppedFramesInterval = setinterval(this.checkFramedrop, 1000);
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0, 0);
- this.streamVolume(((config.mute) ? 0 : config.volume));
- }
- public function onClientData(_arg1:object):void{
- if (!_arg1){
- return;
- };
- if (_arg1.width){
- this._video.width = _arg1.width;
- this._video.height = _arg1.height;
- super.resize(_width, _height);
- };
- if (_arg1.videoframerate){
- this._framerate = number(_arg1.videoframerate);
- };
- if (((_arg1["duration"]) && ((item.duration <= 0)))){
- item.duration = _arg1["duration"];
- };
- if ((((_arg1["type"] == "metadata")) && (!(this._meta)))){
- if (_arg1["seekpoints"]){
- this._mp4 = true;
- this._keyframes = this.convertSeekpoints(_arg1["seekpoints"]);
- } else {
- this._mp4 = false;
- this._keyframes = _arg1["keyframes"];
- };
- if (((!(this._meta)) && (_item.start))){
- this.seek(_item.start);
- };
- this._meta = true;
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
- }
- override public function pause():void{
- this._stream.pause();
- super.pause();
- }
- override public function play():void{
- if (!this._positionInterval){
- this._positionInterval = setinterval(this.positionInterval, 100);
- };
- if (this._bufferFull){
- this._stream.resume();
- super.play();
- } else {
- setState(PlayerState.BUFFERING);
- };
- }
- protected function positionInterval():void{
- var _local2:number;
- var _local3:number;
- var _local5:number;
- var _local1:number = (math.round((this._stream.time * 100)) / 100);
- if (this._mp4){
- _local1 = (_local1 + this._timeoffset);
- };
- if (getConfigProperty("dvr")){
- if (((!(this._dvroffset)) && (_local1))){
- this.initDVR(_local1);
- };
- _local1 = (_local1 - this._dvroffset);
- if (this._dvrloaded){
- item.duration = ((new date().valueof() - this._dvrloaded) / 1000);
- };
- };
- if ((((item.duration > 0)) && (this._stream))){
- _local2 = ((this._timeoffset / item.duration) * 100);
- _local5 = (((this._stream.buffertime < (item.duration - _local1))) ? this._stream.buffertime : math.ceil((item.duration - _local1)));
- _local3 = ((this._stream.buffertime) ? math.ceil(((math.ceil(this._stream.bufferlength) / _local5) * 100)) : 0);
- } else {
- _local2 = 0;
- _local3 = ((this._stream.buffertime) ? ((this._stream.bufferlength / this._stream.buffertime) * 100) : 0);
- };
- var _local4:number = ((this._stream.bytestotal) ? (((this._stream.bytesloaded / this._stream.bytestotal) * (1 - (_local2 / 100))) * 100) : 0);
- if (((((!(this._bandwidthChecked)) && ((this._stream.bytesloaded > 0)))) && ((this._stream.bytesloaded < this._stream.bytestotal)))){
- this._bandwidthChecked = true;
- clearTimeout(this._bandwidthTimeout);
- this._bandwidthTimeout = setTimeout(this.checkBandwidth, this._bandwidthDelay, this._stream.bytesloaded);
- };
- if ((((((_local3 <= 50)) && ((state == PlayerState.PLAYING)))) && (((item.duration - _local1) > 5)))){
- this._bufferFull = false;
- this._stream.pause();
- setState(PlayerState.BUFFERING);
- } else {
- if ((((_local3 > 95)) && (!(this._bufferFull)))){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- };
- };
- if (!this._bufferingComplete){
- if (((((_local4 + _local2) == 100)) && ((this._bufferingComplete == false)))){
- this._bufferingComplete = true;
- };
- sendBufferEvent(_local4, this._timeoffset, {
- loaded:this._stream.bytesloaded,
- total:this._stream.bytestotal,
- offset:this._timeoffset
- });
- };
- if (state != PlayerState.PLAYING){
- return;
- };
- if (_local1 < item.duration){
- _position = _local1;
- if (_position >= 0){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:_position,
- duration:item.duration,
- offset:this._timeoffset
- });
- };
- } else {
- if (item.duration > 0){
- this.complete();
- };
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- super.resize(_arg1, _arg2);
- if (((((!((state == PlayerState.IDLE))) && ((item.levels.length > 0)))) && (!((item.getLevel(config.bandwidth, config.width) == item.currentLevel))))){
- this._byteoffset = this.getOffset(position);
- this._timeoffset = (_position = this.getOffset(position, true));
- this.load(item);
- };
- }
- override public function seek(_arg1:number):void{
- var _local2:number = this.getOffset(_arg1);
- super.seek(_arg1);
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- if ((((_local2 < this._byteoffset)) || ((_local2 >= (this._byteoffset + this._stream.bytesloaded))))){
- if (this._keyframes){
- this._timeoffset = (_position = this.getOffset(_arg1, true));
- } else {
- this._timeoffset = _arg1;
- };
- this._byteoffset = _local2;
- this.load(item);
- } else {
- if (state == PlayerState.PAUSED){
- this._stream.resume();
- };
- if (getConfigProperty("dvr")){
- this._stream.seek(((_arg1 + this._dvroffset) - config.bufferlength));
- } else {
- if (this._mp4){
- this._stream.seek(this.getOffset((_position - this._timeoffset), true));
- } else {
- this._stream.seek(this.getOffset(_position, true));
- };
- };
- this.play();
- };
- }
- protected function statusHandler(_arg1:NetStatusEvent):void{
- switch (_arg1.info.code){
- case "NetStream.Play.Stop":
- if (((!((state == PlayerState.BUFFERING))) && (!(getConfigProperty("dvr"))))){
- this.complete();
- };
- break;
- case "NetStream.Play.StreamNotFound":
- this.stop();
- error(("Video not found: " + item.file));
- break;
- case "NetStream.Buffer.Full":
- if (!this._bufferFull){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- };
- break;
- };
- }
- override public function stop():void{
- if ((((this._stream.bytesloaded < this._stream.bytestotal)) || ((this._byteoffset > 0)))){
- this._stream.close();
- } else {
- this._stream.pause();
- };
- clearinterval(this._positionInterval);
- clearinterval(this._droppedFramesInterval);
- this._positionInterval = undefined;
- _position = (this._byteoffset = (this._timeoffset = 0));
- this._dvroffset = (this._dvrloaded = 0);
- this._droppedFrames = new array();
- this._keyframes = undefined;
- this._framerate = 30;
- this._bandwidthSwitch = true;
- this._bandwidthChecked = false;
- this._meta = false;
- this._timeoffset = 0;
- super.stop();
- }
- override protected function complete():void{
- if (state != PlayerState.IDLE){
- this.stop();
- setTimeout(sendMediaEvent, 100, MediaEvent.JWPLAYER_MEDIA_COMPLETE);
- };
- }
- override public function setvolume(_arg1:number):void{
- this.streamVolume(_arg1);
- super.setvolume(_arg1);
- }
- protected function streamVolume(_arg1:number):void{
- this._transformer.volume = (_arg1 / 100);
- if (this._stream){
- this._stream.soundTransform = this._transformer;
- };
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import com.longtailvideo.jwplayer.plugins.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- public class YouTubeMediaProvider extends MediaProvider {
- private var _loader:Loader;
- private var _ytApiUrl:string = "http://www.youtube.com/apiplayer?version=3&modestbranding=1";
- private var _ytAPI:object;
- private var _loading:boolean = false;
- private var _ready:boolean = false;
- private var _statusTimer:Timer;
- private var _offset:number = 0;
- private var _videoId:string = "";
- private var _qualityLevels:array;
- private var bytesLodaed:number;
- private var bytestotal:number;
- private var bytesOffset:number;
- public function YouTubeMediaProvider(){
- super("youtube");
- this.stretch = false;
- this._statusTimer = new Timer(100);
- this._statusTimer.addEventListener(TimerEvent.TIMER, this.updatePlaybackStatus);
- this._loader = new Loader();
- this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.apiLoaded);
- this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loadErrorHandler);
- }
- public static function getID(_arg1:string):string{
- var _local4:string;
- var _local2:array = _arg1.split(/\?|\#\!/);
- var _local3 = "";
- for (_local4 in _local2) {
- if (_local2[_local4].substr(0, 2) == "v="){
- _local3 = _local2[_local4].substr(2);
- };
- };
- if (_local3 == ""){
- if (_arg1.indexof("/v/") >= 0){
- _local3 = _arg1.substr((_arg1.indexof("/v/") + 3));
- } else {
- if (_arg1.indexof("youtu.be") >= 0){
- _local3 = _arg1.substr((_arg1.indexof("youtu.be/") + 9));
- } else {
- _local3 = _arg1;
- };
- };
- };
- if (_local3.indexof("?") > -1){
- _local3 = _local3.substr(0, _local3.indexof("?"));
- };
- if (_local3.indexof("&") > -1){
- _local3 = _local3.substr(0, _local3.indexof("&"));
- };
- return (_local3);
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- }
- private function loadErrorHandler(_arg1:ErrorEvent):void{
- error(_arg1.text);
- }
- override public function load(_arg1:PlaylistItem):void{
- this.bytesLodaed = (this.bytestotal = (this.bytesOffset = (this._offset = 0)));
- _item = _arg1;
- this._qualityLevels = null;
- this._videoId = getID(_item.file);
- _position = (this._offset = 0);
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- if (this._ready){
- this.completeLoad(_arg1);
- } else {
- this._loading = true;
- this._loader.load(new URLRequest(this._ytApiUrl));
- };
- }
- private function apiLoaded(_arg1:Event):void{
- this._ytAPI = this._loader.content;
- this._ytAPI.addEventListener("onReady", this.apiReady);
- this._ytAPI.addEventListener("onError", this.onPlayerError);
- this._ytAPI.addEventListener("onStateChange", this.onStateChange);
- }
- private function apiReady(_arg1:Event):void{
- this._ready = true;
- var _local2:PluginConfig = config.pluginConfig("display");
- this.resize(_local2.width, _local2.height);
- if (this._loading){
- this._loading = false;
- this.completeLoad(_item);
- };
- }
- private function onPlayerError(_arg1:Event):void{
- var _local2:number = number(object(_arg1).data);
- if (!isnan(_local2)){
- switch (_local2){
- case 2:
- error(("Invalid video ID: " + this._videoId));
- break;
- case 100:
- error("The requested video could not found, or has been marked as private.");
- break;
- case 101:
- case 150:
- error("The requested video is not allowed to be played in embedded players.");
- break;
- };
- } else {
- error("An unknown error occurred in the YouTube MediaProvider");
- };
- }
- private function completeLoad(_arg1:PlaylistItem):void{
- var _local2:string = getConfigProperty("quality");
- this._ytAPI.cueVideoById(this._videoId, _item.start, ((_local2) ? _local2 : "default"));
- media = this._loader;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- this.setvolume(((config.mute) ? 0 : config.volume));
- this._statusTimer.start();
- }
- public function onStateChange(_arg1:Event):void{
- switch (number(object(_arg1).data)){
- case 0:
- if (((!((state == PlayerState.BUFFERING))) && (!((state == PlayerState.IDLE))))){
- complete();
- this._offset = 0;
- };
- break;
- case 1:
- super.play();
- break;
- case 2:
- super.pause();
- break;
- case 3:
- setState(PlayerState.BUFFERING);
- break;
- };
- }
- private function updatePlaybackStatus(_arg1:TimerEvent):void{
- this.bytesLodaed = this._ytAPI.getVideoBytesLoaded();
- this.bytestotal = this._ytAPI.getVideoBytesTotal();
- this.bytesOffset = this._ytAPI.getVideoStartBytes();
- if (_item.duration <= 0){
- _item.duration = this._ytAPI.getDuration();
- };
- if (this.bytestotal > 0){
- if (item.duration > 0){
- this._offset = ((this.bytesOffset / (this.bytesOffset + this.bytestotal)) * _item.duration);
- };
- sendBufferEvent((100 * (this.bytesLodaed / (this.bytesOffset + this.bytestotal))), this._offset, {
- loaded:this.bytesLodaed,
- total:this.bytestotal
- });
- };
- if (state == PlayerState.PLAYING){
- _position = this._ytAPI.getCurrentTime();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:_position,
- duration:_item.duration,
- offset:this._offset
- });
- if (_position > item.duration){
- complete();
- };
- };
- if (((!(this._qualityLevels)) || ((this._qualityLevels.length == 0)))){
- this._qualityLevels = this._ytAPI.getAvailableQualityLevels();
- if (((this._qualityLevels) && ((this._qualityLevels.length > 0)))){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{youtubequalitylevels:this._qualityLevels}});
- };
- };
- }
- override public function pause():void{
- if ((((state == PlayerState.PLAYING)) || ((state == PlayerState.BUFFERING)))){
- if (this._ready){
- this._ytAPI.pauseVideo();
- };
- super.pause();
- };
- }
- override public function play():void{
- if (this._ready){
- this._ytAPI.playVideo();
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- if (this._ready){
- this._ytAPI.setSize(_arg1, _arg2);
- };
- }
- override public function seek(_arg1:number):void{
- if (this._ready){
- if ((((_arg1 < this._offset)) || (((this._offset / item.duration) > ((this.bytesLodaed + this.bytesOffset) / this.bytestotal))))){
- sendBufferEvent(0, _arg1);
- setState(PlayerState.BUFFERING);
- };
- this._ytAPI.seekTo(_arg1, true);
- this._offset = _arg1;
- super.seek(_arg1);
- this.play();
- };
- }
- override public function stop():void{
- if (this._ready){
- if (this._ytAPI.getPlayerState() > 0){
- this._ytAPI.stopVideo();
- };
- };
- this._statusTimer.stop();
- _position = (this._offset = 0);
- super.stop();
- }
- override public function setvolume(_arg1:number):void{
- if (this._ready){
- this._ytAPI.setvolume(math.min(math.max(0, _arg1), 100));
- };
- super.setvolume(_arg1);
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.parsers.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.media.*;
- import com.wowza.encryptionAS3.*;
- public class RTMPMediaProvider extends MediaProvider {
- private var _SEBufferStatus:number = -1;
- private var _bandwidthChecked:boolean;
- private var _bandwidthSwitch:boolean;
- private var _connection:netconnection;
- private var _responded:boolean;
- private var _dynamic:boolean;
- private var _currentFile:string;
- private var _positionInterval:number;
- private var _xmlLoaders:Dictionary;
- private var _stream:netstream;
- private var _subscribeCount:number = 0;
- private var _subscribeInterval:number;
- private var _timeoffset:number = -1;
- private var _transformer:SoundTransform;
- private var _isStreaming:boolean;
- private var _transitionLevel:number = -1;
- private var _video:video;
- private var _bufferFull:boolean = false;
- private var _dvrStartDuration:number = 0;
- private var _dvrStartDate:number = 0;
- private var _lockOnStream:boolean = false;
- private var _loadbalanceOnSwitch:boolean;
- private var _streamInfo:array;
- private var _streamInfoInterval:number;
- private var _userDuration:boolean;
- public function RTMPMediaProvider(){
- super("rtmp");
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- this._connection = new netconnection();
- this._connection.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
- this._connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
- this._connection.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
- this._connection.objectEncoding = ObjectEncoding.AMF0;
- this._connection.client = new NetClient(this);
- this._xmlLoaders = new Dictionary();
- this._transformer = new SoundTransform();
- this._video = new video(320, 240);
- this._video.smoothing = config.smoothing;
- }
- private function checkDynamic(_arg1:string):void{
- var _local2:number = number(new PlayerEvent("").client.split(" ")[2].split(",")[0]);
- var _local3:number = number(_arg1.split(",")[0]);
- var _local4:number = number(_arg1.split(",")[1]);
- if ((((_local2 > 9)) && ((((_local3 > 3)) || ((((_local3 == 3)) && ((_local4 > 4)))))))){
- this._dynamic = true;
- } else {
- this._dynamic = false;
- };
- if (config.se_disabledynamic == true){
- this._dynamic = false;
- };
- }
- private function connectTunneled():void{
- if (this._responded){
- return;
- };
- var _local1:string = item.streamer;
- if (_local1.substr(0, 7) == "rtmp://"){
- _local1 = _local1.replace("rtmp://", "rtmpt://");
- } else {
- if (_local1.substr(0, 8) == "rtmpe://"){
- _local1 = _local1.replace("rtmpe://", "rtmpte://");
- } else {
- return;
- };
- };
- var _local2:number = _local1.indexof("/", 10);
- var _local3:number = _local1.indexof(":", 10);
- if ((((_local3 > -1)) && ((_local3 < _local2)))){
- _local1 = ((_local1.substr(0, _local3) + ":80") + _local1.substr(_local2));
- } else {
- _local1 = ((_local1.substr(0, _local2) + ":80") + _local1.substr(_local2));
- };
- Logger.log(("Fallback to tunneled connection: " + _local1));
- item.streamer = _local1;
- this._connection.connect(item.streamer);
- }
- private function doDVRInfo(_arg1:string):void{
- this._connection.call("DVRGetStreamInfo", new Responder(this.doDVRInfoCallback), _arg1);
- }
- private function doDVRInfoCallback(_arg1:object):void{
- var _local2:string;
- this._subscribeCount++;
- if (_arg1.code == "NetStream.DVRStreamInfo.Success"){
- if (_arg1.data.currLen < 10){
- setTimeout(this.doDVRInfo, 4000, this.getID(item.file));
- } else {
- this._dvrStartDuration = (_arg1.data.currLen - 20);
- if (_arg1.data.isRec){
- this._dvrStartDate = new date().valueof();
- if (this._dvrStartDuration > 20){
- this._timeoffset = (this._dvrStartDuration - 10);
- };
- };
- this.setStream();
- };
- } else {
- if (_arg1.code == "NetStream.DVRStreamInfo.Retry"){
- if (this._subscribeCount > 3){
- clearinterval(this._subscribeInterval);
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:"Subscribing to the dvr stream timed out."});
- } else {
- setTimeout(this.doDVRInfo, 2000, this.getID(item.file));
- };
- };
- };
- for (_local2 in _arg1.data) {
- _arg1[_local2] = _arg1.data[_local2];
- };
- delete _arg1.data;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
- }
- private function doSubscribe():void{
- var _local1:number;
- this._subscribeCount++;
- if (this._subscribeCount > 3){
- clearinterval(this._subscribeInterval);
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:"Subscribing to the live stream timed out."});
- } else {
- if (((item.levels) && ((item.levels.length > 1)))){
- _local1 = 0;
- while (_local1 < item.levels.length) {
- this._connection.call("FCSubscribe", null, this.getID(item.levels[_local1].file));
- _local1++;
- };
- } else {
- this._connection.call("FCSubscribe", null, this.getID(item.file));
- };
- };
- }
- private function errorHandler(_arg1:ErrorEvent):void{
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:_arg1.text});
- }
- private function getStreamInfo():void{
- var bwd:* = nan;
- var drf:* = nan;
- var stt:* = null;
- var len:* = nan;
- var lvl:* = nan;
- if (!this._stream){
- clearinterval(this._streamInfoInterval);
- return;
- };
- try {
- bwd = math.round(((this._stream.info.maxBytesPerSecond * 8) / 0x0400));
- drf = this._stream.info.droppedFrames;
- stt = state;
- this._streamInfo.push({
- bwd:bwd,
- drf:drf,
- stt:stt
- });
- len = this._streamInfo.length;
- if ((((len > 5)) && ((state == PlayerState.PLAYING)))){
- 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));
- config.bandwidth = bwd;
- Configger.saveCookie("bandwidth", bwd);
- if ((((this._streamInfo[(len - 2)].stt == PlayerState.BUFFERING)) || ((this._streamInfo[(len - 3)].stt == PlayerState.BUFFERING)))){
- drf = 0;
- } else {
- drf = (math.round(((this._streamInfo[(len - 1)].drf - this._streamInfo[(len - 3)].drf) * 5)) / 10);
- };
- if ((((item.levels.length > 0)) && (!((item.getLevel(bwd, config.width) == item.currentLevel))))){
- Logger.log("swapping to another level b/c of bandwidth", bwd.tostring());
- this.swap(item.getLevel(bwd, config.width));
- };
- if ((((((item.levels.length > 0)) && ((drf > 10)))) && ((item.currentLevel < (item.levels.length - 1))))){
- lvl = item.currentLevel;
- item.blacklistLevel(lvl);
- setTimeout(this.unBlacklist, 30000, lvl);
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
- type:"blacklist",
- level:lvl,
- state:true
- }});
- Logger.log("swapping to another level b/c of framedrops", drf.tostring());
- this.swap(item.getLevel(bwd, config.width));
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
- bandwidth:bwd,
- droppedFrames:drf
- }});
- };
- } catch(e:error) {
- Logger.log(("There was an error attempting to get stream info: " + e.message));
- };
- }
- private function unBlacklist(_arg1:number):void{
- item.blacklistLevel(_arg1, false);
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
- type:"blacklist",
- level:_arg1,
- state:false
- }});
- }
- private function getID(_arg1:string):string{
- var _local2:array = _arg1.split("?");
- var _local3:string = _local2[0].substr(-4);
- _local2[0] = _local2[0].substr(0, (_local2[0].length - 4));
- if (_arg1.indexof(":") > -1){
- return (_arg1);
- };
- if (_local3 == ".mp3"){
- return (("mp3:" + _local2.join("?")));
- };
- if ((((((((((((_local3 == ".mp4")) || ((_local3 == ".mov")))) || ((_local3 == ".m4v")))) || ((_local3 == ".aac")))) || ((_local3 == ".m4a")))) || ((_local3 == ".f4v")))){
- return (("mp4:" + _arg1));
- };
- if (_local3 == ".flv"){
- return (_local2.join("?"));
- };
- return (_arg1);
- }
- override public function load(_arg1:PlaylistItem):void{
- _item = _arg1;
- _position = 0;
- this._bufferFull = false;
- this._bandwidthSwitch = false;
- this._lockOnStream = false;
- this._userDuration = (_item.duration > 0);
- if (this._timeoffset < 0){
- this._timeoffset = item.start;
- };
- if (item.levels.length > 0){
- item.setLevel(item.getLevel(config.bandwidth, config.width));
- };
- clearinterval(this._positionInterval);
- if (getConfigProperty("loadbalance")){
- this.loadSmil();
- } else {
- this.finishLoad();
- };
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- }
- private function loadSmil():void{
- var _local3:number;
- if (!item.hasOwnProperty("smil")){
- item.smil = [];
- if (item.levels.length > 0){
- _local3 = 0;
- while (_local3 < item.levels.length) {
- item.smil[_local3] = (item.levels[_local3] as PlaylistItemLevel).file;
- _local3++;
- };
- } else {
- item.smil[0] = item.file;
- };
- };
- var _local1:string = (((item.levels.length > 0)) ? item.smil[item.currentLevel] : item.smil[0]);
- var _local2:AssetLoader = new AssetLoader();
- _local2.addEventListener(Event.COMPLETE, this.loaderHandler);
- _local2.addEventListener(ErrorEvent.error, this.errorHandler);
- this._xmlLoaders[_local2] = _local1;
- _local2.load(_local1, xml);
- }
- private function finishLoad():void{
- if ((((((((item.file.substr(-4) == ".mp3")) || ((item.file.substr(0, 4) == "mp3:")))) || ((item.file.substr(-4) == ".aac")))) || ((item.file.substr(-4) == ".m4a")))){
- media = null;
- } else {
- if (!media){
- media = this._video;
- };
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
- try {
- this._responded = false;
- this._connection.connect(item.streamer);
- if (getConfigProperty("tunneling") !== false){
- setTimeout(this.connectTunneled, 5000);
- };
- } catch(e:error) {
- error(("Could not connect to application: " + e.message));
- };
- }
- private function loaderHandler(_arg1:Event):void{
- var _local4:number;
- var _local5:PlaylistItemLevel;
- var _local2:array = LoadbalanceParser.parse((_arg1.target as AssetLoader).loadedObject);
- var _local3:string = this._xmlLoaders[_arg1.target];
- delete this._xmlLoaders[_arg1.target];
- if (_local2.length > 1){
- item.clearLevels();
- _local4 = 0;
- while (_local4 < _local2.length) {
- item.addLevel(_local2[_local4]);
- _local4++;
- };
- item.setLevel(item.getLevel(config.bandwidth, config.width));
- } else {
- if (item.levels.length > 0){
- _local5 = (item.levels[(item.smil as array).indexof(_local3)] as PlaylistItemLevel);
- _local5.streamer = _local2[0].streamer;
- _local5.file = _local2[0].file;
- this._loadbalanceOnSwitch = true;
- } else {
- item.streamer = _local2[0].streamer;
- item.file = _local2[0].file;
- };
- };
- this.finishLoad();
- }
- public function onClientData(_arg1:object):void{
- if (!_arg1){
- return;
- };
- if (_arg1.type == "fcsubscribe"){
- if (_arg1.code == "NetStream.Play.StreamNotFound"){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Subscription failed: " + item.file)});
- } else {
- if ((((_arg1.code == "NetStream.Play.Start")) && (!(this._stream)))){
- this.setStream();
- };
- };
- clearinterval(this._subscribeInterval);
- };
- if (_arg1.width){
- this._video.width = _arg1.width;
- this._video.height = _arg1.height;
- super.resize(_width, _height);
- };
- if (_arg1.code == "NetStream.Play.TransitionComplete"){
- if (this._transitionLevel >= 0){
- this._transitionLevel = -1;
- };
- } else {
- if (_arg1.type == "metadata"){
- if (((_arg1.duration) && (!(this._userDuration)))){
- item.duration = _arg1.duration;
- };
- if (config.se_livestream == true){
- item.duration = 0;
- };
- };
- };
- if (_arg1.type == "complete"){
- clearinterval(this._positionInterval);
- this.complete();
- };
- if (_arg1.type == "close"){
- this.stop();
- };
- if (_arg1.type == "bandwidth"){
- config.bandwidth = _arg1.bandwidth;
- Configger.saveCookie("bandwidth", _arg1.bandwidth);
- if (this._bandwidthSwitch){
- this._bandwidthSwitch = false;
- this.setStream();
- };
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
- }
- override public function pause():void{
- super.pause();
- if (this._stream){
- if (this.isLivestream){
- this._stream.close();
- } else {
- this._stream.pause();
- };
- } else {
- this._lockOnStream = true;
- };
- }
- override public function play():void{
- if (this._lockOnStream){
- this._lockOnStream = false;
- if (this._stream){
- this.seek(this._timeoffset);
- } else {
- this.setStream();
- };
- } else {
- if (state == PlayerState.PAUSED){
- if (this.isLivestream){
- this._stream.play(this.getID(item.file), -1);
- } else {
- this._stream.resume();
- };
- };
- };
- super.play();
- clearinterval(this._positionInterval);
- this._positionInterval = setinterval(this.positionInterval, 100);
- }
- private function positionInterval():void{
- var _local3:object;
- var _local1:number = (math.round((this._stream.time * 100)) / 100);
- var _local2:number = (this._stream.bufferlength / this._stream.buffertime);
- if (math.round(this._SEBufferStatus) != math.round(this._stream.bufferlength)){
- _local3 = {
- bufferLevel:this._stream.bufferlength,
- bufferMax:this._stream.buffertime,
- bufferStatus:(this._stream.bufferlength / this._stream.buffertime)
- };
- sendMediaEvent(MediaEvent.SCALEENGINE_BUFFER_STATUS, {metadata:_local3});
- };
- this._SEBufferStatus = this._stream.bufferlength;
- if ((((((_local2 < 0.25)) && ((_local1 < (this.duration - 5))))) && (!((state == PlayerState.BUFFERING))))){
- this._bufferFull = false;
- setState(PlayerState.BUFFERING);
- } else {
- if ((((((((_local2 > 1)) && (!((state == PlayerState.PLAYING))))) && (!(this._bufferFull)))) && (!(this.isLivestream)))){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL, {bufferPercent:_local2});
- };
- };
- if (((!(getConfigProperty("dvr"))) && (!((state == PlayerState.PLAYING))))){
- return;
- };
- if (_local1 < this.duration){
- _position = _local1;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:position,
- duration:this.duration
- });
- } else {
- if ((((position > 0)) && ((this.duration > 0)))){
- this._stream.pause();
- clearinterval(this._positionInterval);
- this.complete();
- };
- };
- }
- override public function resize(_arg1:number, _arg2:number):void{
- super.resize(_arg1, _arg2);
- if (state == PlayerState.PLAYING){
- if ((((item.levels.length > 0)) && (!((item.currentLevel == item.getLevel(config.bandwidth, config.width)))))){
- if (this._dynamic){
- Logger.log(("swapping to another level b/c of size: " + config.width));
- this.swap(item.getLevel(config.bandwidth, config.width));
- } else {
- this.seek(position);
- };
- };
- };
- }
- override public function seek(_arg1:number):void{
- var pos:* = _arg1;
- this._transitionLevel = -1;
- if (((((getConfigProperty("dvr")) && (this._dvrStartDate))) && ((pos > (this.duration - 10))))){
- pos = (this.duration - 10);
- };
- this._timeoffset = pos;
- clearinterval(this._positionInterval);
- if ((((item.levels.length > 0)) && (!((item.getLevel(config.bandwidth, config.width) == item.currentLevel))))){
- item.setLevel(item.getLevel(config.bandwidth, config.width));
- if (this._loadbalanceOnSwitch){
- this.load(item);
- return;
- };
- };
- if (state == PlayerState.PAUSED){
- this.play();
- };
- if (this._currentFile != item.file){
- this._currentFile = item.file;
- try {
- if (this._dvrStartDate){
- this._stream.play(this.getID(item.file), 10);
- Logger.log(("dvring " + item.file), "rtmp");
- } else {
- this._stream.play(this.getID(item.file));
- if (this._dynamic){
- this._streamInfo = new array();
- clearinterval(this._streamInfoInterval);
- this._streamInfoInterval = setinterval(this.getStreamInfo, 1000);
- };
- };
- } catch(e:error) {
- Logger.log(("Error: " + e.message));
- };
- };
- if ((((((this._timeoffset > 0)) || ((_position > this._timeoffset)))) || ((state == PlayerState.IDLE)))){
- this._bufferFull = false;
- setState(PlayerState.BUFFERING);
- this._stream.seek(this._timeoffset);
- };
- this._isStreaming = true;
- clearinterval(this._positionInterval);
- this._positionInterval = setinterval(this.positionInterval, 100);
- }
- private function setStream():void{
- this._stream = new netstream(this._connection);
- this._stream.checkPolicyFile = true;
- this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
- this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
- if (((((getConfigProperty("dvr")) || (getConfigProperty("subscribe")))) || (this._dynamic))){
- this._stream.buffertime = 4;
- } else {
- this._stream.buffertime = config.bufferlength;
- };
- this._stream.client = new NetClient(this);
- this._video.attachNetStream(this._stream);
- this.streamVolume(((config.mute) ? 0 : config.volume));
- if (!this._lockOnStream){
- this.seek(this._timeoffset);
- };
- }
- private function statusHandler(_arg1:NetStatusEvent):void{
- var msg:* = null;
- var evt:* = _arg1;
- this._responded = true;
- switch (evt.info.code){
- case "NetConnection.Connect.Success":
- if (evt.info.secureToken != undefined){
- this._connection.call("secureTokenResponse", null, TEA.decrypt(evt.info.secureToken, config.token));
- };
- if (evt.info.data){
- this._connection.call("netStreamEnable", null);
- this.checkDynamic(evt.info.data.version);
- };
- if (getConfigProperty("dvr")){
- this._connection.call("DVRSubscribe", null, this.getID(item.file));
- setTimeout(this.doDVRInfo, 2000, this.getID(item.file));
- } else {
- if (getConfigProperty("subscribe")){
- this._subscribeInterval = setinterval(this.doSubscribe, 2000);
- } else {
- if (item.levels.length > 0){
- if (((this._dynamic) || (this._bandwidthChecked))){
- this.setStream();
- } else {
- this._bandwidthChecked = true;
- this._bandwidthSwitch = true;
- this._connection.call("checkBandwidth", null);
- };
- } else {
- this.setStream();
- };
- this._connection.call("getStreamLength", new Responder(this.streamlengthHandler), this.getID(item.file));
- };
- };
- break;
- case "NetStream.Seek.Notify":
- clearinterval(this._positionInterval);
- this._positionInterval = setinterval(this.positionInterval, 100);
- break;
- case "NetConnection.Connect.Rejected":
- try {
- if (evt.info.ex.code == 302){
- item.streamer = evt.info.ex.redirect;
- setTimeout(this.load, 100, item);
- return;
- };
- } catch(err:error) {
- stop();
- msg = evt.info.code;
- if (evt.info["description"]){
- msg = evt.info["description"];
- };
- stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:msg});
- };
- break;
- case "NetStream.Play.Failed":
- msg = evt.info.code;
- if (evt.info["description"]){
- msg = evt.info["description"];
- };
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:msg});
- break;
- case "NetStream.Failed":
- case "NetStream.Play.StreamNotFound":
- if (!this._isStreaming){
- this.onClientData({type:"complete"});
- } else {
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Stream not found: " + item.file)});
- };
- break;
- case "NetStream.Seek.Failed":
- if (!this._isStreaming){
- this.onClientData({type:"complete"});
- } else {
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Could not seek: " + item.file)});
- };
- break;
- case "NetConnection.Connect.Closed":
- this.stop();
- break;
- case "NetConnection.Connect.Failed":
- if (item.streamer.substr(0, 5) == "rtmpt"){
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:("Server not found: " + item.streamer)});
- } else {
- this._responded = false;
- };
- break;
- case "NetStream.Play.UnpublishNotify":
- this.stop();
- break;
- case "NetStream.Buffer.Full":
- if (!this._bufferFull){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- };
- break;
- case "NetStream.Play.Transition":
- this.onClientData(evt.info);
- break;
- case "NetStream.Play.Stop":
- if (getConfigProperty("dvr")){
- this.stop();
- };
- break;
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:evt.info});
- }
- override public function stop():void{
- var _local1:PlaylistItemLevel;
- var _local2:number;
- if (((this._stream) && (this._stream.time))){
- this._stream.close();
- };
- this._stream = null;
- this._isStreaming = false;
- this._currentFile = undefined;
- this._video.clear();
- this._connection.close();
- clearinterval(this._positionInterval);
- _position = 0;
- this._timeoffset = -1;
- this._dvrStartDuration = (this._dvrStartDate = (this._subscribeCount = 0));
- this._streamInfo = new array();
- clearinterval(this._streamInfoInterval);
- super.stop();
- if (((item) && (item.hasOwnProperty("smil")))){
- if (item.levels.length > 0){
- for each (_local1 in item.levels) {
- _local2 = 0;
- while (_local2 < (item.smil as array).length) {
- _local1.file = item.smil[_local2];
- _local2++;
- };
- };
- } else {
- item.file = item.smil[0];
- };
- };
- }
- private function streamlengthHandler(_arg1:number):void{
- if (((((_arg1) && (!(this._userDuration)))) && (!((config.se_livestream == true))))){
- item.duration = _arg1;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{duration:_arg1}});
- };
- }
- private function swap(_arg1:number):void{
- var _local2:NetStreamPlayOptions;
- if ((((this._transitionLevel == -1)) && ((((((_arg1 < item.currentLevel)) || ((this._stream.bufferlength < (this._stream.buffertime * 1.5))))) || (item.levels[item.currentLevel].blacklisted))))){
- this._transitionLevel = _arg1;
- item.setLevel(_arg1);
- _local2 = new NetStreamPlayOptions();
- _local2.streamName = this.getID(item.file);
- _local2.transition = NetStreamPlayTransitions.switch;
- clearinterval(this._streamInfoInterval);
- this._streamInfo = new array();
- this._streamInfoInterval = setinterval(this.getStreamInfo, 1000);
- this._stream.play2(_local2);
- };
- }
- override public function setvolume(_arg1:number):void{
- this.streamVolume(_arg1);
- super.setvolume(_arg1);
- }
- protected function streamVolume(_arg1:number):void{
- this._transformer.volume = (_arg1 / 100);
- if (this._stream){
- this._stream.soundTransform = this._transformer;
- };
- }
- override protected function complete():void{
- this.stop();
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
- }
- protected function get isLivestream():boolean{
- if (config.se_livestream == true){
- return (true);
- };
- return (((!((this.duration > 0))) && (this._stream)));
- }
- protected function get duration():number{
- var _local1:number;
- if (config.se_livestream == true){
- return (0);
- };
- if (getConfigProperty("dvr")){
- _local1 = this._dvrStartDuration;
- if (this._dvrStartDate){
- _local1 = (_local1 + ((new date().valueof() - this._dvrStartDate) / 1000));
- };
- return (math.round(_local1));
- };
- return (item.duration);
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.media.*;
- public class VideoMediaProvider extends MediaProvider {
- protected var _video:video;
- protected var _connection:netconnection;
- protected var _stream:netstream;
- protected var _transformer:SoundTransform;
- protected var _positionInterval:number;
- protected var _currentFile:string;
- private var _bufferFull:boolean;
- private var _bufferingComplete:boolean;
- private var _bandwidthChecked:boolean;
- private var _bandwidthSwitch:boolean = true;
- private var _bandwidthTimeout:number = 2000;
- public function VideoMediaProvider(){
- super("video");
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- this._connection = new netconnection();
- this._connection.connect(null);
- this._stream = new netstream(this._connection);
- this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.statusHandler);
- this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.errorHandler);
- this._stream.buffertime = config.bufferlength;
- this._stream.client = new NetClient(this);
- this._transformer = new SoundTransform();
- this._video = new video(320, 240);
- this._video.smoothing = config.smoothing;
- this._video.attachNetStream(this._stream);
- }
- protected function errorHandler(_arg1:ErrorEvent):void{
- error(_arg1.text);
- }
- override public function load(_arg1:PlaylistItem):void{
- var _local2:boolean;
- var _local3:string;
- this._bufferFull = false;
- this._bufferingComplete = false;
- if (_arg1.levels.length > 0){
- _arg1.setLevel(_arg1.getLevel(config.bandwidth, config.width));
- this._bandwidthChecked = false;
- } else {
- this._bandwidthChecked = true;
- };
- if (((((((!(item)) || (!((this._currentFile == _arg1.file))))) || ((this._stream.bytesloaded == 0)))) || (((this._stream.bytesloaded < this._stream.bytestotal) > 0)))){
- this._currentFile = _arg1.file;
- if ((((Strings.extension(this._currentFile) == "aac")) || ((Strings.extension(this._currentFile) == "m4a")))){
- media = null;
- } else {
- media = this._video;
- };
- this._stream.checkPolicyFile = true;
- _local3 = Strings.getAbsolutePath(_arg1.file, config["netstreambasepath"]);
- this._stream.play(_local3);
- this._stream.pause();
- } else {
- if (_arg1.duration <= 0){
- _arg1.duration = item.duration;
- };
- this.seekStream(_arg1.start, false);
- };
- _item = _arg1;
- super.load(_arg1);
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- this.streamVolume(((config.mute) ? 0 : config.volume));
- clearinterval(this._positionInterval);
- this._positionInterval = setinterval(this.positionHandler, 200);
- }
- public function onClientData(_arg1:object):void{
- if (!_arg1){
- return;
- };
- if (_arg1.width){
- this._video.width = _arg1.width;
- this._video.height = _arg1.height;
- resize(_width, _height);
- };
- if (((_arg1.duration) && ((item.duration < 0)))){
- item.duration = _arg1.duration;
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_arg1});
- }
- override public function pause():void{
- this._stream.pause();
- super.pause();
- }
- override public function play():void{
- if (!this._positionInterval){
- this._positionInterval = setinterval(this.positionHandler, 100);
- };
- if (this._bufferFull){
- this._stream.resume();
- super.play();
- } else {
- setState(PlayerState.BUFFERING);
- };
- }
- protected function positionHandler():void{
- var _local3:number;
- var _local4:number;
- var _local5:number;
- if (((!(this._bandwidthChecked)) && ((this._stream.bytesloaded > 0)))){
- this._bandwidthChecked = true;
- setTimeout(this.checkBandwidth, this._bandwidthTimeout, this._stream.bytesloaded);
- };
- var _local1:number = (math.round((math.min(this._stream.time, math.max(item.duration, 0)) * 100)) / 100);
- var _local2:number = (((item.duration > 0)) ? (item.duration - this._stream.time) : this._stream.time);
- if ((((((item.duration > 0)) && (this._stream))) && ((this._stream.bytestotal > 0)))){
- _local3 = (((this._stream.buffertime < _local2)) ? this._stream.buffertime : math.ceil(_local2));
- _local4 = ((this._stream.buffertime) ? math.ceil(((math.ceil(this._stream.bufferlength) / _local3) * 100)) : 0);
- } else {
- _local4 = ((this._stream.buffertime) ? ((this._stream.bufferlength / this._stream.buffertime) * 100) : 0);
- _local3 = ((this._stream.bytestotal)>0) ? 100 : 0;
- };
- if ((((((_local4 <= 50)) && ((state == PlayerState.PLAYING)))) && (((item.duration - _local1) > 5)))){
- this._bufferFull = false;
- this._stream.pause();
- setState(PlayerState.BUFFERING);
- } else {
- if ((((((_local4 > 95)) && (!(this._bufferFull)))) && ((_local3 > 0)))){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- };
- };
- if (!this._bufferingComplete){
- if (this._stream.bytestotal > 0){
- _local5 = (100 * (this._stream.bytesloaded / this._stream.bytestotal));
- } else {
- _local5 = (((this._stream.bytesloaded > 0)) ? 100 : 0);
- };
- if ((((_local5 == 100)) && ((this._bufferingComplete == false)))){
- this._bufferingComplete = true;
- };
- sendBufferEvent(_local5, 0, {
- loaded:this._stream.bytesloaded,
- total:this._stream.bytestotal
- });
- };
- if (state != PlayerState.PLAYING){
- return;
- };
- _position = _local1;
- if (position < item.duration){
- if (position >= 0){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:position,
- duration:item.duration
- });
- };
- } else {
- if (item.duration > 0){
- complete();
- };
- };
- }
- private function checkBandwidth(_arg1:number):void{
- var _local4:object;
- var _local2:number = this._stream.bytesloaded;
- var _local3:number = ((math.ceil(((_local2 - _arg1) / 0x0400)) * 8) / (this._bandwidthTimeout / 1000));
- if (_local2 < this._stream.bytestotal){
- if (_local3 > 0){
- config.bandwidth = _local3;
- Configger.saveCookie("bandwidth", _local3);
- _local4 = {bandwidth:_local3};
- if ((((item.duration > 0)) && ((this._stream.bytestotal > 0)))){
- _local4.bitrate = math.ceil((((this._stream.bytestotal / 0x0400) * 8) / item.duration));
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local4});
- };
- if (this._bandwidthSwitch){
- this._bandwidthSwitch = false;
- if (item.currentLevel != item.getLevel(config.bandwidth, config.width)){
- this.load(item);
- return;
- };
- };
- };
- setTimeout(this.checkBandwidth, this._bandwidthTimeout, _local2);
- }
- override public function seek(_arg1:number):void{
- this.seekStream(_arg1);
- }
- private function seekStream(_arg1:number, _arg2:boolean=true):void{
- var _local3:number = (((this._stream.bytestotal > 0)) ? ((this._stream.bytesloaded / this._stream.bytestotal) * item.duration) : 0);
- if (_arg1 <= _local3){
- super.seek(_arg1);
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- this._stream.seek(position);
- if (_arg2){
- this.play();
- };
- };
- }
- protected function statusHandler(_arg1:NetStatusEvent):void{
- switch (_arg1.info.code){
- case "NetStream.Play.Stop":
- complete();
- break;
- case "NetStream.Play.StreamNotFound":
- error(("Video not found or access denied: " + item.file));
- break;
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{status:_arg1.info.code}});
- }
- override public function stop():void{
- if (this._stream.bytesloaded < this._stream.bytestotal){
- this._stream.close();
- } else {
- this._stream.pause();
- this._stream.seek(0);
- };
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- super.stop();
- }
- override public function setvolume(_arg1:number):void{
- this.streamVolume(_arg1);
- super.setvolume(_arg1);
- }
- protected function streamVolume(_arg1:number):void{
- this._transformer.volume = (_arg1 / 100);
- if (this._stream){
- this._stream.soundTransform = this._transformer;
- };
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import com.longtailvideo.jwplayer.utils.*;
- import flash.system.*;
- public class ImageMediaProvider extends MediaProvider {
- private var _loader:Loader;
- private var _postitionInterval:number;
- private var _lastFile:string;
- public function ImageMediaProvider(){
- super("image");
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- this._loader = new Loader();
- this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaderHandler);
- this._loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.progressHandler);
- this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- }
- override public function load(_arg1:PlaylistItem):void{
- _item = _arg1;
- _item.duration = this._duration;
- _position = 0;
- if (item.file != this._lastFile){
- this._lastFile = item.file;
- this._loader.load(new URLRequest(item.file), new LoaderContext(true));
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- } else {
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- this.loaderHandler();
- };
- }
- private function errorHandler(_arg1:ErrorEvent):void{
- this.stop();
- error(_arg1.text);
- }
- private function loaderHandler(_arg1:Event=null):void{
- var evt = _arg1;
- media = this._loader;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
- try {
- Draw.smooth((this._loader.content as Bitmap));
- } catch(e:error) {
- Logger.log(("Could not smooth image file: " + e.message));
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:{
- height:this._loader.content.height,
- width:this._loader.content.width
- }});
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- }
- override public function pause():void{
- clearinterval(this._postitionInterval);
- super.pause();
- }
- override public function play():void{
- this._postitionInterval = setinterval(this.positionInterval, 100);
- super.play();
- }
- protected function positionInterval():void{
- if (state != PlayerState.PLAYING){
- return;
- };
- _position = (math.round(((position * 10) + 1)) / 10);
- if (position < this._duration){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:position,
- duration:item.duration
- });
- } else {
- if (this._duration > 0){
- complete();
- };
- };
- }
- private function progressHandler(_arg1:ProgressEvent):void{
- var _local2:number = math.round(((_arg1.bytesloaded / _arg1.bytestotal) * 100));
- sendBufferEvent(_local2);
- }
- override public function seek(_arg1:number):void{
- clearinterval(this._postitionInterval);
- _position = _arg1;
- this.play();
- }
- override public function stop():void{
- clearinterval(this._postitionInterval);
- super.stop();
- }
- private function get _duration():number{
- if (!isnan(getConfigProperty("duration"))){
- return (((((_item) && ((_item.duration > 0)))) ? _item.duration : getConfigProperty("duration")));
- };
- return (_item.duration);
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import com.longtailvideo.jwplayer.player.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.media.*;
- public class SoundMediaProvider extends MediaProvider {
- private var _sound:sound;
- private var _transformer:SoundTransform;
- private var _channel:SoundChannel;
- private var _context:SoundLoaderContext;
- protected var _positionInterval:number;
- private var _bufferFull:boolean;
- private var _bufferingComplete:boolean;
- private var _userDuration:number = -1;
- public function SoundMediaProvider(){
- super("_sound");
- }
- override public function initializeMediaProvider(_arg1:PlayerConfig):void{
- super.initializeMediaProvider(_arg1);
- this._transformer = new SoundTransform();
- this._context = new SoundLoaderContext(0, true);
- }
- private function completeHandler(_arg1:Event):void{
- complete();
- }
- private function errorHandler(_arg1:ErrorEvent):void{
- this.stop();
- error(_arg1.text);
- }
- private function id3Handler(_arg1:Event):void{
- var _local2:ID3Info;
- var _local3:object;
- try {
- _local2 = this._sound.id3;
- _local3 = {
- type:"id3",
- album:_local2.album,
- artist:_local2.artist,
- comment:_local2.comment,
- genre:_local2.genre,
- name:_local2.songName,
- track:_local2.track,
- year:_local2.year
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata:_local3});
- } catch(err:error) {
- };
- }
- override public function load(_arg1:PlaylistItem):void{
- _position = 0;
- this._bufferFull = false;
- this._userDuration = _arg1.duration;
- if (((((!(_item)) || (!((_item.file == _arg1.file))))) || (!(this._bufferingComplete)))){
- this._bufferingComplete = false;
- this._sound = new sound();
- this._sound.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
- this._sound.addEventListener(Event.id3, this.id3Handler);
- this._sound.addEventListener(ProgressEvent.PROGRESS, this.positionHandler);
- this._sound.load(new URLRequest(_arg1.file), this._context);
- };
- _item = _arg1;
- if (!this._positionInterval){
- this._positionInterval = setinterval(this.positionHandler, 100);
- };
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
- setState(PlayerState.BUFFERING);
- sendBufferEvent(0);
- this.streamVolume(((config.mute) ? 0 : config.volume));
- }
- override public function pause():void{
- if (this._positionInterval){
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- };
- if (this._channel){
- this._channel.stop();
- };
- super.pause();
- }
- override public function play():void{
- if ((((position == 0)) && ((_item.start > 0)))){
- this.seek(item.start);
- return;
- };
- if (!this._positionInterval){
- this._positionInterval = setinterval(this.positionHandler, 100);
- };
- if (this._channel){
- this._channel.stop();
- this._channel = null;
- };
- this._channel = this._sound.play((_position * 1000), 0, this._transformer);
- this._channel.addEventListener(Event.SOUND_COMPLETE, this.completeHandler);
- super.play();
- }
- protected function positionHandler(_arg1:ProgressEvent=null):void{
- var _local2:number = 0;
- var _local3:number = 0;
- var _local4:number = config.bufferlength;
- if (this._userDuration < 0){
- if ((((this._sound.bytestotal > 0)) && (((this._sound.bytesloaded / this._sound.bytestotal) > 0.1)))){
- _item.duration = (((this._sound.length / 1000) / this._sound.bytesloaded) * this._sound.bytestotal);
- } else {
- if (this._sound.length > 0){
- _item.duration = (math.floor((this._sound.length / 100)) / 10);
- };
- };
- };
- if (this._channel){
- _position = (math.floor((this._channel.position / 100)) / 10);
- };
- if (((!((_item.duration == 0))) || ((this._userDuration == 0)))){
- if (this._sound.bytestotal > 0){
- _local2 = math.floor(((this._sound.bytesloaded / this._sound.bytestotal) * 100));
- _local3 = math.max(0, (((this._sound.bytesloaded / this._sound.bytestotal) * _item.duration) - _position));
- _local4 = math.min(_local4, (_item.duration - _position));
- } else {
- _local2 = 0;
- _local3 = 1;
- _local4 = 0;
- };
- };
- if ((((((((state == PlayerState.BUFFERING)) && (!(this._bufferFull)))) && ((_local3 >= _local4)))) && ((this._sound.bytesloaded > 0)))){
- this._bufferFull = true;
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- } else {
- if ((((state == PlayerState.PLAYING)) && ((_local3 < (_local4 / 3))))){
- this._bufferFull = false;
- if (this._channel){
- this._channel.stop();
- };
- setState(PlayerState.BUFFERING);
- return;
- };
- };
- if (((((((this._sound) && (!(isnan(_local2))))) && ((_local2 > 0)))) && (!(this._bufferingComplete)))){
- if ((((_local2 == 100)) && ((this._bufferingComplete == false)))){
- this._bufferingComplete = true;
- };
- sendBufferEvent(_local2, 0, {
- loaded:this._sound.bytesloaded,
- total:this._sound.bytestotal
- });
- };
- if (state != PlayerState.PLAYING){
- return;
- };
- if (_position < _item.duration){
- sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {
- position:_position,
- duration:_item.duration
- });
- } else {
- if ((((_item.duration > 0)) && ((this._sound.bytestotal > 0)))){
- complete();
- };
- };
- }
- override public function seek(_arg1:number):void{
- if ((((((((this._userDuration >= 0)) && ((_arg1 < this._userDuration)))) || ((((((this._userDuration < 0)) && (this._sound))) && ((_arg1 < this._sound.length)))))) || (item.start))){
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- if (this._channel){
- this._channel.stop();
- };
- _position = _arg1;
- this.play();
- };
- }
- override public function stop():void{
- clearinterval(this._positionInterval);
- this._positionInterval = undefined;
- if (item){
- item.duration = this._userDuration;
- };
- super.stop();
- if (this._channel){
- this._channel.stop();
- this._channel = null;
- };
- try {
- this._sound.close();
- } catch(err:error) {
- };
- }
- override public function setvolume(_arg1:number):void{
- this.streamVolume(_arg1);
- super.setvolume(_arg1);
- }
- protected function streamVolume(_arg1:number):void{
- this._transformer.volume = (_arg1 / 100);
- if (this._channel){
- this._channel.soundTransform = this._transformer;
- };
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package com.longtailvideo.jwplayer.media {
- import com.longtailvideo.jwplayer.model.*;
- import flash.events.*;
- import com.longtailvideo.jwplayer.events.*;
- import flash.display.*;
- import com.longtailvideo.jwplayer.player.*;
- import com.longtailvideo.jwplayer.utils.*;
- public class MediaProvider extends Sprite implements IGlobalEventDispatcher {
- private var _config:PlayerConfig;
- private var _provider:string;
- protected var _item:PlaylistItem;
- protected var _position:number = 0;
- private var _volume:number;
- private var _state:string;
- private var _media:movieclip;
- private var _bufferPercent:number;
- private var _dispatcher:GlobalEventDispatcher;
- private var _stretch:boolean;
- private var _queuedBufferFull:boolean;
- protected var _width:number;
- protected var _height:number;
- public function MediaProvider(_arg1:string){
- this._provider = _arg1;
- this._dispatcher = new GlobalEventDispatcher();
- this._stretch = true;
- }
- public function initializeMediaProvider(_arg1:PlayerConfig):void{
- this._config = _arg1;
- this._state = PlayerState.IDLE;
- }
- public function load(_arg1:PlaylistItem):void{
- this._item = _arg1;
- this.dispatchEvent(new MediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED));
- }
- public function play():void{
- if (this._queuedBufferFull){
- this._queuedBufferFull = false;
- this.setState(PlayerState.BUFFERING);
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
- } else {
- this.setState(PlayerState.PLAYING);
- };
- }
- public function pause():void{
- this.setState(PlayerState.PAUSED);
- }
- public function seek(_arg1:number):void{
- this._position = _arg1;
- }
- public function stop():void{
- this.setState(PlayerState.IDLE);
- this._position = 0;
- }
- public function setvolume(_arg1:number):void{
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME, {volume:_arg1});
- }
- public function mute(_arg1:boolean):void{
- if ((_arg1 == true)){
- this.setvolume(0);
- } else {
- this.setvolume(this._config.volume);
- };
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_MUTE, {mute:_arg1});
- }
- public function resize(_arg1:number, _arg2:number):void{
- if (this._stretch){
- this._width = _arg1;
- this._height = _arg2;
- if (this._media){
- Stretcher.stretch(this._media, _arg1, _arg2, this._config.stretching);
- };
- };
- }
- public function get display():DisplayObject{
- return (this._media);
- }
- public function get provider():string{
- return (this._provider);
- }
- public function get state():string{
- return (this._state);
- }
- public function get item():PlaylistItem{
- return (this._item);
- }
- public function get position():number{
- return (this._position);
- }
- public function get volume():number{
- return (this._volume);
- }
- protected function buffer():void{
- }
- protected function complete():void{
- if (this.state != PlayerState.IDLE){
- this.stop();
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
- };
- }
- protected function error(_arg1:string):void{
- this.stop();
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message:_arg1});
- }
- protected function setState(_arg1:string):void{
- var _local2:PlayerStateEvent;
- if (this.state != _arg1){
- _local2 = new PlayerStateEvent(PlayerStateEvent.JWPLAYER_PLAYER_STATE, _arg1, this.state);
- this._state = _arg1;
- this.dispatchEvent(_local2);
- };
- }
- protected function sendMediaEvent(_arg1:string, _arg2:object=null):void{
- var _local3:MediaEvent;
- var _local4:string;
- if ((((_arg1 == MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL)) && ((this.state == PlayerState.PAUSED)))){
- this._queuedBufferFull = true;
- } else {
- _local3 = new MediaEvent(_arg1);
- for (_local4 in _arg2) {
- if (_local3.hasOwnProperty(_local4)){
- _local3[_local4] = _arg2[_local4];
- };
- };
- this.dispatchEvent(_local3);
- };
- }
- protected function sendBufferEvent(_arg1:number, _arg2:number=0, _arg3:object=null):void{
- var _local4:object;
- if (((((!((this._bufferPercent == _arg1))) || ((_arg1 == 0)))) && (((0 <= _arg1) < 100)))){
- this._bufferPercent = _arg1;
- _local4 = {
- bufferPercent:this._bufferPercent,
- offset:_arg2,
- duration:this._item.duration,
- position:math.max(0, this._position),
- metadata:_arg3
- };
- this.sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER, _local4);
- };
- }
- protected function get config():PlayerConfig{
- return (this._config);
- }
- protected function getConfigProperty(_arg1:string){
- if (((this.item) && (this.item.hasOwnProperty(((this._provider + ".") + _arg1))))){
- return (this.item[((this._provider + ".") + _arg1)]);
- };
- return (this._config.pluginConfig(this.provider)[_arg1]);
- }
- protected function get media():DisplayObject{
- return (this._media);
- }
- protected function set media(_arg1:DisplayObject):void{
- if (_arg1){
- this._media = new movieclip();
- this._media.addChild(_arg1);
- if ((this._width * this._height) > 0){
- Stretcher.stretch(this._media, this._width, this._height, this._config.stretching);
- };
- } else {
- this._media = null;
- };
- }
- protected function set stretch(_arg1:boolean):void{
- this._stretch = _arg1;
- }
- public function get stretchMedia():boolean{
- return (this._stretch);
- }
- public function addGlobalListener(_arg1:function):void{
- this._dispatcher.addGlobalListener(_arg1);
- }
- public function removeGlobalListener(_arg1:function):void{
- this._dispatcher.removeGlobalListener(_arg1);
- }
- override public function dispatchEvent(_arg1:Event):boolean{
- this._dispatcher.dispatchEvent(_arg1);
- return (super.dispatchEvent(_arg1));
- }
- }
- }//package com.longtailvideo.jwplayer.media
- package mx.utils {
- import flash.display.*;
- import mx.core.*;
- import flash.utils.*;
- public class NameUtil {
- mx_internal static const version:string = "4.6.0.23201";
- private static var counter:int = 0;
- public static function createUniqueName(_arg1:object):string{
- if (!_arg1){
- return (null);
- };
- var _local2:string = getQualifiedClassName(_arg1);
- var _local3:int = _local2.indexof("::");
- if (_local3 != -1){
- _local2 = _local2.substr((_local3 + 2));
- };
- var _local4:int = _local2.charcodeat((_local2.length - 1));
- if ((((_local4 >= 48)) && ((_local4 <= 57)))){
- _local2 = (_local2 + "_");
- };
- return ((_local2 + counter++));
- }
- public static function displayObjectToString(_arg1:DisplayObject):string{
- var _local2:string;
- var _local3:DisplayObject;
- var _local4:string;
- var _local5:array;
- try {
- _local3 = _arg1;
- while (_local3 != null) {
- if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
- break;
- };
- _local4 = ((((("id" in _local3)) && (_local3["id"]))) ? _local3["id"] : _local3.name);
- if ((_local3 is IRepeaterClient)){
- _local5 = IRepeaterClient(_local3).instanceIndices;
- if (_local5){
- _local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
- };
- };
- _local2 = (((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2));
- _local3 = _local3.parent;
- };
- } catch(e:SecurityError) {
- };
- return (_local2);
- }
- public static function getUnqualifiedClassName(_arg1:object):string{
- var _local2:string;
- if ((_arg1 is string)){
- _local2 = (_arg1 as string);
- } else {
- _local2 = getQualifiedClassName(_arg1);
- };
- var _local3:int = _local2.indexof("::");
- if (_local3 != -1){
- _local2 = _local2.substr((_local3 + 2));
- };
- return (_local2);
- }
- }
- }//package mx.utils
- package mx.core {
- public interface IRepeaterClient {
- function get instanceIndices():array;
- function set instanceIndices(_arg1:array):void;
- function get isDocument():boolean;
- function get repeaterIndices():array;
- function set repeaterIndices(_arg1:array):void;
- function get repeaters():array;
- function set repeaters(_arg1:array):void;
- function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
- }
- }//package mx.core
- package mx.core {
- public interface IBorder {
- function get borderMetrics():EdgeMetrics;
- }
- }//package mx.core
- package mx.core {
- import flash.events.*;
- import flash.display.*;
- import flash.geom.*;
- import flash.accessibility.*;
- public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
- function get root():DisplayObject;
- function get stage():stage;
- function get name():string;
- function set name(_arg1:string):void;
- function get parent():DisplayObjectContainer;
- function get mask():DisplayObject;
- function set mask(_arg1:DisplayObject):void;
- function get visible():boolean;
- function set visible(_arg1:boolean):void;
- function get x():number;
- function set x(_arg1:number):void;
- function get y():number;
- function set y(_arg1:number):void;
- function get scaleX():number;
- function set scaleX(_arg1:number):void;
- function get scaleY():number;
- function set scaleY(_arg1:number):void;
- function get mouseX():number;
- function get mouseY():number;
- function get rotation():number;
- function set rotation(_arg1:number):void;
- function get alpha():number;
- function set alpha(_arg1:number):void;
- function get width():number;
- function set width(_arg1:number):void;
- function get height():number;
- function set height(_arg1:number):void;
- function get cacheAsBitmap():boolean;
- function set cacheAsBitmap(_arg1:boolean):void;
- function get opaqueBackground():object;
- function set opaqueBackground(_arg1:object):void;
- function get scrollRect():Rectangle;
- function set scrollRect(_arg1:Rectangle):void;
- function get filters():array;
- function set filters(_arg1:array):void;
- function get blendMode():string;
- function set blendMode(_arg1:string):void;
- function get transform():Transform;
- function set transform(_arg1:Transform):void;
- function get scale9Grid():Rectangle;
- function set scale9Grid(_arg1:Rectangle):void;
- function globaltolocal(_arg1:Point):Point;
- function localtoglobal(_arg1:Point):Point;
- function getbounds(_arg1:DisplayObject):Rectangle;
- function getRect(_arg1:DisplayObject):Rectangle;
- function get loaderInfo():LoaderInfo;
- function hitTestObject(_arg1:DisplayObject):boolean;
- function hitTestPoint(_arg1:number, _arg2:number, _arg3:boolean=false):boolean;
- function get accessibilityProperties():AccessibilityProperties;
- function set accessibilityProperties(_arg1:AccessibilityProperties):void;
- function get measuredHeight():number;
- function get measuredWidth():number;
- function move(_arg1:number, _arg2:number):void;
- function setActualSize(_arg1:number, _arg2:number):void;
- }
- }//package mx.core
- package mx.core {
- import flash.display.*;
- import mx.utils.*;
- public class FlexMovieClip extends movieclip {
- mx_internal static const version:string = "4.6.0.23201";
- public function FlexMovieClip(){
- try {
- name = NameUtil.createUniqueName(this);
- } catch(e:error) {
- };
- }
- override public function tostring():string{
- return (NameUtil.displayObjectToString(this));
- }
- }
- }//package mx.core
- package mx.core {
- import flash.utils.*;
- public class ByteArrayAsset extends ByteArray implements IFlexAsset {
- mx_internal static const version:string = "4.6.0.23201";
- }
- }//package mx.core
- package mx.core {
- public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
- mx_internal static const version:string = "4.6.0.23201";
- private var _measuredHeight:number;
- private var _measuredWidth:number;
- public function MovieClipAsset(){
- this._measuredWidth = width;
- this._measuredHeight = height;
- }
- public function get measuredHeight():number{
- return (this._measuredHeight);
- }
- public function get measuredWidth():number{
- return (this._measuredWidth);
- }
- public function get borderMetrics():EdgeMetrics{
- if (scale9Grid == null){
- return (EdgeMetrics.EMPTY);
- };
- return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, math.ceil((this.measuredWidth - scale9Grid.right)), math.ceil((this.measuredHeight - scale9Grid.bottom))));
- }
- public function move(_arg1:number, _arg2:number):void{
- this.x = _arg1;
- this.y = _arg2;
- }
- public function setActualSize(_arg1:number, _arg2:number):void{
- width = _arg1;
- height = _arg2;
- }
- }
- }//package mx.core
- package mx.core {
- public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
- }//package mx.core
- package mx.core {
- import flash.events.*;
- import flash.display.*;
- import flash.utils.*;
- import flash.system.*;
- public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
- mx_internal static const version:string = "4.6.0.23201";
- private var loader:Loader = null;
- private var initialized:boolean = false;
- private var requestedWidth:number;
- private var requestedHeight:number;
- protected var initialWidth:number = 0;
- protected var initialHeight:number = 0;
- public function MovieClipLoaderAsset(){
- var _local1:LoaderContext = new LoaderContext();
- _local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
- if (("allowLoadBytesCodeExecution" in _local1)){
- _local1["allowLoadBytesCodeExecution"] = true;
- };
- this.loader = new Loader();
- this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.completeHandler);
- this.loader.loadBytes(this.movieClipData, _local1);
- addChild(this.loader);
- }
- override public function get height():number{
- if (!this.initialized){
- return (this.initialHeight);
- };
- return (super.height);
- }
- override public function set height(_arg1:number):void{
- if (!this.initialized){
- this.requestedHeight = _arg1;
- } else {
- this.loader.height = _arg1;
- };
- }
- override public function get measuredHeight():number{
- return (this.initialHeight);
- }
- override public function get measuredWidth():number{
- return (this.initialWidth);
- }
- override public function get width():number{
- if (!this.initialized){
- return (this.initialWidth);
- };
- return (super.width);
- }
- override public function set width(_arg1:number):void{
- if (!this.initialized){
- this.requestedWidth = _arg1;
- } else {
- this.loader.width = _arg1;
- };
- }
- public function get movieClipData():ByteArray{
- return (null);
- }
- private function completeHandler(_arg1:Event):void{
- this.initialized = true;
- this.initialWidth = this.loader.contentLoaderInfo.width;
- this.initialHeight = this.loader.contentLoaderInfo.height;
- if (!isnan(this.requestedWidth)){
- this.loader.width = this.requestedWidth;
- };
- if (!isnan(this.requestedHeight)){
- this.loader.height = this.requestedHeight;
- };
- dispatchEvent(_arg1);
- }
- }
- }//package mx.core
- package mx.core {
- public class EdgeMetrics {
- mx_internal static const version:string = "4.6.0.23201";
- public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
- ;
- public var bottom:number;
- public var left:number;
- public var right:number;
- public var top:number;
- public function EdgeMetrics(_arg1:number=0, _arg2:number=0, _arg3:number=0, _arg4:number=0){
- this.left = _arg1;
- this.top = _arg2;
- this.right = _arg3;
- this.bottom = _arg4;
- }
- public function clone():EdgeMetrics{
- return (new EdgeMetrics(this.left, this.top, this.right, this.bottom));
- }
- }
- }//package mx.core
- package mx.core {
- public interface IFlexAsset {
- }
- }//package mx.core
Advertisement
Add Comment
Please, Sign In to add comment