home *** CD-ROM | disk | FTP | other *** search
- class mx.controls.streamingmedia.PlayerNetStream extends NetStream
- {
- var _player;
- var detectedFirstBuffer;
- var initId;
- var checkSizeInterval;
- function PlayerNetStream(nc, aPlayer)
- {
- super(nc);
- this.setPlayer(aPlayer);
- }
- function getPlayer()
- {
- return this._player;
- }
- function get player()
- {
- return this.getPlayer();
- }
- function setPlayer(aPlayer)
- {
- this._player = aPlayer;
- }
- function set player(aPlayer)
- {
- this.setPlayer(aPlayer);
- }
- function pause(shouldPause)
- {
- super.pause(shouldPause);
- }
- function setBufferTime(time)
- {
- super.setBufferTime(time);
- }
- function play(name, st, len, reset)
- {
- super.play(name,st,len,reset);
- }
- function seek(offset)
- {
- super.seek(offset);
- }
- function close()
- {
- super.close();
- }
- function attachAudio(theMicrophone)
- {
- super.attachAudio(theMicrophone);
- }
- function attachVideo(theCamera, snapshotMilliseconds)
- {
- super.attachVideo(theCamera,snapshotMilliseconds);
- }
- function onStatus(info)
- {
- var _loc2_ = this.getPlayer();
- switch(info.code)
- {
- case "NetStream.Buffer.Full":
- break;
- case "NetStream.Play.Start":
- this.detectedFirstBuffer = false;
- clearInterval(this.initId);
- this.checkSizeInterval = 10;
- this.initId = setInterval(this,"detect",this.checkSizeInterval);
- break;
- case "NetStream.Pause.Notify":
- break;
- case "NetStream.Play.Stop":
- clearInterval(this.initId);
- _loc2_.playStopped();
- break;
- case "NetStream.Play.Failed":
- case "NetStream.Play.StreamNotFound":
- var _loc3_ = undefined;
- _loc3_ = "Error playing URL: " + info.description;
- _loc2_.logError(_loc3_);
- break;
- case "NetStream.Seek.Notify":
- _loc2_.setSeeking(false);
- }
- }
- function detect()
- {
- var _loc2_ = this.getPlayer();
- if(!this.detectedFirstBuffer && _loc2_.isSizeSet())
- {
- this.detectedFirstBuffer = true;
- _loc2_.bufferIsFull();
- }
- if(_loc2_.isSizeChange())
- {
- _loc2_.resizeVideo();
- }
- clearInterval(this.initId);
- this.checkSizeInterval *= 2;
- this.initId = setInterval(this,"detect",this.checkSizeInterval);
- }
- function onMetaData(info)
- {
- var _loc2_ = this.getPlayer();
- if(_loc2_ instanceof mx.controls.streamingmedia.FLVPlayer)
- {
- var _loc3_ = _loc2_;
- _loc3_.setTotalTime(info.duration);
- }
- else if(_loc2_ instanceof mx.controls.streamingmedia.RTMPPlayer)
- {
- var _loc4_ = _loc2_;
- _loc4_.setTotalTime(info.duration);
- }
- }
- }
-