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!
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
}