如何从服务器端网页访问iphone相机? [英] How to access iphone camera from server-side web page?

查看:193
本文介绍了如何从服务器端网页访问iphone相机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从webapp(服务器端网站)访问iphone摄像头? (ex asp,php,jsp)

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

推荐答案

可以在iOS中访问相机

it is possible to access camera in iOS

首先,在HTML正文中使用视频标记如下所示

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

然后在JavaScript中,通过使用视频元素,在视频标签上显示视频

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

这篇关于如何从服务器端网页访问iphone相机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆