您好我正在使用springMVC。在我的项目中,我想使用html5通过网络摄像头拍摄图像 我有图像,但我用这个做什么我不知道意味着我想将这个图像上传到谷歌应用程序blobstore我怎么能这样做任何一个帮助我请检查我的示例代码
<video autoplay id="vid" style="display:none;"></video>
拍照
<script type="text/javascript">
var video = document.querySelector("#vid");
var canvas = document.querySelector('#canvas');
var ctx = canvas.getContext('2d');
var localMediaStream = null;
var onCameraFail = function (e) {
console.log('Camera did not work.', e);
};
function snapshot() {
if (localMediaStream) {
ctx.drawImage(video, 0, 0);
}
}
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia({video:true}, function (stream) {
video.src = window.URL.createObjectURL(stream);
localMediaStream = stream;
}, onCameraFail);