Created
February 21, 2017 03:57
-
-
Save drakezhard/15193eea20a16a6c518dd80a9884c3e6 to your computer and use it in GitHub Desktop.
WebRTC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns webrtc.app) | |
(def gum (js* "Modernizr.prefixed('getUserMedia',navigator);")) | |
(defn webrtc-ready [] | |
(let [on-success (fn [stream] (let [video (. js/document (querySelector "video")) | |
Window (.-URL js/window) | |
media (Window.createObjectURL stream)] | |
(set! (.-src video) media))) | |
on-error (fn [err] (. js/console (log (str "navigator.getUserMedia error: ") err))) | |
constraints #js {:audio false :video true}] | |
(gum constraints on-success on-error))) | |
(defn init [] | |
(let [c (.. js/document (createElement "DIV"))] | |
(aset c "innerHTML" "I'm dynamically created") | |
(.. js/document (getElementById "container") (appendChild c)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment