Genjuro Genjuro - 4 years ago 483
Javascript Question

How to implement web camera and mobile camera on Meteor

I need to implement a photo capture on Meteor. Is there any package or Meteor friendly Jquery plugin to achieve image capturing on Meteor?

Answer Source

so use Meteor Camera Package;

meteor add mdg:camera

Html

<template name="example">
    <a href="#" class="takePhoto">take photo</a>

    <img class="photo">
</template>

JS

Template.example.events({
    'click .takePhoto': function(event, template) {
        var cameraOptions = {
            width: 800,
            height: 600
        };
        MeteorCamera.getPicture(cameraOptions, function (error, data) {
           if (!error) {
               template.$('.photo').attr('src', data); 
           }
        });
        event.preventDefault();
    }
});

for example https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/README.md#meteorcameragetpictureoptions-callback

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download