我有用electron 透過desktop-capturer 把喇叭聲音跟影像錄起來
但是麥克風的聲音不曉得怎麼處理~
請問有大大知道要怎麼把麥克風聲音加進去stream 嗎>?
===========================================
2022/1/21 17:16 更新
找到解答了
原理把麥克風輸入的音訊直接撥放出來,然後用MediaRecorder api就可以錄下來了
https://developers.google.com/web/fundamentals/media/recording-audio
<audio id="player" controls></audio>
<script>
const player = document.getElementById('player');
const handleSuccess = function(stream) {
if (window.URL) {
player.srcObject = stream;
} else {
player.src = stream;
}
};
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
.then(handleSuccess);
</script>