;;  Impromptu supports all Quicktime movie formats

;;  NOTE however that different formats will give

;;  different levels of performance.



(define canvas (gfx:make-canvas))

; replace the file location string with one that suits your movie.

(define movie (gfx:load-movie "/tmp/myfilm.mov"))

(define mlgth (- (gfx:get-movie-duration movie) 1.0))

(define frame-length (* *second* 0.041))

; show each frame, one by one

; Note that you have individual control over each frame

; and that playing it back (like this example) is one of

; the most trivial things to do.

(define loop

   (lambda (time mtime)

      (let ((frame (gfx:get-movie-frame movie mtime)))

         (gfx:draw-image time canvas frame 1.0)

         (set! time (+ time frame-length))

         (objc:release time frame)

         (if (< mtime mlgth)

             (callback (- time 1000) 'loop time (+ mtime 0.041))))))

; start

(loop (now) 0.0)