# Flash streaming video problem

**URL:** <https://forum.kirupa.com/t/flash-streaming-video-problem/206686>\
**Category:** flash\
**Created:** [November 10, 2006, 12:28pm UTC](https://forum.kirupa.com/t/flash-streaming-video-problem/206686 "2006-11-10T12:28:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicksta](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@Nicksta](https://forum.kirupa.com/u/Nicksta)\
**Post date:** [November 10, 2006, 12:28pm UTC](https://forum.kirupa.com/t/flash-streaming-video-problem/206686/1 "2006-11-10T12:28:09Z")

</div>

Hey Everyone

I found this cool tutorial to stream video in flash at [gotoAndlearn.com](http://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](http://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%

```auto

//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

```auto

var duration:Number;

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

```

Before the above code read like this

```auto

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](http://www.kicksaints.com/nick/web1/_work/_data/video.html)
