         (fn []
           (println "Upload successful!"))))))
 ; end stuff that should be cleaned up with react....
+
+(defn play-track [track-id]
+  (let [reader (new js/FileReader)
+        song-blob (get (:music-files @app-state) track-id)]
+    (.readAsDataURL reader song-blob)
+    (set! (.-onloadend reader)
+      (fn []
+        (swap! app-state assoc :current-sound
+          (.createSound js/soundManager #js {:id current-sound-id
+                                             :type "audio/mpeg"
+                                             :url (.-result reader)
+                                             :autoLoad true}))
+        (.play (:current-sound @app-state))))))
 
 (.on socket "connect" #(.emit socket "join-room" room-id))
 (.on socket "sign-in-success"

                          :music-info []
                          :music-files {}
                          :data-downloaded 0
                          :download-progress nil}))

(enable-console-print!)


        (swap! app-state assoc :music-files
          (merge (:music-files @app-state)
                 {track-id
                  (new js/Blob #js [(get (:music-files @app-state) track-id) data-chunk]
                               #js {:type "audio/mpeg"})}))))
    (.on stream "end"
      (fn []
        (println "Download complete!")
        (swap! app-state assoc :download-progress nil)

        (if (= (:current-track-id @app-state) track-id)
          (play-track track-id))))))

(.on socket "track-change"
  (fn [track-id]
    (swap! app-state assoc :current-track-id track-id)
    (.emit socket "file-download-request" track-id)))
