A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Buffer questions!

  1. #1
    Junior Member
    Join Date
    Mar 2004
    Posts
    3

    Buffer questions!

    Hi there - first post and trying to unravel the vagaries of the esoteric progressive video functions in flash mx2004!

    I'm streaming in video from the same server rather than using communication server mx. What I'm after is a streaming display/buffer display to give feedback to the user. I know I could use the Components, but frankly I'd rather not (I'm the only person in the studio with the pro version at the moment, so my files need to be openable by everyone else here, plus I want to have absolute control over the function and look of the interface).

    A fantastic example of what I'm trying to achieve can be found at http://www.khfilms.com/kh.cfm (i believe they are a member here - very beautiful work!)

    My problem is this...I'm trying to build in feedback of how much of the buffer has loaded (at the start), then how far the buffer has loaded in advance of the playhead. So far so good - I can access the bufferTime and bufferLength properties, but I can't access any meaningful values for the bytesLoaded property of the NetStream object. It always gives me the same result as the bytesTotal property - so as far as flash is concerned, the whole movie has been loaded instantly!

    This is the standard code I'm using to connect to the video feed:

    Code:
    //create netconn object
    var connection_nc:NetConnection = new NetConnection;
    //create local streaming connection;
    connection_nc.connect(null);
    //create a net stream
    var videoFeed_ns:NetStream = new NetStream(connection_nc);
    
    //handle status events
    videoFeed_ns.onStatus = function(infoObj){
    	onStatus_txt.text = infoObj.code;
    }
    
    //attach the feed to the video placeholder
    this.placeholder_video.attachVideo(videoFeed_ns);
    //set buffer time
    videoFeed_ns.setBufferTime(10);
    //specify the source flv file
    videoFeed_ns.play("videos/vidtest.flv");
    nothing weird there!

    to access the bytes total and bytes loaded i'm using the following code (on an enter frame event of a movie clip, so the code is evaluated at 25fps):

    Code:
    this._parent.bytesTotal_txt.text = _root.videoFeed_ns.bytesTotal;
    
    this._parent.bytesLoaded_txt.text = _root.videoFeed_ns.bytesLoaded;
    What I'm getting though is the bytes loaded value that is returned is exactly the same as the bytes total! Even with the simulate download option!

    any idea what is going on?

  2. #2
    Junior Member
    Join Date
    Apr 2001
    Posts
    10
    i may be wrong but if yer testing the swf in yer PC the file will always be instantly downloaded... unless test it outside yer PC either thro local network or throo the internet the file wont be actualy downloaded


    i wish we had a way to get the total length of the video along with the total bytes as well

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Location
    London
    Posts
    361
    If you want the duration of the FLV you can access it in an onMetaData function.

    This is a very useful thread here

  4. #4
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    does _soundbuftime property have any impact on FLV loading?

    I am wondering Netconnection setBufferTime() function and the _soundbuftime property are some how controlling the same underlying buffering mechanism in flash and might overide each other or create a confict.

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