                    (.addClass player "playing")
                    (.removeClass player "playing"))))
     
+    ; Map keyboard keys to functions
+    (setup-keypresses button-types-and-fns player-state-atom)
+    
     ; Add click handlers to the buttons
     (doseq [[btn-type btn-fn] button-types-and-fns]
       (setup-button player player-state-atom btn-type btn-fn))

  [player state-atom]
  (let [update-value-fn (partial slide state-atom)]
    (ui.slider/create (.find player "div.slider") update-value-fn)))

(defn ^:export createPlayerFn
  "Creates a player component within the given element and returns a function


; TODO This jams too much all in one file. We should try to abstract away some of it like the 
; button stuff and the slider.

(def left-arrow-key 37)
(def space-key 32)
(def right-arrow-key 39)
(def p-key 80)

(def player-control 
  (hiccups/html 
