   (let [position (new-position (:current-time state) (:duration state) 5)]
     (handle-seek state dispatch [position])))
 
+(defn handle-finished [state _]
+  (-> state (dissoc :stop) (assoc :play-from 0)))
+
 (defn handle-frames-response [state dispatch [frames-json]]
   (dispatch [:toggle-play])
   (assoc state :loading false

                         (do
                           (dispatch [:update-state apply-changes v])
                           (recur))
                         (dispatch [:update-state #(-> % (dissoc :stop) (assoc :play-from 0))]))
          stop-playback-chan nil))) ; do nothing, break the loop
    (go
      (<! stop-playback-chan)

                     :seek handle-seek
                     :rewind handle-rewind
                     :fast-forward handle-fast-forward
                     :finished handle-finished
                     :frames-response handle-frames-response
                     :update-state handle-update-state})

