# VideoPlayer Class problem

**URL:** <https://forum.kirupa.com/t/videoplayer-class-problem/205443>\
**Category:** flash\
**Created:** [October 29, 2006, 7:58pm UTC](https://forum.kirupa.com/t/videoplayer-class-problem/205443 "2006-10-29T19:58:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oaki](https://avatars.discourse-cdn.com/v4/letter/o/7993a0/32.png) [@oaki](https://forum.kirupa.com/u/oaki)\
**Post date:** [October 29, 2006, 7:58pm UTC](https://forum.kirupa.com/t/videoplayer-class-problem/205443/1 "2006-10-29T19:58:20Z")

</div>

Hi guys,

I am trying to create a video player class that allows me to get all kinds of information from a video i’m playing like duration, current position etc.

I let a function run every half second in order to trace the current video position, but it just won’t work!  
When I trace getVideoPosition(), it only says: undefined.

Do you have any idea how to make this work?

Thanks a lot!

```auto
class videoPlayer {
    var netConn;
    var netStream;
    var meta;
    var duration;
    var interval_id;
    
 function videoPlayer() {
        this.netConn = new NetConnection();
        this.netConn.connect(null);
            trace("NetConnection established");
        this.netStream = new NetStream(this.netConn);
            trace("NetStream established");
        var t = this;
        this.play("test_video.flv");
                
         this.interval_id = setInterval(getVideoPosition, 1000);
         trace(getVideoPosition());
         
    }
    
    function getDuration() {
        return this.meta.duration;
    }
    
    function getVideoPosition() {
            return this.netStream.time;
    }
    
    function play(url) {
        if (url != undefined) {
            this.netStream.play(url);
            return;
        }
    }

// CLASS END    
}

```
