         "image" (layout activity (image-from-path activity path))
         "video" (layout activity (video-from-path activity path))))))
 
+(defn view-remote [activity instruction]
+  (when-let [url (:url instruction)]
+    (case (:type instruction)
+      "image" (layout activity (image-from-url activity url))
+      "video" (layout activity (video-from-path activity url)))))
+
 (defn swap-view! [activity view]
   (replace-view! activity view))
 

(defn setVideoSource [video source]
  (log/i "darknet setting video source" source)
  (if (.startsWith source "http")
    (.setVideoUri video (Uri/parse source))
    (.setVideoPath video source)))

(defn setup-video-view [view activity path]

    (doto view
      (.setLayoutParams params))))

(defn image-from-url [activity url]
  (let [view (ImageView. activity)]
    (fit-linear-layout! view)
    (let [f (fn [bytes]
              (let [bitmap (BitmapFactory/decodeByteArray bytes
                                                          0
                                                          (count bytes))]
                (on-ui
                    (.setImageBitmap view bitmap))))]
      (server/get-bytes url f))
    view))

(defn image-from-path [activity path]
