home *** CD-ROM | disk | FTP | other *** search
/ i·claim - visualizing argument / ICLAIM.ISO / pc / glossary.swf / scripts / __Packages / mx / controls / MediaDisplay.as < prev    next >
Encoding:
Text File  |  2005-02-24  |  19.2 KB  |  767 lines

  1. class mx.controls.MediaDisplay extends mx.core.UIComponent
  2. {
  3.    var _deadPreview;
  4.    var _startingTime;
  5.    var _playingBeforeDisabled;
  6.    var _started;
  7.    var _sendCompleteEvent;
  8.    var _fullyLoaded;
  9.    var _screenAccommodator;
  10.    var _cuePoints;
  11.    var initCuePointNames;
  12.    var initCuePointTimes;
  13.    var _mostRecentCuePoint;
  14.    var _playerImpl;
  15.    var _contentPath;
  16.    var _videoHolder;
  17.    var _totalTime;
  18.    var _soundHolder;
  19.    var _autoPlay;
  20.    var _pollId;
  21.    var _autoSize;
  22.    var _aspectRatio;
  23.    var dispatchEvent;
  24.    var _mediaType;
  25.    var addEventListener;
  26.    static var symbolName = "MediaDisplay";
  27.    static var symbolOwner = mx.controls.MediaDisplay;
  28.    var className = "MediaDisplay";
  29.    static var version = "2.0.1.78";
  30.    var clipParameters = {mediaType:"FLV",contentPath:"",totalTime:0,autoSize:true,autoPlay:true,initCuePointNames:new Array(),initCuePointTimes:new Array(),fps:30};
  31.    var _priorTime = 0;
  32.    var _priorBytesLoaded = 0;
  33.    var _scrubbing = false;
  34.    var _fireCuePoints = true;
  35.    var _enabled = true;
  36.    var makeVideoVisible = false;
  37.    function MediaDisplay()
  38.    {
  39.       super();
  40.    }
  41.    function init(Void)
  42.    {
  43.       this.initializeParameters();
  44.       var _loc3_ = this._width;
  45.       var _loc4_ = this._height;
  46.       this._deadPreview._visible = false;
  47.       super.init();
  48.       this.setSize(_loc3_,_loc4_,true);
  49.       this.initCuePoints();
  50.       this._startingTime = 0;
  51.       this._playingBeforeDisabled = false;
  52.       this._started = false;
  53.       this._sendCompleteEvent = false;
  54.       this._fullyLoaded = false;
  55.       this.makeVideoVisible = false;
  56.       this.tabEnabled = false;
  57.       this.tabChildren = false;
  58.       this._screenAccommodator = new mx.controls.streamingmedia.ScreenAccommodator(this);
  59.    }
  60.    function initializeParameters()
  61.    {
  62.       if(this.mediaType == null)
  63.       {
  64.          this.mediaType = "FLV";
  65.       }
  66.       if(this.totalTime == null)
  67.       {
  68.          this.totalTime = 0;
  69.       }
  70.       if(this.contentPath == null)
  71.       {
  72.          this.contentPath = "";
  73.       }
  74.       if(this.autoPlay == null)
  75.       {
  76.          this.autoPlay = true;
  77.       }
  78.       if(this.autoSize == null)
  79.       {
  80.          this.autoSize = true;
  81.       }
  82.       if(this.aspectRatio == null)
  83.       {
  84.          this.aspectRatio = true;
  85.       }
  86.    }
  87.    function initCuePoints()
  88.    {
  89.       this._cuePoints = new Array();
  90.       var _loc2_ = 0;
  91.       while(_loc2_ < this.initCuePointNames.length && _loc2_ < this.initCuePointTimes.length)
  92.       {
  93.          this.addCuePoint(this.initCuePointNames[_loc2_],this.initCuePointTimes[_loc2_]);
  94.          _loc2_ = _loc2_ + 1;
  95.       }
  96.       delete this.initCuePointNames;
  97.       delete this.initCuePointTimes;
  98.       this._mostRecentCuePoint = undefined;
  99.    }
  100.    function initMedia(switchType)
  101.    {
  102.       if(this.isLivePreview())
  103.       {
  104.          return undefined;
  105.       }
  106.       var _loc2_ = this.volume;
  107.       if(switchType)
  108.       {
  109.          this._playerImpl.stop();
  110.       }
  111.       if(this.isFLV())
  112.       {
  113.          if(this.isRtmp(this._contentPath))
  114.          {
  115.             this._playerImpl = new mx.controls.streamingmedia.RTMPPlayer(this._contentPath,mx.controls.streamingmedia.StreamingMediaConstants.FLV_MEDIA_TYPE,this._videoHolder,this._totalTime);
  116.          }
  117.          else
  118.          {
  119.             this._playerImpl = new mx.controls.streamingmedia.FLVPlayer(this._contentPath,this._videoHolder,this._totalTime);
  120.          }
  121.       }
  122.       else if(this.isMP3())
  123.       {
  124.          if(switchType)
  125.          {
  126.             this.releaseVideo();
  127.          }
  128.          if(this.isRtmp(this._contentPath))
  129.          {
  130.             this._playerImpl = new mx.controls.streamingmedia.RTMPPlayer(this._contentPath,mx.controls.streamingmedia.StreamingMediaConstants.MP3_MEDIA_TYPE,this._videoHolder,this._totalTime);
  131.          }
  132.          else
  133.          {
  134.             this.createEmptyMovieClip("_soundHolder",10);
  135.             this._playerImpl = new mx.controls.streamingmedia.MP3Player(this._contentPath,this._soundHolder);
  136.          }
  137.       }
  138.       if(_loc2_ != undefined)
  139.       {
  140.          this.volume = _loc2_;
  141.       }
  142.       this.redraw(true);
  143.       this._playerImpl.removeAllListeners();
  144.       this._playerImpl.addListener(this);
  145.       this._started = false;
  146.       if(!switchType)
  147.       {
  148.          if(this._autoPlay)
  149.          {
  150.             this.play();
  151.          }
  152.          else
  153.          {
  154.             this.load();
  155.          }
  156.          this.poll(true);
  157.          if(this._pollId != null)
  158.          {
  159.             clearInterval(this._pollId);
  160.          }
  161.          this._pollId = setInterval(this,"poll",250);
  162.       }
  163.    }
  164.    function draw()
  165.    {
  166.       if(this.isFLV())
  167.       {
  168.          if(this.makeVideoVisible)
  169.          {
  170.             this._videoHolder._visible = true;
  171.             this.makeVideoVisible = false;
  172.          }
  173.          if(this._autoSize)
  174.          {
  175.             this.assignPreferredSize();
  176.          }
  177.          else if(this._aspectRatio)
  178.          {
  179.             var _loc4_ = this.preferredWidth;
  180.             var _loc3_ = this.preferredHeight;
  181.             var _loc2_ = Math.min(this.width / _loc4_,this.height / _loc3_);
  182.             this.setVideoDisplaySize(_loc2_ * _loc4_,_loc2_ * _loc3_);
  183.          }
  184.          else
  185.          {
  186.             this.setVideoDisplaySize(this.width,this.height);
  187.          }
  188.       }
  189.    }
  190.    function setVideoDisplaySize(w, h)
  191.    {
  192.       if(this.isFLV())
  193.       {
  194.          var _loc2_ = this._videoHolder._video;
  195.          _loc2_._width = w;
  196.          _loc2_._height = h;
  197.          _loc2_._x = (this.width - _loc2_._width) / 2;
  198.          _loc2_._y = (this.height - _loc2_._height) / 2;
  199.       }
  200.    }
  201.    function get videoWidth()
  202.    {
  203.       var _loc2_ = undefined;
  204.       if(this.isMP3())
  205.       {
  206.          _loc2_ = 0;
  207.       }
  208.       else
  209.       {
  210.          _loc2_ = this._videoHolder._video._width;
  211.       }
  212.       return _loc2_;
  213.    }
  214.    function get videoHeight()
  215.    {
  216.       var _loc2_ = undefined;
  217.       if(this.isMP3())
  218.       {
  219.          _loc2_ = 0;
  220.       }
  221.       else
  222.       {
  223.          _loc2_ = this._videoHolder._video._height;
  224.       }
  225.       return _loc2_;
  226.    }
  227.    function get preferredWidth()
  228.    {
  229.       var _loc2_ = undefined;
  230.       if(this.isMP3())
  231.       {
  232.          _loc2_ = 0;
  233.       }
  234.       else
  235.       {
  236.          _loc2_ = this._videoHolder._video.width;
  237.       }
  238.       return _loc2_;
  239.    }
  240.    function get preferredHeight()
  241.    {
  242.       var _loc2_ = undefined;
  243.       if(this.isMP3())
  244.       {
  245.          _loc2_ = 0;
  246.       }
  247.       else
  248.       {
  249.          _loc2_ = this._videoHolder._video.height;
  250.       }
  251.       return _loc2_;
  252.    }
  253.    function assignPreferredSize()
  254.    {
  255.       this.setVideoDisplaySize(this.preferredWidth,this.preferredHeight,true);
  256.    }
  257.    function handlePlayer(player, status)
  258.    {
  259.       if(status == "start" || status == "resizeVideo")
  260.       {
  261.          if(!(this._parent instanceof mx.controls.MediaPlayback))
  262.          {
  263.             this.makeVideoVisible = true;
  264.             this.draw();
  265.          }
  266.          if(this._started)
  267.          {
  268.             var _loc2_ = {target:this,type:"resizeVideo"};
  269.             this.dispatchEvent(_loc2_);
  270.          }
  271.          else
  272.          {
  273.             _loc2_ = {target:this,type:"start"};
  274.             this.dispatchEvent(_loc2_);
  275.             if(this.isRtmp(this._contentPath))
  276.             {
  277.                _loc2_ = {target:this,type:"progress"};
  278.                this.dispatchEvent(_loc2_);
  279.             }
  280.             this._started = true;
  281.          }
  282.       }
  283.       else if(status == "complete")
  284.       {
  285.          this._sendCompleteEvent = true;
  286.       }
  287.    }
  288.    function toString()
  289.    {
  290.       return "MediaDisplay: media=" + this._contentPath;
  291.    }
  292.    function load()
  293.    {
  294.       this._playerImpl.load();
  295.    }
  296.    function play(startingPoint)
  297.    {
  298.       if(startingPoint != undefined)
  299.       {
  300.          this._startingTime = startingPoint;
  301.       }
  302.       if(this.enabled)
  303.       {
  304.          this._playerImpl.play(startingPoint);
  305.       }
  306.       else
  307.       {
  308.          this._playingBeforeDisabled = true;
  309.       }
  310.    }
  311.    function pause()
  312.    {
  313.       this._playerImpl.pause();
  314.    }
  315.    function stop()
  316.    {
  317.       this._playerImpl.stop();
  318.    }
  319.    function get autoSize()
  320.    {
  321.       return this._autoSize;
  322.    }
  323.    function set autoSize(flag)
  324.    {
  325.       if(this._autoSize != flag)
  326.       {
  327.          this._autoSize = flag;
  328.          this.invalidate();
  329.       }
  330.    }
  331.    function get aspectRatio()
  332.    {
  333.       return this._aspectRatio;
  334.    }
  335.    function set aspectRatio(flag)
  336.    {
  337.       if(this._aspectRatio != flag)
  338.       {
  339.          this._aspectRatio = flag;
  340.          this.invalidate();
  341.       }
  342.    }
  343.    function get autoPlay()
  344.    {
  345.       return this._autoPlay;
  346.    }
  347.    function set autoPlay(flag)
  348.    {
  349.       this._autoPlay = flag;
  350.    }
  351.    function get playheadTime()
  352.    {
  353.       return this._playerImpl.getPlayheadTime();
  354.    }
  355.    function set playheadTime(position)
  356.    {
  357.       if(position != undefined)
  358.       {
  359.          this._startingTime = position;
  360.       }
  361.       this._playerImpl.setPlayheadTime(position);
  362.    }
  363.    function get contentPath()
  364.    {
  365.       return this._contentPath;
  366.    }
  367.    function set contentPath(aUrl)
  368.    {
  369.       this.setMedia(aUrl);
  370.    }
  371.    function setMedia(aUrl, aType)
  372.    {
  373.       this._fireCuePoints = false;
  374.       if(aType == null)
  375.       {
  376.          aType = this.deduceMediaType(aUrl);
  377.       }
  378.       else if(aType != mx.controls.streamingmedia.StreamingMediaConstants.FLV_MEDIA_TYPE && aType != mx.controls.streamingmedia.StreamingMediaConstants.MP3_MEDIA_TYPE)
  379.       {
  380.       }
  381.       var _loc5_ = this._mediaType;
  382.       this._mediaType = aType;
  383.       var _loc7_ = this.isRtmp(this._contentPath);
  384.       var _loc6_ = this.isRtmp(aUrl);
  385.       this._contentPath = aUrl;
  386.       this._fullyLoaded = false;
  387.       this._startingTime = 0;
  388.       if(!this.isLivePreview())
  389.       {
  390.          if(this._contentPath == "")
  391.          {
  392.             this.releaseVideo();
  393.          }
  394.          else if(this._playerImpl == null)
  395.          {
  396.             this.initMedia();
  397.          }
  398.          else if(_loc5_ != this._mediaType || _loc7_ != _loc6_)
  399.          {
  400.             var _loc4_ = this._playerImpl.isPlaying();
  401.             this.initMedia(true);
  402.             if(_loc4_)
  403.             {
  404.                this._playerImpl.play(0);
  405.             }
  406.             else
  407.             {
  408.                this._playerImpl.load();
  409.             }
  410.          }
  411.          else
  412.          {
  413.             this._playerImpl.setMediaUrl(aUrl);
  414.             this._started = false;
  415.          }
  416.       }
  417.    }
  418.    function deduceMediaType(aUrl)
  419.    {
  420.       var _loc2_ = aUrl.substr(-3);
  421.       if(_loc2_ == "flv" || _loc2_ == "FLV")
  422.       {
  423.          return "FLV";
  424.       }
  425.       if(_loc2_ == "mp3" || _loc2_ == "MP3")
  426.       {
  427.          return "MP3";
  428.       }
  429.       return this._mediaType;
  430.    }
  431.    function releaseVideo()
  432.    {
  433.       this._playerImpl.close();
  434.       this._playerImpl = null;
  435.    }
  436.    function isLivePreview()
  437.    {
  438.       return _root.contents.obj != null;
  439.    }
  440.    function get volume()
  441.    {
  442.       return this._playerImpl.getVolume();
  443.    }
  444.    function set volume(aVol)
  445.    {
  446.       this._playerImpl.setVolume(aVol);
  447.    }
  448.    function get playing()
  449.    {
  450.       return this._playerImpl.isPlaying();
  451.    }
  452.    function get bytesLoaded()
  453.    {
  454.       return this._playerImpl.getMediaBytesLoaded();
  455.    }
  456.    function get bytesTotal()
  457.    {
  458.       return this._playerImpl.getMediaBytesTotal();
  459.    }
  460.    function isFLV()
  461.    {
  462.       return this._mediaType == mx.controls.streamingmedia.StreamingMediaConstants.FLV_MEDIA_TYPE;
  463.    }
  464.    function isMP3()
  465.    {
  466.       return this._mediaType == mx.controls.streamingmedia.StreamingMediaConstants.MP3_MEDIA_TYPE;
  467.    }
  468.    function get mediaType()
  469.    {
  470.       return this._mediaType;
  471.    }
  472.    function set mediaType(aType)
  473.    {
  474.       this._mediaType = aType;
  475.    }
  476.    function get totalTime()
  477.    {
  478.       var _loc2_ = undefined;
  479.       if(this._playerImpl == null)
  480.       {
  481.          _loc2_ = this._totalTime;
  482.       }
  483.       else
  484.       {
  485.          _loc2_ = this._playerImpl.getTotalTime();
  486.       }
  487.       return _loc2_;
  488.    }
  489.    function set totalTime(aTime)
  490.    {
  491.       this._totalTime = aTime;
  492.       if(this._playerImpl instanceof mx.controls.streamingmedia.FLVPlayer)
  493.       {
  494.          this._playerImpl.setTotalTime(aTime);
  495.       }
  496.       else if(this._playerImpl instanceof mx.controls.streamingmedia.RTMPPlayer)
  497.       {
  498.          this._playerImpl.setTotalTime(aTime);
  499.       }
  500.    }
  501.    function getCuePoints()
  502.    {
  503.       return this._cuePoints;
  504.    }
  505.    function get cuePoints()
  506.    {
  507.       return this.getCuePoints();
  508.    }
  509.    function setCuePoints(cp)
  510.    {
  511.       this._cuePoints = cp;
  512.       var _loc2_ = 0;
  513.       while(_loc2_ < this._cuePoints.length)
  514.       {
  515.          this._cuePoints[_loc2_].display = this;
  516.          _loc2_ = _loc2_ + 1;
  517.       }
  518.    }
  519.    function set cuePoints(cp)
  520.    {
  521.       this.setCuePoints(cp);
  522.    }
  523.    function getCuePoint(pointName)
  524.    {
  525.       var _loc3_ = null;
  526.       var _loc2_ = this.getCuePointIndex(pointName);
  527.       if(_loc2_ > -1)
  528.       {
  529.          _loc3_ = this._cuePoints[_loc2_];
  530.       }
  531.       return _loc3_;
  532.    }
  533.    function addCuePoint(aName, aTime)
  534.    {
  535.       var _loc2_ = new mx.controls.streamingmedia.CuePoint(aName,aTime);
  536.       this.addCuePointObject(_loc2_);
  537.    }
  538.    function addCuePointObject(aCuePoint)
  539.    {
  540.       aCuePoint.display = this;
  541.       this._cuePoints.push(aCuePoint);
  542.    }
  543.    function removeCuePoint(aCuePoint)
  544.    {
  545.       var _loc2_ = this.getCuePointIndex(aCuePoint.name);
  546.       if(_loc2_ > -1)
  547.       {
  548.          this._cuePoints.splice(_loc2_,1);
  549.       }
  550.    }
  551.    function removeAllCuePoints()
  552.    {
  553.       this._cuePoints.length = 0;
  554.       this._mostRecentCuePoint = undefined;
  555.    }
  556.    function get mostRecentCuePoint()
  557.    {
  558.       return this._mostRecentCuePoint;
  559.    }
  560.    function get mostRecentCuePointName()
  561.    {
  562.       return this._mostRecentCuePoint.name;
  563.    }
  564.    function get mostRecentCuePointTime()
  565.    {
  566.       return this._mostRecentCuePoint.time;
  567.    }
  568.    function handleEvent(ev)
  569.    {
  570.       if(ev.type == "click" && ev.detail == "play")
  571.       {
  572.          this.handlePlayEvent(ev);
  573.       }
  574.       else if(ev.type == "click" && ev.detail == "pause")
  575.       {
  576.          this.handlePauseEvent(ev);
  577.       }
  578.       else if(ev.type == "playheadChange")
  579.       {
  580.          this.handlePlayheadChangeEvent(ev);
  581.       }
  582.       else if(ev.type == "volume")
  583.       {
  584.          this.handleVolumeEvent(ev);
  585.       }
  586.       else if(ev.type == "scrubbing")
  587.       {
  588.          this.handleScrubbingEvent(ev);
  589.       }
  590.       else
  591.       {
  592.          this.handleUnrecognizedEvent(ev);
  593.       }
  594.    }
  595.    function handlePlayEvent(ev)
  596.    {
  597.       this.play();
  598.    }
  599.    function handleStopEvent(ev)
  600.    {
  601.       this.stop();
  602.    }
  603.    function handlePauseEvent(ev)
  604.    {
  605.       this.pause();
  606.    }
  607.    function handleRewindEvent(ev)
  608.    {
  609.       this.playheadTime = 0;
  610.    }
  611.    function handleFastForwardEvent(ev)
  612.    {
  613.       var _loc2_ = this.totalTime;
  614.       this.playheadTime = _loc2_;
  615.    }
  616.    function handlePlayheadChangeEvent(ev)
  617.    {
  618.       var _loc3_ = ev.detail;
  619.       var _loc2_ = _loc3_ / 100 * this.totalTime;
  620.       this._fireCuePoints = this._scrubbing;
  621.       this.playheadTime = _loc2_;
  622.    }
  623.    function handleVolumeEvent(ev)
  624.    {
  625.       var _loc2_ = ev.detail;
  626.       this.volume = _loc2_;
  627.    }
  628.    function handleScrubbingEvent(ev)
  629.    {
  630.       this._scrubbing = ev.detail;
  631.    }
  632.    function handleUnrecognizedEvent(ev)
  633.    {
  634.    }
  635.    function getCuePointIndex(pointName)
  636.    {
  637.       var _loc3_ = -1;
  638.       var _loc2_ = 0;
  639.       while(_loc2_ < this._cuePoints.length && _loc3_ == -1)
  640.       {
  641.          if(this._cuePoints[_loc2_].name == pointName)
  642.          {
  643.             _loc3_ = _loc2_;
  644.          }
  645.          _loc2_ = _loc2_ + 1;
  646.       }
  647.       return _loc3_;
  648.    }
  649.    function poll(first)
  650.    {
  651.       var _loc4_ = this.playheadTime;
  652.       var _loc8_ = this.bytesLoaded;
  653.       if(_loc4_ != this._priorTime)
  654.       {
  655.          if(this._mediaType == "MP3" && this._playerImpl.isPlaying() && !this._started)
  656.          {
  657.             this._playerImpl.playStarted();
  658.             var _loc9_ = this.playheadTime;
  659.             if(this._startingTime - 0.1 < _loc9_ && _loc9_ < this._startingTime + 0.1)
  660.             {
  661.                this._started = true;
  662.                var _loc10_ = {target:this,type:"start"};
  663.                this.dispatchEvent(_loc10_);
  664.             }
  665.          }
  666.          _loc10_ = {type:"change",target:this};
  667.          this.dispatchEvent(_loc10_);
  668.       }
  669.       var _loc7_ = false;
  670.       if(!this._fullyLoaded && this.bytesLoaded >= this.bytesTotal - 100)
  671.       {
  672.          this._fullyLoaded = true;
  673.          this._playerImpl.mediaLoaded();
  674.          _loc7_ = true;
  675.       }
  676.       else if(first || _loc8_ != this._priorBytesLoaded)
  677.       {
  678.          _loc7_ = true;
  679.       }
  680.       if(_loc7_)
  681.       {
  682.          _loc10_ = {type:"progress",target:this};
  683.          this.dispatchEvent(_loc10_);
  684.       }
  685.       var _loc2_ = null;
  686.       var _loc3_ = 0;
  687.       while(this._fireCuePoints && _loc3_ < this._cuePoints.length)
  688.       {
  689.          _loc2_ = this._cuePoints[_loc3_];
  690.          if(this._priorTime < _loc2_.time && _loc4_ >= _loc2_.time || this._priorTime > _loc2_.time && _loc4_ <= _loc2_.time)
  691.          {
  692.             this._mostRecentCuePoint = _loc2_;
  693.             _loc10_ = {type:"cuePoint",target:this,cuePointName:_loc2_.name,cuePointTime:_loc2_.time};
  694.             this.dispatchEvent(_loc10_);
  695.          }
  696.          _loc3_ = _loc3_ + 1;
  697.       }
  698.       this._fireCuePoints = true;
  699.       if(this._sendCompleteEvent)
  700.       {
  701.          this._sendCompleteEvent = false;
  702.          _loc10_ = {type:"complete",target:this};
  703.          this.dispatchEvent(_loc10_);
  704.       }
  705.       this._priorTime = _loc4_;
  706.       this._priorBytesLoaded = _loc8_;
  707.    }
  708.    function isRtmp(mediaUrl)
  709.    {
  710.       if(mediaUrl != null)
  711.       {
  712.          var _loc1_ = undefined;
  713.          _loc1_ = mediaUrl.toLowerCase();
  714.          return _loc1_.indexOf("rtmp") == 0;
  715.       }
  716.       return false;
  717.    }
  718.    function associateController(c)
  719.    {
  720.       c.addEventListener("click",this);
  721.       c.addEventListener("playheadChange",this);
  722.       c.addEventListener("volume",this);
  723.       c.addEventListener("scrubbing",this);
  724.       this.addEventListener("change",c);
  725.       this.addEventListener("progress",c);
  726.       this.addEventListener("complete",c);
  727.    }
  728.    function setSize(w, h, noEvent)
  729.    {
  730.       super.setSize(w,h,noEvent);
  731.       this.invalidate();
  732.    }
  733.    function get enabled()
  734.    {
  735.       return this._enabled;
  736.    }
  737.    function set enabled(is)
  738.    {
  739.       if(this._enabled == is)
  740.       {
  741.          return;
  742.       }
  743.       this._enabled = is;
  744.       if(is)
  745.       {
  746.          if(this._playingBeforeDisabled)
  747.          {
  748.             this.play();
  749.             this._playingBeforeDisabled = false;
  750.          }
  751.       }
  752.       else
  753.       {
  754.          this._playingBeforeDisabled = this.playing;
  755.          if(this._playingBeforeDisabled && this._playerImpl instanceof mx.controls.streamingmedia.MP3Player)
  756.          {
  757.             this._playingBeforeDisabled = !this._playerImpl.willStop();
  758.          }
  759.          this.pause();
  760.       }
  761.    }
  762.    function onUnload()
  763.    {
  764.       this._playerImpl.close();
  765.    }
  766. }
  767.