;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; SIMPLE MOVIE PLAYER
;;
;; Download a medium sized quicktime trailer from apple
;; Load it into quicktime-pro and export it at its current
;; size but in TIFF format. Use that file in gfx:load-movie.
;;
;; Impromptu does not currently support any format
;; other than TIFF
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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)
(gfx:draw-movie-frame time canvas movie mtime 1.0 75 150)
(set! time (+ time frame-length))
(if (< mtime mlgth)
(callback (- time 1000) 'loop time (+ mtime 0.041)))))
; start
(loop (now) 0.0)