Это через jsp, вы должны изменить server.jsp на php код
<html>
<body>
<div id="mine">
<video id="video" width="500" height="500" autoplay="true"></video>
<video id="video1" width="500" height="500" autoplay="true"> </video>
</div>
<script type="text/javascript">
var str;
(function(){
var video=document.getElementById('video'),
vendorUrl =window.URL || window.webkitURL;
navigator.getMedia=navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.nsGetUserMedia;
navigator.getMedia({
video:true,
audio:true
},function(stream){
video.src=vendorUrl.createObjectURL(stream);
str=vendorUrl.createObjectURL(stream);
video.play();
},function(error){
alert("error")
});
})();
var ajax=new XMLHttpRequest();
function processresponse(){
if(ajax.readyState===4){
var rse=ajax.responseText;
var vid=document.getElementById("video1");
vid.src=rse;
vid.play();
}
}
function show(){
ajax.onreadystatechange=processresponse;
ajax.open("Post","server.jsp",true);
ajax.send(str);
}
timer = setInterval(show,10000 );
</script>
</body>
</html>
server.jsp ....
<%
InputStream is=request.getInputStream();
byte[] bt=new byte[1000];
is.read(bt);
String req=new String(bt);
out.println(req );
%>