home *** CD-ROM | disk | FTP | other *** search
/ Canadian Forces: A World of Opportunities / CanadianForces-AWorldOfOpportunities-WinMac.bin / 04_WhatOptions_FR.swf / scripts / __Packages / mx / video / FLVPlayback.as < prev    next >
Text File  |  2006-07-20  |  52KB  |  1,659 lines

  1. class mx.video.FLVPlayback extends MovieClip
  2. {
  3.    static var version = "1.0.0.103";
  4.    static var DISCONNECTED = "disconnected";
  5.    static var STOPPED = "stopped";
  6.    static var PLAYING = "playing";
  7.    static var PAUSED = "paused";
  8.    static var BUFFERING = "buffering";
  9.    static var LOADING = "loading";
  10.    static var CONNECTION_ERROR = "connectionError";
  11.    static var REWINDING = "rewinding";
  12.    static var SEEKING = "seeking";
  13.    static var ALL = "all";
  14.    static var EVENT = "event";
  15.    static var NAVIGATION = "navigation";
  16.    static var FLV = "flv";
  17.    static var ACTIONSCRIPT = "actionscript";
  18.    static var VP_DEPTH_OFFSET = 100;
  19.    static var SEEK_TO_PREV_OFFSET_DEFAULT = 1;
  20.    function FLVPlayback()
  21.    {
  22.       super();
  23.       mx.events.EventDispatcher.initialize(this);
  24.       if(this._autoPlay == undefined)
  25.       {
  26.          this._autoPlay = true;
  27.       }
  28.       if(this._autoRewind == undefined)
  29.       {
  30.          this._autoRewind = true;
  31.       }
  32.       if(this._autoSize == undefined)
  33.       {
  34.          this._autoSize = false;
  35.       }
  36.       if(this._bufferTime == undefined)
  37.       {
  38.          this._bufferTime = 0.1;
  39.       }
  40.       if(this._contentPath == undefined)
  41.       {
  42.          this._contentPath = "";
  43.       }
  44.       if(this._cuePoints == undefined)
  45.       {
  46.          this._cuePoints = null;
  47.       }
  48.       if(this._idleTimeout == undefined)
  49.       {
  50.          this._idleTimeout = mx.video.VideoPlayer.DEFAULT_IDLE_TIMEOUT_INTERVAL;
  51.       }
  52.       if(this._isLive == undefined)
  53.       {
  54.          this._isLive = false;
  55.       }
  56.       if(this._aspectRatio == undefined)
  57.       {
  58.          this._aspectRatio = true;
  59.       }
  60.       if(this._seekToPrevOffset == undefined)
  61.       {
  62.          this._seekToPrevOffset = mx.video.FLVPlayback.SEEK_TO_PREV_OFFSET_DEFAULT;
  63.       }
  64.       if(this._playheadUpdateInterval == undefined)
  65.       {
  66.          this._playheadUpdateInterval = mx.video.VideoPlayer.DEFAULT_UPDATE_PROGRESS_INTERVAL;
  67.       }
  68.       if(this._progressInterval == undefined)
  69.       {
  70.          this._progressInterval = mx.video.VideoPlayer.DEFAULT_UPDATE_TIME_INTERVAL;
  71.       }
  72.       if(this._totalTime == undefined)
  73.       {
  74.          this._totalTime = 0;
  75.       }
  76.       if(this._transform == undefined)
  77.       {
  78.          this._transform = null;
  79.       }
  80.       if(this._volume == undefined)
  81.       {
  82.          this._volume = 100;
  83.       }
  84.       if(this._skinAutoHide == undefined)
  85.       {
  86.          this._skinAutoHide = false;
  87.       }
  88.       if(this._bufferingBarHides == undefined)
  89.       {
  90.          this._bufferingBarHides = false;
  91.       }
  92.       this._origHeight = this._prevHeight = this.__height = this._height;
  93.       this._origWidth = this._prevWidth = this.__width = this._width;
  94.       this._scaleX = 100;
  95.       this._scaleY = 100;
  96.       this._xscale = 100;
  97.       this._yscale = 100;
  98.       this._preSeekTime = -1;
  99.       this._firstStreamReady = false;
  100.       this._firstStreamShown = false;
  101.       this.createUIManager();
  102.       this._activeVP = 0;
  103.       this._visibleVP = 0;
  104.       this._topVP = 0;
  105.       this._vp = new Array();
  106.       this._vpState = new Array();
  107.       this._cpMgr = new Array();
  108.       this.createVideoPlayer(0);
  109.       this._vp[0].visible = false;
  110.       this._vp[0].volume = 0;
  111.       this.boundingBox_mc._visible = false;
  112.       this.boundingBox_mc.unloadMovie();
  113.       delete this.boundingBox_mc;
  114.       if(_global.isLivePreview)
  115.       {
  116.          this.createLivePreviewMovieClip();
  117.          this.setSize(this.__width,this.__height);
  118.       }
  119.       this._cpMgr[0].processCuePointsProperty(this._cuePoints);
  120.       delete this._cuePoints;
  121.       this._cuePoints = null;
  122.    }
  123.    function setSize(w, h)
  124.    {
  125.       if(_global.isLivePreview)
  126.       {
  127.          if(this.preview_mc == undefined)
  128.          {
  129.             this.createLivePreviewMovieClip();
  130.          }
  131.          this.preview_mc.box_mc._width = w;
  132.          this.preview_mc.box_mc._height = h;
  133.          if(this.preview_mc.box_mc._width < this.preview_mc.icon_mc._width || this.preview_mc.box_mc._height < this.preview_mc.icon_mc._height)
  134.          {
  135.             this.preview_mc.icon_mc._visible = false;
  136.          }
  137.          else
  138.          {
  139.             this.preview_mc.icon_mc._visible = true;
  140.             this.preview_mc.icon_mc._x = (this.preview_mc.box_mc._width - this.preview_mc.icon_mc._width) / 2;
  141.             this.preview_mc.icon_mc._y = (this.preview_mc.box_mc._height - this.preview_mc.icon_mc._height) / 2;
  142.          }
  143.       }
  144.       if(w == this.__get__width() && h == this.__get__height())
  145.       {
  146.          return undefined;
  147.       }
  148.       this._prevWidth = this.__width = w;
  149.       this._prevHeight = this.__height = h;
  150.       var _loc3_ = 0;
  151.       while(_loc3_ < this._vp.length)
  152.       {
  153.          if(this._vp[_loc3_] != undefined)
  154.          {
  155.             this._vp[_loc3_].setSize(w,h);
  156.          }
  157.          _loc3_ = _loc3_ + 1;
  158.       }
  159.       this.dispatchEvent({type:"resize",x:this.__get__x(),y:this.__get__y(),width:w,height:h});
  160.    }
  161.    function setScale(xs, ys)
  162.    {
  163.       if(xs == this.__get__scaleX() && ys == this.__get__scaleY())
  164.       {
  165.          return undefined;
  166.       }
  167.       this._scaleX = xs;
  168.       this._scaleY = ys;
  169.       var _loc2_ = 0;
  170.       while(_loc2_ < this._vp.length)
  171.       {
  172.          if(this._vp[_loc2_] != undefined)
  173.          {
  174.             this._vp[_loc2_].setSize(this._origWidth * xs / 100,this._origHeight * ys / 100);
  175.          }
  176.          _loc2_ = _loc2_ + 1;
  177.       }
  178.       this.dispatchEvent({type:"resize",x:this.__get__x(),y:this.__get__y(),width:this.__get__width(),height:this.__get__height()});
  179.    }
  180.    function handleEvent(e)
  181.    {
  182.       var _loc3_ = e.state;
  183.       if(e.state != undefined && e.target._name == this._visibleVP && this.__get__scrubbing())
  184.       {
  185.          _loc3_ = mx.video.FLVPlayback.SEEKING;
  186.       }
  187.       if(e.type == "metadataReceived")
  188.       {
  189.          this._cpMgr[e.target._name].processFLVCuePoints(e.info.cuePoints);
  190.          this.dispatchEvent({type:e.type,info:e.info,vp:e.target._name});
  191.       }
  192.       else if(e.type == "cuePoint")
  193.       {
  194.          if(this._cpMgr[e.target._name].isFLVCuePointEnabled(e.info))
  195.          {
  196.             this.dispatchEvent({type:e.type,info:e.info,vp:e.target._name});
  197.          }
  198.       }
  199.       else if(e.type == "rewind")
  200.       {
  201.          this.dispatchEvent({type:e.type,auto:true,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  202.          this._cpMgr[e.target._name].resetASCuePointIndex(e.playheadTime);
  203.       }
  204.       else if(e.type == "resize")
  205.       {
  206.          this.dispatchEvent({type:e.type,x:this.__get__x(),y:this.__get__y(),width:this.__get__width(),height:this.__get__height(),auto:true,vp:e.target._name});
  207.          this._prevWidth = this.__width;
  208.          this._prevHeight = this.__height;
  209.       }
  210.       else if(e.type == "playheadUpdate")
  211.       {
  212.          this.dispatchEvent({type:e.type,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  213.          if(this._preSeekTime >= 0 && e.target.state != mx.video.FLVPlayback.SEEKING)
  214.          {
  215.             var _loc5_ = this._preSeekTime;
  216.             this._preSeekTime = -1;
  217.             this._cpMgr[e.target._name].resetASCuePointIndex(e.playheadTime);
  218.             this.dispatchEvent({type:"seek",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  219.             if(_loc5_ < e.playheadTime)
  220.             {
  221.                this.dispatchEvent({type:"fastForward",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  222.             }
  223.             else if(_loc5_ > e.playheadTime)
  224.             {
  225.                this.dispatchEvent({type:"rewind",auto:false,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  226.             }
  227.          }
  228.          this._cpMgr[e.target._name].dispatchASCuePoints();
  229.       }
  230.       else if(e.type == "stateChange")
  231.       {
  232.          var _loc4_ = e.target._name;
  233.          if(_loc4_ == this._visibleVP && this.__get__scrubbing())
  234.          {
  235.             return undefined;
  236.          }
  237.          if(e.state == mx.video.VideoPlayer.RESIZING)
  238.          {
  239.             return undefined;
  240.          }
  241.          if(this._vpState[_loc4_].prevState == mx.video.FLVPlayback.LOADING && this._vpState[_loc4_].autoPlay && e.state == mx.video.FLVPlayback.STOPPED)
  242.          {
  243.             return undefined;
  244.          }
  245.          this._vpState[_loc4_].prevState = e.state;
  246.          this.dispatchEvent({type:e.type,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  247.          if(this._vp[e.target._name].state != _loc3_)
  248.          {
  249.             return undefined;
  250.          }
  251.          switch(_loc3_)
  252.          {
  253.             case mx.video.FLVPlayback.BUFFERING:
  254.                this.dispatchEvent({type:"buffering",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  255.                break;
  256.             case mx.video.FLVPlayback.PAUSED:
  257.                this.dispatchEvent({type:"paused",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  258.                break;
  259.             case mx.video.FLVPlayback.PLAYING:
  260.                this.dispatchEvent({type:"playing",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  261.                break;
  262.             case mx.video.FLVPlayback.STOPPED:
  263.                this.dispatchEvent({type:"stopped",state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  264.          }
  265.       }
  266.       else if(e.type == "progress")
  267.       {
  268.          this.dispatchEvent({type:e.type,bytesLoaded:e.bytesLoaded,bytesTotal:e.bytesTotal,vp:e.target._name});
  269.       }
  270.       else if(e.type == "ready")
  271.       {
  272.          _loc4_ = e.target._name;
  273.          if(!this._firstStreamReady)
  274.          {
  275.             if(_loc4_ == this._visibleVP)
  276.             {
  277.                this._firstStreamReady = true;
  278.                if(this._uiMgr.__get__skinReady() && !this._firstStreamShown)
  279.                {
  280.                   this._uiMgr.__set__visible(true);
  281.                   this.showFirstStream();
  282.                }
  283.             }
  284.          }
  285.          else if(this._firstStreamShown && _loc3_ == mx.video.FLVPlayback.STOPPED && this._vpState[_loc4_].autoPlay)
  286.          {
  287.             this._vp[_loc4_].play();
  288.          }
  289.          this.dispatchEvent({type:e.type,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  290.       }
  291.       else if(e.type == "close" || e.type == "complete")
  292.       {
  293.          this.dispatchEvent({type:e.type,state:_loc3_,playheadTime:e.playheadTime,vp:e.target._name});
  294.       }
  295.    }
  296.    function load(contentPath, totalTime, isLive)
  297.    {
  298.       if(this._vp[this._activeVP] == undefined)
  299.       {
  300.          return undefined;
  301.       }
  302.       if(contentPath == undefined || contentPath == null || contentPath == "")
  303.       {
  304.          return undefined;
  305.       }
  306.       this.__set__autoPlay(false);
  307.       if(totalTime != undefined)
  308.       {
  309.          this.__set__totalTime(totalTime);
  310.       }
  311.       if(isLive != undefined)
  312.       {
  313.          this.__set__isLive(isLive);
  314.       }
  315.       this.__set__contentPath(contentPath);
  316.    }
  317.    function play(contentPath, totalTime, isLive)
  318.    {
  319.       if(this._vp[this._activeVP] == undefined)
  320.       {
  321.          return undefined;
  322.       }
  323.       if(contentPath == undefined)
  324.       {
  325.          this._vp[this._activeVP].play();
  326.       }
  327.       else
  328.       {
  329.          this.__set__autoPlay(true);
  330.          if(totalTime != undefined)
  331.          {
  332.             this.__set__totalTime(totalTime);
  333.          }
  334.          if(isLive != undefined)
  335.          {
  336.             this.__set__isLive(isLive);
  337.          }
  338.          this.__set__contentPath(contentPath);
  339.       }
  340.    }
  341.    function pause()
  342.    {
  343.       if(this._vp[this._activeVP] == undefined)
  344.       {
  345.          return undefined;
  346.       }
  347.       this._vp[this._activeVP].pause();
  348.    }
  349.    function stop()
  350.    {
  351.       if(this._vp[this._activeVP] == undefined)
  352.       {
  353.          return undefined;
  354.       }
  355.       this._vp[this._activeVP].stop();
  356.    }
  357.    function seek(time)
  358.    {
  359.       if(this._vp[this._activeVP] == undefined)
  360.       {
  361.          return undefined;
  362.       }
  363.       this._preSeekTime = this.playheadTime;
  364.       this._vp[this._activeVP].seek(time);
  365.    }
  366.    function seekSeconds(time)
  367.    {
  368.       this.seek(time);
  369.    }
  370.    function seekPercent(percent)
  371.    {
  372.       if(this._vp[this._activeVP] == undefined)
  373.       {
  374.          return undefined;
  375.       }
  376.       if(percent < 0 || percent > 100 || this._vp[this._activeVP].totalTime == undefined || this._vp[this._activeVP].totalTime == null || this._vp[this._activeVP].totalTime <= 0)
  377.       {
  378.          throw new mx.video.VideoError(mx.video.VideoError.INVALID_SEEK);
  379.       }
  380.       else
  381.       {
  382.          this.seek(this._vp[this._activeVP].totalTime * percent / 100);
  383.       }
  384.    }
  385.    function get playheadPercentage()
  386.    {
  387.       if(this._vp[this._activeVP].totalTime == undefined || this._vp[this._activeVP].totalTime == null || this._vp[this._activeVP].totalTime <= 0)
  388.       {
  389.          return undefined;
  390.       }
  391.       return this._vp[this._activeVP].playheadTime / this._vp[this._activeVP].totalTime * 100;
  392.    }
  393.    function set playheadPercentage(percent)
  394.    {
  395.       this.seekPercent(percent);
  396.    }
  397.    function seekToNavCuePoint(timeNameOrCuePoint)
  398.    {
  399.       var _loc3_ = undefined;
  400.       switch(typeof timeNameOrCuePoint)
  401.       {
  402.          case "string":
  403.             _loc3_ = {name:timeNameOrCuePoint};
  404.             break;
  405.          case "number":
  406.             _loc3_ = {time:timeNameOrCuePoint};
  407.             break;
  408.          case "object":
  409.             _loc3_ = timeNameOrCuePoint;
  410.       }
  411.       if(_loc3_.name == null || _loc3_.name == undefined || typeof _loc3_.name != "string")
  412.       {
  413.          this.seekToNextNavCuePoint(_loc3_.time);
  414.          return undefined;
  415.       }
  416.       if(isNaN(_loc3_.time))
  417.       {
  418.          _loc3_.time = 0;
  419.       }
  420.       var _loc2_ = this.findNearestCuePoint(timeNameOrCuePoint,mx.video.FLVPlayback.NAVIGATION);
  421.       while(_loc2_ != null && (_loc2_.time < _loc3_.time || !this.isFLVCuePointEnabled(_loc2_)))
  422.       {
  423.          _loc2_ = this.findNextCuePointWithName(_loc2_);
  424.       }
  425.       if(_loc2_ == null)
  426.       {
  427.          throw new mx.video.VideoError(mx.video.VideoError.INVALID_SEEK);
  428.       }
  429.       else
  430.       {
  431.          this.seek(_loc2_.time);
  432.       }
  433.    }
  434.    function seekToNextNavCuePoint(time)
  435.    {
  436.       if(this._vp[this._activeVP] == undefined)
  437.       {
  438.          return undefined;
  439.       }
  440.       if(isNaN(time) || time < 0)
  441.       {
  442.          time = this._vp[this._activeVP].playheadTime + 0.001;
  443.       }
  444.       var _loc3_ = undefined;
  445.       _loc3_ = this.findNearestCuePoint(time,mx.video.FLVPlayback.NAVIGATION);
  446.       if(_loc3_ == null)
  447.       {
  448.          this.seek(this._vp[this._activeVP].totalTime);
  449.          return undefined;
  450.       }
  451.       var _loc2_ = _loc3_.index;
  452.       if(_loc3_.time < time)
  453.       {
  454.          _loc2_ = _loc2_ + 1;
  455.       }
  456.       while(_loc2_ < _loc3_.array.length && !this.isFLVCuePointEnabled(_loc3_.array[_loc2_]))
  457.       {
  458.          _loc2_ = _loc2_ + 1;
  459.       }
  460.       if(_loc2_ >= _loc3_.array.length)
  461.       {
  462.          var _loc5_ = this._vp[this._activeVP].totalTime;
  463.          if(_loc3_.array[_loc3_.array.length - 1].time > _loc5_)
  464.          {
  465.             _loc5_ = _loc3_.array[_loc3_.array.length - 1];
  466.          }
  467.          this.seek(_loc5_);
  468.       }
  469.       else
  470.       {
  471.          this.seek(_loc3_.array[_loc2_].time);
  472.       }
  473.    }
  474.    function seekToPrevNavCuePoint(time)
  475.    {
  476.       if(this._vp[this._activeVP] == undefined)
  477.       {
  478.          return undefined;
  479.       }
  480.       if(isNaN(time) || time < 0)
  481.       {
  482.          time = this._vp[this._activeVP].playheadTime;
  483.       }
  484.       var _loc3_ = this.findNearestCuePoint(time,mx.video.FLVPlayback.NAVIGATION);
  485.       if(_loc3_ == null)
  486.       {
  487.          this.seek(0);
  488.          return undefined;
  489.       }
  490.       var _loc2_ = _loc3_.index;
  491.       while(_loc2_ >= 0 && (!this.isFLVCuePointEnabled(_loc3_.array[_loc2_]) || _loc3_.array[_loc2_].time >= time - this._seekToPrevOffset))
  492.       {
  493.          _loc2_ = _loc2_ - 1;
  494.       }
  495.       if(_loc2_ < 0)
  496.       {
  497.          this.seek(0);
  498.       }
  499.       else
  500.       {
  501.          this.seek(_loc3_.array[_loc2_].time);
  502.       }
  503.    }
  504.    function addASCuePoint(timeOrCuePoint, name, parameters)
  505.    {
  506.       return this._cpMgr[this._activeVP].addASCuePoint(timeOrCuePoint,name,parameters);
  507.    }
  508.    function removeASCuePoint(timeNameOrCuePoint)
  509.    {
  510.       return this._cpMgr[this._activeVP].removeASCuePoint(timeNameOrCuePoint);
  511.    }
  512.    function findCuePoint(timeNameOrCuePoint, type)
  513.    {
  514.       switch(type)
  515.       {
  516.          case "event":
  517.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].eventCuePoints,false,timeNameOrCuePoint);
  518.          case "navigation":
  519.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].navCuePoints,false,timeNameOrCuePoint);
  520.          case "flv":
  521.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].flvCuePoints,false,timeNameOrCuePoint);
  522.          case "actionscript":
  523.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].asCuePoints,false,timeNameOrCuePoint);
  524.          case "all":
  525.          default:
  526.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].allCuePoints,false,timeNameOrCuePoint);
  527.       }
  528.    }
  529.    function findNearestCuePoint(timeNameOrCuePoint, type)
  530.    {
  531.       switch(type)
  532.       {
  533.          case "event":
  534.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].eventCuePoints,true,timeNameOrCuePoint);
  535.          case "navigation":
  536.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].navCuePoints,true,timeNameOrCuePoint);
  537.          case "flv":
  538.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].flvCuePoints,true,timeNameOrCuePoint);
  539.          case "actionscript":
  540.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].asCuePoints,true,timeNameOrCuePoint);
  541.          case "all":
  542.          default:
  543.             return this._cpMgr[this._activeVP].getCuePoint(this._cpMgr[this._activeVP].allCuePoints,true,timeNameOrCuePoint);
  544.       }
  545.    }
  546.    function findNextCuePointWithName(cuePoint)
  547.    {
  548.       return this._cpMgr[this._activeVP].getNextCuePointWithName(cuePoint);
  549.    }
  550.    function setFLVCuePointEnabled(enabled, timeNameOrCuePoint)
  551.    {
  552.       return this._cpMgr[this._activeVP].setFLVCuePointEnabled(enabled,timeNameOrCuePoint);
  553.    }
  554.    function isFLVCuePointEnabled(timeNameOrCuePoint)
  555.    {
  556.       return this._cpMgr[this._activeVP].isFLVCuePointEnabled(timeNameOrCuePoint);
  557.    }
  558.    function getNextHighestDepth()
  559.    {
  560.       var _loc2_ = super.getNextHighestDepth();
  561.       return _loc2_ >= 1000 ? _loc2_ : 1000;
  562.    }
  563.    function bringVideoPlayerToFront(index)
  564.    {
  565.       if(index == this._topVP || this._vp[index] == undefined)
  566.       {
  567.          return undefined;
  568.       }
  569.       this._vp[this._topVP].swapDepths(this._vp[index].getDepth());
  570.       this._topVP = index;
  571.    }
  572.    function getVideoPlayer(index)
  573.    {
  574.       return this._vp[index];
  575.    }
  576.    function closeVideoPlayer(index)
  577.    {
  578.       if(this._vp[index] == undefined)
  579.       {
  580.          return undefined;
  581.       }
  582.       if(index == 0)
  583.       {
  584.          throw new mx.video.VideoError(mx.video.VideoError.DELETE_DEFAULT_PLAYER);
  585.       }
  586.       else
  587.       {
  588.          if(this._visibleVP == index)
  589.          {
  590.             this.__set__visibleVideoPlayerIndex(0);
  591.          }
  592.          if(this._activeVP == index)
  593.          {
  594.             this.__set__activeVideoPlayerIndex(0);
  595.          }
  596.          this._vp[index].close();
  597.          this._vp[index].unloadMovie();
  598.          delete this._vp[index];
  599.          this._vp[index] = undefined;
  600.       }
  601.    }
  602.    function get activeVideoPlayerIndex()
  603.    {
  604.       return this._activeVP;
  605.    }
  606.    function set activeVideoPlayerIndex(i)
  607.    {
  608.       if(this._activeVP == i)
  609.       {
  610.          return undefined;
  611.       }
  612.       if(this._vp[this._activeVP].onEnterFrame != undefined)
  613.       {
  614.          this.doContentPathConnect();
  615.       }
  616.       this._activeVP = i;
  617.       if(this._vp[this._activeVP] == undefined)
  618.       {
  619.          this.createVideoPlayer(this._activeVP);
  620.          this._vp[this._activeVP].visible = false;
  621.          this._vp[this._activeVP].volume = 0;
  622.       }
  623.    }
  624.    function get autoPlay()
  625.    {
  626.       if(this._vpState[this._activeVP] == undefined)
  627.       {
  628.          return this._autoPlay;
  629.       }
  630.       return this._vpState[this._activeVP].autoPlay;
  631.    }
  632.    function set autoPlay(flag)
  633.    {
  634.       if(this._activeVP == 0 || this._activeVP == undefined)
  635.       {
  636.          this._autoPlay = flag;
  637.       }
  638.       this._vpState[this._activeVP].autoPlay = flag;
  639.    }
  640.    function get autoRewind()
  641.    {
  642.       if(this._vp[this._activeVP] == undefined)
  643.       {
  644.          return this._autoRewind;
  645.       }
  646.       return this._vp[this._activeVP].autoRewind;
  647.    }
  648.    function set autoRewind(flag)
  649.    {
  650.       if(this._activeVP == 0 || this._activeVP == undefined)
  651.       {
  652.          this._autoRewind = flag;
  653.       }
  654.       this._vp[this._activeVP].autoRewind = flag;
  655.    }
  656.    function get autoSize()
  657.    {
  658.       if(this._vp[this._activeVP] == undefined)
  659.       {
  660.          return this._autoSize;
  661.       }
  662.       return this._vp[this._activeVP].autoSize;
  663.    }
  664.    function set autoSize(flag)
  665.    {
  666.       if(this._activeVP == 0 || this._activeVP == undefined)
  667.       {
  668.          this._autoSize = flag;
  669.       }
  670.       this._vp[this._activeVP].autoSize = flag;
  671.    }
  672.    function get bitrate()
  673.    {
  674.       return this.__get__ncMgr().getBitrate();
  675.    }
  676.    function set bitrate(b)
  677.    {
  678.       this.__get__ncMgr().setBitrate(b);
  679.    }
  680.    function get buffering()
  681.    {
  682.       if(this._vp[this._activeVP] == undefined)
  683.       {
  684.          return false;
  685.       }
  686.       return this._vp[this._activeVP].state == mx.video.FLVPlayback.BUFFERING;
  687.    }
  688.    function get bufferingBar()
  689.    {
  690.       if(this._uiMgr != null && this._uiMgr != undefined)
  691.       {
  692.          this._bufferingBar = this._uiMgr.getControl(mx.video.UIManager.BUFFERING_BAR);
  693.       }
  694.       return this._bufferingBar;
  695.    }
  696.    function set bufferingBar(s)
  697.    {
  698.       this._bufferingBar = s;
  699.       if(this._uiMgr != null && this._uiMgr != undefined)
  700.       {
  701.          this._uiMgr.setControl(mx.video.UIManager.BUFFERING_BAR,s);
  702.       }
  703.    }
  704.    function get bufferingBarHidesAndDisablesOthers()
  705.    {
  706.       if(this._uiMgr != null && this._uiMgr != undefined)
  707.       {
  708.          this._bufferingBarHides = this._uiMgr.bufferingBarHidesAndDisablesOthers;
  709.       }
  710.       return this._bufferingBarHides;
  711.    }
  712.    function set bufferingBarHidesAndDisablesOthers(b)
  713.    {
  714.       this._bufferingBarHides = b;
  715.       if(this._uiMgr != null && this._uiMgr != undefined)
  716.       {
  717.          this._uiMgr.__set__bufferingBarHidesAndDisablesOthers(b);
  718.       }
  719.    }
  720.    function get backButton()
  721.    {
  722.       if(this._uiMgr != null && this._uiMgr != undefined)
  723.       {
  724.          this._backButton = this._uiMgr.getControl(mx.video.UIManager.BACK_BUTTON);
  725.       }
  726.       return this._backButton;
  727.    }
  728.    function set backButton(s)
  729.    {
  730.       this._backButton = s;
  731.       if(this._uiMgr != null && this._uiMgr != undefined)
  732.       {
  733.          this._uiMgr.setControl(mx.video.UIManager.BACK_BUTTON,s);
  734.       }
  735.    }
  736.    function get bufferTime()
  737.    {
  738.       if(this._vp[this._activeVP] == undefined)
  739.       {
  740.          return this._bufferTime;
  741.       }
  742.       return this._vp[this._activeVP].bufferTime;
  743.    }
  744.    function set bufferTime(aTime)
  745.    {
  746.       if(this._activeVP == 0 || this._activeVP == undefined)
  747.       {
  748.          this._bufferTime = aTime;
  749.       }
  750.       this._vp[this._activeVP].bufferTime = aTime;
  751.    }
  752.    function get bytesLoaded()
  753.    {
  754.       return this._vp[this._activeVP].bytesLoaded;
  755.    }
  756.    function get bytesTotal()
  757.    {
  758.       return this._vp[this._activeVP].bytesTotal;
  759.    }
  760.    function get contentPath()
  761.    {
  762.       if(this._vp[this._activeVP] == undefined || this._vp[this._activeVP].onEnterFrame != undefined)
  763.       {
  764.          return this._contentPath;
  765.       }
  766.       return this._vp[this._activeVP].url;
  767.    }
  768.    function set contentPath(url)
  769.    {
  770.       if(_global.isLivePreview)
  771.       {
  772.          return undefined;
  773.       }
  774.       if(this._vp[this._activeVP] == undefined)
  775.       {
  776.          if(url == this._contentPath)
  777.          {
  778.             return undefined;
  779.          }
  780.          this._contentPath = url;
  781.       }
  782.       else
  783.       {
  784.          if(this._vp[this._activeVP].url == url)
  785.          {
  786.             return undefined;
  787.          }
  788.          this._vpState[this._activeVP].minProgressPercent = undefined;
  789.          if(this._vp[this._activeVP].onEnterFrame != undefined)
  790.          {
  791.             delete this._vp[this._activeVP].onEnterFrame;
  792.             this._vp[this._activeVP].onEnterFrame = undefined;
  793.          }
  794.          this._cpMgr[this._activeVP].reset();
  795.          if(this._vpState[this._activeVP].autoPlay && this._firstStreamShown)
  796.          {
  797.             this._vp[this._activeVP].play(url,this._vpState[this._activeVP].isLive,this._vpState[this._activeVP].totalTime);
  798.          }
  799.          else
  800.          {
  801.             this._vp[this._activeVP].load(url,this._vpState[this._activeVP].isLive,this._vpState[this._activeVP].totalTime);
  802.          }
  803.          this._vpState[this._activeVP].isLiveSet = false;
  804.          this._vpState[this._activeVP].totalTimeSet = false;
  805.       }
  806.    }
  807.    function set cuePoints(cp)
  808.    {
  809.       if(this._cuePoints != undefined)
  810.       {
  811.          return undefined;
  812.       }
  813.       this._cuePoints = cp;
  814.    }
  815.    function get forwardButton()
  816.    {
  817.       if(this._uiMgr != null && this._uiMgr != undefined)
  818.       {
  819.          this._forwardButton = this._uiMgr.getControl(mx.video.UIManager.FORWARD_BUTTON);
  820.       }
  821.       return this._forwardButton;
  822.    }
  823.    function set forwardButton(s)
  824.    {
  825.       this._forwardButton = s;
  826.       if(this._uiMgr != null && this._uiMgr != undefined)
  827.       {
  828.          this._uiMgr.setControl(mx.video.UIManager.FORWARD_BUTTON,s);
  829.       }
  830.    }
  831.    function get height()
  832.    {
  833.       if(_global.isLivePreview)
  834.       {
  835.          return this.__height;
  836.       }
  837.       if(this._vp[this._visibleVP] != undefined)
  838.       {
  839.          this.__height = this._vp[this._visibleVP].height;
  840.       }
  841.       return this.__height;
  842.    }
  843.    function set height(h)
  844.    {
  845.       this.setSize(this.__get__width(),h);
  846.    }
  847.    function get idleTimeout()
  848.    {
  849.       if(this._vp[this._activeVP] == undefined)
  850.       {
  851.          return this._idleTimeout;
  852.       }
  853.       return this._vp[this._activeVP].idleTimeout;
  854.    }
  855.    function set idleTimeout(aTime)
  856.    {
  857.       if(this._activeVP == 0 || this._activeVP == undefined)
  858.       {
  859.          this._idleTimeout = aTime;
  860.       }
  861.       this._vp[this._activeVP].idleTimeout = aTime;
  862.    }
  863.    function get isRTMP()
  864.    {
  865.       if(_global.isLivePreview)
  866.       {
  867.          return true;
  868.       }
  869.       if(this._vp[this._activeVP] == undefined)
  870.       {
  871.          return undefined;
  872.       }
  873.       return this._vp[this._activeVP].isRTMP;
  874.    }
  875.    function get isLive()
  876.    {
  877.       if(this._vp[this._activeVP] == undefined)
  878.       {
  879.          return this._isLive;
  880.       }
  881.       if(this._vpState[this._activeVP].isLiveSet)
  882.       {
  883.          return this._vpState[this._activeVP].isLive;
  884.       }
  885.       return this._vp[this._activeVP].isLive;
  886.    }
  887.    function set isLive(flag)
  888.    {
  889.       if(this._activeVP == 0 || this._activeVP == undefined)
  890.       {
  891.          this._isLive = flag;
  892.       }
  893.       this._vpState[this._activeVP].isLive = flag;
  894.       this._vpState[this._activeVP].isLiveSet = true;
  895.    }
  896.    function get maintainAspectRatio()
  897.    {
  898.       if(this._vp[this._activeVP] == undefined)
  899.       {
  900.          return this._aspectRatio;
  901.       }
  902.       return this._vp[this._activeVP].maintainAspectRatio;
  903.    }
  904.    function set maintainAspectRatio(flag)
  905.    {
  906.       if(this._activeVP == 0 || this._activeVP == undefined)
  907.       {
  908.          this._aspectRatio = flag;
  909.       }
  910.       this._vp[this._activeVP].maintainAspectRatio = flag;
  911.    }
  912.    function get metadata()
  913.    {
  914.       if(this._vp[this._activeVP] == undefined)
  915.       {
  916.          return null;
  917.       }
  918.       return this._vp[this._activeVP].metadata;
  919.    }
  920.    function get metadataLoaded()
  921.    {
  922.       if(this._vp[this._activeVP] == undefined)
  923.       {
  924.          return false;
  925.       }
  926.       return this._cpMgr[this._activeVP].metadataLoaded;
  927.    }
  928.    function get muteButton()
  929.    {
  930.       if(this._uiMgr != null && this._uiMgr != undefined)
  931.       {
  932.          this._muteButton = this._uiMgr.getControl(mx.video.UIManager.MUTE_BUTTON);
  933.       }
  934.       return this._muteButton;
  935.    }
  936.    function set muteButton(s)
  937.    {
  938.       this._muteButton = s;
  939.       if(this._uiMgr != null && this._uiMgr != undefined)
  940.       {
  941.          this._uiMgr.setControl(mx.video.UIManager.MUTE_BUTTON,s);
  942.       }
  943.    }
  944.    function get ncMgr()
  945.    {
  946.       if(this._vp[this._activeVP] == undefined)
  947.       {
  948.          return null;
  949.       }
  950.       return this._vp[this._activeVP].ncMgr;
  951.    }
  952.    function get pauseButton()
  953.    {
  954.       if(this._uiMgr != null && this._uiMgr != undefined)
  955.       {
  956.          this._pauseButton = this._uiMgr.getControl(mx.video.UIManager.PAUSE_BUTTON);
  957.       }
  958.       return this._pauseButton;
  959.    }
  960.    function set pauseButton(s)
  961.    {
  962.       this._pauseButton = s;
  963.       if(this._uiMgr != null && this._uiMgr != undefined)
  964.       {
  965.          this._uiMgr.setControl(mx.video.UIManager.PAUSE_BUTTON,s);
  966.       }
  967.    }
  968.    function get paused()
  969.    {
  970.       if(this._vp[this._activeVP] == undefined)
  971.       {
  972.          return false;
  973.       }
  974.       return this._vp[this._activeVP].state == mx.video.FLVPlayback.PAUSED;
  975.    }
  976.    function get playButton()
  977.    {
  978.       if(this._uiMgr != null && this._uiMgr != undefined)
  979.       {
  980.          this._playButton = this._uiMgr.getControl(mx.video.UIManager.PLAY_BUTTON);
  981.       }
  982.       return this._playButton;
  983.    }
  984.    function set playButton(s)
  985.    {
  986.       this._playButton = s;
  987.       if(this._uiMgr != null && this._uiMgr != undefined)
  988.       {
  989.          this._uiMgr.setControl(mx.video.UIManager.PLAY_BUTTON,s);
  990.       }
  991.    }
  992.    function get playheadTime()
  993.    {
  994.       if(this._vp[this._activeVP] == undefined)
  995.       {
  996.          return 0;
  997.       }
  998.       return this._vp[this._activeVP].playheadTime;
  999.    }
  1000.    function set playheadTime(position)
  1001.    {
  1002.       this.seek(position);
  1003.    }
  1004.    function get playheadUpdateInterval()
  1005.    {
  1006.       if(this._vp[this._activeVP] == undefined)
  1007.       {
  1008.          return this._playheadUpdateInterval;
  1009.       }
  1010.       return this._vp[this._activeVP].playheadUpdateInterval;
  1011.    }
  1012.    function set playheadUpdateInterval(aTime)
  1013.    {
  1014.       if(this._activeVP == 0 || this._activeVP == undefined)
  1015.       {
  1016.          this._playheadUpdateInterval = aTime;
  1017.       }
  1018.       this._cpMgr[this._activeVP].playheadUpdateInterval = aTime;
  1019.       this._vp[this._activeVP].playheadUpdateInterval = aTime;
  1020.    }
  1021.    function get playing()
  1022.    {
  1023.       if(this._vp[this._activeVP] == undefined)
  1024.       {
  1025.          return false;
  1026.       }
  1027.       return this._vp[this._activeVP].state == mx.video.FLVPlayback.PLAYING;
  1028.    }
  1029.    function get playPauseButton()
  1030.    {
  1031.       if(this._uiMgr != null && this._uiMgr != undefined)
  1032.       {
  1033.          this._playPauseButton = this._uiMgr.getControl(mx.video.UIManager.PLAY_PAUSE_BUTTON);
  1034.       }
  1035.       return this._playPauseButton;
  1036.    }
  1037.    function set playPauseButton(s)
  1038.    {
  1039.       this._playPauseButton = s;
  1040.       if(this._uiMgr != null && this._uiMgr != undefined)
  1041.       {
  1042.          this._uiMgr.setControl(mx.video.UIManager.PLAY_PAUSE_BUTTON,s);
  1043.       }
  1044.    }
  1045.    function get preferredHeight()
  1046.    {
  1047.       if(this._vp[this._activeVP] == undefined)
  1048.       {
  1049.          return 0;
  1050.       }
  1051.       return this._vp[this._activeVP].videoHeight;
  1052.    }
  1053.    function get preferredWidth()
  1054.    {
  1055.       if(this._vp[this._activeVP] == undefined)
  1056.       {
  1057.          return 0;
  1058.       }
  1059.       return this._vp[this._activeVP].videoWidth;
  1060.    }
  1061.    function get progressInterval()
  1062.    {
  1063.       if(this._vp[this._activeVP] == undefined)
  1064.       {
  1065.          return this._progressInterval;
  1066.       }
  1067.       return this._vp[this._activeVP].progressInterval;
  1068.    }
  1069.    function set progressInterval(aTime)
  1070.    {
  1071.       if(this._activeVP == 0 || this._activeVP == undefined)
  1072.       {
  1073.          this._progressInterval = aTime;
  1074.       }
  1075.       this._vp[this._activeVP].progressInterval = aTime;
  1076.    }
  1077.    function get scaleX()
  1078.    {
  1079.       if(this._vp[this._visibleVP] != undefined)
  1080.       {
  1081.          this._scaleX = this._vp[this._visibleVP].width / this._origWidth * 100;
  1082.       }
  1083.       return this._scaleX;
  1084.    }
  1085.    function set scaleX(xs)
  1086.    {
  1087.       this.setScale(xs,this.__get__scaleY());
  1088.    }
  1089.    function get scaleY()
  1090.    {
  1091.       if(this._vp[this._visibleVP] != undefined)
  1092.       {
  1093.          this._scaleY = this._vp[this._visibleVP].height / this._origHeight * 100;
  1094.       }
  1095.       return this._scaleY;
  1096.    }
  1097.    function set scaleY(ys)
  1098.    {
  1099.       this.setScale(this.__get__scaleX(),ys);
  1100.    }
  1101.    function get scrubbing()
  1102.    {
  1103.       var _loc2_ = this.__get__seekBar();
  1104.       if(_loc2_ == undefined || _loc2_.isDragging == undefined)
  1105.       {
  1106.          return false;
  1107.       }
  1108.       return _loc2_.isDragging;
  1109.    }
  1110.    function get seekBar()
  1111.    {
  1112.       if(this._uiMgr != null && this._uiMgr != undefined)
  1113.       {
  1114.          this._seekBar = this._uiMgr.getControl(mx.video.UIManager.SEEK_BAR);
  1115.       }
  1116.       return this._seekBar;
  1117.    }
  1118.    function set seekBar(s)
  1119.    {
  1120.       this._seekBar = s;
  1121.       if(this._uiMgr != null && this._uiMgr != undefined)
  1122.       {
  1123.          this._uiMgr.setControl(mx.video.UIManager.SEEK_BAR,s);
  1124.       }
  1125.    }
  1126.    function get seekBarInterval()
  1127.    {
  1128.       if(this._uiMgr != null && this._uiMgr != undefined)
  1129.       {
  1130.          this._seekBarInterval = this._uiMgr.seekBarInterval;
  1131.       }
  1132.       return this._seekBarInterval;
  1133.    }
  1134.    function set seekBarInterval(s)
  1135.    {
  1136.       this._seekBarInterval = s;
  1137.       if(this._uiMgr != null && this._uiMgr != undefined)
  1138.       {
  1139.          this._uiMgr.__set__seekBarInterval(this._seekBarInterval);
  1140.       }
  1141.    }
  1142.    function get seekBarScrubTolerance()
  1143.    {
  1144.       if(this._uiMgr != null && this._uiMgr != undefined)
  1145.       {
  1146.          this._seekBarScrubTolerance = this._uiMgr.seekBarScrubTolerance;
  1147.       }
  1148.       return this._seekBarScrubTolerance;
  1149.    }
  1150.    function set seekBarScrubTolerance(s)
  1151.    {
  1152.       this._seekBarScrubTolerance = s;
  1153.       if(this._uiMgr != null && this._uiMgr != undefined)
  1154.       {
  1155.          this._uiMgr.__set__seekBarScrubTolerance(this._seekBarScrubTolerance);
  1156.       }
  1157.    }
  1158.    function get seekToPrevOffset()
  1159.    {
  1160.       return this._seekToPrevOffset;
  1161.    }
  1162.    function set seekToPrevOffset(s)
  1163.    {
  1164.       this._seekToPrevOffset = s;
  1165.    }
  1166.    function get skin()
  1167.    {
  1168.       if(this._uiMgr != null && this._uiMgr != undefined)
  1169.       {
  1170.          this._skin = this._uiMgr.skin;
  1171.       }
  1172.       return this._skin;
  1173.    }
  1174.    function set skin(s)
  1175.    {
  1176.       this._skin = s;
  1177.       if(this._uiMgr != null && this._uiMgr != undefined)
  1178.       {
  1179.          this._uiMgr.__set__skin(s);
  1180.       }
  1181.    }
  1182.    function get skinAutoHide()
  1183.    {
  1184.       if(this._uiMgr != null && this._uiMgr != undefined)
  1185.       {
  1186.          this._skinAutoHide = this._uiMgr.skinAutoHide;
  1187.       }
  1188.       return this._skinAutoHide;
  1189.    }
  1190.    function set skinAutoHide(b)
  1191.    {
  1192.       if(_global.isLivePreview)
  1193.       {
  1194.          return undefined;
  1195.       }
  1196.       this._skinAutoHide = b;
  1197.       if(this._uiMgr != null && this._uiMgr != undefined)
  1198.       {
  1199.          this._uiMgr.__set__skinAutoHide(b);
  1200.       }
  1201.    }
  1202.    function get transform()
  1203.    {
  1204.       return this._transform;
  1205.    }
  1206.    function set transform(s)
  1207.    {
  1208.       this._transform = s;
  1209.       if(this._vp[this._activeVP] != undefined)
  1210.       {
  1211.          this._vp[this._activeVP].transform = this._transform;
  1212.       }
  1213.    }
  1214.    function get state()
  1215.    {
  1216.       if(_global.isLivePreview)
  1217.       {
  1218.          return mx.video.FLVPlayback.STOPPED;
  1219.       }
  1220.       if(this._vp[this._activeVP] == undefined)
  1221.       {
  1222.          return mx.video.FLVPlayback.DISCONNECTED;
  1223.       }
  1224.       if(this._activeVP == this._visibleVP && this.__get__scrubbing())
  1225.       {
  1226.          return mx.video.FLVPlayback.SEEKING;
  1227.       }
  1228.       var _loc3_ = this._vp[this._activeVP].state;
  1229.       if(_loc3_ == mx.video.VideoPlayer.RESIZING)
  1230.       {
  1231.          return mx.video.FLVPlayback.LOADING;
  1232.       }
  1233.       if(this._vpState[this._activeVP].prevState == mx.video.FLVPlayback.LOADING && this._vpState[this._activeVP].autoPlay && _loc3_ == mx.video.FLVPlayback.STOPPED)
  1234.       {
  1235.          return mx.video.FLVPlayback.LOADING;
  1236.       }
  1237.       return _loc3_;
  1238.    }
  1239.    function get stateResponsive()
  1240.    {
  1241.       if(this._vp[this._activeVP] == undefined)
  1242.       {
  1243.          return false;
  1244.       }
  1245.       return this._vp[this._activeVP].stateResponsive;
  1246.    }
  1247.    function get stopButton()
  1248.    {
  1249.       if(this._uiMgr != null && this._uiMgr != undefined)
  1250.       {
  1251.          this._stopButton = this._uiMgr.getControl(mx.video.UIManager.STOP_BUTTON);
  1252.       }
  1253.       return this._stopButton;
  1254.    }
  1255.    function set stopButton(s)
  1256.    {
  1257.       this._stopButton = s;
  1258.       if(this._uiMgr != null && this._uiMgr != undefined)
  1259.       {
  1260.          this._uiMgr.setControl(mx.video.UIManager.STOP_BUTTON,s);
  1261.       }
  1262.    }
  1263.    function get stopped()
  1264.    {
  1265.       if(this._vp[this._activeVP] == undefined)
  1266.       {
  1267.          return false;
  1268.       }
  1269.       return this._vp[this._activeVP].state == mx.video.FLVPlayback.STOPPED;
  1270.    }
  1271.    function get totalTime()
  1272.    {
  1273.       if(_global.isLivePreview)
  1274.       {
  1275.          return 1;
  1276.       }
  1277.       if(this._vp[this._activeVP] == undefined)
  1278.       {
  1279.          return this._totalTime;
  1280.       }
  1281.       if(this._vpState[this._activeVP].totalTimeSet)
  1282.       {
  1283.          return this._vpState[this._activeVP].totalTime;
  1284.       }
  1285.       return this._vp[this._activeVP].totalTime;
  1286.    }
  1287.    function set totalTime(aTime)
  1288.    {
  1289.       if(this._activeVP == 0 || this._activeVP == undefined)
  1290.       {
  1291.          this._totalTime = aTime;
  1292.       }
  1293.       this._vpState[this._activeVP].totalTime = aTime;
  1294.       this._vpState[this._activeVP].totalTimeSet = true;
  1295.    }
  1296.    function get visible()
  1297.    {
  1298.       return this._visible;
  1299.    }
  1300.    function set visible(v)
  1301.    {
  1302.       this._visible = v;
  1303.    }
  1304.    function get visibleVideoPlayerIndex()
  1305.    {
  1306.       return this._visibleVP;
  1307.    }
  1308.    function set visibleVideoPlayerIndex(i)
  1309.    {
  1310.       if(this._visibleVP == i)
  1311.       {
  1312.          return undefined;
  1313.       }
  1314.       var _loc2_ = this._visibleVP;
  1315.       if(this._vp[i] == undefined)
  1316.       {
  1317.          this.createVideoPlayer(i);
  1318.       }
  1319.       var _loc5_ = this._vp[i].height != this._vp[this._visibleVP].height || this._vp[i].width != this._vp[this._visibleVP].width;
  1320.       this._vp[this._visibleVP].visible = false;
  1321.       this._vp[this._visibleVP].volume = 0;
  1322.       this._visibleVP = i;
  1323.       if(this._firstStreamShown)
  1324.       {
  1325.          this._uiMgr.setupSkinAutoHide(_loc2_);
  1326.          this._vp[this._visibleVP].visible = true;
  1327.          if(!this.__get__scrubbing())
  1328.          {
  1329.             this._vp[this._visibleVP].volume = this._volume;
  1330.          }
  1331.       }
  1332.       else if(this._vp[this._visibleVP].stateResponsive && this._vp[this._visibleVP].state != mx.video.FLVPlayback.DISCONNECTED && this._uiMgr.__get__skinReady())
  1333.       {
  1334.          this._uiMgr.__set__visible(true);
  1335.          this._uiMgr.setupSkinAutoHide(_loc2_);
  1336.          this._firstStreamReady = true;
  1337.          this.showFirstStream();
  1338.       }
  1339.       if(this._vp[_loc2_].height != this._vp[this._visibleVP].height || this._vp[_loc2_].width != this._vp[this._visibleVP].width)
  1340.       {
  1341.          this.dispatchEvent({type:"resize",x:this.__get__x(),y:this.__get__y(),width:this.__get__width(),height:this.__get__height(),auto:false,vp:this._visibleVP});
  1342.       }
  1343.       this._uiMgr.handleEvent({type:"stateChange",state:this._vp[this._visibleVP].state,vp:this._visibleVP});
  1344.       this._uiMgr.handleEvent({type:"playheadUpdate",playheadTime:this._vp[this._visibleVP].playheadTime,vp:this._visibleVP});
  1345.       if(this._vp[this._visibleVP].isRTMP)
  1346.       {
  1347.          this._uiMgr.handleEvent({type:"ready",vp:this._visibleVP});
  1348.       }
  1349.       else
  1350.       {
  1351.          this._uiMgr.handleEvent({type:"progress",bytesLoaded:this._vp[this._visibleVP].bytesLoaded,bytesTotal:this._vp[this._visibleVP].bytesTotal,vp:this._visibleVP});
  1352.       }
  1353.    }
  1354.    function get volume()
  1355.    {
  1356.       return this._volume;
  1357.    }
  1358.    function set volume(aVol)
  1359.    {
  1360.       if(this._volume == aVol)
  1361.       {
  1362.          return undefined;
  1363.       }
  1364.       this._volume = aVol;
  1365.       if(!this.__get__scrubbing())
  1366.       {
  1367.          this._vp[this._visibleVP].volume = this._volume;
  1368.       }
  1369.       this.dispatchEvent({type:"volumeUpdate",volume:aVol});
  1370.    }
  1371.    function get volumeBar()
  1372.    {
  1373.       if(this._uiMgr != null && this._uiMgr != undefined)
  1374.       {
  1375.          this._volumeBar = this._uiMgr.getControl(mx.video.UIManager.VOLUME_BAR);
  1376.       }
  1377.       return this._volumeBar;
  1378.    }
  1379.    function set volumeBar(s)
  1380.    {
  1381.       this._volumeBar = s;
  1382.       if(this._uiMgr != null && this._uiMgr != undefined)
  1383.       {
  1384.          this._uiMgr.setControl(mx.video.UIManager.VOLUME_BAR,s);
  1385.       }
  1386.    }
  1387.    function get volumeBarInterval()
  1388.    {
  1389.       if(this._uiMgr != null && this._uiMgr != undefined)
  1390.       {
  1391.          this._volumeBarInterval = this._uiMgr.volumeBarInterval;
  1392.       }
  1393.       return this._volumeBarInterval;
  1394.    }
  1395.    function set volumeBarInterval(s)
  1396.    {
  1397.       this._volumeBarInterval = s;
  1398.       if(this._uiMgr != null && this._uiMgr != undefined)
  1399.       {
  1400.          this._uiMgr.__set__volumeBarInterval(this._volumeBarInterval);
  1401.       }
  1402.    }
  1403.    function get volumeBarScrubTolerance()
  1404.    {
  1405.       if(this._uiMgr != null && this._uiMgr != undefined)
  1406.       {
  1407.          this._volumeBarScrubTolerance = this._uiMgr.volumeBarScrubTolerance;
  1408.       }
  1409.       return this._volumeBarScrubTolerance;
  1410.    }
  1411.    function set volumeBarScrubTolerance(s)
  1412.    {
  1413.       this._volumeBarScrubTolerance = s;
  1414.       if(this._uiMgr != null && this._uiMgr != undefined)
  1415.       {
  1416.          this._uiMgr.__set__volumeBarScrubTolerance(this._volumeBarScrubTolerance);
  1417.       }
  1418.    }
  1419.    function get width()
  1420.    {
  1421.       if(_global.isLivePreview)
  1422.       {
  1423.          return this.__width;
  1424.       }
  1425.       if(this._vp[this._visibleVP] != undefined)
  1426.       {
  1427.          this.__width = this._vp[this._visibleVP].width;
  1428.       }
  1429.       return this.__width;
  1430.    }
  1431.    function set width(w)
  1432.    {
  1433.       this.setSize(w,this.__get__height());
  1434.    }
  1435.    function get x()
  1436.    {
  1437.       return this._x;
  1438.    }
  1439.    function set x(xpos)
  1440.    {
  1441.       this._x = xpos;
  1442.    }
  1443.    function get y()
  1444.    {
  1445.       return this._y;
  1446.    }
  1447.    function set y(ypos)
  1448.    {
  1449.       this._y = ypos;
  1450.    }
  1451.    function createVideoPlayer(index)
  1452.    {
  1453.       if(_global.isLivePreview)
  1454.       {
  1455.          return undefined;
  1456.       }
  1457.       var _loc4_ = this.__get__width();
  1458.       var _loc5_ = this.__get__height();
  1459.       this._vp[index] = mx.video.VideoPlayer(this.attachMovie("VideoPlayer",String(index),mx.video.FLVPlayback.VP_DEPTH_OFFSET + index));
  1460.       this._vp[index].setSize(_loc4_,_loc5_);
  1461.       this._topVP = index;
  1462.       this._vp[index].autoRewind = this._autoRewind;
  1463.       this._vp[index].autoSize = this._autoSize;
  1464.       this._vp[index].bufferTime = this._bufferTime;
  1465.       this._vp[index].idleTimeout = this._idleTimeout;
  1466.       this._vp[index].maintainAspectRatio = this._aspectRatio;
  1467.       this._vp[index].playheadUpdateInterval = this._playheadUpdateInterval;
  1468.       this._vp[index].progressInterval = this._progressInterval;
  1469.       this._vp[index].transform = this._transform;
  1470.       this._vp[index].volume = this._volume;
  1471.       if(index == 0)
  1472.       {
  1473.          this._vpState[index] = {id:index,isLive:this._isLive,isLiveSet:true,totalTime:this._totalTime,totalTimeSet:true,autoPlay:this._autoPlay};
  1474.          if(this._contentPath != null && this._contentPath != undefined && this._contentPath != "")
  1475.          {
  1476.             this._vp[index].onEnterFrame = mx.utils.Delegate.create(this,this.doContentPathConnect);
  1477.          }
  1478.       }
  1479.       else
  1480.       {
  1481.          this._vpState[index] = {id:index,isLive:false,isLiveSet:true,totalTime:0,totalTimeSet:true,autoPlay:false};
  1482.       }
  1483.       this._vp[index].addEventListener("resize",this);
  1484.       this._vp[index].addEventListener("close",this);
  1485.       this._vp[index].addEventListener("complete",this);
  1486.       this._vp[index].addEventListener("cuePoint",this);
  1487.       this._vp[index].addEventListener("playheadUpdate",this);
  1488.       this._vp[index].addEventListener("progress",this);
  1489.       this._vp[index].addEventListener("metadataReceived",this);
  1490.       this._vp[index].addEventListener("stateChange",this);
  1491.       this._vp[index].addEventListener("ready",this);
  1492.       this._vp[index].addEventListener("rewind",this);
  1493.       this._cpMgr[index] = new mx.video.CuePointManager(this,index);
  1494.       this._cpMgr[index].playheadUpdateInterval = this._playheadUpdateInterval;
  1495.    }
  1496.    function createUIManager()
  1497.    {
  1498.       this._uiMgr = new mx.video.UIManager(this);
  1499.       this._uiMgr.__set__visible(false);
  1500.       if(this._backButton != undefined && this._backButton != null)
  1501.       {
  1502.          this._uiMgr.setControl(mx.video.UIManager.BACK_BUTTON,this._backButton);
  1503.       }
  1504.       if(this._bufferingBar != undefined && this._bufferingBar != null)
  1505.       {
  1506.          this._uiMgr.setControl(mx.video.UIManager.BUFFERING_BAR,this._bufferingBar);
  1507.       }
  1508.       this._uiMgr.__set__bufferingBarHidesAndDisablesOthers(this._bufferingBarHides);
  1509.       if(this._forwardButton != undefined && this._forwardButton != null)
  1510.       {
  1511.          this._uiMgr.setControl(mx.video.UIManager.FORWARD_BUTTON,this._forwardButton);
  1512.       }
  1513.       if(this._pauseButton != undefined && this._pauseButton != null)
  1514.       {
  1515.          this._uiMgr.setControl(mx.video.UIManager.PAUSE_BUTTON,this._pauseButton);
  1516.       }
  1517.       if(this._playButton != undefined && this._playButton != null)
  1518.       {
  1519.          this._uiMgr.setControl(mx.video.UIManager.PLAY_BUTTON,this._playButton);
  1520.       }
  1521.       if(this._playPauseButton != undefined && this._playPauseButton != null)
  1522.       {
  1523.          this._uiMgr.setControl(mx.video.UIManager.PLAY_PAUSE_BUTTON,this._playPauseButton);
  1524.       }
  1525.       if(this._stopButton != undefined && this._stopButton != null)
  1526.       {
  1527.          this._uiMgr.setControl(mx.video.UIManager.STOP_BUTTON,this._stopButton);
  1528.       }
  1529.       if(this._seekBar != undefined && this._seekBar != null)
  1530.       {
  1531.          this._uiMgr.setControl(mx.video.UIManager.SEEK_BAR,this._seekBar);
  1532.       }
  1533.       if(this._seekBarInterval != undefined && this._seekBarInterval != null)
  1534.       {
  1535.          this._uiMgr.__set__seekBarInterval(this._seekBarInterval);
  1536.       }
  1537.       if(this._seekBarScrubTolerance != undefined && this._seekBarScrubTolerance != null)
  1538.       {
  1539.          this._uiMgr.__set__seekBarScrubTolerance(this._seekBarScrubTolerance);
  1540.       }
  1541.       if(this._skin != undefined && this._skin != null)
  1542.       {
  1543.          this._uiMgr.__set__skin(this._skin);
  1544.       }
  1545.       if(this._skinAutoHide != undefined && this._skinAutoHide != null)
  1546.       {
  1547.          this._uiMgr.__set__skinAutoHide(this._skinAutoHide);
  1548.       }
  1549.       if(this._muteButton != undefined && this._muteButton != null)
  1550.       {
  1551.          this._uiMgr.setControl(mx.video.UIManager.MUTE_BUTTON,this._muteButton);
  1552.       }
  1553.       if(this._volumeBar != undefined && this._volumeBar != null)
  1554.       {
  1555.          this._uiMgr.setControl(mx.video.UIManager.VOLUME_BAR,this._volumeBar);
  1556.       }
  1557.       if(this._volumeBarInterval != undefined && this._volumeBarInterval != null)
  1558.       {
  1559.          this._uiMgr.__set__volumeBarInterval(this._volumeBarInterval);
  1560.       }
  1561.       if(this._volumeBarScrubTolerance != undefined && this._volumeBarScrubTolerance != null)
  1562.       {
  1563.          this._uiMgr.__set__volumeBarScrubTolerance(this._volumeBarScrubTolerance);
  1564.       }
  1565.    }
  1566.    function createLivePreviewMovieClip()
  1567.    {
  1568.       this.preview_mc = this.createEmptyMovieClip("preview_mc",10);
  1569.       this.preview_mc.createEmptyMovieClip("box_mc",10);
  1570.       this.preview_mc.box_mc.beginFill(0);
  1571.       this.preview_mc.box_mc.moveTo(0,0);
  1572.       this.preview_mc.box_mc.lineTo(0,100);
  1573.       this.preview_mc.box_mc.lineTo(100,100);
  1574.       this.preview_mc.box_mc.lineTo(100,0);
  1575.       this.preview_mc.box_mc.lineTo(0,0);
  1576.       this.preview_mc.box_mc.endFill();
  1577.       this.preview_mc.attachMovie("Icon","icon_mc",20);
  1578.    }
  1579.    function doContentPathConnect()
  1580.    {
  1581.       delete this._vp[0].onEnterFrame;
  1582.       this._vp[0].onEnterFrame = undefined;
  1583.       if(_global.isLivePreview)
  1584.       {
  1585.          return undefined;
  1586.       }
  1587.       if(this._vpState[0].autoPlay && this._firstStreamShown)
  1588.       {
  1589.          this._vp[0].play(this._contentPath,this._isLive,this._totalTime);
  1590.       }
  1591.       else
  1592.       {
  1593.          this._vp[0].load(this._contentPath,this._isLive,this._totalTime);
  1594.       }
  1595.       this._vpState[0].isLiveSet = false;
  1596.       this._vpState[0].totalTimeSet = false;
  1597.    }
  1598.    function showFirstStream()
  1599.    {
  1600.       this._firstStreamShown = true;
  1601.       this._vp[this._visibleVP].visible = true;
  1602.       if(!this.__get__scrubbing())
  1603.       {
  1604.          this._vp[this._visibleVP].volume = this._volume;
  1605.       }
  1606.       var _loc2_ = 0;
  1607.       while(_loc2_ < this._vp.length)
  1608.       {
  1609.          if(this._vp[_loc2_] != undefined && this._vp[_loc2_].state == mx.video.FLVPlayback.STOPPED && this._vpState[_loc2_].autoPlay)
  1610.          {
  1611.             this._vp[_loc2_].play();
  1612.          }
  1613.          _loc2_ = _loc2_ + 1;
  1614.       }
  1615.    }
  1616.    function _scrubStart()
  1617.    {
  1618.       var _loc2_ = this.__get__playheadTime();
  1619.       this._vp[this._visibleVP].volume = 0;
  1620.       this.dispatchEvent({type:"stateChange",state:mx.video.FLVPlayback.SEEKING,playheadTime:_loc2_,vp:this._visibleVP});
  1621.       this.dispatchEvent({type:"scrubStart",state:mx.video.FLVPlayback.SEEKING,playheadTime:_loc2_});
  1622.    }
  1623.    function _scrubFinish()
  1624.    {
  1625.       var _loc3_ = this.__get__playheadTime();
  1626.       var _loc2_ = this.__get__state();
  1627.       this._vp[this._visibleVP].volume = this._volume;
  1628.       if(_loc2_ != mx.video.FLVPlayback.SEEKING)
  1629.       {
  1630.          this.dispatchEvent({type:"stateChange",state:_loc2_,playheadTime:_loc3_,vp:this._visibleVP});
  1631.       }
  1632.       this.dispatchEvent({type:"scrubFinish",state:_loc2_,playheadTime:_loc3_});
  1633.    }
  1634.    function skinError(message)
  1635.    {
  1636.       if(this._firstStreamReady && !this._firstStreamShown)
  1637.       {
  1638.          this.showFirstStream();
  1639.       }
  1640.       this.dispatchEvent({type:"skinError",message:message});
  1641.    }
  1642.    function skinLoaded()
  1643.    {
  1644.       if(this._firstStreamReady)
  1645.       {
  1646.          this._uiMgr.__set__visible(true);
  1647.          if(!this._firstStreamShown)
  1648.          {
  1649.             this.showFirstStream();
  1650.          }
  1651.       }
  1652.       else if(this._contentPath == undefined || this._contentPath == null || this._contentPath == "")
  1653.       {
  1654.          this._uiMgr.__set__visible(true);
  1655.       }
  1656.       this.dispatchEvent({type:"skinLoaded"});
  1657.    }
  1658. }
  1659.