Flash streaming video problem

Hey Everyone

I found this cool tutorial to stream video in flash at gotoAndlearn.com

I’ve run into a problem though and no one on the GotoAndLearn forum can help me out.

Maybe someone can help me here

I created the tutorial for a video player which I found on gotoAndLearn.com . It works completely fine when I test it offline, it buffers and the video loader bar works.

As soon as I upload and test online it screws out, the bufferClip stays open and the progress bar just jumps to 100%


//Net Connection object
var nc:NetConnection = new NetConnection();
nc.connect(null);

//Net Stream object
var ns:NetStream = new NetStream(nc);

//buffer code
ns.setBufferTime(30);
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") {
        ns.seek(0);
    }
};
//Attach NetStream to the video

theVideo.attachVideo(ns);
//Play this video

ns.play("http://www.kicksaints.com/nick/web1/_work/_data/blin.flv");
//Button actionscript
playButton.onRelease = function() {
    ns.pause();
};
rewindButton.onRelease = function() {
    ns.seek(0);
};
//Video interval function

var videoInterval = setInterval(videoStatus, 10);

//Amount loaded Variable
var amountLoaded:Number;

//Loader width
var loadBarwidth:Number = 363;

// duration variable

var duration:Number;

//on Metadata function
ns.onMetaData = function(obj) {
    duration = obj.duration;
};
// VideoStatus function code
function videoStatus() {
    amountLoaded = ns.bytesLoaded/ns.bytesTotal;
    loader.loadbar._width = amountLoaded*loadBarwidth;
    loader.scrub._x = ns.time/duration*loadBarwidth;
}
//scrub Variable
var scrubInterval;

//scrub bar code
loader.scrub.onPress = function() {
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit, 100);
    this.startDrag(false, -1, this._y, 359, this._y);
};

//scrub event handler
loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus, 100);
    this.stopDrag();
};

//scrubit function
function scrubit() {
    ns.seek(Math.floor((loader.scrub._x/359)*duration));
}

This bit of code I changed according to a thread on gotoAndLearn. In order for this to work the way I have it below I had to add a line of code in the NetStream.as file


var duration:Number;

//on Metadata function
ns.onMetaData = function(obj) {
    duration = obj.duration;
};

Before the above code read like this


var duration:Number; 
 
ns["onMetaData"] = function (obj) { 
   duration = obj.duration; 
} 

Here is the url to the onlie player
http://www.kicksaints.com/nick/web1/_work/_data/video.html