[Initial flowplayer-component implementation clinton@unknownlamer.org**20080209220559] hunk ./src/flowplayer.lisp 1 +(in-package :com.tee-it-up-golf.web) + +(defconstant +flowplayer-controls-height+ 28 + "Height in pixels of the flowplayer controls") + +(defvar *flowplayer-default-controls-width* 468 + "Default Width in pixels of flowplayer controls.") + +(defvar *flowplayer-default-video-height* 300 + "Default height in pixels of the flowplayer video screen") + +(defcomponent flowplayer-component () + ((ucw:dom-id :initform (js:gen-js-name-string :prefix "flowplayer")) + (playlist :initarg :playlist :accessor playlist :initform nil) + (auto-play :initarg :auto-play :accessor auto-play-p :initform nil) + (loop-clips :initarg :loop-clips :accessor loop-clips-p :initform t) + (hide-controls :initarg :hide-controls :accessor hide-controls-p :initform nil) + (video-height :initarg :video-height + :accessor video-height + :initform *flowplayer-default-video-height*) + (video-width :initarg :video-width :accessor video-width + :initform *flowplayer-default-controls-width*))) + +(defmethod render ((self flowplayer-component)) + (<:div :id (slot-value self 'dom-id) + (<:p + (let ((player-id (js:gen-js-name-string :prefix "fbp"))) + (<:object + :id player-id + :declare "declare" + :data (action-href-body (:with-call/cc t + :invocation-isolated nil) + (call-as-window 'fallback-playlist :playlist (playlist self))) + :style (format nil "height: ~Dpx; width: ~Dpx;" + (+ +flowplayer-controls-height+ (video-height self)) + (video-width self))) + (<:a :href (format nil "#~A" player-id) (<:as-html "Play"))))) + (<:script :src "/static/js/swfobject.js") + (let ((player-var (gensym "fo")) + (player-id (js:gen-js-name-string :prefix "fbp"))) + (