# Problem displaying duration time Netstream

**URL:** <https://forum.kirupa.com/t/problem-displaying-duration-time-netstream/267252>\
**Category:** flash\
**Created:** [July 30, 2008, 3:59am UTC](https://forum.kirupa.com/t/problem-displaying-duration-time-netstream/267252 "2008-07-30T03:59:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheMagicMan](https://avatars.discourse-cdn.com/v4/letter/t/f4b2a3/32.png) [@TheMagicMan](https://forum.kirupa.com/u/TheMagicMan)\
**Post date:** [July 30, 2008, 3:59am UTC](https://forum.kirupa.com/t/problem-displaying-duration-time-netstream/267252/1 "2008-07-30T03:59:33Z")

</div>

I have a flv in my netstream. Somehow I cannot show the duration correctly. I have read forums and tried their ways, still no luck.

this part is in my constructor --------  
//load video  
var connection:NetConnection = new NetConnection();  
connection.connect(null);  
stream = new NetStream(connection);  
stream.play(“video.flv”);  
video = new Video();  
video.attachNetStream(stream);  
addChild(video);

```
        //caculate video duration and initial cuepoint event 
        //handle function
        var client:Object = new Object();
        client.onMetaData = onMetaData;
        client.onCuePoint = onCuePoint;
        stream.client = client;
       
        //create playback time info.
        playbackTime = new TextField();
        playbackTime.width = 50;
        playbackTime.height = 20;
        this.addEventListener(Event.ENTER_FRAME, handleEnterFrame);

```

* * *

then the functions

```
    private function onMetaData(data:Object){
        duration = data.duration;
        trace(duration);
        //resize video, video.width may not equial to video.videoWidth
        video.width = video.videoWidth;
        video.height = video.videoHeight;
        //setup playtime info.
        setPlaybackTime();
        //setup subtitle
        setSubtitle();
    }
    
    /*
     * keep checking the playback time
     */
    private function handleEnterFrame(event:Event):void {
        playbackTime.text = Math.round(stream.time) + " / " + Math.round(duration); 
        trace(stream.time);
    }

```

my duration time keeps showing 10. the elapsed time is ok.

Can someone help?

Thanks
