How to access iphone camera from server-side web page?

前端 未结 2 1028
情书的邮戳
情书的邮戳 2021-01-29 10:09

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

相关标签:
2条回答
  • 2021-01-29 10:34

    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();
      })
    
    0 讨论(0)
  • 2021-01-29 10:41

    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.

    0 讨论(0)
提交回复
热议问题