 
 (defn frames->chan
   "Returns a channel that emits frames from the given collection."
-  [frames speed]
+  [frames]
   (let [ch (chan)
         start (js/Date.)]
     (go

  (let [start (js/Date.)
        play-from (:play-from state)
        speed (:speed state)
        frames (-> (:frames state) (next-frames play-from))
        diff-chan (frames->chan frames speed)
        timer-chan (coll->chan (repeat [0.3 true]))
        stop-playback-chan (chan)
        elapsed-time #(* (elapsed-time-since start) speed)

             virtual-time 0
             pending-diff {}]
        (when-let [[delay diff] (first frames)]
          (let [wall-time (elapsed-time-since start)
                new-virtual-time (+ virtual-time delay)
                ahead (- new-virtual-time wall-time)]
            (if (pos? ahead)
              (do
                (when-not (empty? pending-diff)
                  (>! ch pending-diff))
                (<! (timeout (* 1000 ahead)))
                (>! ch diff)
                (recur (rest frames) new-virtual-time {}))
              (recur (rest frames) new-virtual-time (merge-with merge pending-diff diff))))))
