我正在为音频/视频实现getUserMedia,然后通过HTML5 api通过本地存储保存它。我有两个问题。
第一个问题是,当音频连接时,我的声音非常微弱,并且具有恒定的静态声音(在firefox中测试)。有没有任何已知问题,我无法找到任何答案。
同样,是否有文档停止并将mediaStream文件放入要通过本地存储或通过ajax / php或类似的东西保存的内容?我对如何停止然后保存文件感到有点迷失。
我的JavaScript代码和HTML代码如下......谢谢!
<section>
<!-- <audio controls autoplay></audio> -->
<video controls autoplay></video>
<input id="startRecording" type="button" value="Start Recording"/>
<input id="stopRecording" type="button" value="Stop Recording"/>
</section>
window.onload = function() {
function hasGetUserMedia() {
//Note: opera is unprefixed
return !!(navigator.hasGetUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
} //Check for Get User Media in browsers
function startRecording() {
navigator.getUserMedia({audio: true, video: true},function(stream) {audio.src = window.URL.createObjectURL(stream); },onFail);
}
function stopRecording() {
var audio = document.querySelector('video');
audio.src = "";Q
}
var onFail = function(e) {
console.log("ERROR");
}
var audio = document.querySelector('video');
if (hasGetUserMedia()) {
//AWESOME! Do whatever needs to be done
window.URL = (window.URL || window.webkitURL || window.webkitURL || window.mozURL || window.msURL);
navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia );
var startRecord = document.getElementById('startRecording');
var endRecord = document.getElementById('stopRecording');
startRecord.onclick = startRecording;
endRecord.onclick = stopRecording;
} else {
alert("FAIL");
//Put in fallback for flash/silverlight?
} //Check for getUserMedia()
} //load this stuff onload
答案 0 :(得分:0)
目前可以通过画布间接捕获视频,但Mediastream Recorder API尚未实现。所以声音反正很难。
至于回声,这很可能。看到: https://hacks.mozilla.org/2013/06/webrtc-comes-to-firefox/
所以我担心你还要等一会儿。