5

I am trying to build a web app that will allow users to use the built in camera on an iPad to take a picture or video of themselves and then post it to Facebook. So far I have had no luck when testing getUserMedia() in Safari for iOS 6 or the Chrome app.

This info graphic shows that it is not supported by Safari with iOS 6 but it should work with Chrome, no?

http://caniuse.com/stream

Any help would be much appreciated.

zachjs
  • 1,738
  • 1
  • 11
  • 22
user1733466
  • 51
  • 1
  • 1
  • 2

3 Answers3

5

Currently the only way for mobile Safari to get an image from the camera (or photo roll) is with an input element. It is quite simple:

<input id="image-picker" type="file" accept="image/*" />

Then in js:

$("#image-picker").change( function (event) {
  var files = event.target.files;
  if (files.length>0) {
    // Do something with files[0]
  }
});
forresto
  • 12,078
  • 7
  • 45
  • 64
0

Chrome for iOS uses identical methods/views for displaying and interpreting HTML, with the exception of a few Safari-specific optimizations. If Safari does not support getUserMedia(), then Chrome cannot support it either unless they build their own port of WebKit for iOS, and even then, it might be a stretch. The functionality you are after may be available through some other means, but not using getUserMedia().

zachjs
  • 1,738
  • 1
  • 11
  • 22
  • I thought the point of Chrome limited is because Apple/AppStore won't allow browsers to implement their own renderers? – DanH May 29 '13 at 02:58
  • 2
    What I said may not actually be true however. It seems Ericsson provide an iOS browser called Bowser which is WebRTC enabled: https://labs.ericsson.com/apps/bowser – DanH May 29 '13 at 03:02
  • @DanH unfortunately bowser is no longer available: http://labs.ericsson.com/blog/retiring-bowser. Is there an iOS browser which has getUserMedia available? – Jan Święcki May 21 '14 at 12:35
  • Bowser is back on the App Store, I can view the camera using getUserMedia (Hurray!), but I'm having trouble capturing images https://itunes.apple.com/app/bowser/id560478358?mt=8 – NiloVelez Feb 03 '15 at 19:40
0

Now Safari supports it starting from IOS 11 & Safari 11. The namespaces have changed a little as its now mediaDevices prefixed. Check https://caniuse.com/?search=mediaDevices