Dear Sir,
After much troubleshooting, I have been able to work the webcam fine for now but when i connect the localhost using the machine’s IP from another PC it say’s webcam.js error? kindly help me solve this issue. Thank you. Below is my code.
<div class="col-75">
<div id="my_camera"></div><br>
<input type=button value="Take Snapshot" onClick="take_snapshot()" name="image">
<input type="hidden" name="image" class="image-tag">
<div class="col-md-6">
<div id="results">Your captured image will appear here...
</div>
</div></div>
<div class="row">
<input type="submit" value="Submit" class="btn btn-success" name="ronel">
</div>
</form>
</div>
</body>
</html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcamjs/1.0.25/webcam.min.js"></script>
<!-- Configure a few settings and attach camera -->
<script language="JavaScript">
Webcam.set({
width: 140,
height: 150,
image_format: 'jpeg',
jpeg_quality: 90
});
Webcam.attach( '#my_camera' );
function take_snapshot() {
Webcam.snap( function(data_uri) {
$(".image-tag").val(data_uri);
document.getElementById('results').innerHTML = '<img src="'+data_uri+'"/>';
} );
}
</script>