java实现web端启动摄像头录制视频并保存

java实现web端启动摄像头录制视频并保存,再网页端点击按钮开始录制点击完成停止录制,
并将这段视频上传

1个回答

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



Insert title here

拍照 上传

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; if (navigator.getUserMedia) { navigator.getUserMedia({ audio: true, video: { width: 320, height: 320 } }, function(stream) { var video = document.getElementById("video"); video.src = window.URL.createObjectURL(stream); video.onloadedmetadata = function(e) { console.log('nihao44eee4aaaaddda'); video.play(); }; }, function(err) { console.log("The following error occurred: " + err.name); } ); } else { console.log("getUserMedia not supported"); } var context = document.getElementById("canvas").getContext("2d"); document.getElementById("picture").addEventListener("click", function () { context.drawImage(video, 0, 0, 320, 320); }); document.getElementById("sc").addEventListener("click", function () { var imgData=document.getElementById("canvas").toDataURL("image/png"); var data=imgData.substr(22); $.post('recorder/target/sc',{'sj':data}); });


Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问