A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: FLV seekbar/duration

  1. #1
    Junior Member
    Join Date
    Oct 2007

    FLV seekbar/duration

    I just started using the NetStream/NetConnection methods of pulling in flvs. I'm having a problem figuring out how to get the MetaData from the flv. Example, how would I pull the duration from the flv. and put it into a text box? Also, does anyone have a good example of a custom coded seekbar, I'm so not used to working outside of the timeline like this. Thanks!


  2. #2
    Junior Member
    Join Date
    Jul 2002
    The NetStream object has a method that you define, onMetaData, which will have an object instance as an argument. From there you'll be able to access the different meta information associated with the NetStream. It would look something like this:

    var myConnection:NetConnection = new NetConnection();
    var myStream:NetStream = new NetStream(myConnection);
    myStream.onMetaData = function(info:Object):void
        var duration:int = int(info.duration);
        myDynamicTextBox.text = "Total time: " + duration;
        // other coded logic here...
    NOTE: If your FLV was not encoded with the duration, then it will not be available in the stream. Just make sure that this meta is getting added in, or you may be in for a surprise.

    As for the progress bar, you'll have to write some sort of timer so that you can check the current playhead position of the asset. What we usually do is run a listener for Event.ENTER_FRAME, then run a small calculation to determine the play head position relative to the duration and width of our progress bar:

    var percentComplete:Number = currentPlayheadPosition/totalDurationTime;
    progress_indicator.x = progress_container.x+(percentComplete*progress_container.width);

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