Buffering Issue
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Buffering Issue

  1. #1
    Senior Member
    Join Date
    Sep 2001
    Location
    Manhattan
    Posts
    398

    Buffering Issue

    I am having a problem with buffering. I have my code set up to show a graphical representation of a buffer whenever the buffer is empty and then I have it disapear when the buffer is full. My problem is that half the time my video starts to buffer itself before it becomes empty, or somehow the message is not getting recieved by flash. So what happens is my video simply looks like it stops and then all the sudden re-appears.

    My code looks like this:

    Code:
    // setting the buffering function
    buffering = function () {
    	buffer._visible = true;
    	buffer.bar._width = (vidStream.bufferLength/vidStream.bufferTime)*294;
    	buffer.BufferText = "Buffering...";
    };
    // setting the not buffering function
    notBuffering = function () {
    	buffer._visible = false;
    	buffer.bar._width = 0;
    };
    // 
    buffer.onEnterFrame = function() {
    	vidStream.onStatus = function(infoObject) {
    		if ((infoObject.code == "NetStream.Play.Start" || infoObject.code == "NetStream.Buffer.Empty") || (vidStream.bufferLength<1)) {
    			goBuff = true;
    		} else if (infoObject.code == "NetStream.Buffer.Full") {
    			goBuff = false;
    		}
    		if (endTime<=videoStream.time) {
    			buffer._visible = true;
    			buffer.bar._width = 0;
    			buffer.bufferText = "Video Complete";
    		}
    	};
    	if (goBuff) {
    		buffering();
    	} else if (goBuff == false) {
    		notBuffering();
    	}
    The video is located at http://www.dttment.com/video/videoplayer.htm

    Any help would be greatly appreciated.
    JA

  2. #2
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    Hey -
    A few things - check out the code below:
    Code:
    // setting the buffering function
    buffering = function () {
    	buffer._visible = true;
    	buffer.BufferText = "Buffering...";
    	stopped = false;
    	buffer.onEnterFrame = function() {
    		trace("length= "+vidStream.bufferLength+":: time= "+vidStream.bufferTime);
    		this.bar._width = (vidStream.bufferLength/vidStream.bufferTime)*294;
    	};
    	
    };
    // setting the not buffering function
    notBuffering = function () {
    	buffer.bar._width = 0;
    	buffer._visible = false;
    	delete buffer.onEnterFrame;
    };
    
    // 
    vidStream.onStatus = function(infoObject) {
    		if (stopped!=true && (infoObject.code == "NetStream.Play.Start" || infoObject.code == "NetStream.Buffer.Empty")) {
    			trace(infoObject.code+" buffering..");
    			buffering();
    			
    		} else if (infoObject.code == "NetStream.Buffer.Full") {
    			trace(infoObject.code+" not buffering..");
    			notBuffering();
    			
    		} else if (infoObject.code == "NetStream.Play.Stop") {
    			stopped = true;
    			trace(infoObject.code+" stopped");
    			buffer.bufferText = "Video Complete";
    			buffer.bar._width = 0;
    			delete buffer.onEnterFrame;
    		}
    	};
    Let me know if it doesn't make sense and I'll try to explain.

    Psx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com