53486

Error while taking pictures using MeteorCamera.getPicture() while testing on a laptop

Question:

I am working to add a photo ability to my app using Meteor's mdg:camera plugin. For now, I don't have any PhoneGap devices setup, so I am testing on my laptop. I thought I read somewhere that the Meteor implementation would fall-back and use a simple file dialog when a camera wasn't available, but when I try to run the following code on my laptop:

var cameraOptions = { width: 800, height: 600 }; MeteorCamera.getPicture(cameraOptions, function (err, data) { if (err) { console.log(err); // TODO Need to handle the error } else { if (!this.photos) { this.photos = []; } this.photos.push({ submitted_by: Meteor.userId(), submitted_on: new Date(), photo_data: data}); } });

I get the error:

Meteor.makeErrorType.errorClass {error: "unknownError", reason: "There was an error while accessing the camera.", details: undefined, message: "There was an error while accessing the camera. [unknownError]", errorType: "Meteor.Error"…}

I would actually like for users to be able to upload photos via the same button when using a laptop. For what it's worth, I actually do have a camera built-in, and I am developing on a 15" MacBook Pro.

Answer1:

On browser client, the mdg:camera falls back on using navigator.getUserMedia to try to obtain a video stream from the webcam, it does not allow the user to upload a photo.

<a href="https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/photo-browser.js#L41" rel="nofollow">https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/photo-browser.js#L41</a>

Unfortunately as we are speaking getUserMedia lacks support on Safari, which is probably the browser you are using working on a MacBook.

<a href="http://caniuse.com/#feat=stream" rel="nofollow">http://caniuse.com/#feat=stream</a>

Try your application on Google Chrome or Firefox instead.

Recommend

  • ionic3 tag src [duplicate]
  • Passing an argument into a function as a parameter of a function call
  • Windows 8 - Cordova - navigator.camera.getPicture
  • Store image to Firebase storage from cordova camera plugins on Ionic
  • AngularFire upload and get download URL
  • MultiLevel ExpandableListView not highlighting properly
  • jQuery - resize an elements height to match window without refreshing, on window resize
  • using html data-attributes as css-variable (i.e. text-shadow)
  • Drawing a Path in XAML (with binding) vs. C#. One works, one doesn't
  • chrome video src change not working
  • WPF Template Binding in ToggleButton UserControl
  • WPF version of .ScaleControl?
  • blade.php method outputting it's result to the form
  • D3 get axis values on zoom event
  • Detect when Facebook like button is clicked
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • MongoError: Incorrect arguments
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Obtain ObjectIdHex value from mgo query
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • How to show dropdown in excel using jrxml (jasper api)?
  • Upload files with Ajax and Jquery
  • How to pass list parameters for each object using Spring MVC?
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • embed rChart in Markdown
  • LevelDB C iterator
  • Authorize attributes not working in MVC 4
  • python draw pie shapes with colour filled
  • EntityFramework adding new object to nested object collection
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?