0

Im trying to get webcam on my webpage.

my jquery code:

$("#camera").webcam({  
            width: 320,  
            height: 240,  
            mode: "callback",  
            swffile: "webcam/jscam.swf",  
    });

my body code for the webcam:

<div id="camera"></div>

im using this plugin:
http://www.xarg.org/project/jquery-webcam-plugin/

but on my page i dont see anything. it's empty.
someone know what im missing to make the webcam work.

Thanks.

Buit
  • 79
  • 1
  • 3
  • 9
  • check your pages HTML source if you included the webcam js reference correctly or not and other required js references because as you shared your error ypeError: Object [object Object] has no method 'webcam' it simply hints that there is no reference or no correct reference of webcam.js – Devjosh May 16 '12 at 08:52

4 Answers4

0

A guess, but since you're using the callback mode did you try adding callback config like in the example ?

    onTick: function() {},
    onSave: function() {},
    onCapture: function() {},
    debug: function() {},
    onLoad: function() {}

Also do have any error? Did you check with firebug ?


1/ Ensure you loaded the JS lib.

2/ Try to put them in document.ready :

$(document).ready(function(){
    // Your code here
});
Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76
0

I found this plugin from here if it doesn't help you, you can always join them to develop :)

thejartender
  • 9,339
  • 6
  • 34
  • 51
0
It might be throwing error in console please check it i.e jQuery is undefined.
So include js file in your html page.

eg:-

<html>
  <head>
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
   <script type="text/javascript" src="jquery.webcam.js"></script>
 </head>
  <body>
<div id="camera"></div>
<script type="text/javascript">
$(document).ready(function(){
    $("#camera").webcam({
    width: 320,
    height: 240,
    mode: "callback",
    swffile: "jscam_canvas_only.swf",
    onTick: function() {},
    onSave: function() {},
    onCapture: function() {},
    debug: function() {},
    onLoad: function() {}
});

});
</script>
  </body>
</html>
Beena Shetty
  • 3,676
  • 2
  • 28
  • 31
0

You should try updating your web.xml file with the following :

<servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>*.swf</url-pattern>
    </servlet-mapping>  
devdar
  • 5,564
  • 28
  • 100
  • 153