Help me figure it out with JS AudioWebAPI. Using the library recorder.js I try to record telephone conversations (SIPML5 + asterisk). So far it has only sounded from the microphone:
var audio_context;
var recorder;
function startUserMedia(stream) {
recorder = new Recorder(audio_context.createMediaStreamSource(stream));
console.log('Recorder initialised.');
}
function startRecording(button) {
recorder && recorder.record();
console.log('Recording...');
}
function stopRecording(button) {
recorder && recorder.stop();
console.log('Stopped recording.');
createDownloadLink();
recorder.clear();
}
window.onload = function init() {
try {
// webkit shim
window.AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
window.URL = window.URL || window.webkitURL;
audio_context = new AudioContext;
} catch (e) {
alert('No web audio support in this browser!');
}
navigator.getUserMedia({audio: true}, startUserMedia, function(e) {
console.log('No live audio input: ' + e);
});
};
How to record the sound of incoming stream? Tried to record the sound of the interlocutor in the following way - to no avail.
function startUserMedia(stream) {
recorder = new Recorder(audio_context.createMediaStreamSource(document.getElementById('main_audio_remote').captureStream()));
console.log('Recorder initialised.');
}
Thread webrts into tag 'main_audio_remote':
callform.oConfigCall = {
audio_remote: document.getElementById('main_audio_remote'),
screencast_window_id: 0x00000000, // entire desktop
bandwidth: { audio: undefined, video: undefined },
video_size: { minWidth: undefined, minHeight: undefined, maxWidth: undefined, maxHeight: undefined },
events_listener: { events: '*', listener: callform.onSipEventSession },
sip_caps: [
{ name: '+g.oma.sip-im' },
{ name: 'language', value: '\"en,fr\"' }
]
};
User contributions licensed under CC BY-SA 3.0