I followed this fiddle. In this it has the video and audio capturing. But it won't let me record the video and send it to php for further processing using ffmpeg and save it. I want to know that how am i able to record the video and send it to php and save it ?
var btnVideoCapture = document.getElementById('btn-capture-video');
btnVideoCapture.addEventListener('click', showUserMedia, false);
var btnScreenshot = document.getElementById('btn-screenshot');
btnScreenshot.addEventListener('click', snapshot, false);
var btnStopVideo = document.getElementById('btn-stop-video');
btnStopVideo.addEventListener('click', stopUserMedia, false);
var onFailSoHard = function (e) {
console.log('Reeeejected!', e);
};
var video = document.querySelector('video');
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
var localMediaStream = null;
function showUserMedia() {
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({
audio: true,
video: true
}, function (stream) {
video.src = window.URL.createObjectURL(stream);
video.controls = true;
localMediaStream = stream;
}, onFailSoHard);
// console.log('Good to go!');
} else {
video.src = 'somevideo.webm'; // fallback.
//console.log('getUserMedia() is not supported in your browser');
}
}
function snapshot() {
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
if (localMediaStream) {
ctx.drawImage(video, 0, 0);
// "image/webp" works in Chrome 18. In other browsers, this will fall back to image/png.
document.querySelector('img').src = canvas.toDataURL('image/webp');
}
}
function stopUserMedia() {
video.pause();
localMediaStream.stop();
video.src = '';
}