-1

How to access iphone camera from webapp(server-side web)? (ex asp,php,jsp)

1
  • I guess there is no way to access local resources of iPhone eg Camera, Files using Web.So why Native App comes in picture to access local resources.
    – iOSPawan
    Commented Nov 21, 2011 at 9:34

2 Answers 2

0

It's not possible for code running on a server to access an iPhone's camera. It's not even possible for client-side web-app code (Javascript, HTML, CSS) to access the camera.

You'll need to write a full native app to be able to work with the camera. If you'd still like to be able to use web-technologies to do this, have a look at PhoneGap: http://phonegap.com/

PhoneGap makes it easier to write an app that loads a web page, but allows for access to device native APIs. Building the user interface will be more difficult though.

1
  • This answer is outdated and incorrect.
    – Zargold
    Commented Feb 15, 2022 at 5:48
0

it is possible to access camera in iOS

First, in HTML body use video tag as below

<video id="video" class="video" height="400" width="400" playsinline autoplay muted loop></video>

this will ask permission to access the camera

Then in JavaScript, by using video element, display the video on the video tag

var video = document.getElementById("video");

navigator.mediaDevices.getUserMedia({video: true, audio: false})
    .then(function(s) {
    stream = s;
    video.srcObject = s;
    video.play();
  })

Not the answer you're looking for? Browse other questions tagged or ask your own question.