オーディオ/ビデオ用の getUserMedia の実装に取り組んでおり、HTML5 API を介してローカル ストレージ経由で保存しています。2 つの問題があります。
最初の問題は、オーディオが接続されると、私の声が非常にかすかにエコーされ、常に静的な音がすることです (firefox でテスト済み)。これに関する既知の問題はありますか?私は何らかの答えを見つけることができませんでした.
同様に、メディアストリームファイルを停止して、ローカルストレージまたは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