I'm currently building a custom flv player and need some help. I've followed the vid tutorial on this site which helped out a lot, but now I'm stuck on a few things. Maybe I'm missing something, I'm not sure. The main problem is that the FLV doesn't load/play, which most likely causes the secondary problems, such as the bufferClip always visible and no way to test the video and audio scrubbers.
Thank you for your help in advance. If you need anymore info, just let me know.Code:var nc: NetConnection = new NetConnection(); nc.connect(null); var ns: NetStream = new NetStream(nc); ns.setBufferTime(5); ns.onStatus = function(info){ if(info.code == "NetStream.Buffer.Full"){ bufferClip._visible=false; } if(info.code == "NetStream.Buffer.Empty"){ bufferClip._visible=true; } if(info.code == "NetStream.Play.Stop"){ gotoAndStop("end"); } } //video location videoPlace.attachVideo(ns); ns.play("URL of FLV"); //audio control _root.createEmptyMovieClip("vSound",_root.getNextHighestDepth()) vSound.attachAudio(ns); var so:Sound = new Sound(vSound); audioControl.audioScrub.onEnterFrame=function(){ so.setVolume(100-this._y); } audioControl.audioScrub.onPress=function(){ this.startDrag(false,this._x,0,this._y,100); } audioControl.audioScrub.onRelease = audioControl.audioScrub.onReleaseOutside = function(){ this.stopDrag(); } //restart button controlBar.restartBtn.onRelease = function(){ ns.seek(0); } //Play and Pause button controlBar.playpause.onRelease = function(){ ns.pause(); } //setup the video interval var vidInt = setInterval(videoStatus, 100); var amtLoad:Number; var duration:Number; ns["onMetaData"] = function(obj){ duration = obj.duration; } function videoStatus(){ amtLoad = ns.bytesLoaded/ns.bytesTotal; loader_mc.loadBar._width = amtLoad * 560; loader_mc.scrubber._x = ns.time/duration * 560; } //scrubber code var scrubInt; loader_mc.scrubber.onPress = function(){ clearInterval(vidInt); scrubInt = setInterval(scrubIt,10); this.startDrag(false,0,this._y,560,this._y); } loader_mc.scrubber.onRelease = loader_mc.scrubber.onReleaseOutside = function(){ clearInterval(vidInt); vidInt = setInterval(videoStatus,100); this.stopDrag(); } function scrubIt(){ ns.seek(Math.floor((controlBar.loader_mc.scrubber._x/560) * duration)); }
~sg123




Reply With Quote
