Movie Duration

Hi All,

I have this code to determine the movie duration, but i can’t seem to get it to work when the movie starts playing, it only works if I place it in the movieplayer stop event or if I place it in a button action event and click the button while the movie is playing. I know that xojo docs state that the duration can only be retrieved if a movie is playing but placing the code in the play event doesn’t work it shows a very large negative number and there is not isplaying method or property that I can use to trigger this.
Am I doing something wrong? Any help would be greatly appreciated.

dim mpdur as integer
mpdur = Ctype(MoviePlayer1.Duration, integer)
    if mpdur > 60 then
      mpdur = mpdur/60
      mplabel.text = mpdur.ToText + "minutes"
    else
      mplabel.text = mpdur.ToText + "seconds"
    end if

UPDATE:

So i solved the issue by placing the code in a timer.
My question now is: Is that a proper way of doing it? Or is there another more efficient way?

Thanks,

Kareem