单击录制按钮时,网络摄像头启动,但是当您单击停止按钮时,没有任何反应
我现在有这个,但我不确定它是否正在录制?我怎么知道它是否在录制,如何重新显示录制的视频?
<html>
<input type="button" value="Record" onclick="record(this)">
<input type="button" value="Stop" onclick="stop(this)">
<video autoplay></video>
<script language="javascript" type="text/javascript">
var record = function(button) {
navigator.getUserMedia = navigator.webkitGetUserMedia
|| navigator.getUserMedia;
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia({audio: true, video: true}, function(stream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(stream);
stream.record();
//setTimeout(stop, 10);
}, function(e) {
console.log(e);
//setTimeout(10);
});
};
var stop = function(button){
//alert('Checking');
stream.stop();
stream.getRecordedData(function(blob) {
alert('Checking');
//upload blobusing XHR2.
});
};
</script>
</html>