我看过很多教程和演示,展示了如何用一个简单的网页捕获和录制音频和视频。
最好的演示:
音频:http://webaudiodemos.appspot.com/AudioRecorder/index.html
视频:http://html5-demos.appspot.com/static/getusermedia/record-user-webm.html
我正在寻找同时捕获和记录两个流。即使它只在特定平台上的特定浏览器上工作,我也很感兴趣。
我认为不可能,但不确定。有没有人发现一个技巧来捕捉音频和视频同时与网页?
如果你想做同样的事情,你应该看看
[http://jsfiddle.net/james2doyle/URyLt/]
请让我知道如果你设法做谢谢
$("button").click(do_it);
function do_it() {
var obj = {}, txt="";
if (this.id == "video") {
obj = {
video: true,
audio: true
};
txt = "<video>";
} else {
obj = {
video: false,
audio: true
};
txt = "<audio>";
}
navigator.webkitGetUserMedia(obj, function(stream) {
$("#result").empty();
var output = $(txt).appendTo("#result")[0],
source = window.webkitURL.createObjectURL(stream);
output.autoplay = true;
output.src = source;
console.log(stream);
window.a = stream; //debug
$("span#name").html("Camera name: <b>" + stream.videoTracks[0].label + "</b><br>" + "Mic name: <b>" + stream.audioTracks[0].label + "</b>");
}, function(err) {
console.log(err);
err.code == 1 && (alert("You can click the button again anytime to enable."))
});
}
这个实验怎么样?它在Chrome和FF夜间工作。查看repo: https://github.com/muaz-khan/WebRTC-Experiment/tree/master/RecordRTC
您可以在这里尝试一个实时演示:https://www.webrtc-experiment.com/RecordRTC/PHP/