title: TypeError: webcam.capture is not a function using jQuery webcam
body: <p>Have been getting this error since the first time I tried to use the <code>jQuery WebCam...</code> I <em>googled</em> for <strong>like 18Hours,</strong> trying all possible Examples ever available, NONE works whenever I just Call the <code>capture</code> method of the <code>webcam</code>.</p>
  
  <p><strong><em>Please Note:: This might sound duplicate but, I spent hours and hours in stackOverflow, all examples gave not good result. the closest, infact the code am using is from;</em></strong> <a href="https://stackoverflow.com/questions/19507301/jquery-webcam-plugin-typeerror-webcam-capture-is-not-a-function-thrown-occasion">jquery webcam plugin TypeError: webcam.capture is not a function thrown occasionally</a>
  and <a href="https://stackoverflow.com/questions/19507301/jquery-webcam-plugin-typeerror-webcam-capture-is-not-a-function-thrown-occasion">jquery webcam plugin TypeError: webcam.capture is not a function thrown occasionally</a>
  and <a href="https://stackoverflow.com/questions/10614867/jquery-webcam-on-webpage-help-needed">Jquery Webcam on webpage help needed</a> and <a href="https://stackoverflow.com/questions/6570283/jquery-webcam-plugin-saving-image?rq=1">jQuery webcam plugin - saving image</a> and <a href="https://stackoverflow.com/questions/12163537/display-pic-in-web-page-captured-from-webcam?rq=1">Display pic in web page captured from webcam</a> and MANY MORE.....</p>
  
  <p>I tried the suggestions by the accpted answer, still yielded no progress...</p>
  
  <pre><code> &lt;html&gt;
    &lt;head&gt;
       &lt;script type="text/javascript" src="jQ.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript" src="cam/jquery.webcam.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
    &lt;body&gt;
  
  
  &lt;script type="text/javascript"&gt;
     $(document).ready(function(){
  
  
      $("#camera").webcam({
              width: 315,
              height: 240,
              useMicrophone: false,
              mode: "callback",
              swffile: "cam/jscam_canvas_only.swf", 
  
  
              onLoad: function() {
  
                  var cams = webcam.getCameraList();
                  for(var i in cams) {
                      jQuery("#cams").append("&lt;li&gt;" + cams[i] + "&lt;/li&gt;");
                  }
              },
  
              debug: function (type, string) {
                  $("#status").html(type + ": " + string);
              },
  
              onCapture: function () {
  
                  jQuery("#flash").css("display", "block");
                  jQuery("#flash").fadeOut("fast", function () {
                  jQuery("#flash").css("opacity", 1);
  
                  webcam.capture();
                   alert($.webcam.getFrameAsBase64());    
                  });
  
  
              },
  
              onSave: function(data) {
  
                  var col = data.split(";");
                  var img = image;
  
                  for(var i = 0; i &lt; 320; i++) {
                      var tmp = parseInt(col[i]);
                      img.data[pos + 0] = (tmp &gt;&gt; 16) &amp; 0xff;
                      img.data[pos + 1] = (tmp &gt;&gt; 8) &amp; 0xff;
                      img.data[pos + 2] = tmp &amp; 0xff;
                      img.data[pos + 3] = 0xff;
                      pos+= 4;
                  }
  
                  if (pos &gt;= 4 * 320 * 240) {
                      ctx.putImageData(img, 0, 0);
                      pos = 0;
                  }
              }
  
  
  
  
  
      }); });
  &lt;/script&gt;
  
  
  &lt;label id="status"&gt;&lt;/label&gt;                             
                      &lt;div id="camera"&gt;&lt;/div&gt;
                      &lt;div&gt;&lt;p&gt;&lt;canvas id="canvas" height="240" width="320"&gt;&lt;/canvas&gt;&lt;/p&gt;&lt;/div&gt;
                       &lt;a href="javascript:webcam.capture();changeFilter();void(0);"&gt;Take a picture instantly&lt;/a&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Does anyone know any possible reason why it cannot work or what am i doing wrong, please I will be glad to be lectured on this. thx</p>