 <p>Is there an error of some sorts, or you just don't understand how that works?</p> <p><code>navigator.webkitGetUserMedia</code> <a href="https://developer.mozilla.org/en-US/docs/NavigatorUserMedia.getUserMedia" rel="nofollow">expects 3 arguments</a>. One for configuration data, one for a function to call on success (a success <em>callback</em>) and one to call on error.</p> <p>Note that it expects a <em>function</em>. This code passes a reference to the function by name; it will be called with the appropriate parameter (from within <code>webkitGetUserMedia</code>).</p> <p>Consider this code, it works in the same manner:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function hello(subject) { alert("Hello, " + subject + "!"); } function passWorldTo(callback) { callback("world"); } passWorldTo(hello);</code></pre> </div> </div> </p>