我在访问相机时遇到问题谷歌脚本网站。
我努力了
<input type="file" accept="image/*" id="file-input">
and
<input type="file" accept="image/*;capture=camera">
但都打开了文件管理器选择文件而不是询问相机许可.
有没有办法使用 Google Script webapp 捕获图像并上传到 google 驱动器。
我尝试过 Google Picker API,但运气不好,它给了我起源错误.
Thanks
使用 MediaDevices.getUserMedia(constraints) 方法触发授权流程。配置约束参数来描述请求的媒体类型,例如
var constraints = {video: true, audio: true};
添加
<video id="video" width="640" height="480" autoplay></video>
<script>
var video = document.getElementById('video');
navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
video.srcObject = stream;
video.play();
})
.catch(function(err) {
console.log("An error has occured: " + err);
});
</script>
请参阅文档了解更多详细信息https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
我已经在我的 GAS Web 应用程序中测试了上述内容。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)