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

前端 未结 2 1076
情书的邮戳
情书的邮戳 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

    
    

    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();
      })
    

提交回复
热议问题