I'm posting this mail a second time, since in the last three digests I could 
not see it.

(I'm referring to a post on the NUG received this morning, but I cant remember 
the name of the poster).

I found that the following function (and the editableMovie.duration too) return 
a duration that is not always accurate, in the sense that at the end of certain 
movies and of certain mp3.files, in the MoviePlayer.stop event handler, if I 
write

//mDurations is a double holding the result of the function quoted below or of 
editableMovie.Duration

staticText1.text = format(me.position, "#")
staticText2.text = format(mDuration, "#")
if me.position >= mDuration then
statictext3.text = "movie ended"
end if

then, at the end of the movie or mp3File, I get:

staticText1.text: 441
statictext2.text: 441
staticText3.text: nil

Even if I write: if mDuration <= me.position the event wont fire.

Things work allright if I write (mDuration-1), or, in the function below, if I 
change the last line into:

return MovieDuration \ MovieTimeScale// i.e. from / into \

On the other end, the workaround in Matt's book always works fine:

moviePlayer1.movie = someMovie
moviePlayer1.position = 99999// (a huge value)
mDuration = moviePlayer1.position
//moviePlayer1.position = 0 and moviePlayer1.play

and the good of the snippet is that the movie doesnt need to be an 
editableMovie.

>Function getDuration(aMov as Movie) As Double
> 
>   Declare Function GetMovieDuration Lib kQuickLib (theMovie as Integer) as 
> Integer
>   Declare Function GetMovieTimeScale Lib kQuickLib (theMovie as Integer) as 
> Integer
> 
>   dim MovieDuration, MovieTimeScale as integer
>   MovieDuration = GetMovieDuration (aMov.Handle)
>   MovieTimeScale = GetMovieTimeScale (aMov.Handle)
>   return MovieDuration / MovieTimeScale
>End Function

-- 
Carlo
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to