      (.canPlayType player
                    (if codec (str media-type "; codecs=" codec) media-type))))
 
-
 (defn best-media-url [r]
   (let [urls (get r "_links")]
     (get

  (is (s/valid? ::search-term [:= "artist" "Lou Reed"]))
  (is (s/valid? ::search-term [:shuffle "Manic Thursday"])))

(defn xhr-search [term]
  (let [conformed-term (s/conform (s/coll-of ::search-term) term)
        json-term (apply vector "and" conformed-term)
        body (.stringify js/JSON (clj->js json-term))
        channel (chan)]
    (.send XhrIo "/tracks.json"
           (fn [e]
             (let [xhr (.-target e)

                   o (and (< code 400) (js->clj (.getResponseJson xhr)))]
               (put! channel (or o []))))
           "POST"
            (.stringify js/JSON (search-term-as-js-obj term))
           {"Content-Type" "text/plain"}
           )
    channel))
