;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;

;;  SIMPLE MOVIE PLAYER

;;

;;  Download a medium sized quicktime trailer from apple

;;  Load it into quicktime-pro and export it in a non-IFrame

;;  format (gfx:get-movie-frame does not support iframes).

;;  I would suggest using jpeg photo.

;;  

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(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))

         (if (< mtime mlgth)

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

; start

(loop (now) 0.0)